ac086be8eb562b667066621c342136cae53ae403
[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.17.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
2773 /**
2774  * Features used within the channel_type field in an OpenChannel message.
2775  *
2776  * A channel is always of some known \"type\", describing the transaction formats used and the exact
2777  * semantics of our interaction with our peer.
2778  *
2779  * Note that because a channel is a specific type which is proposed by the opener and accepted by
2780  * the counterparty, only required features are allowed here.
2781  *
2782  * This is serialized differently from other feature types - it is not prefixed by a length, and
2783  * thus must only appear inside a TLV where its length is known in advance.
2784  */
2785 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
2786    /**
2787     * A pointer to the opaque Rust object.
2788     * Nearly everywhere, inner must be non-null, however in places where
2789     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2790     */
2791    LDKnativeChannelTypeFeatures *inner;
2792    /**
2793     * Indicates that this is the only struct which contains the same pointer.
2794     * Rust functions which take ownership of an object provided via an argument require
2795     * this to be true and invalidate the object pointed to by inner.
2796     */
2797    bool is_owned;
2798 } LDKChannelTypeFeatures;
2799
2800 /**
2801  * An Event which you should probably take some action in response to.
2802  *
2803  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2804  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2805  * written as it makes no sense to respond to it after reconnecting to peers).
2806  */
2807 typedef enum LDKEvent_Tag {
2808    /**
2809     * Used to indicate that the client should generate a funding transaction with the given
2810     * parameters and then call [`ChannelManager::funding_transaction_generated`].
2811     * Generated in [`ChannelManager`] message handling.
2812     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2813     * counterparty can steal your funds!
2814     *
2815     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2816     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2817     */
2818    LDKEvent_FundingGenerationReady,
2819    /**
2820     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2821     * [`ChannelManager::claim_funds`] to get it....
2822     * Note that if the preimage is not known, you should call
2823     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
2824     * network congestion.
2825     * If you fail to call either [`ChannelManager::claim_funds`] or
2826     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
2827     * automatically failed.
2828     *
2829     * # Note
2830     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2831     * `PaymentReceived` events may be generated for the same payment.
2832     *
2833     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2834     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
2835     */
2836    LDKEvent_PaymentReceived,
2837    /**
2838     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
2839     * and we got back the payment preimage for it).
2840     *
2841     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
2842     * event. In this situation, you SHOULD treat this payment as having succeeded.
2843     */
2844    LDKEvent_PaymentSent,
2845    /**
2846     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
2847     * something. You may wish to retry with a different route.
2848     *
2849     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
2850     * [`Event::PaymentFailed`] and [`all_paths_failed`].
2851     *
2852     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
2853     */
2854    LDKEvent_PaymentPathFailed,
2855    /**
2856     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
2857     * provide failure information for each MPP part in the payment.
2858     *
2859     * This event is provided once there are no further pending HTLCs for the payment and the
2860     * payment is no longer retryable, either due to a several-block timeout or because
2861     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
2862     *
2863     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2864     */
2865    LDKEvent_PaymentFailed,
2866    /**
2867     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
2868     * a time in the future.
2869     *
2870     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
2871     */
2872    LDKEvent_PendingHTLCsForwardable,
2873    /**
2874     * Used to indicate that an output which you should know how to spend was confirmed on chain
2875     * and is now spendable.
2876     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2877     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2878     * somewhere and spend them when you create on-chain transactions.
2879     */
2880    LDKEvent_SpendableOutputs,
2881    /**
2882     * This event is generated when a payment has been successfully forwarded through us and a
2883     * forwarding fee earned.
2884     */
2885    LDKEvent_PaymentForwarded,
2886    /**
2887     * Used to indicate that a channel with the given `channel_id` is in the process of closure.
2888     */
2889    LDKEvent_ChannelClosed,
2890    /**
2891     * Used to indicate to the user that they can abandon the funding transaction and recycle the
2892     * inputs for another purpose.
2893     */
2894    LDKEvent_DiscardFunding,
2895    /**
2896     * Indicates that a path for an outbound payment was successful.
2897     *
2898     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
2899     * [`Event::PaymentSent`] for obtaining the payment preimage.
2900     */
2901    LDKEvent_PaymentPathSuccessful,
2902    /**
2903     * Indicates a request to open a new channel by a peer.
2904     *
2905     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
2906     * request, call [`ChannelManager::force_close_channel`].
2907     *
2908     * The event is only triggered when a new open channel request is received and the
2909     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
2910     *
2911     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
2912     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
2913     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
2914     */
2915    LDKEvent_OpenChannelRequest,
2916    /**
2917     * Must be last for serialization purposes
2918     */
2919    LDKEvent_Sentinel,
2920 } LDKEvent_Tag;
2921
2922 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2923    /**
2924     * The random channel_id we picked which you'll need to pass into
2925     * ChannelManager::funding_transaction_generated.
2926     */
2927    struct LDKThirtyTwoBytes temporary_channel_id;
2928    /**
2929     * The value, in satoshis, that the output should have.
2930     */
2931    uint64_t channel_value_satoshis;
2932    /**
2933     * The script which should be used in the transaction output.
2934     */
2935    struct LDKCVec_u8Z output_script;
2936    /**
2937     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2938     * an inbound channel.
2939     *
2940     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2941     */
2942    uint64_t user_channel_id;
2943 } LDKEvent_LDKFundingGenerationReady_Body;
2944
2945 typedef struct LDKEvent_LDKPaymentReceived_Body {
2946    /**
2947     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
2948     * not stop you from registering duplicate payment hashes for inbound payments.
2949     */
2950    struct LDKThirtyTwoBytes payment_hash;
2951    /**
2952     * The value, in thousandths of a satoshi, that this payment is for.
2953     */
2954    uint64_t amt;
2955    /**
2956     * Information for claiming this received payment, based on whether the purpose of the
2957     * payment is to pay an invoice or to send a spontaneous payment.
2958     */
2959    struct LDKPaymentPurpose purpose;
2960 } LDKEvent_LDKPaymentReceived_Body;
2961
2962 typedef struct LDKEvent_LDKPaymentSent_Body {
2963    /**
2964     * The id returned by [`ChannelManager::send_payment`] and used with
2965     * [`ChannelManager::retry_payment`].
2966     *
2967     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2968     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2969     *
2970     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2971     */
2972    struct LDKThirtyTwoBytes payment_id;
2973    /**
2974     * The preimage to the hash given to ChannelManager::send_payment.
2975     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2976     * store it somehow!
2977     */
2978    struct LDKThirtyTwoBytes payment_preimage;
2979    /**
2980     * The hash that was given to [`ChannelManager::send_payment`].
2981     *
2982     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2983     */
2984    struct LDKThirtyTwoBytes payment_hash;
2985    /**
2986     * The total fee which was spent at intermediate hops in this payment, across all paths.
2987     *
2988     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
2989     * overpayment to the recipient node.
2990     *
2991     * If the recipient or an intermediate node misbehaves and gives us free money, this may
2992     * overstate the amount paid, though this is unlikely.
2993     *
2994     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
2995     */
2996    struct LDKCOption_u64Z fee_paid_msat;
2997 } LDKEvent_LDKPaymentSent_Body;
2998
2999 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
3000    /**
3001     * The id returned by [`ChannelManager::send_payment`] and used with
3002     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3003     *
3004     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3005     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3006     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3007     *
3008     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3009     */
3010    struct LDKThirtyTwoBytes payment_id;
3011    /**
3012     * The hash that was given to [`ChannelManager::send_payment`].
3013     *
3014     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3015     */
3016    struct LDKThirtyTwoBytes payment_hash;
3017    /**
3018     * Indicates the payment was rejected for some reason by the recipient. This implies that
3019     * the payment has failed, not just the route in question. If this is not set, you may
3020     * retry the payment via a different route.
3021     */
3022    bool rejected_by_dest;
3023    /**
3024     * Any failure information conveyed via the Onion return packet by a node along the failed
3025     * payment route.
3026     *
3027     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
3028     * account the update. [`NetGraphMsgHandler`] is capable of doing this.
3029     *
3030     * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
3031     * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
3032     */
3033    struct LDKCOption_NetworkUpdateZ network_update;
3034    /**
3035     * For both single-path and multi-path payments, this is set if all paths of the payment have
3036     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
3037     * larger MPP payment were still in flight when this event was generated.
3038     *
3039     * Note that if you are retrying individual MPP parts, using this value to determine if a
3040     * payment has fully failed is race-y. Because multiple failures can happen prior to events
3041     * being processed, you may retry in response to a first failure, with a second failure
3042     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
3043     * you will see `all_paths_failed` set even though the retry of the first failure still
3044     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3045     *
3046     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3047     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3048     *
3049     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3050     *
3051     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3052     */
3053    bool all_paths_failed;
3054    /**
3055     * The payment path that failed.
3056     */
3057    struct LDKCVec_RouteHopZ path;
3058    /**
3059     * The channel responsible for the failed payment path.
3060     *
3061     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3062     * retried. May be `None` for older [`Event`] serializations.
3063     */
3064    struct LDKCOption_u64Z short_channel_id;
3065    /**
3066     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3067     *
3068     * See [`find_route`] for details.
3069     *
3070     * [`Route`]: crate::routing::router::Route
3071     * [`find_route`]: crate::routing::router::find_route
3072     *
3073     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3074     */
3075    struct LDKRouteParameters retry;
3076 } LDKEvent_LDKPaymentPathFailed_Body;
3077
3078 typedef struct LDKEvent_LDKPaymentFailed_Body {
3079    /**
3080     * The id returned by [`ChannelManager::send_payment`] and used with
3081     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3082     *
3083     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3084     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3085     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3086     */
3087    struct LDKThirtyTwoBytes payment_id;
3088    /**
3089     * The hash that was given to [`ChannelManager::send_payment`].
3090     *
3091     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3092     */
3093    struct LDKThirtyTwoBytes payment_hash;
3094 } LDKEvent_LDKPaymentFailed_Body;
3095
3096 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3097    /**
3098     * The minimum amount of time that should be waited prior to calling
3099     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3100     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3101     * now + 5*time_forwardable).
3102     */
3103    uint64_t time_forwardable;
3104 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3105
3106 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3107    /**
3108     * The outputs which you should store as spendable by you.
3109     */
3110    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3111 } LDKEvent_LDKSpendableOutputs_Body;
3112
3113 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3114    /**
3115     * The fee, in milli-satoshis, which was earned as a result of the payment.
3116     *
3117     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3118     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3119     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3120     * claimed the full value in millisatoshis from the source. In this case,
3121     * `claim_from_onchain_tx` will be set.
3122     *
3123     * If the channel which sent us the payment has been force-closed, we will claim the funds
3124     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3125     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3126     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3127     * `None`.
3128     */
3129    struct LDKCOption_u64Z fee_earned_msat;
3130    /**
3131     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3132     * transaction.
3133     */
3134    bool claim_from_onchain_tx;
3135 } LDKEvent_LDKPaymentForwarded_Body;
3136
3137 typedef struct LDKEvent_LDKChannelClosed_Body {
3138    /**
3139     * The channel_id of the channel which has been closed. Note that on-chain transactions
3140     * resolving the channel are likely still awaiting confirmation.
3141     */
3142    struct LDKThirtyTwoBytes channel_id;
3143    /**
3144     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
3145     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
3146     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
3147     * `user_channel_id` will be 0 for an inbound channel.
3148     * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
3149     *
3150     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3151     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3152     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3153     */
3154    uint64_t user_channel_id;
3155    /**
3156     * The reason the channel was closed.
3157     */
3158    struct LDKClosureReason reason;
3159 } LDKEvent_LDKChannelClosed_Body;
3160
3161 typedef struct LDKEvent_LDKDiscardFunding_Body {
3162    /**
3163     * The channel_id of the channel which has been closed.
3164     */
3165    struct LDKThirtyTwoBytes channel_id;
3166    /**
3167     * The full transaction received from the user
3168     */
3169    struct LDKTransaction transaction;
3170 } LDKEvent_LDKDiscardFunding_Body;
3171
3172 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3173    /**
3174     * The id returned by [`ChannelManager::send_payment`] and used with
3175     * [`ChannelManager::retry_payment`].
3176     *
3177     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3178     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3179     */
3180    struct LDKThirtyTwoBytes payment_id;
3181    /**
3182     * The hash that was given to [`ChannelManager::send_payment`].
3183     *
3184     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3185     *
3186     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3187     */
3188    struct LDKThirtyTwoBytes payment_hash;
3189    /**
3190     * The payment path that was successful.
3191     *
3192     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
3193     */
3194    struct LDKCVec_RouteHopZ path;
3195 } LDKEvent_LDKPaymentPathSuccessful_Body;
3196
3197 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3198    /**
3199     * The temporary channel ID of the channel requested to be opened.
3200     *
3201     * When responding to the request, the `temporary_channel_id` should be passed
3202     * back to the ChannelManager with [`ChannelManager::accept_inbound_channel`] to accept,
3203     * or to [`ChannelManager::force_close_channel`] to reject.
3204     *
3205     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3206     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
3207     */
3208    struct LDKThirtyTwoBytes temporary_channel_id;
3209    /**
3210     * The node_id of the counterparty requesting to open the channel.
3211     */
3212    struct LDKPublicKey counterparty_node_id;
3213    /**
3214     * The channel value of the requested channel.
3215     */
3216    uint64_t funding_satoshis;
3217    /**
3218     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3219     */
3220    uint64_t push_msat;
3221    /**
3222     * The features that this channel will operate with. If you reject the channel, a
3223     * well-behaved counterparty may automatically re-attempt the channel with a new set of
3224     * feature flags.
3225     *
3226     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
3227     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3228     * 0.0.106.
3229     *
3230     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3231     */
3232    struct LDKChannelTypeFeatures channel_type;
3233 } LDKEvent_LDKOpenChannelRequest_Body;
3234
3235 typedef struct MUST_USE_STRUCT LDKEvent {
3236    LDKEvent_Tag tag;
3237    union {
3238       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3239       LDKEvent_LDKPaymentReceived_Body payment_received;
3240       LDKEvent_LDKPaymentSent_Body payment_sent;
3241       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3242       LDKEvent_LDKPaymentFailed_Body payment_failed;
3243       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3244       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3245       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3246       LDKEvent_LDKChannelClosed_Body channel_closed;
3247       LDKEvent_LDKDiscardFunding_Body discard_funding;
3248       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3249       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
3250    };
3251 } LDKEvent;
3252
3253 /**
3254  * An enum which can either contain a crate::lightning::util::events::Event or not
3255  */
3256 typedef enum LDKCOption_EventZ_Tag {
3257    /**
3258     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3259     */
3260    LDKCOption_EventZ_Some,
3261    /**
3262     * When we're in this state, this COption_EventZ contains nothing
3263     */
3264    LDKCOption_EventZ_None,
3265    /**
3266     * Must be last for serialization purposes
3267     */
3268    LDKCOption_EventZ_Sentinel,
3269 } LDKCOption_EventZ_Tag;
3270
3271 typedef struct LDKCOption_EventZ {
3272    LDKCOption_EventZ_Tag tag;
3273    union {
3274       struct {
3275          struct LDKEvent some;
3276       };
3277    };
3278 } LDKCOption_EventZ;
3279
3280 /**
3281  * The contents of CResult_COption_EventZDecodeErrorZ
3282  */
3283 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
3284    /**
3285     * A pointer to the contents in the success state.
3286     * Reading from this pointer when `result_ok` is not set is undefined.
3287     */
3288    struct LDKCOption_EventZ *result;
3289    /**
3290     * A pointer to the contents in the error state.
3291     * Reading from this pointer when `result_ok` is set is undefined.
3292     */
3293    struct LDKDecodeError *err;
3294 } LDKCResult_COption_EventZDecodeErrorZPtr;
3295
3296 /**
3297  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3298  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3299  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3300  */
3301 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3302    /**
3303     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3304     * `err` or `result` depending on the state of `result_ok`.
3305     */
3306    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3307    /**
3308     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3309     */
3310    bool result_ok;
3311 } LDKCResult_COption_EventZDecodeErrorZ;
3312
3313
3314
3315 /**
3316  * An accept_channel message to be sent or received from a peer
3317  */
3318 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3319    /**
3320     * A pointer to the opaque Rust object.
3321     * Nearly everywhere, inner must be non-null, however in places where
3322     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3323     */
3324    LDKnativeAcceptChannel *inner;
3325    /**
3326     * Indicates that this is the only struct which contains the same pointer.
3327     * Rust functions which take ownership of an object provided via an argument require
3328     * this to be true and invalidate the object pointed to by inner.
3329     */
3330    bool is_owned;
3331 } LDKAcceptChannel;
3332
3333
3334
3335 /**
3336  * An open_channel message to be sent or received from a peer
3337  */
3338 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3339    /**
3340     * A pointer to the opaque Rust object.
3341     * Nearly everywhere, inner must be non-null, however in places where
3342     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3343     */
3344    LDKnativeOpenChannel *inner;
3345    /**
3346     * Indicates that this is the only struct which contains the same pointer.
3347     * Rust functions which take ownership of an object provided via an argument require
3348     * this to be true and invalidate the object pointed to by inner.
3349     */
3350    bool is_owned;
3351 } LDKOpenChannel;
3352
3353
3354
3355 /**
3356  * A funding_created message to be sent or received from a peer
3357  */
3358 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3359    /**
3360     * A pointer to the opaque Rust object.
3361     * Nearly everywhere, inner must be non-null, however in places where
3362     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3363     */
3364    LDKnativeFundingCreated *inner;
3365    /**
3366     * Indicates that this is the only struct which contains the same pointer.
3367     * Rust functions which take ownership of an object provided via an argument require
3368     * this to be true and invalidate the object pointed to by inner.
3369     */
3370    bool is_owned;
3371 } LDKFundingCreated;
3372
3373
3374
3375 /**
3376  * A funding_signed message to be sent or received from a peer
3377  */
3378 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3379    /**
3380     * A pointer to the opaque Rust object.
3381     * Nearly everywhere, inner must be non-null, however in places where
3382     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3383     */
3384    LDKnativeFundingSigned *inner;
3385    /**
3386     * Indicates that this is the only struct which contains the same pointer.
3387     * Rust functions which take ownership of an object provided via an argument require
3388     * this to be true and invalidate the object pointed to by inner.
3389     */
3390    bool is_owned;
3391 } LDKFundingSigned;
3392
3393
3394
3395 /**
3396  * A funding_locked message to be sent or received from a peer
3397  */
3398 typedef struct MUST_USE_STRUCT LDKFundingLocked {
3399    /**
3400     * A pointer to the opaque Rust object.
3401     * Nearly everywhere, inner must be non-null, however in places where
3402     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3403     */
3404    LDKnativeFundingLocked *inner;
3405    /**
3406     * Indicates that this is the only struct which contains the same pointer.
3407     * Rust functions which take ownership of an object provided via an argument require
3408     * this to be true and invalidate the object pointed to by inner.
3409     */
3410    bool is_owned;
3411 } LDKFundingLocked;
3412
3413
3414
3415 /**
3416  * An announcement_signatures message to be sent or received from a peer
3417  */
3418 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3419    /**
3420     * A pointer to the opaque Rust object.
3421     * Nearly everywhere, inner must be non-null, however in places where
3422     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3423     */
3424    LDKnativeAnnouncementSignatures *inner;
3425    /**
3426     * Indicates that this is the only struct which contains the same pointer.
3427     * Rust functions which take ownership of an object provided via an argument require
3428     * this to be true and invalidate the object pointed to by inner.
3429     */
3430    bool is_owned;
3431 } LDKAnnouncementSignatures;
3432
3433
3434
3435 /**
3436  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3437  * transaction updates if they were pending.
3438  */
3439 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3440    /**
3441     * A pointer to the opaque Rust object.
3442     * Nearly everywhere, inner must be non-null, however in places where
3443     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3444     */
3445    LDKnativeCommitmentUpdate *inner;
3446    /**
3447     * Indicates that this is the only struct which contains the same pointer.
3448     * Rust functions which take ownership of an object provided via an argument require
3449     * this to be true and invalidate the object pointed to by inner.
3450     */
3451    bool is_owned;
3452 } LDKCommitmentUpdate;
3453
3454
3455
3456 /**
3457  * A revoke_and_ack message to be sent or received from a peer
3458  */
3459 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3460    /**
3461     * A pointer to the opaque Rust object.
3462     * Nearly everywhere, inner must be non-null, however in places where
3463     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3464     */
3465    LDKnativeRevokeAndACK *inner;
3466    /**
3467     * Indicates that this is the only struct which contains the same pointer.
3468     * Rust functions which take ownership of an object provided via an argument require
3469     * this to be true and invalidate the object pointed to by inner.
3470     */
3471    bool is_owned;
3472 } LDKRevokeAndACK;
3473
3474
3475
3476 /**
3477  * A closing_signed message to be sent or received from a peer
3478  */
3479 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3480    /**
3481     * A pointer to the opaque Rust object.
3482     * Nearly everywhere, inner must be non-null, however in places where
3483     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3484     */
3485    LDKnativeClosingSigned *inner;
3486    /**
3487     * Indicates that this is the only struct which contains the same pointer.
3488     * Rust functions which take ownership of an object provided via an argument require
3489     * this to be true and invalidate the object pointed to by inner.
3490     */
3491    bool is_owned;
3492 } LDKClosingSigned;
3493
3494
3495
3496 /**
3497  * A shutdown message to be sent or received from a peer
3498  */
3499 typedef struct MUST_USE_STRUCT LDKShutdown {
3500    /**
3501     * A pointer to the opaque Rust object.
3502     * Nearly everywhere, inner must be non-null, however in places where
3503     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3504     */
3505    LDKnativeShutdown *inner;
3506    /**
3507     * Indicates that this is the only struct which contains the same pointer.
3508     * Rust functions which take ownership of an object provided via an argument require
3509     * this to be true and invalidate the object pointed to by inner.
3510     */
3511    bool is_owned;
3512 } LDKShutdown;
3513
3514
3515
3516 /**
3517  * A channel_reestablish message to be sent or received from a peer
3518  */
3519 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3520    /**
3521     * A pointer to the opaque Rust object.
3522     * Nearly everywhere, inner must be non-null, however in places where
3523     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3524     */
3525    LDKnativeChannelReestablish *inner;
3526    /**
3527     * Indicates that this is the only struct which contains the same pointer.
3528     * Rust functions which take ownership of an object provided via an argument require
3529     * this to be true and invalidate the object pointed to by inner.
3530     */
3531    bool is_owned;
3532 } LDKChannelReestablish;
3533
3534
3535
3536 /**
3537  * A channel_announcement message to be sent or received from a peer
3538  */
3539 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3540    /**
3541     * A pointer to the opaque Rust object.
3542     * Nearly everywhere, inner must be non-null, however in places where
3543     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3544     */
3545    LDKnativeChannelAnnouncement *inner;
3546    /**
3547     * Indicates that this is the only struct which contains the same pointer.
3548     * Rust functions which take ownership of an object provided via an argument require
3549     * this to be true and invalidate the object pointed to by inner.
3550     */
3551    bool is_owned;
3552 } LDKChannelAnnouncement;
3553
3554
3555
3556 /**
3557  * A node_announcement message to be sent or received from a peer
3558  */
3559 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3560    /**
3561     * A pointer to the opaque Rust object.
3562     * Nearly everywhere, inner must be non-null, however in places where
3563     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3564     */
3565    LDKnativeNodeAnnouncement *inner;
3566    /**
3567     * Indicates that this is the only struct which contains the same pointer.
3568     * Rust functions which take ownership of an object provided via an argument require
3569     * this to be true and invalidate the object pointed to by inner.
3570     */
3571    bool is_owned;
3572 } LDKNodeAnnouncement;
3573
3574
3575
3576 /**
3577  * An error message to be sent or received from a peer
3578  */
3579 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3580    /**
3581     * A pointer to the opaque Rust object.
3582     * Nearly everywhere, inner must be non-null, however in places where
3583     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3584     */
3585    LDKnativeErrorMessage *inner;
3586    /**
3587     * Indicates that this is the only struct which contains the same pointer.
3588     * Rust functions which take ownership of an object provided via an argument require
3589     * this to be true and invalidate the object pointed to by inner.
3590     */
3591    bool is_owned;
3592 } LDKErrorMessage;
3593
3594
3595
3596 /**
3597  * A warning message to be sent or received from a peer
3598  */
3599 typedef struct MUST_USE_STRUCT LDKWarningMessage {
3600    /**
3601     * A pointer to the opaque Rust object.
3602     * Nearly everywhere, inner must be non-null, however in places where
3603     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3604     */
3605    LDKnativeWarningMessage *inner;
3606    /**
3607     * Indicates that this is the only struct which contains the same pointer.
3608     * Rust functions which take ownership of an object provided via an argument require
3609     * this to be true and invalidate the object pointed to by inner.
3610     */
3611    bool is_owned;
3612 } LDKWarningMessage;
3613
3614 /**
3615  * Used to put an error message in a LightningError
3616  */
3617 typedef enum LDKErrorAction_Tag {
3618    /**
3619     * The peer took some action which made us think they were useless. Disconnect them.
3620     */
3621    LDKErrorAction_DisconnectPeer,
3622    /**
3623     * The peer did something harmless that we weren't able to process, just log and ignore
3624     */
3625    LDKErrorAction_IgnoreError,
3626    /**
3627     * The peer did something harmless that we weren't able to meaningfully process.
3628     * If the error is logged, log it at the given level.
3629     */
3630    LDKErrorAction_IgnoreAndLog,
3631    /**
3632     * The peer provided us with a gossip message which we'd already seen. In most cases this
3633     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
3634     * our own channel announcements.
3635     */
3636    LDKErrorAction_IgnoreDuplicateGossip,
3637    /**
3638     * The peer did something incorrect. Tell them.
3639     */
3640    LDKErrorAction_SendErrorMessage,
3641    /**
3642     * The peer did something incorrect. Tell them without closing any channels.
3643     */
3644    LDKErrorAction_SendWarningMessage,
3645    /**
3646     * Must be last for serialization purposes
3647     */
3648    LDKErrorAction_Sentinel,
3649 } LDKErrorAction_Tag;
3650
3651 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3652    /**
3653     * An error message which we should make an effort to send before we disconnect.
3654     *
3655     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3656     */
3657    struct LDKErrorMessage msg;
3658 } LDKErrorAction_LDKDisconnectPeer_Body;
3659
3660 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3661    /**
3662     * The message to send.
3663     */
3664    struct LDKErrorMessage msg;
3665 } LDKErrorAction_LDKSendErrorMessage_Body;
3666
3667 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
3668    /**
3669     * The message to send.
3670     */
3671    struct LDKWarningMessage msg;
3672    /**
3673     * The peer may have done something harmless that we weren't able to meaningfully process,
3674     * though we should still tell them about it.
3675     * If this event is logged, log it at the given level.
3676     */
3677    enum LDKLevel log_level;
3678 } LDKErrorAction_LDKSendWarningMessage_Body;
3679
3680 typedef struct MUST_USE_STRUCT LDKErrorAction {
3681    LDKErrorAction_Tag tag;
3682    union {
3683       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3684       struct {
3685          enum LDKLevel ignore_and_log;
3686       };
3687       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3688       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
3689    };
3690 } LDKErrorAction;
3691
3692
3693
3694 /**
3695  * A query_channel_range message is used to query a peer for channel
3696  * UTXOs in a range of blocks. The recipient of a query makes a best
3697  * effort to reply to the query using one or more reply_channel_range
3698  * messages.
3699  */
3700 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3701    /**
3702     * A pointer to the opaque Rust object.
3703     * Nearly everywhere, inner must be non-null, however in places where
3704     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3705     */
3706    LDKnativeQueryChannelRange *inner;
3707    /**
3708     * Indicates that this is the only struct which contains the same pointer.
3709     * Rust functions which take ownership of an object provided via an argument require
3710     * this to be true and invalidate the object pointed to by inner.
3711     */
3712    bool is_owned;
3713 } LDKQueryChannelRange;
3714
3715
3716
3717 /**
3718  * A query_short_channel_ids message is used to query a peer for
3719  * routing gossip messages related to one or more short_channel_ids.
3720  * The query recipient will reply with the latest, if available,
3721  * channel_announcement, channel_update and node_announcement messages
3722  * it maintains for the requested short_channel_ids followed by a
3723  * reply_short_channel_ids_end message. The short_channel_ids sent in
3724  * this query are encoded. We only support encoding_type=0 uncompressed
3725  * serialization and do not support encoding_type=1 zlib serialization.
3726  */
3727 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3728    /**
3729     * A pointer to the opaque Rust object.
3730     * Nearly everywhere, inner must be non-null, however in places where
3731     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3732     */
3733    LDKnativeQueryShortChannelIds *inner;
3734    /**
3735     * Indicates that this is the only struct which contains the same pointer.
3736     * Rust functions which take ownership of an object provided via an argument require
3737     * this to be true and invalidate the object pointed to by inner.
3738     */
3739    bool is_owned;
3740 } LDKQueryShortChannelIds;
3741
3742
3743
3744 /**
3745  * A reply_channel_range message is a reply to a query_channel_range
3746  * message. Multiple reply_channel_range messages can be sent in reply
3747  * to a single query_channel_range message. The query recipient makes a
3748  * best effort to respond based on their local network view which may
3749  * not be a perfect view of the network. The short_channel_ids in the
3750  * reply are encoded. We only support encoding_type=0 uncompressed
3751  * serialization and do not support encoding_type=1 zlib serialization.
3752  */
3753 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3754    /**
3755     * A pointer to the opaque Rust object.
3756     * Nearly everywhere, inner must be non-null, however in places where
3757     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3758     */
3759    LDKnativeReplyChannelRange *inner;
3760    /**
3761     * Indicates that this is the only struct which contains the same pointer.
3762     * Rust functions which take ownership of an object provided via an argument require
3763     * this to be true and invalidate the object pointed to by inner.
3764     */
3765    bool is_owned;
3766 } LDKReplyChannelRange;
3767
3768
3769
3770 /**
3771  * A gossip_timestamp_filter message is used by a node to request
3772  * gossip relay for messages in the requested time range when the
3773  * gossip_queries feature has been negotiated.
3774  */
3775 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
3776    /**
3777     * A pointer to the opaque Rust object.
3778     * Nearly everywhere, inner must be non-null, however in places where
3779     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3780     */
3781    LDKnativeGossipTimestampFilter *inner;
3782    /**
3783     * Indicates that this is the only struct which contains the same pointer.
3784     * Rust functions which take ownership of an object provided via an argument require
3785     * this to be true and invalidate the object pointed to by inner.
3786     */
3787    bool is_owned;
3788 } LDKGossipTimestampFilter;
3789
3790 /**
3791  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3792  * broadcast to most peers).
3793  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3794  */
3795 typedef enum LDKMessageSendEvent_Tag {
3796    /**
3797     * Used to indicate that we've accepted a channel open and should send the accept_channel
3798     * message provided to the given peer.
3799     */
3800    LDKMessageSendEvent_SendAcceptChannel,
3801    /**
3802     * Used to indicate that we've initiated a channel open and should send the open_channel
3803     * message provided to the given peer.
3804     */
3805    LDKMessageSendEvent_SendOpenChannel,
3806    /**
3807     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3808     */
3809    LDKMessageSendEvent_SendFundingCreated,
3810    /**
3811     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3812     */
3813    LDKMessageSendEvent_SendFundingSigned,
3814    /**
3815     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3816     */
3817    LDKMessageSendEvent_SendFundingLocked,
3818    /**
3819     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3820     */
3821    LDKMessageSendEvent_SendAnnouncementSignatures,
3822    /**
3823     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3824     * message should be sent to the peer with the given node_id.
3825     */
3826    LDKMessageSendEvent_UpdateHTLCs,
3827    /**
3828     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3829     */
3830    LDKMessageSendEvent_SendRevokeAndACK,
3831    /**
3832     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3833     */
3834    LDKMessageSendEvent_SendClosingSigned,
3835    /**
3836     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3837     */
3838    LDKMessageSendEvent_SendShutdown,
3839    /**
3840     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3841     */
3842    LDKMessageSendEvent_SendChannelReestablish,
3843    /**
3844     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3845     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3846     *
3847     * Note that after doing so, you very likely (unless you did so very recently) want to call
3848     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3849     * This ensures that any nodes which see our channel_announcement also have a relevant
3850     * node_announcement, including relevant feature flags which may be important for routing
3851     * through or to us.
3852     */
3853    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3854    /**
3855     * Used to indicate that a node_announcement should be broadcast to all peers.
3856     */
3857    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3858    /**
3859     * Used to indicate that a channel_update should be broadcast to all peers.
3860     */
3861    LDKMessageSendEvent_BroadcastChannelUpdate,
3862    /**
3863     * Used to indicate that a channel_update should be sent to a single peer.
3864     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
3865     * private channel and we shouldn't be informing all of our peers of channel parameters.
3866     */
3867    LDKMessageSendEvent_SendChannelUpdate,
3868    /**
3869     * Broadcast an error downstream to be handled
3870     */
3871    LDKMessageSendEvent_HandleError,
3872    /**
3873     * Query a peer for channels with funding transaction UTXOs in a block range.
3874     */
3875    LDKMessageSendEvent_SendChannelRangeQuery,
3876    /**
3877     * Request routing gossip messages from a peer for a list of channels identified by
3878     * their short_channel_ids.
3879     */
3880    LDKMessageSendEvent_SendShortIdsQuery,
3881    /**
3882     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3883     * emitted during processing of the query.
3884     */
3885    LDKMessageSendEvent_SendReplyChannelRange,
3886    /**
3887     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
3888     * enable receiving gossip messages from the peer.
3889     */
3890    LDKMessageSendEvent_SendGossipTimestampFilter,
3891    /**
3892     * Must be last for serialization purposes
3893     */
3894    LDKMessageSendEvent_Sentinel,
3895 } LDKMessageSendEvent_Tag;
3896
3897 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3898    /**
3899     * The node_id of the node which should receive this message
3900     */
3901    struct LDKPublicKey node_id;
3902    /**
3903     * The message which should be sent.
3904     */
3905    struct LDKAcceptChannel msg;
3906 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3907
3908 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3909    /**
3910     * The node_id of the node which should receive this message
3911     */
3912    struct LDKPublicKey node_id;
3913    /**
3914     * The message which should be sent.
3915     */
3916    struct LDKOpenChannel msg;
3917 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3918
3919 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3920    /**
3921     * The node_id of the node which should receive this message
3922     */
3923    struct LDKPublicKey node_id;
3924    /**
3925     * The message which should be sent.
3926     */
3927    struct LDKFundingCreated msg;
3928 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3929
3930 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3931    /**
3932     * The node_id of the node which should receive this message
3933     */
3934    struct LDKPublicKey node_id;
3935    /**
3936     * The message which should be sent.
3937     */
3938    struct LDKFundingSigned msg;
3939 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3940
3941 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3942    /**
3943     * The node_id of the node which should receive these message(s)
3944     */
3945    struct LDKPublicKey node_id;
3946    /**
3947     * The funding_locked message which should be sent.
3948     */
3949    struct LDKFundingLocked msg;
3950 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3951
3952 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3953    /**
3954     * The node_id of the node which should receive these message(s)
3955     */
3956    struct LDKPublicKey node_id;
3957    /**
3958     * The announcement_signatures message which should be sent.
3959     */
3960    struct LDKAnnouncementSignatures msg;
3961 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3962
3963 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3964    /**
3965     * The node_id of the node which should receive these message(s)
3966     */
3967    struct LDKPublicKey node_id;
3968    /**
3969     * The update messages which should be sent. ALL messages in the struct should be sent!
3970     */
3971    struct LDKCommitmentUpdate updates;
3972 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3973
3974 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3975    /**
3976     * The node_id of the node which should receive this message
3977     */
3978    struct LDKPublicKey node_id;
3979    /**
3980     * The message which should be sent.
3981     */
3982    struct LDKRevokeAndACK msg;
3983 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3984
3985 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3986    /**
3987     * The node_id of the node which should receive this message
3988     */
3989    struct LDKPublicKey node_id;
3990    /**
3991     * The message which should be sent.
3992     */
3993    struct LDKClosingSigned msg;
3994 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3995
3996 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3997    /**
3998     * The node_id of the node which should receive this message
3999     */
4000    struct LDKPublicKey node_id;
4001    /**
4002     * The message which should be sent.
4003     */
4004    struct LDKShutdown msg;
4005 } LDKMessageSendEvent_LDKSendShutdown_Body;
4006
4007 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4008    /**
4009     * The node_id of the node which should receive this message
4010     */
4011    struct LDKPublicKey node_id;
4012    /**
4013     * The message which should be sent.
4014     */
4015    struct LDKChannelReestablish msg;
4016 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4017
4018 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4019    /**
4020     * The channel_announcement which should be sent.
4021     */
4022    struct LDKChannelAnnouncement msg;
4023    /**
4024     * The followup channel_update which should be sent.
4025     */
4026    struct LDKChannelUpdate update_msg;
4027 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4028
4029 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
4030    /**
4031     * The node_announcement which should be sent.
4032     */
4033    struct LDKNodeAnnouncement msg;
4034 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
4035
4036 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4037    /**
4038     * The channel_update which should be sent.
4039     */
4040    struct LDKChannelUpdate msg;
4041 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4042
4043 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
4044    /**
4045     * The node_id of the node which should receive this message
4046     */
4047    struct LDKPublicKey node_id;
4048    /**
4049     * The channel_update which should be sent.
4050     */
4051    struct LDKChannelUpdate msg;
4052 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
4053
4054 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4055    /**
4056     * The node_id of the node which should receive this message
4057     */
4058    struct LDKPublicKey node_id;
4059    /**
4060     * The action which should be taken.
4061     */
4062    struct LDKErrorAction action;
4063 } LDKMessageSendEvent_LDKHandleError_Body;
4064
4065 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4066    /**
4067     * The node_id of this message recipient
4068     */
4069    struct LDKPublicKey node_id;
4070    /**
4071     * The query_channel_range which should be sent.
4072     */
4073    struct LDKQueryChannelRange msg;
4074 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4075
4076 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4077    /**
4078     * The node_id of this message recipient
4079     */
4080    struct LDKPublicKey node_id;
4081    /**
4082     * The query_short_channel_ids which should be sent.
4083     */
4084    struct LDKQueryShortChannelIds msg;
4085 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4086
4087 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4088    /**
4089     * The node_id of this message recipient
4090     */
4091    struct LDKPublicKey node_id;
4092    /**
4093     * The reply_channel_range which should be sent.
4094     */
4095    struct LDKReplyChannelRange msg;
4096 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4097
4098 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
4099    /**
4100     * The node_id of this message recipient
4101     */
4102    struct LDKPublicKey node_id;
4103    /**
4104     * The gossip_timestamp_filter which should be sent.
4105     */
4106    struct LDKGossipTimestampFilter msg;
4107 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
4108
4109 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4110    LDKMessageSendEvent_Tag tag;
4111    union {
4112       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4113       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4114       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4115       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4116       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
4117       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4118       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4119       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4120       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4121       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4122       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4123       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4124       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4125       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4126       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4127       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4128       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4129       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4130       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4131       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
4132    };
4133 } LDKMessageSendEvent;
4134
4135 /**
4136  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4137  * This corresponds to std::vector in C++
4138  */
4139 typedef struct LDKCVec_MessageSendEventZ {
4140    /**
4141     * The elements in the array.
4142     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4143     */
4144    struct LDKMessageSendEvent *data;
4145    /**
4146     * The number of elements pointed to by `data`.
4147     */
4148    uintptr_t datalen;
4149 } LDKCVec_MessageSendEventZ;
4150
4151
4152
4153 /**
4154  * [`Score`] implementation that uses a fixed penalty.
4155  */
4156 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
4157    /**
4158     * A pointer to the opaque Rust object.
4159     * Nearly everywhere, inner must be non-null, however in places where
4160     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4161     */
4162    LDKnativeFixedPenaltyScorer *inner;
4163    /**
4164     * Indicates that this is the only struct which contains the same pointer.
4165     * Rust functions which take ownership of an object provided via an argument require
4166     * this to be true and invalidate the object pointed to by inner.
4167     */
4168    bool is_owned;
4169 } LDKFixedPenaltyScorer;
4170
4171 /**
4172  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4173  */
4174 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
4175    /**
4176     * A pointer to the contents in the success state.
4177     * Reading from this pointer when `result_ok` is not set is undefined.
4178     */
4179    struct LDKFixedPenaltyScorer *result;
4180    /**
4181     * A pointer to the contents in the error state.
4182     * Reading from this pointer when `result_ok` is set is undefined.
4183     */
4184    struct LDKDecodeError *err;
4185 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
4186
4187 /**
4188  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4189  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4190  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4191  */
4192 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
4193    /**
4194     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4195     * `err` or `result` depending on the state of `result_ok`.
4196     */
4197    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
4198    /**
4199     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4200     */
4201    bool result_ok;
4202 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
4203
4204
4205
4206 /**
4207  * Parameters for configuring [`Scorer`].
4208  */
4209 typedef struct MUST_USE_STRUCT LDKScoringParameters {
4210    /**
4211     * A pointer to the opaque Rust object.
4212     * Nearly everywhere, inner must be non-null, however in places where
4213     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4214     */
4215    LDKnativeScoringParameters *inner;
4216    /**
4217     * Indicates that this is the only struct which contains the same pointer.
4218     * Rust functions which take ownership of an object provided via an argument require
4219     * this to be true and invalidate the object pointed to by inner.
4220     */
4221    bool is_owned;
4222 } LDKScoringParameters;
4223
4224 /**
4225  * The contents of CResult_ScoringParametersDecodeErrorZ
4226  */
4227 typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
4228    /**
4229     * A pointer to the contents in the success state.
4230     * Reading from this pointer when `result_ok` is not set is undefined.
4231     */
4232    struct LDKScoringParameters *result;
4233    /**
4234     * A pointer to the contents in the error state.
4235     * Reading from this pointer when `result_ok` is set is undefined.
4236     */
4237    struct LDKDecodeError *err;
4238 } LDKCResult_ScoringParametersDecodeErrorZPtr;
4239
4240 /**
4241  * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
4242  * containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4243  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4244  */
4245 typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
4246    /**
4247     * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
4248     * `err` or `result` depending on the state of `result_ok`.
4249     */
4250    union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
4251    /**
4252     * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
4253     */
4254    bool result_ok;
4255 } LDKCResult_ScoringParametersDecodeErrorZ;
4256
4257
4258
4259 /**
4260  * [`Score`] implementation that provides reasonable default behavior.
4261  *
4262  * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
4263  * slightly higher fees are available. Will further penalize channels that fail to relay payments.
4264  *
4265  * See [module-level documentation] for usage and [`ScoringParameters`] for customization.
4266  *
4267  * # Note
4268  *
4269  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4270  * behavior.
4271  *
4272  * [module-level documentation]: crate::routing::scoring
4273  */
4274 typedef struct MUST_USE_STRUCT LDKScorer {
4275    /**
4276     * A pointer to the opaque Rust object.
4277     * Nearly everywhere, inner must be non-null, however in places where
4278     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4279     */
4280    LDKnativeScorer *inner;
4281    /**
4282     * Indicates that this is the only struct which contains the same pointer.
4283     * Rust functions which take ownership of an object provided via an argument require
4284     * this to be true and invalidate the object pointed to by inner.
4285     */
4286    bool is_owned;
4287 } LDKScorer;
4288
4289 /**
4290  * The contents of CResult_ScorerDecodeErrorZ
4291  */
4292 typedef union LDKCResult_ScorerDecodeErrorZPtr {
4293    /**
4294     * A pointer to the contents in the success state.
4295     * Reading from this pointer when `result_ok` is not set is undefined.
4296     */
4297    struct LDKScorer *result;
4298    /**
4299     * A pointer to the contents in the error state.
4300     * Reading from this pointer when `result_ok` is set is undefined.
4301     */
4302    struct LDKDecodeError *err;
4303 } LDKCResult_ScorerDecodeErrorZPtr;
4304
4305 /**
4306  * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
4307  * containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4308  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4309  */
4310 typedef struct LDKCResult_ScorerDecodeErrorZ {
4311    /**
4312     * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
4313     * `err` or `result` depending on the state of `result_ok`.
4314     */
4315    union LDKCResult_ScorerDecodeErrorZPtr contents;
4316    /**
4317     * Whether this CResult_ScorerDecodeErrorZ represents a success state.
4318     */
4319    bool result_ok;
4320 } LDKCResult_ScorerDecodeErrorZ;
4321
4322
4323
4324 /**
4325  * Represents the network as nodes and channels between them
4326  */
4327 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4328    /**
4329     * A pointer to the opaque Rust object.
4330     * Nearly everywhere, inner must be non-null, however in places where
4331     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4332     */
4333    LDKnativeNetworkGraph *inner;
4334    /**
4335     * Indicates that this is the only struct which contains the same pointer.
4336     * Rust functions which take ownership of an object provided via an argument require
4337     * this to be true and invalidate the object pointed to by inner.
4338     */
4339    bool is_owned;
4340 } LDKNetworkGraph;
4341
4342
4343
4344 /**
4345  * [`Score`] implementation using channel success probability distributions.
4346  *
4347  * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
4348  * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
4349  * distributions are defined based on knowledge learned from successful and unsuccessful attempts.
4350  * Then the negative `log10` of the success probability is used to determine the cost of routing a
4351  * specific HTLC amount through a channel.
4352  *
4353  * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
4354  * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
4355  * [`ProbabilisticScoringParameters`] for details.
4356  *
4357  * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
4358  * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
4359  * volume are more likely to experience failed payment paths, which would need to be retried.
4360  *
4361  * # Note
4362  *
4363  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4364  * behavior.
4365  *
4366  * [1]: https://arxiv.org/abs/2107.05322
4367  */
4368 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
4369    /**
4370     * A pointer to the opaque Rust object.
4371     * Nearly everywhere, inner must be non-null, however in places where
4372     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4373     */
4374    LDKnativeProbabilisticScorer *inner;
4375    /**
4376     * Indicates that this is the only struct which contains the same pointer.
4377     * Rust functions which take ownership of an object provided via an argument require
4378     * this to be true and invalidate the object pointed to by inner.
4379     */
4380    bool is_owned;
4381 } LDKProbabilisticScorer;
4382
4383 /**
4384  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
4385  */
4386 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
4387    /**
4388     * A pointer to the contents in the success state.
4389     * Reading from this pointer when `result_ok` is not set is undefined.
4390     */
4391    struct LDKProbabilisticScorer *result;
4392    /**
4393     * A pointer to the contents in the error state.
4394     * Reading from this pointer when `result_ok` is set is undefined.
4395     */
4396    struct LDKDecodeError *err;
4397 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
4398
4399 /**
4400  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4401  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4402  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4403  */
4404 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
4405    /**
4406     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4407     * `err` or `result` depending on the state of `result_ok`.
4408     */
4409    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
4410    /**
4411     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4412     */
4413    bool result_ok;
4414 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
4415
4416
4417
4418 /**
4419  * Features used within an `init` message.
4420  */
4421 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4422    /**
4423     * A pointer to the opaque Rust object.
4424     * Nearly everywhere, inner must be non-null, however in places where
4425     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4426     */
4427    LDKnativeInitFeatures *inner;
4428    /**
4429     * Indicates that this is the only struct which contains the same pointer.
4430     * Rust functions which take ownership of an object provided via an argument require
4431     * this to be true and invalidate the object pointed to by inner.
4432     */
4433    bool is_owned;
4434 } LDKInitFeatures;
4435
4436 /**
4437  * The contents of CResult_InitFeaturesDecodeErrorZ
4438  */
4439 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4440    /**
4441     * A pointer to the contents in the success state.
4442     * Reading from this pointer when `result_ok` is not set is undefined.
4443     */
4444    struct LDKInitFeatures *result;
4445    /**
4446     * A pointer to the contents in the error state.
4447     * Reading from this pointer when `result_ok` is set is undefined.
4448     */
4449    struct LDKDecodeError *err;
4450 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4451
4452 /**
4453  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4454  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4455  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4456  */
4457 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4458    /**
4459     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4460     * `err` or `result` depending on the state of `result_ok`.
4461     */
4462    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4463    /**
4464     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4465     */
4466    bool result_ok;
4467 } LDKCResult_InitFeaturesDecodeErrorZ;
4468
4469
4470
4471 /**
4472  * Features used within a `channel_announcement` message.
4473  */
4474 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4475    /**
4476     * A pointer to the opaque Rust object.
4477     * Nearly everywhere, inner must be non-null, however in places where
4478     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4479     */
4480    LDKnativeChannelFeatures *inner;
4481    /**
4482     * Indicates that this is the only struct which contains the same pointer.
4483     * Rust functions which take ownership of an object provided via an argument require
4484     * this to be true and invalidate the object pointed to by inner.
4485     */
4486    bool is_owned;
4487 } LDKChannelFeatures;
4488
4489 /**
4490  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4491  */
4492 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4493    /**
4494     * A pointer to the contents in the success state.
4495     * Reading from this pointer when `result_ok` is not set is undefined.
4496     */
4497    struct LDKChannelFeatures *result;
4498    /**
4499     * A pointer to the contents in the error state.
4500     * Reading from this pointer when `result_ok` is set is undefined.
4501     */
4502    struct LDKDecodeError *err;
4503 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4504
4505 /**
4506  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4507  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4508  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4509  */
4510 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4511    /**
4512     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4513     * `err` or `result` depending on the state of `result_ok`.
4514     */
4515    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4516    /**
4517     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4518     */
4519    bool result_ok;
4520 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4521
4522
4523
4524 /**
4525  * Features used within a `node_announcement` message.
4526  */
4527 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4528    /**
4529     * A pointer to the opaque Rust object.
4530     * Nearly everywhere, inner must be non-null, however in places where
4531     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4532     */
4533    LDKnativeNodeFeatures *inner;
4534    /**
4535     * Indicates that this is the only struct which contains the same pointer.
4536     * Rust functions which take ownership of an object provided via an argument require
4537     * this to be true and invalidate the object pointed to by inner.
4538     */
4539    bool is_owned;
4540 } LDKNodeFeatures;
4541
4542 /**
4543  * The contents of CResult_NodeFeaturesDecodeErrorZ
4544  */
4545 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4546    /**
4547     * A pointer to the contents in the success state.
4548     * Reading from this pointer when `result_ok` is not set is undefined.
4549     */
4550    struct LDKNodeFeatures *result;
4551    /**
4552     * A pointer to the contents in the error state.
4553     * Reading from this pointer when `result_ok` is set is undefined.
4554     */
4555    struct LDKDecodeError *err;
4556 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4557
4558 /**
4559  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4560  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4561  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4562  */
4563 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4564    /**
4565     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4566     * `err` or `result` depending on the state of `result_ok`.
4567     */
4568    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4569    /**
4570     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4571     */
4572    bool result_ok;
4573 } LDKCResult_NodeFeaturesDecodeErrorZ;
4574
4575
4576
4577 /**
4578  * Features used within an invoice.
4579  */
4580 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4581    /**
4582     * A pointer to the opaque Rust object.
4583     * Nearly everywhere, inner must be non-null, however in places where
4584     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4585     */
4586    LDKnativeInvoiceFeatures *inner;
4587    /**
4588     * Indicates that this is the only struct which contains the same pointer.
4589     * Rust functions which take ownership of an object provided via an argument require
4590     * this to be true and invalidate the object pointed to by inner.
4591     */
4592    bool is_owned;
4593 } LDKInvoiceFeatures;
4594
4595 /**
4596  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4597  */
4598 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4599    /**
4600     * A pointer to the contents in the success state.
4601     * Reading from this pointer when `result_ok` is not set is undefined.
4602     */
4603    struct LDKInvoiceFeatures *result;
4604    /**
4605     * A pointer to the contents in the error state.
4606     * Reading from this pointer when `result_ok` is set is undefined.
4607     */
4608    struct LDKDecodeError *err;
4609 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4610
4611 /**
4612  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4613  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4614  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4615  */
4616 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4617    /**
4618     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4619     * `err` or `result` depending on the state of `result_ok`.
4620     */
4621    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4622    /**
4623     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4624     */
4625    bool result_ok;
4626 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4627
4628 /**
4629  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4630  */
4631 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
4632    /**
4633     * A pointer to the contents in the success state.
4634     * Reading from this pointer when `result_ok` is not set is undefined.
4635     */
4636    struct LDKChannelTypeFeatures *result;
4637    /**
4638     * A pointer to the contents in the error state.
4639     * Reading from this pointer when `result_ok` is set is undefined.
4640     */
4641    struct LDKDecodeError *err;
4642 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
4643
4644 /**
4645  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4646  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4647  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4648  */
4649 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
4650    /**
4651     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4652     * `err` or `result` depending on the state of `result_ok`.
4653     */
4654    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
4655    /**
4656     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4657     */
4658    bool result_ok;
4659 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
4660
4661 /**
4662  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4663  */
4664 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4665    /**
4666     * A pointer to the contents in the success state.
4667     * Reading from this pointer when `result_ok` is not set is undefined.
4668     */
4669    struct LDKDelayedPaymentOutputDescriptor *result;
4670    /**
4671     * A pointer to the contents in the error state.
4672     * Reading from this pointer when `result_ok` is set is undefined.
4673     */
4674    struct LDKDecodeError *err;
4675 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
4676
4677 /**
4678  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4679  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4680  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4681  */
4682 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4683    /**
4684     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4685     * `err` or `result` depending on the state of `result_ok`.
4686     */
4687    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
4688    /**
4689     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4690     */
4691    bool result_ok;
4692 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
4693
4694 /**
4695  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4696  */
4697 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4698    /**
4699     * A pointer to the contents in the success state.
4700     * Reading from this pointer when `result_ok` is not set is undefined.
4701     */
4702    struct LDKStaticPaymentOutputDescriptor *result;
4703    /**
4704     * A pointer to the contents in the error state.
4705     * Reading from this pointer when `result_ok` is set is undefined.
4706     */
4707    struct LDKDecodeError *err;
4708 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
4709
4710 /**
4711  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4712  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4713  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4714  */
4715 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4716    /**
4717     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4718     * `err` or `result` depending on the state of `result_ok`.
4719     */
4720    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
4721    /**
4722     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4723     */
4724    bool result_ok;
4725 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
4726
4727 /**
4728  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4729  */
4730 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
4731    /**
4732     * A pointer to the contents in the success state.
4733     * Reading from this pointer when `result_ok` is not set is undefined.
4734     */
4735    struct LDKSpendableOutputDescriptor *result;
4736    /**
4737     * A pointer to the contents in the error state.
4738     * Reading from this pointer when `result_ok` is set is undefined.
4739     */
4740    struct LDKDecodeError *err;
4741 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
4742
4743 /**
4744  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4745  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4746  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4747  */
4748 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
4749    /**
4750     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4751     * `err` or `result` depending on the state of `result_ok`.
4752     */
4753    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
4754    /**
4755     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4756     */
4757    bool result_ok;
4758 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
4759
4760 /**
4761  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4762  * This corresponds to std::vector in C++
4763  */
4764 typedef struct LDKCVec_PaymentPreimageZ {
4765    /**
4766     * The elements in the array.
4767     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4768     */
4769    struct LDKThirtyTwoBytes *data;
4770    /**
4771     * The number of elements pointed to by `data`.
4772     */
4773    uintptr_t datalen;
4774 } LDKCVec_PaymentPreimageZ;
4775
4776 /**
4777  * A tuple of 2 elements. See the individual fields for the types contained.
4778  */
4779 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
4780    /**
4781     * The element at position 0
4782     */
4783    struct LDKSignature a;
4784    /**
4785     * The element at position 1
4786     */
4787    struct LDKCVec_SignatureZ b;
4788 } LDKC2Tuple_SignatureCVec_SignatureZZ;
4789
4790 /**
4791  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4792  */
4793 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4794    /**
4795     * A pointer to the contents in the success state.
4796     * Reading from this pointer when `result_ok` is not set is undefined.
4797     */
4798    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
4799    /**
4800     * Note that this value is always NULL, as there are no contents in the Err variant
4801     */
4802    void *err;
4803 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
4804
4805 /**
4806  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4807  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4808  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4809  */
4810 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4811    /**
4812     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4813     * `err` or `result` depending on the state of `result_ok`.
4814     */
4815    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
4816    /**
4817     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4818     */
4819    bool result_ok;
4820 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
4821
4822 /**
4823  * The contents of CResult_SignatureNoneZ
4824  */
4825 typedef union LDKCResult_SignatureNoneZPtr {
4826    /**
4827     * A pointer to the contents in the success state.
4828     * Reading from this pointer when `result_ok` is not set is undefined.
4829     */
4830    struct LDKSignature *result;
4831    /**
4832     * Note that this value is always NULL, as there are no contents in the Err variant
4833     */
4834    void *err;
4835 } LDKCResult_SignatureNoneZPtr;
4836
4837 /**
4838  * A CResult_SignatureNoneZ represents the result of a fallible operation,
4839  * containing a crate::c_types::Signature on success and a () on failure.
4840  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4841  */
4842 typedef struct LDKCResult_SignatureNoneZ {
4843    /**
4844     * The contents of this CResult_SignatureNoneZ, accessible via either
4845     * `err` or `result` depending on the state of `result_ok`.
4846     */
4847    union LDKCResult_SignatureNoneZPtr contents;
4848    /**
4849     * Whether this CResult_SignatureNoneZ represents a success state.
4850     */
4851    bool result_ok;
4852 } LDKCResult_SignatureNoneZ;
4853
4854 /**
4855  * A tuple of 2 elements. See the individual fields for the types contained.
4856  */
4857 typedef struct LDKC2Tuple_SignatureSignatureZ {
4858    /**
4859     * The element at position 0
4860     */
4861    struct LDKSignature a;
4862    /**
4863     * The element at position 1
4864     */
4865    struct LDKSignature b;
4866 } LDKC2Tuple_SignatureSignatureZ;
4867
4868 /**
4869  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
4870  */
4871 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
4872    /**
4873     * A pointer to the contents in the success state.
4874     * Reading from this pointer when `result_ok` is not set is undefined.
4875     */
4876    struct LDKC2Tuple_SignatureSignatureZ *result;
4877    /**
4878     * Note that this value is always NULL, as there are no contents in the Err variant
4879     */
4880    void *err;
4881 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
4882
4883 /**
4884  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
4885  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
4886  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4887  */
4888 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
4889    /**
4890     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
4891     * `err` or `result` depending on the state of `result_ok`.
4892     */
4893    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
4894    /**
4895     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
4896     */
4897    bool result_ok;
4898 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
4899
4900 /**
4901  * The contents of CResult_SecretKeyNoneZ
4902  */
4903 typedef union LDKCResult_SecretKeyNoneZPtr {
4904    /**
4905     * A pointer to the contents in the success state.
4906     * Reading from this pointer when `result_ok` is not set is undefined.
4907     */
4908    struct LDKSecretKey *result;
4909    /**
4910     * Note that this value is always NULL, as there are no contents in the Err variant
4911     */
4912    void *err;
4913 } LDKCResult_SecretKeyNoneZPtr;
4914
4915 /**
4916  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
4917  * containing a crate::c_types::SecretKey on success and a () on failure.
4918  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4919  */
4920 typedef struct LDKCResult_SecretKeyNoneZ {
4921    /**
4922     * The contents of this CResult_SecretKeyNoneZ, accessible via either
4923     * `err` or `result` depending on the state of `result_ok`.
4924     */
4925    union LDKCResult_SecretKeyNoneZPtr contents;
4926    /**
4927     * Whether this CResult_SecretKeyNoneZ represents a success state.
4928     */
4929    bool result_ok;
4930 } LDKCResult_SecretKeyNoneZ;
4931
4932
4933
4934 /**
4935  * This class tracks the per-transaction information needed to build a closing transaction and will
4936  * actually build it and sign.
4937  *
4938  * This class can be used inside a signer implementation to generate a signature given the relevant
4939  * secret key.
4940  */
4941 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
4942    /**
4943     * A pointer to the opaque Rust object.
4944     * Nearly everywhere, inner must be non-null, however in places where
4945     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4946     */
4947    LDKnativeClosingTransaction *inner;
4948    /**
4949     * Indicates that this is the only struct which contains the same pointer.
4950     * Rust functions which take ownership of an object provided via an argument require
4951     * this to be true and invalidate the object pointed to by inner.
4952     */
4953    bool is_owned;
4954 } LDKClosingTransaction;
4955
4956
4957
4958 /**
4959  * The unsigned part of a channel_announcement
4960  */
4961 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
4962    /**
4963     * A pointer to the opaque Rust object.
4964     * Nearly everywhere, inner must be non-null, however in places where
4965     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4966     */
4967    LDKnativeUnsignedChannelAnnouncement *inner;
4968    /**
4969     * Indicates that this is the only struct which contains the same pointer.
4970     * Rust functions which take ownership of an object provided via an argument require
4971     * this to be true and invalidate the object pointed to by inner.
4972     */
4973    bool is_owned;
4974 } LDKUnsignedChannelAnnouncement;
4975
4976 /**
4977  * A trait to sign lightning channel transactions as described in BOLT 3.
4978  *
4979  * Signing services could be implemented on a hardware wallet. In this case,
4980  * the current Sign would be a front-end on top of a communication
4981  * channel connected to your secure device and lightning key material wouldn't
4982  * reside on a hot server. Nevertheless, a this deployment would still need
4983  * to trust the ChannelManager to avoid loss of funds as this latest component
4984  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
4985  *
4986  * A more secure iteration would be to use hashlock (or payment points) to pair
4987  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
4988  * at the price of more state and computation on the hardware wallet side. In the future,
4989  * we are looking forward to design such interface.
4990  *
4991  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
4992  * to act, as liveness and breach reply correctness are always going to be hard requirements
4993  * of LN security model, orthogonal of key management issues.
4994  */
4995 typedef struct LDKBaseSign {
4996    /**
4997     * An opaque pointer which is passed to your function implementations as an argument.
4998     * This has no meaning in the LDK, and can be NULL or any other value.
4999     */
5000    void *this_arg;
5001    /**
5002     * Gets the per-commitment point for a specific commitment number
5003     *
5004     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
5005     */
5006    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
5007    /**
5008     * Gets the commitment secret for a specific commitment number as part of the revocation process
5009     *
5010     * An external signer implementation should error here if the commitment was already signed
5011     * and should refuse to sign it in the future.
5012     *
5013     * May be called more than once for the same index.
5014     *
5015     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
5016     */
5017    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
5018    /**
5019     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
5020     *
5021     * This is required in order for the signer to make sure that releasing a commitment
5022     * secret won't leave us without a broadcastable holder transaction.
5023     * Policy checks should be implemented in this function, including checking the amount
5024     * sent to us and checking the HTLCs.
5025     *
5026     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
5027     * A validating signer should ensure that an HTLC output is removed only when the matching
5028     * preimage is provided, or when the value to holder is restored.
5029     *
5030     * NOTE: all the relevant preimages will be provided, but there may also be additional
5031     * irrelevant or duplicate preimages.
5032     */
5033    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
5034    /**
5035     * Gets the holder's channel public keys and basepoints
5036     */
5037    struct LDKChannelPublicKeys pubkeys;
5038    /**
5039     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
5040     * Note that this takes a pointer to this object, not the this_ptr like other methods do
5041     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
5042     */
5043    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
5044    /**
5045     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
5046     * some SpendableOutputDescriptor types. This should be sufficient to identify this
5047     * Sign object uniquely and lookup or re-derive its keys.
5048     */
5049    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
5050    /**
5051     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
5052     *
5053     * Note that if signing fails or is rejected, the channel will be force-closed.
5054     *
5055     * Policy checks should be implemented in this function, including checking the amount
5056     * sent to us and checking the HTLCs.
5057     *
5058     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
5059     * A validating signer should ensure that an HTLC output is removed only when the matching
5060     * preimage is provided, or when the value to holder is restored.
5061     *
5062     * NOTE: all the relevant preimages will be provided, but there may also be additional
5063     * irrelevant or duplicate preimages.
5064     */
5065    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
5066    /**
5067     * Validate the counterparty's revocation.
5068     *
5069     * This is required in order for the signer to make sure that the state has moved
5070     * forward and it is safe to sign the next counterparty commitment.
5071     */
5072    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
5073    /**
5074     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
5075     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
5076     * latest commitment_tx when we initiate a force-close.
5077     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
5078     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
5079     * the latest.
5080     * This may be called multiple times for the same transaction.
5081     *
5082     * An external signer implementation should check that the commitment has not been revoked.
5083     *
5084     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
5085     */
5086    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
5087    /**
5088     * Create a signature for the given input in a transaction spending an HTLC transaction output
5089     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
5090     *
5091     * A justice transaction may claim multiple outputs at the same time if timelocks are
5092     * similar, but only a signature for the input at index `input` should be signed for here.
5093     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
5094     * to an upcoming timelock expiration.
5095     *
5096     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5097     *
5098     * per_commitment_key is revocation secret which was provided by our counterparty when they
5099     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
5100     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
5101     * so).
5102     */
5103    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]);
5104    /**
5105     * Create a signature for the given input in a transaction spending a commitment transaction
5106     * HTLC output when our counterparty broadcasts an old state.
5107     *
5108     * A justice transaction may claim multiple outputs at the same time if timelocks are
5109     * similar, but only a signature for the input at index `input` should be signed for here.
5110     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
5111     * to an upcoming timelock expiration.
5112     *
5113     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5114     *
5115     * per_commitment_key is revocation secret which was provided by our counterparty when they
5116     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
5117     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
5118     * so).
5119     *
5120     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
5121     * (which is committed to in the BIP 143 signatures).
5122     */
5123    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);
5124    /**
5125     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
5126     * transaction, either offered or received.
5127     *
5128     * Such a transaction may claim multiples offered outputs at same time if we know the
5129     * preimage for each when we create it, but only the input at index `input` should be
5130     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
5131     * needed with regards to an upcoming timelock expiration.
5132     *
5133     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
5134     * outputs.
5135     *
5136     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5137     *
5138     * Per_commitment_point is the dynamic point corresponding to the channel state
5139     * detected onchain. It has been generated by our counterparty and is used to derive
5140     * channel state keys, which are then included in the witness script and committed to in the
5141     * BIP 143 signature.
5142     */
5143    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);
5144    /**
5145     * Create a signature for a (proposed) closing transaction.
5146     *
5147     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
5148     * chosen to forgo their output as dust.
5149     */
5150    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
5151    /**
5152     * Signs a channel announcement message with our funding key and our node secret key (aka
5153     * node_id or network_key), proving it comes from one of the channel participants.
5154     *
5155     * The first returned signature should be from our node secret key, the second from our
5156     * funding key.
5157     *
5158     * Note that if this fails or is rejected, the channel will not be publicly announced and
5159     * our counterparty may (though likely will not) close the channel on us for violating the
5160     * protocol.
5161     */
5162    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
5163    /**
5164     * Set the counterparty static channel data, including basepoints,
5165     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
5166     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
5167     * they MUST NOT be allowed to change to different values once set.
5168     *
5169     * channel_parameters.is_populated() MUST be true.
5170     *
5171     * We bind holder_selected_contest_delay late here for API convenience.
5172     *
5173     * Will be called before any signatures are applied.
5174     */
5175    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
5176    /**
5177     * Frees any resources associated with this object given its this_arg pointer.
5178     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5179     */
5180    void (*free)(void *this_arg);
5181 } LDKBaseSign;
5182
5183 /**
5184  * A cloneable signer.
5185  *
5186  * Although we require signers to be cloneable, it may be useful for developers to be able to use
5187  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
5188  * which implies Sized, into this derived trait.
5189  */
5190 typedef struct LDKSign {
5191    /**
5192     * An opaque pointer which is passed to your function implementations as an argument.
5193     * This has no meaning in the LDK, and can be NULL or any other value.
5194     */
5195    void *this_arg;
5196    /**
5197     * Implementation of BaseSign for this object.
5198     */
5199    struct LDKBaseSign BaseSign;
5200    /**
5201     * Serialize the object into a byte array
5202     */
5203    struct LDKCVec_u8Z (*write)(const void *this_arg);
5204    /**
5205     * Called, if set, after this Sign has been cloned into a duplicate object.
5206     * The new Sign is provided, and should be mutated as needed to perform a
5207     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
5208     */
5209    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
5210    /**
5211     * Frees any resources associated with this object given its this_arg pointer.
5212     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5213     */
5214    void (*free)(void *this_arg);
5215 } LDKSign;
5216
5217 /**
5218  * The contents of CResult_SignDecodeErrorZ
5219  */
5220 typedef union LDKCResult_SignDecodeErrorZPtr {
5221    /**
5222     * A pointer to the contents in the success state.
5223     * Reading from this pointer when `result_ok` is not set is undefined.
5224     */
5225    struct LDKSign *result;
5226    /**
5227     * A pointer to the contents in the error state.
5228     * Reading from this pointer when `result_ok` is set is undefined.
5229     */
5230    struct LDKDecodeError *err;
5231 } LDKCResult_SignDecodeErrorZPtr;
5232
5233 /**
5234  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5235  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5236  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5237  */
5238 typedef struct LDKCResult_SignDecodeErrorZ {
5239    /**
5240     * The contents of this CResult_SignDecodeErrorZ, accessible via either
5241     * `err` or `result` depending on the state of `result_ok`.
5242     */
5243    union LDKCResult_SignDecodeErrorZPtr contents;
5244    /**
5245     * Whether this CResult_SignDecodeErrorZ represents a success state.
5246     */
5247    bool result_ok;
5248 } LDKCResult_SignDecodeErrorZ;
5249
5250 /**
5251  * Integer in the range `0..32`
5252  */
5253 typedef struct LDKu5 {
5254    uint8_t _0;
5255 } LDKu5;
5256
5257 /**
5258  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5259  * This corresponds to std::vector in C++
5260  */
5261 typedef struct LDKCVec_u5Z {
5262    /**
5263     * The elements in the array.
5264     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5265     */
5266    struct LDKu5 *data;
5267    /**
5268     * The number of elements pointed to by `data`.
5269     */
5270    uintptr_t datalen;
5271 } LDKCVec_u5Z;
5272
5273 /**
5274  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
5275  * allows recovering the exact public key which created the signature given the message.
5276  */
5277 typedef struct LDKRecoverableSignature {
5278    /**
5279     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
5280     * recovery.
5281     */
5282    uint8_t serialized_form[68];
5283 } LDKRecoverableSignature;
5284
5285 /**
5286  * The contents of CResult_RecoverableSignatureNoneZ
5287  */
5288 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
5289    /**
5290     * A pointer to the contents in the success state.
5291     * Reading from this pointer when `result_ok` is not set is undefined.
5292     */
5293    struct LDKRecoverableSignature *result;
5294    /**
5295     * Note that this value is always NULL, as there are no contents in the Err variant
5296     */
5297    void *err;
5298 } LDKCResult_RecoverableSignatureNoneZPtr;
5299
5300 /**
5301  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5302  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
5303  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5304  */
5305 typedef struct LDKCResult_RecoverableSignatureNoneZ {
5306    /**
5307     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5308     * `err` or `result` depending on the state of `result_ok`.
5309     */
5310    union LDKCResult_RecoverableSignatureNoneZPtr contents;
5311    /**
5312     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5313     */
5314    bool result_ok;
5315 } LDKCResult_RecoverableSignatureNoneZ;
5316
5317 /**
5318  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5319  * This corresponds to std::vector in C++
5320  */
5321 typedef struct LDKCVec_CVec_u8ZZ {
5322    /**
5323     * The elements in the array.
5324     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5325     */
5326    struct LDKCVec_u8Z *data;
5327    /**
5328     * The number of elements pointed to by `data`.
5329     */
5330    uintptr_t datalen;
5331 } LDKCVec_CVec_u8ZZ;
5332
5333 /**
5334  * The contents of CResult_CVec_CVec_u8ZZNoneZ
5335  */
5336 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
5337    /**
5338     * A pointer to the contents in the success state.
5339     * Reading from this pointer when `result_ok` is not set is undefined.
5340     */
5341    struct LDKCVec_CVec_u8ZZ *result;
5342    /**
5343     * Note that this value is always NULL, as there are no contents in the Err variant
5344     */
5345    void *err;
5346 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
5347
5348 /**
5349  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5350  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5351  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5352  */
5353 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
5354    /**
5355     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5356     * `err` or `result` depending on the state of `result_ok`.
5357     */
5358    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
5359    /**
5360     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5361     */
5362    bool result_ok;
5363 } LDKCResult_CVec_CVec_u8ZZNoneZ;
5364
5365
5366
5367 /**
5368  * A simple implementation of Sign that just keeps the private keys in memory.
5369  *
5370  * This implementation performs no policy checks and is insufficient by itself as
5371  * a secure external signer.
5372  */
5373 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
5374    /**
5375     * A pointer to the opaque Rust object.
5376     * Nearly everywhere, inner must be non-null, however in places where
5377     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5378     */
5379    LDKnativeInMemorySigner *inner;
5380    /**
5381     * Indicates that this is the only struct which contains the same pointer.
5382     * Rust functions which take ownership of an object provided via an argument require
5383     * this to be true and invalidate the object pointed to by inner.
5384     */
5385    bool is_owned;
5386 } LDKInMemorySigner;
5387
5388 /**
5389  * The contents of CResult_InMemorySignerDecodeErrorZ
5390  */
5391 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
5392    /**
5393     * A pointer to the contents in the success state.
5394     * Reading from this pointer when `result_ok` is not set is undefined.
5395     */
5396    struct LDKInMemorySigner *result;
5397    /**
5398     * A pointer to the contents in the error state.
5399     * Reading from this pointer when `result_ok` is set is undefined.
5400     */
5401    struct LDKDecodeError *err;
5402 } LDKCResult_InMemorySignerDecodeErrorZPtr;
5403
5404 /**
5405  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5406  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5407  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5408  */
5409 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
5410    /**
5411     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5412     * `err` or `result` depending on the state of `result_ok`.
5413     */
5414    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
5415    /**
5416     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5417     */
5418    bool result_ok;
5419 } LDKCResult_InMemorySignerDecodeErrorZ;
5420
5421 /**
5422  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5423  * This corresponds to std::vector in C++
5424  */
5425 typedef struct LDKCVec_TxOutZ {
5426    /**
5427     * The elements in the array.
5428     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5429     */
5430    struct LDKTxOut *data;
5431    /**
5432     * The number of elements pointed to by `data`.
5433     */
5434    uintptr_t datalen;
5435 } LDKCVec_TxOutZ;
5436
5437 /**
5438  * The contents of CResult_TransactionNoneZ
5439  */
5440 typedef union LDKCResult_TransactionNoneZPtr {
5441    /**
5442     * A pointer to the contents in the success state.
5443     * Reading from this pointer when `result_ok` is not set is undefined.
5444     */
5445    struct LDKTransaction *result;
5446    /**
5447     * Note that this value is always NULL, as there are no contents in the Err variant
5448     */
5449    void *err;
5450 } LDKCResult_TransactionNoneZPtr;
5451
5452 /**
5453  * A CResult_TransactionNoneZ represents the result of a fallible operation,
5454  * containing a crate::c_types::Transaction on success and a () on failure.
5455  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5456  */
5457 typedef struct LDKCResult_TransactionNoneZ {
5458    /**
5459     * The contents of this CResult_TransactionNoneZ, accessible via either
5460     * `err` or `result` depending on the state of `result_ok`.
5461     */
5462    union LDKCResult_TransactionNoneZPtr contents;
5463    /**
5464     * Whether this CResult_TransactionNoneZ represents a success state.
5465     */
5466    bool result_ok;
5467 } LDKCResult_TransactionNoneZ;
5468
5469
5470
5471 /**
5472  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
5473  * on-chain transactions to ensure no loss of funds occurs.
5474  *
5475  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
5476  * information and are actively monitoring the chain.
5477  *
5478  * Pending Events or updated HTLCs which have not yet been read out by
5479  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
5480  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
5481  * gotten are fully handled before re-serializing the new state.
5482  *
5483  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
5484  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
5485  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
5486  * returned block hash and the the current chain and then reconnecting blocks to get to the
5487  * best chain) upon deserializing the object!
5488  */
5489 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
5490    /**
5491     * A pointer to the opaque Rust object.
5492     * Nearly everywhere, inner must be non-null, however in places where
5493     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5494     */
5495    LDKnativeChannelMonitor *inner;
5496    /**
5497     * Indicates that this is the only struct which contains the same pointer.
5498     * Rust functions which take ownership of an object provided via an argument require
5499     * this to be true and invalidate the object pointed to by inner.
5500     */
5501    bool is_owned;
5502 } LDKChannelMonitor;
5503
5504 /**
5505  * A tuple of 2 elements. See the individual fields for the types contained.
5506  */
5507 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
5508    /**
5509     * The element at position 0
5510     */
5511    struct LDKThirtyTwoBytes a;
5512    /**
5513     * The element at position 1
5514     */
5515    struct LDKChannelMonitor b;
5516 } LDKC2Tuple_BlockHashChannelMonitorZ;
5517
5518 /**
5519  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5520  * This corresponds to std::vector in C++
5521  */
5522 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
5523    /**
5524     * The elements in the array.
5525     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5526     */
5527    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
5528    /**
5529     * The number of elements pointed to by `data`.
5530     */
5531    uintptr_t datalen;
5532 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
5533
5534 /**
5535  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5536  */
5537 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5538    /**
5539     * A pointer to the contents in the success state.
5540     * Reading from this pointer when `result_ok` is not set is undefined.
5541     */
5542    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
5543    /**
5544     * A pointer to the contents in the error state.
5545     * Reading from this pointer when `result_ok` is set is undefined.
5546     */
5547    enum LDKIOError *err;
5548 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
5549
5550 /**
5551  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5552  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5554  */
5555 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5556    /**
5557     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5558     * `err` or `result` depending on the state of `result_ok`.
5559     */
5560    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
5561    /**
5562     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5563     */
5564    bool result_ok;
5565 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
5566
5567 /**
5568  * An enum which can either contain a u16 or not
5569  */
5570 typedef enum LDKCOption_u16Z_Tag {
5571    /**
5572     * When we're in this state, this COption_u16Z contains a u16
5573     */
5574    LDKCOption_u16Z_Some,
5575    /**
5576     * When we're in this state, this COption_u16Z contains nothing
5577     */
5578    LDKCOption_u16Z_None,
5579    /**
5580     * Must be last for serialization purposes
5581     */
5582    LDKCOption_u16Z_Sentinel,
5583 } LDKCOption_u16Z_Tag;
5584
5585 typedef struct LDKCOption_u16Z {
5586    LDKCOption_u16Z_Tag tag;
5587    union {
5588       struct {
5589          uint16_t some;
5590       };
5591    };
5592 } LDKCOption_u16Z;
5593
5594 /**
5595  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
5596  * too-high values)
5597  */
5598 typedef enum LDKAPIError_Tag {
5599    /**
5600     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
5601     * are documented, but generally indicates some precondition of a function was violated.
5602     */
5603    LDKAPIError_APIMisuseError,
5604    /**
5605     * Due to a high feerate, we were unable to complete the request.
5606     * For example, this may be returned if the feerate implies we cannot open a channel at the
5607     * requested value, but opening a larger channel would succeed.
5608     */
5609    LDKAPIError_FeeRateTooHigh,
5610    /**
5611     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
5612     * too-many-hops, etc).
5613     */
5614    LDKAPIError_RouteError,
5615    /**
5616     * We were unable to complete the request as the Channel required to do so is unable to
5617     * complete the request (or was not found). This can take many forms, including disconnected
5618     * peer, channel at capacity, channel shutting down, etc.
5619     */
5620    LDKAPIError_ChannelUnavailable,
5621    /**
5622     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
5623     * attempted action to fail.
5624     */
5625    LDKAPIError_MonitorUpdateFailed,
5626    /**
5627     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
5628     * with the channel counterparty as negotiated in [`InitFeatures`].
5629     *
5630     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
5631     * a channel or cooperatively close one with this peer (and will have to force-close instead).
5632     *
5633     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
5634     * [`InitFeatures`]: crate::ln::features::InitFeatures
5635     */
5636    LDKAPIError_IncompatibleShutdownScript,
5637    /**
5638     * Must be last for serialization purposes
5639     */
5640    LDKAPIError_Sentinel,
5641 } LDKAPIError_Tag;
5642
5643 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
5644    /**
5645     * A human-readable error message
5646     */
5647    struct LDKStr err;
5648 } LDKAPIError_LDKAPIMisuseError_Body;
5649
5650 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
5651    /**
5652     * A human-readable error message
5653     */
5654    struct LDKStr err;
5655    /**
5656     * The feerate which was too high.
5657     */
5658    uint32_t feerate;
5659 } LDKAPIError_LDKFeeRateTooHigh_Body;
5660
5661 typedef struct LDKAPIError_LDKRouteError_Body {
5662    /**
5663     * A human-readable error message
5664     */
5665    struct LDKStr err;
5666 } LDKAPIError_LDKRouteError_Body;
5667
5668 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
5669    /**
5670     * A human-readable error message
5671     */
5672    struct LDKStr err;
5673 } LDKAPIError_LDKChannelUnavailable_Body;
5674
5675 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
5676    /**
5677     * The incompatible shutdown script.
5678     */
5679    struct LDKShutdownScript script;
5680 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
5681
5682 typedef struct MUST_USE_STRUCT LDKAPIError {
5683    LDKAPIError_Tag tag;
5684    union {
5685       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
5686       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
5687       LDKAPIError_LDKRouteError_Body route_error;
5688       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
5689       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
5690    };
5691 } LDKAPIError;
5692
5693 /**
5694  * The contents of CResult_NoneAPIErrorZ
5695  */
5696 typedef union LDKCResult_NoneAPIErrorZPtr {
5697    /**
5698     * Note that this value is always NULL, as there are no contents in the OK variant
5699     */
5700    void *result;
5701    /**
5702     * A pointer to the contents in the error state.
5703     * Reading from this pointer when `result_ok` is set is undefined.
5704     */
5705    struct LDKAPIError *err;
5706 } LDKCResult_NoneAPIErrorZPtr;
5707
5708 /**
5709  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5710  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
5711  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5712  */
5713 typedef struct LDKCResult_NoneAPIErrorZ {
5714    /**
5715     * The contents of this CResult_NoneAPIErrorZ, accessible via either
5716     * `err` or `result` depending on the state of `result_ok`.
5717     */
5718    union LDKCResult_NoneAPIErrorZPtr contents;
5719    /**
5720     * Whether this CResult_NoneAPIErrorZ represents a success state.
5721     */
5722    bool result_ok;
5723 } LDKCResult_NoneAPIErrorZ;
5724
5725 /**
5726  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5727  * This corresponds to std::vector in C++
5728  */
5729 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
5730    /**
5731     * The elements in the array.
5732     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5733     */
5734    struct LDKCResult_NoneAPIErrorZ *data;
5735    /**
5736     * The number of elements pointed to by `data`.
5737     */
5738    uintptr_t datalen;
5739 } LDKCVec_CResult_NoneAPIErrorZZ;
5740
5741 /**
5742  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5743  * This corresponds to std::vector in C++
5744  */
5745 typedef struct LDKCVec_APIErrorZ {
5746    /**
5747     * The elements in the array.
5748     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5749     */
5750    struct LDKAPIError *data;
5751    /**
5752     * The number of elements pointed to by `data`.
5753     */
5754    uintptr_t datalen;
5755 } LDKCVec_APIErrorZ;
5756
5757 /**
5758  * The contents of CResult__u832APIErrorZ
5759  */
5760 typedef union LDKCResult__u832APIErrorZPtr {
5761    /**
5762     * A pointer to the contents in the success state.
5763     * Reading from this pointer when `result_ok` is not set is undefined.
5764     */
5765    struct LDKThirtyTwoBytes *result;
5766    /**
5767     * A pointer to the contents in the error state.
5768     * Reading from this pointer when `result_ok` is set is undefined.
5769     */
5770    struct LDKAPIError *err;
5771 } LDKCResult__u832APIErrorZPtr;
5772
5773 /**
5774  * A CResult__u832APIErrorZ represents the result of a fallible operation,
5775  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5776  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5777  */
5778 typedef struct LDKCResult__u832APIErrorZ {
5779    /**
5780     * The contents of this CResult__u832APIErrorZ, accessible via either
5781     * `err` or `result` depending on the state of `result_ok`.
5782     */
5783    union LDKCResult__u832APIErrorZPtr contents;
5784    /**
5785     * Whether this CResult__u832APIErrorZ represents a success state.
5786     */
5787    bool result_ok;
5788 } LDKCResult__u832APIErrorZ;
5789
5790 /**
5791  * If a payment fails to send, it can be in one of several states. This enum is returned as the
5792  * Err() type describing which state the payment is in, see the description of individual enum
5793  * states for more.
5794  */
5795 typedef enum LDKPaymentSendFailure_Tag {
5796    /**
5797     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
5798     * send the payment at all. No channel state has been changed or messages sent to peers, and
5799     * once you've changed the parameter at error, you can freely retry the payment in full.
5800     */
5801    LDKPaymentSendFailure_ParameterError,
5802    /**
5803     * A parameter in a single path which was passed to send_payment was invalid, preventing us
5804     * from attempting to send the payment at all. No channel state has been changed or messages
5805     * sent to peers, and once you've changed the parameter at error, you can freely retry the
5806     * payment in full.
5807     *
5808     * The results here are ordered the same as the paths in the route object which was passed to
5809     * send_payment.
5810     */
5811    LDKPaymentSendFailure_PathParameterError,
5812    /**
5813     * All paths which were attempted failed to send, with no channel state change taking place.
5814     * You can freely retry the payment in full (though you probably want to do so over different
5815     * paths than the ones selected).
5816     */
5817    LDKPaymentSendFailure_AllFailedRetrySafe,
5818    /**
5819     * Some paths which were attempted failed to send, though possibly not all. At least some
5820     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
5821     * in over-/re-payment.
5822     *
5823     * The results here are ordered the same as the paths in the route object which was passed to
5824     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
5825     * retried (though there is currently no API with which to do so).
5826     *
5827     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
5828     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
5829     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
5830     * with the latest update_id.
5831     */
5832    LDKPaymentSendFailure_PartialFailure,
5833    /**
5834     * Must be last for serialization purposes
5835     */
5836    LDKPaymentSendFailure_Sentinel,
5837 } LDKPaymentSendFailure_Tag;
5838
5839 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
5840    /**
5841     * The errors themselves, in the same order as the route hops.
5842     */
5843    struct LDKCVec_CResult_NoneAPIErrorZZ results;
5844    /**
5845     * If some paths failed without irrevocably committing to the new HTLC(s), this will
5846     * contain a [`RouteParameters`] object which can be used to calculate a new route that
5847     * will pay all remaining unpaid balance.
5848     *
5849     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5850     */
5851    struct LDKRouteParameters failed_paths_retry;
5852    /**
5853     * The payment id for the payment, which is now at least partially pending.
5854     */
5855    struct LDKThirtyTwoBytes payment_id;
5856 } LDKPaymentSendFailure_LDKPartialFailure_Body;
5857
5858 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
5859    LDKPaymentSendFailure_Tag tag;
5860    union {
5861       struct {
5862          struct LDKAPIError parameter_error;
5863       };
5864       struct {
5865          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
5866       };
5867       struct {
5868          struct LDKCVec_APIErrorZ all_failed_retry_safe;
5869       };
5870       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
5871    };
5872 } LDKPaymentSendFailure;
5873
5874 /**
5875  * The contents of CResult_PaymentIdPaymentSendFailureZ
5876  */
5877 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
5878    /**
5879     * A pointer to the contents in the success state.
5880     * Reading from this pointer when `result_ok` is not set is undefined.
5881     */
5882    struct LDKThirtyTwoBytes *result;
5883    /**
5884     * A pointer to the contents in the error state.
5885     * Reading from this pointer when `result_ok` is set is undefined.
5886     */
5887    struct LDKPaymentSendFailure *err;
5888 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
5889
5890 /**
5891  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5892  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5893  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5894  */
5895 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
5896    /**
5897     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5898     * `err` or `result` depending on the state of `result_ok`.
5899     */
5900    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
5901    /**
5902     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5903     */
5904    bool result_ok;
5905 } LDKCResult_PaymentIdPaymentSendFailureZ;
5906
5907 /**
5908  * The contents of CResult_NonePaymentSendFailureZ
5909  */
5910 typedef union LDKCResult_NonePaymentSendFailureZPtr {
5911    /**
5912     * Note that this value is always NULL, as there are no contents in the OK variant
5913     */
5914    void *result;
5915    /**
5916     * A pointer to the contents in the error state.
5917     * Reading from this pointer when `result_ok` is set is undefined.
5918     */
5919    struct LDKPaymentSendFailure *err;
5920 } LDKCResult_NonePaymentSendFailureZPtr;
5921
5922 /**
5923  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5924  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5925  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5926  */
5927 typedef struct LDKCResult_NonePaymentSendFailureZ {
5928    /**
5929     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5930     * `err` or `result` depending on the state of `result_ok`.
5931     */
5932    union LDKCResult_NonePaymentSendFailureZPtr contents;
5933    /**
5934     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
5935     */
5936    bool result_ok;
5937 } LDKCResult_NonePaymentSendFailureZ;
5938
5939 /**
5940  * A tuple of 2 elements. See the individual fields for the types contained.
5941  */
5942 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
5943    /**
5944     * The element at position 0
5945     */
5946    struct LDKThirtyTwoBytes a;
5947    /**
5948     * The element at position 1
5949     */
5950    struct LDKThirtyTwoBytes b;
5951 } LDKC2Tuple_PaymentHashPaymentIdZ;
5952
5953 /**
5954  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5955  */
5956 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5957    /**
5958     * A pointer to the contents in the success state.
5959     * Reading from this pointer when `result_ok` is not set is undefined.
5960     */
5961    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
5962    /**
5963     * A pointer to the contents in the error state.
5964     * Reading from this pointer when `result_ok` is set is undefined.
5965     */
5966    struct LDKPaymentSendFailure *err;
5967 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
5968
5969 /**
5970  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5971  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5972  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5973  */
5974 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5975    /**
5976     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5977     * `err` or `result` depending on the state of `result_ok`.
5978     */
5979    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
5980    /**
5981     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5982     */
5983    bool result_ok;
5984 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
5985
5986 /**
5987  * A 4-byte byte array.
5988  */
5989 typedef struct LDKFourBytes {
5990    /**
5991     * The four bytes
5992     */
5993    uint8_t data[4];
5994 } LDKFourBytes;
5995
5996 /**
5997  * A 16-byte byte array.
5998  */
5999 typedef struct LDKSixteenBytes {
6000    /**
6001     * The sixteen bytes
6002     */
6003    uint8_t data[16];
6004 } LDKSixteenBytes;
6005
6006 /**
6007  * A 12-byte byte array.
6008  */
6009 typedef struct LDKTwelveBytes {
6010    /**
6011     * The twelve bytes
6012     */
6013    uint8_t data[12];
6014 } LDKTwelveBytes;
6015
6016 /**
6017  * An address which can be used to connect to a remote peer
6018  */
6019 typedef enum LDKNetAddress_Tag {
6020    /**
6021     * An IPv4 address/port on which the peer is listening.
6022     */
6023    LDKNetAddress_IPv4,
6024    /**
6025     * An IPv6 address/port on which the peer is listening.
6026     */
6027    LDKNetAddress_IPv6,
6028    /**
6029     * An old-style Tor onion address/port on which the peer is listening.
6030     *
6031     * This field is deprecated and the Tor network generally no longer supports V2 Onion
6032     * addresses. Thus, the details are not parsed here.
6033     */
6034    LDKNetAddress_OnionV2,
6035    /**
6036     * A new-style Tor onion address/port on which the peer is listening.
6037     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
6038     * wrap as base32 and append \".onion\".
6039     */
6040    LDKNetAddress_OnionV3,
6041    /**
6042     * Must be last for serialization purposes
6043     */
6044    LDKNetAddress_Sentinel,
6045 } LDKNetAddress_Tag;
6046
6047 typedef struct LDKNetAddress_LDKIPv4_Body {
6048    /**
6049     * The 4-byte IPv4 address
6050     */
6051    struct LDKFourBytes addr;
6052    /**
6053     * The port on which the node is listening
6054     */
6055    uint16_t port;
6056 } LDKNetAddress_LDKIPv4_Body;
6057
6058 typedef struct LDKNetAddress_LDKIPv6_Body {
6059    /**
6060     * The 16-byte IPv6 address
6061     */
6062    struct LDKSixteenBytes addr;
6063    /**
6064     * The port on which the node is listening
6065     */
6066    uint16_t port;
6067 } LDKNetAddress_LDKIPv6_Body;
6068
6069 typedef struct LDKNetAddress_LDKOnionV3_Body {
6070    /**
6071     * The ed25519 long-term public key of the peer
6072     */
6073    struct LDKThirtyTwoBytes ed25519_pubkey;
6074    /**
6075     * The checksum of the pubkey and version, as included in the onion address
6076     */
6077    uint16_t checksum;
6078    /**
6079     * The version byte, as defined by the Tor Onion v3 spec.
6080     */
6081    uint8_t version;
6082    /**
6083     * The port on which the node is listening
6084     */
6085    uint16_t port;
6086 } LDKNetAddress_LDKOnionV3_Body;
6087
6088 typedef struct MUST_USE_STRUCT LDKNetAddress {
6089    LDKNetAddress_Tag tag;
6090    union {
6091       LDKNetAddress_LDKIPv4_Body i_pv4;
6092       LDKNetAddress_LDKIPv6_Body i_pv6;
6093       struct {
6094          struct LDKTwelveBytes onion_v2;
6095       };
6096       LDKNetAddress_LDKOnionV3_Body onion_v3;
6097    };
6098 } LDKNetAddress;
6099
6100 /**
6101  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6102  * This corresponds to std::vector in C++
6103  */
6104 typedef struct LDKCVec_NetAddressZ {
6105    /**
6106     * The elements in the array.
6107     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6108     */
6109    struct LDKNetAddress *data;
6110    /**
6111     * The number of elements pointed to by `data`.
6112     */
6113    uintptr_t datalen;
6114 } LDKCVec_NetAddressZ;
6115
6116 /**
6117  * A tuple of 2 elements. See the individual fields for the types contained.
6118  */
6119 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
6120    /**
6121     * The element at position 0
6122     */
6123    struct LDKThirtyTwoBytes a;
6124    /**
6125     * The element at position 1
6126     */
6127    struct LDKThirtyTwoBytes b;
6128 } LDKC2Tuple_PaymentHashPaymentSecretZ;
6129
6130 /**
6131  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6132  */
6133 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6134    /**
6135     * A pointer to the contents in the success state.
6136     * Reading from this pointer when `result_ok` is not set is undefined.
6137     */
6138    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
6139    /**
6140     * Note that this value is always NULL, as there are no contents in the Err variant
6141     */
6142    void *err;
6143 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
6144
6145 /**
6146  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6147  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6148  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6149  */
6150 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6151    /**
6152     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6153     * `err` or `result` depending on the state of `result_ok`.
6154     */
6155    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
6156    /**
6157     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6158     */
6159    bool result_ok;
6160 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
6161
6162 /**
6163  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6164  */
6165 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6166    /**
6167     * A pointer to the contents in the success state.
6168     * Reading from this pointer when `result_ok` is not set is undefined.
6169     */
6170    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
6171    /**
6172     * A pointer to the contents in the error state.
6173     * Reading from this pointer when `result_ok` is set is undefined.
6174     */
6175    struct LDKAPIError *err;
6176 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
6177
6178 /**
6179  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6180  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6181  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6182  */
6183 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6184    /**
6185     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6186     * `err` or `result` depending on the state of `result_ok`.
6187     */
6188    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
6189    /**
6190     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6191     */
6192    bool result_ok;
6193 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
6194
6195 /**
6196  * The contents of CResult_PaymentSecretNoneZ
6197  */
6198 typedef union LDKCResult_PaymentSecretNoneZPtr {
6199    /**
6200     * A pointer to the contents in the success state.
6201     * Reading from this pointer when `result_ok` is not set is undefined.
6202     */
6203    struct LDKThirtyTwoBytes *result;
6204    /**
6205     * Note that this value is always NULL, as there are no contents in the Err variant
6206     */
6207    void *err;
6208 } LDKCResult_PaymentSecretNoneZPtr;
6209
6210 /**
6211  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6212  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6213  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6214  */
6215 typedef struct LDKCResult_PaymentSecretNoneZ {
6216    /**
6217     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
6218     * `err` or `result` depending on the state of `result_ok`.
6219     */
6220    union LDKCResult_PaymentSecretNoneZPtr contents;
6221    /**
6222     * Whether this CResult_PaymentSecretNoneZ represents a success state.
6223     */
6224    bool result_ok;
6225 } LDKCResult_PaymentSecretNoneZ;
6226
6227 /**
6228  * The contents of CResult_PaymentSecretAPIErrorZ
6229  */
6230 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
6231    /**
6232     * A pointer to the contents in the success state.
6233     * Reading from this pointer when `result_ok` is not set is undefined.
6234     */
6235    struct LDKThirtyTwoBytes *result;
6236    /**
6237     * A pointer to the contents in the error state.
6238     * Reading from this pointer when `result_ok` is set is undefined.
6239     */
6240    struct LDKAPIError *err;
6241 } LDKCResult_PaymentSecretAPIErrorZPtr;
6242
6243 /**
6244  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6245  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6246  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6247  */
6248 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
6249    /**
6250     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6251     * `err` or `result` depending on the state of `result_ok`.
6252     */
6253    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
6254    /**
6255     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6256     */
6257    bool result_ok;
6258 } LDKCResult_PaymentSecretAPIErrorZ;
6259
6260 /**
6261  * The contents of CResult_PaymentPreimageAPIErrorZ
6262  */
6263 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
6264    /**
6265     * A pointer to the contents in the success state.
6266     * Reading from this pointer when `result_ok` is not set is undefined.
6267     */
6268    struct LDKThirtyTwoBytes *result;
6269    /**
6270     * A pointer to the contents in the error state.
6271     * Reading from this pointer when `result_ok` is set is undefined.
6272     */
6273    struct LDKAPIError *err;
6274 } LDKCResult_PaymentPreimageAPIErrorZPtr;
6275
6276 /**
6277  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
6278  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6279  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6280  */
6281 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
6282    /**
6283     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
6284     * `err` or `result` depending on the state of `result_ok`.
6285     */
6286    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
6287    /**
6288     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
6289     */
6290    bool result_ok;
6291 } LDKCResult_PaymentPreimageAPIErrorZ;
6292
6293
6294
6295 /**
6296  * Information needed for constructing an invoice route hint for this channel.
6297  */
6298 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
6299    /**
6300     * A pointer to the opaque Rust object.
6301     * Nearly everywhere, inner must be non-null, however in places where
6302     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6303     */
6304    LDKnativeCounterpartyForwardingInfo *inner;
6305    /**
6306     * Indicates that this is the only struct which contains the same pointer.
6307     * Rust functions which take ownership of an object provided via an argument require
6308     * this to be true and invalidate the object pointed to by inner.
6309     */
6310    bool is_owned;
6311 } LDKCounterpartyForwardingInfo;
6312
6313 /**
6314  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
6315  */
6316 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
6317    /**
6318     * A pointer to the contents in the success state.
6319     * Reading from this pointer when `result_ok` is not set is undefined.
6320     */
6321    struct LDKCounterpartyForwardingInfo *result;
6322    /**
6323     * A pointer to the contents in the error state.
6324     * Reading from this pointer when `result_ok` is set is undefined.
6325     */
6326    struct LDKDecodeError *err;
6327 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
6328
6329 /**
6330  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
6331  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6332  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6333  */
6334 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
6335    /**
6336     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
6337     * `err` or `result` depending on the state of `result_ok`.
6338     */
6339    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
6340    /**
6341     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
6342     */
6343    bool result_ok;
6344 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
6345
6346
6347
6348 /**
6349  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
6350  * to better separate parameters.
6351  */
6352 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
6353    /**
6354     * A pointer to the opaque Rust object.
6355     * Nearly everywhere, inner must be non-null, however in places where
6356     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6357     */
6358    LDKnativeChannelCounterparty *inner;
6359    /**
6360     * Indicates that this is the only struct which contains the same pointer.
6361     * Rust functions which take ownership of an object provided via an argument require
6362     * this to be true and invalidate the object pointed to by inner.
6363     */
6364    bool is_owned;
6365 } LDKChannelCounterparty;
6366
6367 /**
6368  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
6369  */
6370 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
6371    /**
6372     * A pointer to the contents in the success state.
6373     * Reading from this pointer when `result_ok` is not set is undefined.
6374     */
6375    struct LDKChannelCounterparty *result;
6376    /**
6377     * A pointer to the contents in the error state.
6378     * Reading from this pointer when `result_ok` is set is undefined.
6379     */
6380    struct LDKDecodeError *err;
6381 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
6382
6383 /**
6384  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
6385  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
6386  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6387  */
6388 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
6389    /**
6390     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
6391     * `err` or `result` depending on the state of `result_ok`.
6392     */
6393    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
6394    /**
6395     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
6396     */
6397    bool result_ok;
6398 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
6399
6400 /**
6401  * The contents of CResult_ChannelDetailsDecodeErrorZ
6402  */
6403 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
6404    /**
6405     * A pointer to the contents in the success state.
6406     * Reading from this pointer when `result_ok` is not set is undefined.
6407     */
6408    struct LDKChannelDetails *result;
6409    /**
6410     * A pointer to the contents in the error state.
6411     * Reading from this pointer when `result_ok` is set is undefined.
6412     */
6413    struct LDKDecodeError *err;
6414 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
6415
6416 /**
6417  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
6418  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
6419  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6420  */
6421 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
6422    /**
6423     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
6424     * `err` or `result` depending on the state of `result_ok`.
6425     */
6426    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
6427    /**
6428     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
6429     */
6430    bool result_ok;
6431 } LDKCResult_ChannelDetailsDecodeErrorZ;
6432
6433
6434
6435 /**
6436  * Route hints used in constructing invoices for [phantom node payents].
6437  *
6438  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
6439  */
6440 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
6441    /**
6442     * A pointer to the opaque Rust object.
6443     * Nearly everywhere, inner must be non-null, however in places where
6444     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6445     */
6446    LDKnativePhantomRouteHints *inner;
6447    /**
6448     * Indicates that this is the only struct which contains the same pointer.
6449     * Rust functions which take ownership of an object provided via an argument require
6450     * this to be true and invalidate the object pointed to by inner.
6451     */
6452    bool is_owned;
6453 } LDKPhantomRouteHints;
6454
6455 /**
6456  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
6457  */
6458 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
6459    /**
6460     * A pointer to the contents in the success state.
6461     * Reading from this pointer when `result_ok` is not set is undefined.
6462     */
6463    struct LDKPhantomRouteHints *result;
6464    /**
6465     * A pointer to the contents in the error state.
6466     * Reading from this pointer when `result_ok` is set is undefined.
6467     */
6468    struct LDKDecodeError *err;
6469 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
6470
6471 /**
6472  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
6473  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
6474  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6475  */
6476 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
6477    /**
6478     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
6479     * `err` or `result` depending on the state of `result_ok`.
6480     */
6481    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
6482    /**
6483     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
6484     */
6485    bool result_ok;
6486 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
6487
6488 /**
6489  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6490  * This corresponds to std::vector in C++
6491  */
6492 typedef struct LDKCVec_ChannelMonitorZ {
6493    /**
6494     * The elements in the array.
6495     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6496     */
6497    struct LDKChannelMonitor *data;
6498    /**
6499     * The number of elements pointed to by `data`.
6500     */
6501    uintptr_t datalen;
6502 } LDKCVec_ChannelMonitorZ;
6503
6504
6505
6506 /**
6507  * An update generated by the underlying Channel itself which contains some new information the
6508  * ChannelMonitor should be made aware of.
6509  */
6510 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
6511    /**
6512     * A pointer to the opaque Rust object.
6513     * Nearly everywhere, inner must be non-null, however in places where
6514     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6515     */
6516    LDKnativeChannelMonitorUpdate *inner;
6517    /**
6518     * Indicates that this is the only struct which contains the same pointer.
6519     * Rust functions which take ownership of an object provided via an argument require
6520     * this to be true and invalidate the object pointed to by inner.
6521     */
6522    bool is_owned;
6523 } LDKChannelMonitorUpdate;
6524
6525 /**
6526  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
6527  * blocks are connected and disconnected.
6528  *
6529  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
6530  * responsible for maintaining a set of monitors such that they can be updated accordingly as
6531  * channel state changes and HTLCs are resolved. See method documentation for specific
6532  * requirements.
6533  *
6534  * Implementations **must** ensure that updates are successfully applied and persisted upon method
6535  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
6536  * without taking any further action such as persisting the current state.
6537  *
6538  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
6539  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
6540  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
6541  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
6542  * multiple instances.
6543  *
6544  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
6545  */
6546 typedef struct LDKWatch {
6547    /**
6548     * An opaque pointer which is passed to your function implementations as an argument.
6549     * This has no meaning in the LDK, and can be NULL or any other value.
6550     */
6551    void *this_arg;
6552    /**
6553     * Watches a channel identified by `funding_txo` using `monitor`.
6554     *
6555     * Implementations are responsible for watching the chain for the funding transaction along
6556     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
6557     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
6558     *
6559     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
6560     * the given `funding_txo` has previously been registered via `watch_channel`.
6561     *
6562     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
6563     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
6564     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
6565     */
6566    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
6567    /**
6568     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
6569     *
6570     * Implementations must call [`update_monitor`] with the given update. See
6571     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
6572     *
6573     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
6574     */
6575    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
6576    /**
6577     * Returns any monitor events since the last call. Subsequent calls must only return new
6578     * events.
6579     *
6580     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
6581     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
6582     * to disk.
6583     *
6584     * For details on asynchronous [`ChannelMonitor`] updating and returning
6585     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
6586     */
6587    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
6588    /**
6589     * Frees any resources associated with this object given its this_arg pointer.
6590     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6591     */
6592    void (*free)(void *this_arg);
6593 } LDKWatch;
6594
6595 /**
6596  * An interface to send a transaction to the Bitcoin network.
6597  */
6598 typedef struct LDKBroadcasterInterface {
6599    /**
6600     * An opaque pointer which is passed to your function implementations as an argument.
6601     * This has no meaning in the LDK, and can be NULL or any other value.
6602     */
6603    void *this_arg;
6604    /**
6605     * Sends a transaction out to (hopefully) be mined.
6606     */
6607    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
6608    /**
6609     * Frees any resources associated with this object given its this_arg pointer.
6610     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6611     */
6612    void (*free)(void *this_arg);
6613 } LDKBroadcasterInterface;
6614
6615 /**
6616  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
6617  * own the memory pointed to by data.
6618  */
6619 typedef struct LDKu8slice {
6620    /**
6621     * A pointer to the byte buffer
6622     */
6623    const uint8_t *data;
6624    /**
6625     * The number of bytes pointed to by `data`.
6626     */
6627    uintptr_t datalen;
6628 } LDKu8slice;
6629
6630 /**
6631  * A trait to describe an object which can get user secrets and key material.
6632  */
6633 typedef struct LDKKeysInterface {
6634    /**
6635     * An opaque pointer which is passed to your function implementations as an argument.
6636     * This has no meaning in the LDK, and can be NULL or any other value.
6637     */
6638    void *this_arg;
6639    /**
6640     * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`].
6641     *
6642     * This method must return the same value each time it is called with a given `Recipient`
6643     * parameter.
6644     */
6645    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
6646    /**
6647     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
6648     *
6649     * This method should return a different value each time it is called, to avoid linking
6650     * on-chain funds across channels as controlled to the same user.
6651     */
6652    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
6653    /**
6654     * Get a script pubkey which we will send funds to when closing a channel.
6655     *
6656     * This method should return a different value each time it is called, to avoid linking
6657     * on-chain funds across channels as controlled to the same user.
6658     */
6659    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
6660    /**
6661     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
6662     * restarted with some stale data!
6663     *
6664     * This method must return a different value each time it is called.
6665     */
6666    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
6667    /**
6668     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
6669     * onion packets and for temporary channel IDs. There is no requirement that these be
6670     * persisted anywhere, though they must be unique across restarts.
6671     *
6672     * This method must return a different value each time it is called.
6673     */
6674    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
6675    /**
6676     * Reads a `Signer` for this `KeysInterface` from the given input stream.
6677     * This is only called during deserialization of other objects which contain
6678     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
6679     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
6680     * contain no versioning scheme. You may wish to include your own version prefix and ensure
6681     * you've read all of the provided bytes to ensure no corruption occurred.
6682     */
6683    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
6684    /**
6685     * Sign an invoice.
6686     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
6687     * this trait to parse the invoice and make sure they're signing what they expect, rather than
6688     * blindly signing the hash.
6689     * The hrp is ascii bytes, while the invoice data is base32.
6690     *
6691     * The secret key used to sign the invoice is dependent on the [`Recipient`].
6692     */
6693    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
6694    /**
6695     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
6696     *
6697     * If the implementor of this trait supports [phantom node payments], then every node that is
6698     * intended to be included in the phantom invoice route hints must return the same value from
6699     * this method.
6700     *
6701     * This method must return the same value each time it is called.
6702     *
6703     * [phantom node payments]: PhantomKeysManager
6704     */
6705    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
6706    /**
6707     * Frees any resources associated with this object given its this_arg pointer.
6708     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6709     */
6710    void (*free)(void *this_arg);
6711 } LDKKeysInterface;
6712
6713 /**
6714  * A trait which should be implemented to provide feerate information on a number of time
6715  * horizons.
6716  *
6717  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
6718  * called from inside the library in response to chain events, P2P events, or timer events).
6719  */
6720 typedef struct LDKFeeEstimator {
6721    /**
6722     * An opaque pointer which is passed to your function implementations as an argument.
6723     * This has no meaning in the LDK, and can be NULL or any other value.
6724     */
6725    void *this_arg;
6726    /**
6727     * Gets estimated satoshis of fee required per 1000 Weight-Units.
6728     *
6729     * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
6730     * round-downs don't put us below 1 satoshi-per-byte).
6731     *
6732     * This method can be implemented with the following unit conversions:
6733     *  * max(satoshis-per-byte * 250, 253)
6734     *  * max(satoshis-per-kbyte / 4, 253)
6735     */
6736    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
6737    /**
6738     * Frees any resources associated with this object given its this_arg pointer.
6739     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6740     */
6741    void (*free)(void *this_arg);
6742 } LDKFeeEstimator;
6743
6744
6745
6746 /**
6747  * A Record, unit of logging output with Metadata to enable filtering
6748  * Module_path, file, line to inform on log's source
6749  */
6750 typedef struct MUST_USE_STRUCT LDKRecord {
6751    /**
6752     * A pointer to the opaque Rust object.
6753     * Nearly everywhere, inner must be non-null, however in places where
6754     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6755     */
6756    LDKnativeRecord *inner;
6757    /**
6758     * Indicates that this is the only struct which contains the same pointer.
6759     * Rust functions which take ownership of an object provided via an argument require
6760     * this to be true and invalidate the object pointed to by inner.
6761     */
6762    bool is_owned;
6763 } LDKRecord;
6764
6765 /**
6766  * A trait encapsulating the operations required of a logger
6767  */
6768 typedef struct LDKLogger {
6769    /**
6770     * An opaque pointer which is passed to your function implementations as an argument.
6771     * This has no meaning in the LDK, and can be NULL or any other value.
6772     */
6773    void *this_arg;
6774    /**
6775     * Logs the `Record`
6776     */
6777    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
6778    /**
6779     * Frees any resources associated with this object given its this_arg pointer.
6780     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6781     */
6782    void (*free)(void *this_arg);
6783 } LDKLogger;
6784
6785
6786
6787 /**
6788  * Manager which keeps track of a number of channels and sends messages to the appropriate
6789  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
6790  *
6791  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
6792  * to individual Channels.
6793  *
6794  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
6795  * all peers during write/read (though does not modify this instance, only the instance being
6796  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
6797  * called funding_transaction_generated for outbound channels).
6798  *
6799  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
6800  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
6801  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
6802  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
6803  * the serialization process). If the deserialized version is out-of-date compared to the
6804  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
6805  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
6806  *
6807  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
6808  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6809  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
6810  * block_connected() to step towards your best block) upon deserialization before using the
6811  * object!
6812  *
6813  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
6814  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
6815  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
6816  * offline for a full minute. In order to track this, you must call
6817  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
6818  *
6819  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
6820  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
6821  * essentially you should default to using a SimpleRefChannelManager, and use a
6822  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
6823  * you're using lightning-net-tokio.
6824  */
6825 typedef struct MUST_USE_STRUCT LDKChannelManager {
6826    /**
6827     * A pointer to the opaque Rust object.
6828     * Nearly everywhere, inner must be non-null, however in places where
6829     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6830     */
6831    LDKnativeChannelManager *inner;
6832    /**
6833     * Indicates that this is the only struct which contains the same pointer.
6834     * Rust functions which take ownership of an object provided via an argument require
6835     * this to be true and invalidate the object pointed to by inner.
6836     */
6837    bool is_owned;
6838 } LDKChannelManager;
6839
6840 /**
6841  * A tuple of 2 elements. See the individual fields for the types contained.
6842  */
6843 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
6844    /**
6845     * The element at position 0
6846     */
6847    struct LDKThirtyTwoBytes a;
6848    /**
6849     * The element at position 1
6850     */
6851    struct LDKChannelManager b;
6852 } LDKC2Tuple_BlockHashChannelManagerZ;
6853
6854 /**
6855  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6856  */
6857 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6858    /**
6859     * A pointer to the contents in the success state.
6860     * Reading from this pointer when `result_ok` is not set is undefined.
6861     */
6862    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
6863    /**
6864     * A pointer to the contents in the error state.
6865     * Reading from this pointer when `result_ok` is set is undefined.
6866     */
6867    struct LDKDecodeError *err;
6868 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
6869
6870 /**
6871  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6872  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6873  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6874  */
6875 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6876    /**
6877     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6878     * `err` or `result` depending on the state of `result_ok`.
6879     */
6880    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
6881    /**
6882     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6883     */
6884    bool result_ok;
6885 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
6886
6887
6888
6889 /**
6890  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
6891  * with our counterparty.
6892  */
6893 typedef struct MUST_USE_STRUCT LDKChannelConfig {
6894    /**
6895     * A pointer to the opaque Rust object.
6896     * Nearly everywhere, inner must be non-null, however in places where
6897     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6898     */
6899    LDKnativeChannelConfig *inner;
6900    /**
6901     * Indicates that this is the only struct which contains the same pointer.
6902     * Rust functions which take ownership of an object provided via an argument require
6903     * this to be true and invalidate the object pointed to by inner.
6904     */
6905    bool is_owned;
6906 } LDKChannelConfig;
6907
6908 /**
6909  * The contents of CResult_ChannelConfigDecodeErrorZ
6910  */
6911 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
6912    /**
6913     * A pointer to the contents in the success state.
6914     * Reading from this pointer when `result_ok` is not set is undefined.
6915     */
6916    struct LDKChannelConfig *result;
6917    /**
6918     * A pointer to the contents in the error state.
6919     * Reading from this pointer when `result_ok` is set is undefined.
6920     */
6921    struct LDKDecodeError *err;
6922 } LDKCResult_ChannelConfigDecodeErrorZPtr;
6923
6924 /**
6925  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6926  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6927  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6928  */
6929 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
6930    /**
6931     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6932     * `err` or `result` depending on the state of `result_ok`.
6933     */
6934    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
6935    /**
6936     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6937     */
6938    bool result_ok;
6939 } LDKCResult_ChannelConfigDecodeErrorZ;
6940
6941 /**
6942  * The contents of CResult_OutPointDecodeErrorZ
6943  */
6944 typedef union LDKCResult_OutPointDecodeErrorZPtr {
6945    /**
6946     * A pointer to the contents in the success state.
6947     * Reading from this pointer when `result_ok` is not set is undefined.
6948     */
6949    struct LDKOutPoint *result;
6950    /**
6951     * A pointer to the contents in the error state.
6952     * Reading from this pointer when `result_ok` is set is undefined.
6953     */
6954    struct LDKDecodeError *err;
6955 } LDKCResult_OutPointDecodeErrorZPtr;
6956
6957 /**
6958  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
6959  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
6960  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6961  */
6962 typedef struct LDKCResult_OutPointDecodeErrorZ {
6963    /**
6964     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
6965     * `err` or `result` depending on the state of `result_ok`.
6966     */
6967    union LDKCResult_OutPointDecodeErrorZPtr contents;
6968    /**
6969     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
6970     */
6971    bool result_ok;
6972 } LDKCResult_OutPointDecodeErrorZ;
6973
6974 /**
6975  * Defines a type identifier for sending messages over the wire.
6976  *
6977  * Messages implementing this trait specify a type and must be [`Writeable`].
6978  */
6979 typedef struct LDKType {
6980    /**
6981     * An opaque pointer which is passed to your function implementations as an argument.
6982     * This has no meaning in the LDK, and can be NULL or any other value.
6983     */
6984    void *this_arg;
6985    /**
6986     * Returns the type identifying the message payload.
6987     */
6988    uint16_t (*type_id)(const void *this_arg);
6989    /**
6990     * Return a human-readable "debug" string describing this object
6991     */
6992    struct LDKStr (*debug_str)(const void *this_arg);
6993    /**
6994     * Serialize the object into a byte array
6995     */
6996    struct LDKCVec_u8Z (*write)(const void *this_arg);
6997    /**
6998     * Frees any resources associated with this object given its this_arg pointer.
6999     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7000     */
7001    void (*free)(void *this_arg);
7002 } LDKType;
7003
7004 /**
7005  * An enum which can either contain a crate::lightning::ln::wire::Type or not
7006  */
7007 typedef enum LDKCOption_TypeZ_Tag {
7008    /**
7009     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7010     */
7011    LDKCOption_TypeZ_Some,
7012    /**
7013     * When we're in this state, this COption_TypeZ contains nothing
7014     */
7015    LDKCOption_TypeZ_None,
7016    /**
7017     * Must be last for serialization purposes
7018     */
7019    LDKCOption_TypeZ_Sentinel,
7020 } LDKCOption_TypeZ_Tag;
7021
7022 typedef struct LDKCOption_TypeZ {
7023    LDKCOption_TypeZ_Tag tag;
7024    union {
7025       struct {
7026          struct LDKType some;
7027       };
7028    };
7029 } LDKCOption_TypeZ;
7030
7031 /**
7032  * The contents of CResult_COption_TypeZDecodeErrorZ
7033  */
7034 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
7035    /**
7036     * A pointer to the contents in the success state.
7037     * Reading from this pointer when `result_ok` is not set is undefined.
7038     */
7039    struct LDKCOption_TypeZ *result;
7040    /**
7041     * A pointer to the contents in the error state.
7042     * Reading from this pointer when `result_ok` is set is undefined.
7043     */
7044    struct LDKDecodeError *err;
7045 } LDKCResult_COption_TypeZDecodeErrorZPtr;
7046
7047 /**
7048  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7049  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7050  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7051  */
7052 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
7053    /**
7054     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7055     * `err` or `result` depending on the state of `result_ok`.
7056     */
7057    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
7058    /**
7059     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7060     */
7061    bool result_ok;
7062 } LDKCResult_COption_TypeZDecodeErrorZ;
7063
7064 /**
7065  * An error that may occur when making a payment.
7066  */
7067 typedef enum LDKPaymentError_Tag {
7068    /**
7069     * An error resulting from the provided [`Invoice`] or payment hash.
7070     */
7071    LDKPaymentError_Invoice,
7072    /**
7073     * An error occurring when finding a route.
7074     */
7075    LDKPaymentError_Routing,
7076    /**
7077     * An error occurring when sending a payment.
7078     */
7079    LDKPaymentError_Sending,
7080    /**
7081     * Must be last for serialization purposes
7082     */
7083    LDKPaymentError_Sentinel,
7084 } LDKPaymentError_Tag;
7085
7086 typedef struct MUST_USE_STRUCT LDKPaymentError {
7087    LDKPaymentError_Tag tag;
7088    union {
7089       struct {
7090          struct LDKStr invoice;
7091       };
7092       struct {
7093          struct LDKLightningError routing;
7094       };
7095       struct {
7096          struct LDKPaymentSendFailure sending;
7097       };
7098    };
7099 } LDKPaymentError;
7100
7101 /**
7102  * The contents of CResult_PaymentIdPaymentErrorZ
7103  */
7104 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
7105    /**
7106     * A pointer to the contents in the success state.
7107     * Reading from this pointer when `result_ok` is not set is undefined.
7108     */
7109    struct LDKThirtyTwoBytes *result;
7110    /**
7111     * A pointer to the contents in the error state.
7112     * Reading from this pointer when `result_ok` is set is undefined.
7113     */
7114    struct LDKPaymentError *err;
7115 } LDKCResult_PaymentIdPaymentErrorZPtr;
7116
7117 /**
7118  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
7119  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7120  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7121  */
7122 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
7123    /**
7124     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7125     * `err` or `result` depending on the state of `result_ok`.
7126     */
7127    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
7128    /**
7129     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7130     */
7131    bool result_ok;
7132 } LDKCResult_PaymentIdPaymentErrorZ;
7133
7134 /**
7135  * The contents of CResult_SiPrefixNoneZ
7136  */
7137 typedef union LDKCResult_SiPrefixNoneZPtr {
7138    /**
7139     * A pointer to the contents in the success state.
7140     * Reading from this pointer when `result_ok` is not set is undefined.
7141     */
7142    enum LDKSiPrefix *result;
7143    /**
7144     * Note that this value is always NULL, as there are no contents in the Err variant
7145     */
7146    void *err;
7147 } LDKCResult_SiPrefixNoneZPtr;
7148
7149 /**
7150  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
7151  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
7152  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7153  */
7154 typedef struct LDKCResult_SiPrefixNoneZ {
7155    /**
7156     * The contents of this CResult_SiPrefixNoneZ, accessible via either
7157     * `err` or `result` depending on the state of `result_ok`.
7158     */
7159    union LDKCResult_SiPrefixNoneZPtr contents;
7160    /**
7161     * Whether this CResult_SiPrefixNoneZ represents a success state.
7162     */
7163    bool result_ok;
7164 } LDKCResult_SiPrefixNoneZ;
7165
7166
7167
7168 /**
7169  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
7170  *
7171  * There are three ways to construct an `Invoice`:
7172  *  1. using `InvoiceBuilder`
7173  *  2. using `Invoice::from_signed(SignedRawInvoice)`
7174  *  3. using `str::parse::<Invoice>(&str)`
7175  */
7176 typedef struct MUST_USE_STRUCT LDKInvoice {
7177    /**
7178     * A pointer to the opaque Rust object.
7179     * Nearly everywhere, inner must be non-null, however in places where
7180     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7181     */
7182    LDKnativeInvoice *inner;
7183    /**
7184     * Indicates that this is the only struct which contains the same pointer.
7185     * Rust functions which take ownership of an object provided via an argument require
7186     * this to be true and invalidate the object pointed to by inner.
7187     */
7188    bool is_owned;
7189 } LDKInvoice;
7190
7191 /**
7192  * The contents of CResult_InvoiceNoneZ
7193  */
7194 typedef union LDKCResult_InvoiceNoneZPtr {
7195    /**
7196     * A pointer to the contents in the success state.
7197     * Reading from this pointer when `result_ok` is not set is undefined.
7198     */
7199    struct LDKInvoice *result;
7200    /**
7201     * Note that this value is always NULL, as there are no contents in the Err variant
7202     */
7203    void *err;
7204 } LDKCResult_InvoiceNoneZPtr;
7205
7206 /**
7207  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
7208  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
7209  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7210  */
7211 typedef struct LDKCResult_InvoiceNoneZ {
7212    /**
7213     * The contents of this CResult_InvoiceNoneZ, accessible via either
7214     * `err` or `result` depending on the state of `result_ok`.
7215     */
7216    union LDKCResult_InvoiceNoneZPtr contents;
7217    /**
7218     * Whether this CResult_InvoiceNoneZ represents a success state.
7219     */
7220    bool result_ok;
7221 } LDKCResult_InvoiceNoneZ;
7222
7223
7224
7225 /**
7226  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
7227  * invalid.
7228  *
7229  * # Invariants
7230  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
7231  */
7232 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
7233    /**
7234     * A pointer to the opaque Rust object.
7235     * Nearly everywhere, inner must be non-null, however in places where
7236     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7237     */
7238    LDKnativeSignedRawInvoice *inner;
7239    /**
7240     * Indicates that this is the only struct which contains the same pointer.
7241     * Rust functions which take ownership of an object provided via an argument require
7242     * this to be true and invalidate the object pointed to by inner.
7243     */
7244    bool is_owned;
7245 } LDKSignedRawInvoice;
7246
7247 /**
7248  * The contents of CResult_SignedRawInvoiceNoneZ
7249  */
7250 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
7251    /**
7252     * A pointer to the contents in the success state.
7253     * Reading from this pointer when `result_ok` is not set is undefined.
7254     */
7255    struct LDKSignedRawInvoice *result;
7256    /**
7257     * Note that this value is always NULL, as there are no contents in the Err variant
7258     */
7259    void *err;
7260 } LDKCResult_SignedRawInvoiceNoneZPtr;
7261
7262 /**
7263  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
7264  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
7265  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7266  */
7267 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
7268    /**
7269     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
7270     * `err` or `result` depending on the state of `result_ok`.
7271     */
7272    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
7273    /**
7274     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
7275     */
7276    bool result_ok;
7277 } LDKCResult_SignedRawInvoiceNoneZ;
7278
7279
7280
7281 /**
7282  * Represents an syntactically correct Invoice for a payment on the lightning network,
7283  * but without the signature information.
7284  * De- and encoding should not lead to information loss but may lead to different hashes.
7285  *
7286  * For methods without docs see the corresponding methods in `Invoice`.
7287  */
7288 typedef struct MUST_USE_STRUCT LDKRawInvoice {
7289    /**
7290     * A pointer to the opaque Rust object.
7291     * Nearly everywhere, inner must be non-null, however in places where
7292     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7293     */
7294    LDKnativeRawInvoice *inner;
7295    /**
7296     * Indicates that this is the only struct which contains the same pointer.
7297     * Rust functions which take ownership of an object provided via an argument require
7298     * this to be true and invalidate the object pointed to by inner.
7299     */
7300    bool is_owned;
7301 } LDKRawInvoice;
7302
7303
7304
7305 /**
7306  * Recoverable signature
7307  */
7308 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
7309    /**
7310     * A pointer to the opaque Rust object.
7311     * Nearly everywhere, inner must be non-null, however in places where
7312     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7313     */
7314    LDKnativeInvoiceSignature *inner;
7315    /**
7316     * Indicates that this is the only struct which contains the same pointer.
7317     * Rust functions which take ownership of an object provided via an argument require
7318     * this to be true and invalidate the object pointed to by inner.
7319     */
7320    bool is_owned;
7321 } LDKInvoiceSignature;
7322
7323 /**
7324  * A tuple of 3 elements. See the individual fields for the types contained.
7325  */
7326 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
7327    /**
7328     * The element at position 0
7329     */
7330    struct LDKRawInvoice a;
7331    /**
7332     * The element at position 1
7333     */
7334    struct LDKThirtyTwoBytes b;
7335    /**
7336     * The element at position 2
7337     */
7338    struct LDKInvoiceSignature c;
7339 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
7340
7341
7342
7343 /**
7344  * Payee public key
7345  */
7346 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
7347    /**
7348     * A pointer to the opaque Rust object.
7349     * Nearly everywhere, inner must be non-null, however in places where
7350     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7351     */
7352    LDKnativePayeePubKey *inner;
7353    /**
7354     * Indicates that this is the only struct which contains the same pointer.
7355     * Rust functions which take ownership of an object provided via an argument require
7356     * this to be true and invalidate the object pointed to by inner.
7357     */
7358    bool is_owned;
7359 } LDKPayeePubKey;
7360
7361 /**
7362  * The contents of CResult_PayeePubKeyErrorZ
7363  */
7364 typedef union LDKCResult_PayeePubKeyErrorZPtr {
7365    /**
7366     * A pointer to the contents in the success state.
7367     * Reading from this pointer when `result_ok` is not set is undefined.
7368     */
7369    struct LDKPayeePubKey *result;
7370    /**
7371     * A pointer to the contents in the error state.
7372     * Reading from this pointer when `result_ok` is set is undefined.
7373     */
7374    enum LDKSecp256k1Error *err;
7375 } LDKCResult_PayeePubKeyErrorZPtr;
7376
7377 /**
7378  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
7379  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
7380  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7381  */
7382 typedef struct LDKCResult_PayeePubKeyErrorZ {
7383    /**
7384     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
7385     * `err` or `result` depending on the state of `result_ok`.
7386     */
7387    union LDKCResult_PayeePubKeyErrorZPtr contents;
7388    /**
7389     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
7390     */
7391    bool result_ok;
7392 } LDKCResult_PayeePubKeyErrorZ;
7393
7394
7395
7396 /**
7397  * Private routing information
7398  *
7399  * # Invariants
7400  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
7401  *
7402  */
7403 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
7404    /**
7405     * A pointer to the opaque Rust object.
7406     * Nearly everywhere, inner must be non-null, however in places where
7407     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7408     */
7409    LDKnativePrivateRoute *inner;
7410    /**
7411     * Indicates that this is the only struct which contains the same pointer.
7412     * Rust functions which take ownership of an object provided via an argument require
7413     * this to be true and invalidate the object pointed to by inner.
7414     */
7415    bool is_owned;
7416 } LDKPrivateRoute;
7417
7418 /**
7419  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
7420  * This corresponds to std::vector in C++
7421  */
7422 typedef struct LDKCVec_PrivateRouteZ {
7423    /**
7424     * The elements in the array.
7425     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7426     */
7427    struct LDKPrivateRoute *data;
7428    /**
7429     * The number of elements pointed to by `data`.
7430     */
7431    uintptr_t datalen;
7432 } LDKCVec_PrivateRouteZ;
7433
7434
7435
7436 /**
7437  * A timestamp that refers to a date after 1 January 1970.
7438  *
7439  * # Invariants
7440  *
7441  * The Unix timestamp representing the stored time has to be positive and no greater than
7442  * [`MAX_TIMESTAMP`].
7443  */
7444 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
7445    /**
7446     * A pointer to the opaque Rust object.
7447     * Nearly everywhere, inner must be non-null, however in places where
7448     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7449     */
7450    LDKnativePositiveTimestamp *inner;
7451    /**
7452     * Indicates that this is the only struct which contains the same pointer.
7453     * Rust functions which take ownership of an object provided via an argument require
7454     * this to be true and invalidate the object pointed to by inner.
7455     */
7456    bool is_owned;
7457 } LDKPositiveTimestamp;
7458
7459 /**
7460  * The contents of CResult_PositiveTimestampCreationErrorZ
7461  */
7462 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
7463    /**
7464     * A pointer to the contents in the success state.
7465     * Reading from this pointer when `result_ok` is not set is undefined.
7466     */
7467    struct LDKPositiveTimestamp *result;
7468    /**
7469     * A pointer to the contents in the error state.
7470     * Reading from this pointer when `result_ok` is set is undefined.
7471     */
7472    enum LDKCreationError *err;
7473 } LDKCResult_PositiveTimestampCreationErrorZPtr;
7474
7475 /**
7476  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
7477  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
7478  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7479  */
7480 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
7481    /**
7482     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
7483     * `err` or `result` depending on the state of `result_ok`.
7484     */
7485    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
7486    /**
7487     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
7488     */
7489    bool result_ok;
7490 } LDKCResult_PositiveTimestampCreationErrorZ;
7491
7492 /**
7493  * The contents of CResult_NoneSemanticErrorZ
7494  */
7495 typedef union LDKCResult_NoneSemanticErrorZPtr {
7496    /**
7497     * Note that this value is always NULL, as there are no contents in the OK variant
7498     */
7499    void *result;
7500    /**
7501     * A pointer to the contents in the error state.
7502     * Reading from this pointer when `result_ok` is set is undefined.
7503     */
7504    enum LDKSemanticError *err;
7505 } LDKCResult_NoneSemanticErrorZPtr;
7506
7507 /**
7508  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
7509  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
7510  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7511  */
7512 typedef struct LDKCResult_NoneSemanticErrorZ {
7513    /**
7514     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
7515     * `err` or `result` depending on the state of `result_ok`.
7516     */
7517    union LDKCResult_NoneSemanticErrorZPtr contents;
7518    /**
7519     * Whether this CResult_NoneSemanticErrorZ represents a success state.
7520     */
7521    bool result_ok;
7522 } LDKCResult_NoneSemanticErrorZ;
7523
7524 /**
7525  * The contents of CResult_InvoiceSemanticErrorZ
7526  */
7527 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
7528    /**
7529     * A pointer to the contents in the success state.
7530     * Reading from this pointer when `result_ok` is not set is undefined.
7531     */
7532    struct LDKInvoice *result;
7533    /**
7534     * A pointer to the contents in the error state.
7535     * Reading from this pointer when `result_ok` is set is undefined.
7536     */
7537    enum LDKSemanticError *err;
7538 } LDKCResult_InvoiceSemanticErrorZPtr;
7539
7540 /**
7541  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
7542  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
7543  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7544  */
7545 typedef struct LDKCResult_InvoiceSemanticErrorZ {
7546    /**
7547     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
7548     * `err` or `result` depending on the state of `result_ok`.
7549     */
7550    union LDKCResult_InvoiceSemanticErrorZPtr contents;
7551    /**
7552     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
7553     */
7554    bool result_ok;
7555 } LDKCResult_InvoiceSemanticErrorZ;
7556
7557
7558
7559 /**
7560  * Description string
7561  *
7562  * # Invariants
7563  * The description can be at most 639 __bytes__ long
7564  */
7565 typedef struct MUST_USE_STRUCT LDKDescription {
7566    /**
7567     * A pointer to the opaque Rust object.
7568     * Nearly everywhere, inner must be non-null, however in places where
7569     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7570     */
7571    LDKnativeDescription *inner;
7572    /**
7573     * Indicates that this is the only struct which contains the same pointer.
7574     * Rust functions which take ownership of an object provided via an argument require
7575     * this to be true and invalidate the object pointed to by inner.
7576     */
7577    bool is_owned;
7578 } LDKDescription;
7579
7580 /**
7581  * The contents of CResult_DescriptionCreationErrorZ
7582  */
7583 typedef union LDKCResult_DescriptionCreationErrorZPtr {
7584    /**
7585     * A pointer to the contents in the success state.
7586     * Reading from this pointer when `result_ok` is not set is undefined.
7587     */
7588    struct LDKDescription *result;
7589    /**
7590     * A pointer to the contents in the error state.
7591     * Reading from this pointer when `result_ok` is set is undefined.
7592     */
7593    enum LDKCreationError *err;
7594 } LDKCResult_DescriptionCreationErrorZPtr;
7595
7596 /**
7597  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
7598  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
7599  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7600  */
7601 typedef struct LDKCResult_DescriptionCreationErrorZ {
7602    /**
7603     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
7604     * `err` or `result` depending on the state of `result_ok`.
7605     */
7606    union LDKCResult_DescriptionCreationErrorZPtr contents;
7607    /**
7608     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
7609     */
7610    bool result_ok;
7611 } LDKCResult_DescriptionCreationErrorZ;
7612
7613 /**
7614  * The contents of CResult_PrivateRouteCreationErrorZ
7615  */
7616 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
7617    /**
7618     * A pointer to the contents in the success state.
7619     * Reading from this pointer when `result_ok` is not set is undefined.
7620     */
7621    struct LDKPrivateRoute *result;
7622    /**
7623     * A pointer to the contents in the error state.
7624     * Reading from this pointer when `result_ok` is set is undefined.
7625     */
7626    enum LDKCreationError *err;
7627 } LDKCResult_PrivateRouteCreationErrorZPtr;
7628
7629 /**
7630  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
7631  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
7632  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7633  */
7634 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
7635    /**
7636     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
7637     * `err` or `result` depending on the state of `result_ok`.
7638     */
7639    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
7640    /**
7641     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
7642     */
7643    bool result_ok;
7644 } LDKCResult_PrivateRouteCreationErrorZ;
7645
7646 /**
7647  * The contents of CResult_StringErrorZ
7648  */
7649 typedef union LDKCResult_StringErrorZPtr {
7650    /**
7651     * A pointer to the contents in the success state.
7652     * Reading from this pointer when `result_ok` is not set is undefined.
7653     */
7654    struct LDKStr *result;
7655    /**
7656     * A pointer to the contents in the error state.
7657     * Reading from this pointer when `result_ok` is set is undefined.
7658     */
7659    enum LDKSecp256k1Error *err;
7660 } LDKCResult_StringErrorZPtr;
7661
7662 /**
7663  * A CResult_StringErrorZ represents the result of a fallible operation,
7664  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
7665  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7666  */
7667 typedef struct LDKCResult_StringErrorZ {
7668    /**
7669     * The contents of this CResult_StringErrorZ, accessible via either
7670     * `err` or `result` depending on the state of `result_ok`.
7671     */
7672    union LDKCResult_StringErrorZPtr contents;
7673    /**
7674     * Whether this CResult_StringErrorZ represents a success state.
7675     */
7676    bool result_ok;
7677 } LDKCResult_StringErrorZ;
7678
7679 /**
7680  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
7681  */
7682 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
7683    /**
7684     * A pointer to the contents in the success state.
7685     * Reading from this pointer when `result_ok` is not set is undefined.
7686     */
7687    struct LDKChannelMonitorUpdate *result;
7688    /**
7689     * A pointer to the contents in the error state.
7690     * Reading from this pointer when `result_ok` is set is undefined.
7691     */
7692    struct LDKDecodeError *err;
7693 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
7694
7695 /**
7696  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
7697  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7698  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7699  */
7700 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
7701    /**
7702     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
7703     * `err` or `result` depending on the state of `result_ok`.
7704     */
7705    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
7706    /**
7707     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
7708     */
7709    bool result_ok;
7710 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
7711
7712 /**
7713  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
7714  */
7715 typedef enum LDKCOption_MonitorEventZ_Tag {
7716    /**
7717     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
7718     */
7719    LDKCOption_MonitorEventZ_Some,
7720    /**
7721     * When we're in this state, this COption_MonitorEventZ contains nothing
7722     */
7723    LDKCOption_MonitorEventZ_None,
7724    /**
7725     * Must be last for serialization purposes
7726     */
7727    LDKCOption_MonitorEventZ_Sentinel,
7728 } LDKCOption_MonitorEventZ_Tag;
7729
7730 typedef struct LDKCOption_MonitorEventZ {
7731    LDKCOption_MonitorEventZ_Tag tag;
7732    union {
7733       struct {
7734          struct LDKMonitorEvent some;
7735       };
7736    };
7737 } LDKCOption_MonitorEventZ;
7738
7739 /**
7740  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
7741  */
7742 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
7743    /**
7744     * A pointer to the contents in the success state.
7745     * Reading from this pointer when `result_ok` is not set is undefined.
7746     */
7747    struct LDKCOption_MonitorEventZ *result;
7748    /**
7749     * A pointer to the contents in the error state.
7750     * Reading from this pointer when `result_ok` is set is undefined.
7751     */
7752    struct LDKDecodeError *err;
7753 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
7754
7755 /**
7756  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
7757  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7758  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7759  */
7760 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
7761    /**
7762     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
7763     * `err` or `result` depending on the state of `result_ok`.
7764     */
7765    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
7766    /**
7767     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
7768     */
7769    bool result_ok;
7770 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
7771
7772 /**
7773  * The contents of CResult_HTLCUpdateDecodeErrorZ
7774  */
7775 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
7776    /**
7777     * A pointer to the contents in the success state.
7778     * Reading from this pointer when `result_ok` is not set is undefined.
7779     */
7780    struct LDKHTLCUpdate *result;
7781    /**
7782     * A pointer to the contents in the error state.
7783     * Reading from this pointer when `result_ok` is set is undefined.
7784     */
7785    struct LDKDecodeError *err;
7786 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
7787
7788 /**
7789  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7790  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7791  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7792  */
7793 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
7794    /**
7795     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7796     * `err` or `result` depending on the state of `result_ok`.
7797     */
7798    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
7799    /**
7800     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7801     */
7802    bool result_ok;
7803 } LDKCResult_HTLCUpdateDecodeErrorZ;
7804
7805 /**
7806  * A tuple of 2 elements. See the individual fields for the types contained.
7807  */
7808 typedef struct LDKC2Tuple_OutPointScriptZ {
7809    /**
7810     * The element at position 0
7811     */
7812    struct LDKOutPoint a;
7813    /**
7814     * The element at position 1
7815     */
7816    struct LDKCVec_u8Z b;
7817 } LDKC2Tuple_OutPointScriptZ;
7818
7819 /**
7820  * A tuple of 2 elements. See the individual fields for the types contained.
7821  */
7822 typedef struct LDKC2Tuple_u32ScriptZ {
7823    /**
7824     * The element at position 0
7825     */
7826    uint32_t a;
7827    /**
7828     * The element at position 1
7829     */
7830    struct LDKCVec_u8Z b;
7831 } LDKC2Tuple_u32ScriptZ;
7832
7833 /**
7834  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
7835  * This corresponds to std::vector in C++
7836  */
7837 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
7838    /**
7839     * The elements in the array.
7840     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7841     */
7842    struct LDKC2Tuple_u32ScriptZ *data;
7843    /**
7844     * The number of elements pointed to by `data`.
7845     */
7846    uintptr_t datalen;
7847 } LDKCVec_C2Tuple_u32ScriptZZ;
7848
7849 /**
7850  * A tuple of 2 elements. See the individual fields for the types contained.
7851  */
7852 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7853    /**
7854     * The element at position 0
7855     */
7856    struct LDKThirtyTwoBytes a;
7857    /**
7858     * The element at position 1
7859     */
7860    struct LDKCVec_C2Tuple_u32ScriptZZ b;
7861 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
7862
7863 /**
7864  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
7865  * This corresponds to std::vector in C++
7866  */
7867 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7868    /**
7869     * The elements in the array.
7870     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7871     */
7872    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
7873    /**
7874     * The number of elements pointed to by `data`.
7875     */
7876    uintptr_t datalen;
7877 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
7878
7879 /**
7880  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
7881  * This corresponds to std::vector in C++
7882  */
7883 typedef struct LDKCVec_EventZ {
7884    /**
7885     * The elements in the array.
7886     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7887     */
7888    struct LDKEvent *data;
7889    /**
7890     * The number of elements pointed to by `data`.
7891     */
7892    uintptr_t datalen;
7893 } LDKCVec_EventZ;
7894
7895 /**
7896  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
7897  * This corresponds to std::vector in C++
7898  */
7899 typedef struct LDKCVec_TransactionZ {
7900    /**
7901     * The elements in the array.
7902     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7903     */
7904    struct LDKTransaction *data;
7905    /**
7906     * The number of elements pointed to by `data`.
7907     */
7908    uintptr_t datalen;
7909 } LDKCVec_TransactionZ;
7910
7911 /**
7912  * A tuple of 2 elements. See the individual fields for the types contained.
7913  */
7914 typedef struct LDKC2Tuple_u32TxOutZ {
7915    /**
7916     * The element at position 0
7917     */
7918    uint32_t a;
7919    /**
7920     * The element at position 1
7921     */
7922    struct LDKTxOut b;
7923 } LDKC2Tuple_u32TxOutZ;
7924
7925 /**
7926  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7927  * This corresponds to std::vector in C++
7928  */
7929 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
7930    /**
7931     * The elements in the array.
7932     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7933     */
7934    struct LDKC2Tuple_u32TxOutZ *data;
7935    /**
7936     * The number of elements pointed to by `data`.
7937     */
7938    uintptr_t datalen;
7939 } LDKCVec_C2Tuple_u32TxOutZZ;
7940
7941 /**
7942  * A tuple of 2 elements. See the individual fields for the types contained.
7943  */
7944 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7945    /**
7946     * The element at position 0
7947     */
7948    struct LDKThirtyTwoBytes a;
7949    /**
7950     * The element at position 1
7951     */
7952    struct LDKCVec_C2Tuple_u32TxOutZZ b;
7953 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
7954
7955 /**
7956  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7957  * This corresponds to std::vector in C++
7958  */
7959 typedef struct LDKCVec_TransactionOutputsZ {
7960    /**
7961     * The elements in the array.
7962     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7963     */
7964    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
7965    /**
7966     * The number of elements pointed to by `data`.
7967     */
7968    uintptr_t datalen;
7969 } LDKCVec_TransactionOutputsZ;
7970
7971 /**
7972  * Details about the balance(s) available for spending once the channel appears on chain.
7973  *
7974  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
7975  * be provided.
7976  */
7977 typedef enum LDKBalance_Tag {
7978    /**
7979     * The channel is not yet closed (or the commitment or closing transaction has not yet
7980     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
7981     * force-closed now.
7982     */
7983    LDKBalance_ClaimableOnChannelClose,
7984    /**
7985     * The channel has been closed, and the given balance is ours but awaiting confirmations until
7986     * we consider it spendable.
7987     */
7988    LDKBalance_ClaimableAwaitingConfirmations,
7989    /**
7990     * The channel has been closed, and the given balance should be ours but awaiting spending
7991     * transaction confirmation. If the spending transaction does not confirm in time, it is
7992     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
7993     *
7994     * Once the spending transaction confirms, before it has reached enough confirmations to be
7995     * considered safe from chain reorganizations, the balance will instead be provided via
7996     * [`Balance::ClaimableAwaitingConfirmations`].
7997     */
7998    LDKBalance_ContentiousClaimable,
7999    /**
8000     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
8001     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
8002     * likely to be claimed by our counterparty before we do.
8003     */
8004    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
8005    /**
8006     * Must be last for serialization purposes
8007     */
8008    LDKBalance_Sentinel,
8009 } LDKBalance_Tag;
8010
8011 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
8012    /**
8013     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8014     * required to do so.
8015     */
8016    uint64_t claimable_amount_satoshis;
8017 } LDKBalance_LDKClaimableOnChannelClose_Body;
8018
8019 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
8020    /**
8021     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
8022     * were spent in broadcasting the transaction.
8023     */
8024    uint64_t claimable_amount_satoshis;
8025    /**
8026     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
8027     * amount.
8028     */
8029    uint32_t confirmation_height;
8030 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
8031
8032 typedef struct LDKBalance_LDKContentiousClaimable_Body {
8033    /**
8034     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8035     * required to do so.
8036     */
8037    uint64_t claimable_amount_satoshis;
8038    /**
8039     * The height at which the counterparty may be able to claim the balance if we have not
8040     * done so.
8041     */
8042    uint32_t timeout_height;
8043 } LDKBalance_LDKContentiousClaimable_Body;
8044
8045 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
8046    /**
8047     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8048     * required to do so.
8049     */
8050    uint64_t claimable_amount_satoshis;
8051    /**
8052     * The height at which we will be able to claim the balance if our counterparty has not
8053     * done so.
8054     */
8055    uint32_t claimable_height;
8056 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
8057
8058 typedef struct MUST_USE_STRUCT LDKBalance {
8059    LDKBalance_Tag tag;
8060    union {
8061       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
8062       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
8063       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
8064       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
8065    };
8066 } LDKBalance;
8067
8068 /**
8069  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
8070  * This corresponds to std::vector in C++
8071  */
8072 typedef struct LDKCVec_BalanceZ {
8073    /**
8074     * The elements in the array.
8075     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8076     */
8077    struct LDKBalance *data;
8078    /**
8079     * The number of elements pointed to by `data`.
8080     */
8081    uintptr_t datalen;
8082 } LDKCVec_BalanceZ;
8083
8084 /**
8085  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
8086  */
8087 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
8088    /**
8089     * A pointer to the contents in the success state.
8090     * Reading from this pointer when `result_ok` is not set is undefined.
8091     */
8092    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
8093    /**
8094     * A pointer to the contents in the error state.
8095     * Reading from this pointer when `result_ok` is set is undefined.
8096     */
8097    struct LDKDecodeError *err;
8098 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
8099
8100 /**
8101  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
8102  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8103  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8104  */
8105 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8106    /**
8107     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
8108     * `err` or `result` depending on the state of `result_ok`.
8109     */
8110    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
8111    /**
8112     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
8113     */
8114    bool result_ok;
8115 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
8116
8117 /**
8118  * The contents of CResult_NoneLightningErrorZ
8119  */
8120 typedef union LDKCResult_NoneLightningErrorZPtr {
8121    /**
8122     * Note that this value is always NULL, as there are no contents in the OK variant
8123     */
8124    void *result;
8125    /**
8126     * A pointer to the contents in the error state.
8127     * Reading from this pointer when `result_ok` is set is undefined.
8128     */
8129    struct LDKLightningError *err;
8130 } LDKCResult_NoneLightningErrorZPtr;
8131
8132 /**
8133  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
8134  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
8135  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8136  */
8137 typedef struct LDKCResult_NoneLightningErrorZ {
8138    /**
8139     * The contents of this CResult_NoneLightningErrorZ, accessible via either
8140     * `err` or `result` depending on the state of `result_ok`.
8141     */
8142    union LDKCResult_NoneLightningErrorZPtr contents;
8143    /**
8144     * Whether this CResult_NoneLightningErrorZ represents a success state.
8145     */
8146    bool result_ok;
8147 } LDKCResult_NoneLightningErrorZ;
8148
8149 /**
8150  * A tuple of 2 elements. See the individual fields for the types contained.
8151  */
8152 typedef struct LDKC2Tuple_PublicKeyTypeZ {
8153    /**
8154     * The element at position 0
8155     */
8156    struct LDKPublicKey a;
8157    /**
8158     * The element at position 1
8159     */
8160    struct LDKType b;
8161 } LDKC2Tuple_PublicKeyTypeZ;
8162
8163 /**
8164  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
8165  * This corresponds to std::vector in C++
8166  */
8167 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
8168    /**
8169     * The elements in the array.
8170     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8171     */
8172    struct LDKC2Tuple_PublicKeyTypeZ *data;
8173    /**
8174     * The number of elements pointed to by `data`.
8175     */
8176    uintptr_t datalen;
8177 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
8178
8179 /**
8180  * The contents of CResult_boolLightningErrorZ
8181  */
8182 typedef union LDKCResult_boolLightningErrorZPtr {
8183    /**
8184     * A pointer to the contents in the success state.
8185     * Reading from this pointer when `result_ok` is not set is undefined.
8186     */
8187    bool *result;
8188    /**
8189     * A pointer to the contents in the error state.
8190     * Reading from this pointer when `result_ok` is set is undefined.
8191     */
8192    struct LDKLightningError *err;
8193 } LDKCResult_boolLightningErrorZPtr;
8194
8195 /**
8196  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
8197  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
8198  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8199  */
8200 typedef struct LDKCResult_boolLightningErrorZ {
8201    /**
8202     * The contents of this CResult_boolLightningErrorZ, accessible via either
8203     * `err` or `result` depending on the state of `result_ok`.
8204     */
8205    union LDKCResult_boolLightningErrorZPtr contents;
8206    /**
8207     * Whether this CResult_boolLightningErrorZ represents a success state.
8208     */
8209    bool result_ok;
8210 } LDKCResult_boolLightningErrorZ;
8211
8212 /**
8213  * A tuple of 3 elements. See the individual fields for the types contained.
8214  */
8215 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8216    /**
8217     * The element at position 0
8218     */
8219    struct LDKChannelAnnouncement a;
8220    /**
8221     * The element at position 1
8222     */
8223    struct LDKChannelUpdate b;
8224    /**
8225     * The element at position 2
8226     */
8227    struct LDKChannelUpdate c;
8228 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
8229
8230 /**
8231  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
8232  * This corresponds to std::vector in C++
8233  */
8234 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8235    /**
8236     * The elements in the array.
8237     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8238     */
8239    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
8240    /**
8241     * The number of elements pointed to by `data`.
8242     */
8243    uintptr_t datalen;
8244 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
8245
8246 /**
8247  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
8248  * This corresponds to std::vector in C++
8249  */
8250 typedef struct LDKCVec_NodeAnnouncementZ {
8251    /**
8252     * The elements in the array.
8253     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8254     */
8255    struct LDKNodeAnnouncement *data;
8256    /**
8257     * The number of elements pointed to by `data`.
8258     */
8259    uintptr_t datalen;
8260 } LDKCVec_NodeAnnouncementZ;
8261
8262 /**
8263  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
8264  * This corresponds to std::vector in C++
8265  */
8266 typedef struct LDKCVec_PublicKeyZ {
8267    /**
8268     * The elements in the array.
8269     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8270     */
8271    struct LDKPublicKey *data;
8272    /**
8273     * The number of elements pointed to by `data`.
8274     */
8275    uintptr_t datalen;
8276 } LDKCVec_PublicKeyZ;
8277
8278 /**
8279  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
8280  */
8281 typedef enum LDKCOption_NetAddressZ_Tag {
8282    /**
8283     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
8284     */
8285    LDKCOption_NetAddressZ_Some,
8286    /**
8287     * When we're in this state, this COption_NetAddressZ contains nothing
8288     */
8289    LDKCOption_NetAddressZ_None,
8290    /**
8291     * Must be last for serialization purposes
8292     */
8293    LDKCOption_NetAddressZ_Sentinel,
8294 } LDKCOption_NetAddressZ_Tag;
8295
8296 typedef struct LDKCOption_NetAddressZ {
8297    LDKCOption_NetAddressZ_Tag tag;
8298    union {
8299       struct {
8300          struct LDKNetAddress some;
8301       };
8302    };
8303 } LDKCOption_NetAddressZ;
8304
8305
8306
8307 /**
8308  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
8309  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
8310  * descriptor.
8311  */
8312 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
8313    /**
8314     * A pointer to the opaque Rust object.
8315     * Nearly everywhere, inner must be non-null, however in places where
8316     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8317     */
8318    LDKnativePeerHandleError *inner;
8319    /**
8320     * Indicates that this is the only struct which contains the same pointer.
8321     * Rust functions which take ownership of an object provided via an argument require
8322     * this to be true and invalidate the object pointed to by inner.
8323     */
8324    bool is_owned;
8325 } LDKPeerHandleError;
8326
8327 /**
8328  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
8329  */
8330 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
8331    /**
8332     * A pointer to the contents in the success state.
8333     * Reading from this pointer when `result_ok` is not set is undefined.
8334     */
8335    struct LDKCVec_u8Z *result;
8336    /**
8337     * A pointer to the contents in the error state.
8338     * Reading from this pointer when `result_ok` is set is undefined.
8339     */
8340    struct LDKPeerHandleError *err;
8341 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
8342
8343 /**
8344  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
8345  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8346  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8347  */
8348 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
8349    /**
8350     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
8351     * `err` or `result` depending on the state of `result_ok`.
8352     */
8353    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
8354    /**
8355     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
8356     */
8357    bool result_ok;
8358 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
8359
8360 /**
8361  * The contents of CResult_NonePeerHandleErrorZ
8362  */
8363 typedef union LDKCResult_NonePeerHandleErrorZPtr {
8364    /**
8365     * Note that this value is always NULL, as there are no contents in the OK variant
8366     */
8367    void *result;
8368    /**
8369     * A pointer to the contents in the error state.
8370     * Reading from this pointer when `result_ok` is set is undefined.
8371     */
8372    struct LDKPeerHandleError *err;
8373 } LDKCResult_NonePeerHandleErrorZPtr;
8374
8375 /**
8376  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
8377  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8378  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8379  */
8380 typedef struct LDKCResult_NonePeerHandleErrorZ {
8381    /**
8382     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
8383     * `err` or `result` depending on the state of `result_ok`.
8384     */
8385    union LDKCResult_NonePeerHandleErrorZPtr contents;
8386    /**
8387     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
8388     */
8389    bool result_ok;
8390 } LDKCResult_NonePeerHandleErrorZ;
8391
8392 /**
8393  * The contents of CResult_boolPeerHandleErrorZ
8394  */
8395 typedef union LDKCResult_boolPeerHandleErrorZPtr {
8396    /**
8397     * A pointer to the contents in the success state.
8398     * Reading from this pointer when `result_ok` is not set is undefined.
8399     */
8400    bool *result;
8401    /**
8402     * A pointer to the contents in the error state.
8403     * Reading from this pointer when `result_ok` is set is undefined.
8404     */
8405    struct LDKPeerHandleError *err;
8406 } LDKCResult_boolPeerHandleErrorZPtr;
8407
8408 /**
8409  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
8410  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8411  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8412  */
8413 typedef struct LDKCResult_boolPeerHandleErrorZ {
8414    /**
8415     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
8416     * `err` or `result` depending on the state of `result_ok`.
8417     */
8418    union LDKCResult_boolPeerHandleErrorZPtr contents;
8419    /**
8420     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
8421     */
8422    bool result_ok;
8423 } LDKCResult_boolPeerHandleErrorZ;
8424
8425
8426
8427 /**
8428  * Represents the compressed public key of a node
8429  */
8430 typedef struct MUST_USE_STRUCT LDKNodeId {
8431    /**
8432     * A pointer to the opaque Rust object.
8433     * Nearly everywhere, inner must be non-null, however in places where
8434     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8435     */
8436    LDKnativeNodeId *inner;
8437    /**
8438     * Indicates that this is the only struct which contains the same pointer.
8439     * Rust functions which take ownership of an object provided via an argument require
8440     * this to be true and invalidate the object pointed to by inner.
8441     */
8442    bool is_owned;
8443 } LDKNodeId;
8444
8445 /**
8446  * The contents of CResult_NodeIdDecodeErrorZ
8447  */
8448 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
8449    /**
8450     * A pointer to the contents in the success state.
8451     * Reading from this pointer when `result_ok` is not set is undefined.
8452     */
8453    struct LDKNodeId *result;
8454    /**
8455     * A pointer to the contents in the error state.
8456     * Reading from this pointer when `result_ok` is set is undefined.
8457     */
8458    struct LDKDecodeError *err;
8459 } LDKCResult_NodeIdDecodeErrorZPtr;
8460
8461 /**
8462  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
8463  * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
8464  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8465  */
8466 typedef struct LDKCResult_NodeIdDecodeErrorZ {
8467    /**
8468     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
8469     * `err` or `result` depending on the state of `result_ok`.
8470     */
8471    union LDKCResult_NodeIdDecodeErrorZPtr contents;
8472    /**
8473     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
8474     */
8475    bool result_ok;
8476 } LDKCResult_NodeIdDecodeErrorZ;
8477
8478 /**
8479  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
8480  */
8481 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
8482    /**
8483     * A pointer to the contents in the success state.
8484     * Reading from this pointer when `result_ok` is not set is undefined.
8485     */
8486    struct LDKCOption_NetworkUpdateZ *result;
8487    /**
8488     * A pointer to the contents in the error state.
8489     * Reading from this pointer when `result_ok` is set is undefined.
8490     */
8491    struct LDKDecodeError *err;
8492 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
8493
8494 /**
8495  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
8496  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8497  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8498  */
8499 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
8500    /**
8501     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
8502     * `err` or `result` depending on the state of `result_ok`.
8503     */
8504    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
8505    /**
8506     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
8507     */
8508    bool result_ok;
8509 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
8510
8511 /**
8512  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
8513  * UTXOs.
8514  */
8515 typedef struct LDKAccess {
8516    /**
8517     * An opaque pointer which is passed to your function implementations as an argument.
8518     * This has no meaning in the LDK, and can be NULL or any other value.
8519     */
8520    void *this_arg;
8521    /**
8522     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
8523     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
8524     * is unknown.
8525     *
8526     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
8527     */
8528    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
8529    /**
8530     * Frees any resources associated with this object given its this_arg pointer.
8531     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8532     */
8533    void (*free)(void *this_arg);
8534 } LDKAccess;
8535
8536 /**
8537  * An enum which can either contain a crate::lightning::chain::Access or not
8538  */
8539 typedef enum LDKCOption_AccessZ_Tag {
8540    /**
8541     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
8542     */
8543    LDKCOption_AccessZ_Some,
8544    /**
8545     * When we're in this state, this COption_AccessZ contains nothing
8546     */
8547    LDKCOption_AccessZ_None,
8548    /**
8549     * Must be last for serialization purposes
8550     */
8551    LDKCOption_AccessZ_Sentinel,
8552 } LDKCOption_AccessZ_Tag;
8553
8554 typedef struct LDKCOption_AccessZ {
8555    LDKCOption_AccessZ_Tag tag;
8556    union {
8557       struct {
8558          struct LDKAccess some;
8559       };
8560    };
8561 } LDKCOption_AccessZ;
8562
8563
8564
8565 /**
8566  * Details about one direction of a channel as received within a [`ChannelUpdate`].
8567  */
8568 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
8569    /**
8570     * A pointer to the opaque Rust object.
8571     * Nearly everywhere, inner must be non-null, however in places where
8572     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8573     */
8574    LDKnativeChannelUpdateInfo *inner;
8575    /**
8576     * Indicates that this is the only struct which contains the same pointer.
8577     * Rust functions which take ownership of an object provided via an argument require
8578     * this to be true and invalidate the object pointed to by inner.
8579     */
8580    bool is_owned;
8581 } LDKChannelUpdateInfo;
8582
8583 /**
8584  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
8585  */
8586 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
8587    /**
8588     * A pointer to the contents in the success state.
8589     * Reading from this pointer when `result_ok` is not set is undefined.
8590     */
8591    struct LDKChannelUpdateInfo *result;
8592    /**
8593     * A pointer to the contents in the error state.
8594     * Reading from this pointer when `result_ok` is set is undefined.
8595     */
8596    struct LDKDecodeError *err;
8597 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
8598
8599 /**
8600  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
8601  * containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8602  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8603  */
8604 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
8605    /**
8606     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
8607     * `err` or `result` depending on the state of `result_ok`.
8608     */
8609    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
8610    /**
8611     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
8612     */
8613    bool result_ok;
8614 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
8615
8616
8617
8618 /**
8619  * Details about a channel (both directions).
8620  * Received within a channel announcement.
8621  */
8622 typedef struct MUST_USE_STRUCT LDKChannelInfo {
8623    /**
8624     * A pointer to the opaque Rust object.
8625     * Nearly everywhere, inner must be non-null, however in places where
8626     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8627     */
8628    LDKnativeChannelInfo *inner;
8629    /**
8630     * Indicates that this is the only struct which contains the same pointer.
8631     * Rust functions which take ownership of an object provided via an argument require
8632     * this to be true and invalidate the object pointed to by inner.
8633     */
8634    bool is_owned;
8635 } LDKChannelInfo;
8636
8637 /**
8638  * The contents of CResult_ChannelInfoDecodeErrorZ
8639  */
8640 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
8641    /**
8642     * A pointer to the contents in the success state.
8643     * Reading from this pointer when `result_ok` is not set is undefined.
8644     */
8645    struct LDKChannelInfo *result;
8646    /**
8647     * A pointer to the contents in the error state.
8648     * Reading from this pointer when `result_ok` is set is undefined.
8649     */
8650    struct LDKDecodeError *err;
8651 } LDKCResult_ChannelInfoDecodeErrorZPtr;
8652
8653 /**
8654  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8655  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8656  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8657  */
8658 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
8659    /**
8660     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8661     * `err` or `result` depending on the state of `result_ok`.
8662     */
8663    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
8664    /**
8665     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8666     */
8667    bool result_ok;
8668 } LDKCResult_ChannelInfoDecodeErrorZ;
8669
8670
8671
8672 /**
8673  * Fees for routing via a given channel or a node
8674  */
8675 typedef struct MUST_USE_STRUCT LDKRoutingFees {
8676    /**
8677     * A pointer to the opaque Rust object.
8678     * Nearly everywhere, inner must be non-null, however in places where
8679     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8680     */
8681    LDKnativeRoutingFees *inner;
8682    /**
8683     * Indicates that this is the only struct which contains the same pointer.
8684     * Rust functions which take ownership of an object provided via an argument require
8685     * this to be true and invalidate the object pointed to by inner.
8686     */
8687    bool is_owned;
8688 } LDKRoutingFees;
8689
8690 /**
8691  * The contents of CResult_RoutingFeesDecodeErrorZ
8692  */
8693 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
8694    /**
8695     * A pointer to the contents in the success state.
8696     * Reading from this pointer when `result_ok` is not set is undefined.
8697     */
8698    struct LDKRoutingFees *result;
8699    /**
8700     * A pointer to the contents in the error state.
8701     * Reading from this pointer when `result_ok` is set is undefined.
8702     */
8703    struct LDKDecodeError *err;
8704 } LDKCResult_RoutingFeesDecodeErrorZPtr;
8705
8706 /**
8707  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8708  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8709  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8710  */
8711 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
8712    /**
8713     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8714     * `err` or `result` depending on the state of `result_ok`.
8715     */
8716    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
8717    /**
8718     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8719     */
8720    bool result_ok;
8721 } LDKCResult_RoutingFeesDecodeErrorZ;
8722
8723
8724
8725 /**
8726  * Information received in the latest node_announcement from this node.
8727  */
8728 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
8729    /**
8730     * A pointer to the opaque Rust object.
8731     * Nearly everywhere, inner must be non-null, however in places where
8732     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8733     */
8734    LDKnativeNodeAnnouncementInfo *inner;
8735    /**
8736     * Indicates that this is the only struct which contains the same pointer.
8737     * Rust functions which take ownership of an object provided via an argument require
8738     * this to be true and invalidate the object pointed to by inner.
8739     */
8740    bool is_owned;
8741 } LDKNodeAnnouncementInfo;
8742
8743 /**
8744  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8745  */
8746 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
8747    /**
8748     * A pointer to the contents in the success state.
8749     * Reading from this pointer when `result_ok` is not set is undefined.
8750     */
8751    struct LDKNodeAnnouncementInfo *result;
8752    /**
8753     * A pointer to the contents in the error state.
8754     * Reading from this pointer when `result_ok` is set is undefined.
8755     */
8756    struct LDKDecodeError *err;
8757 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
8758
8759 /**
8760  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8761  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8762  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8763  */
8764 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
8765    /**
8766     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8767     * `err` or `result` depending on the state of `result_ok`.
8768     */
8769    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
8770    /**
8771     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8772     */
8773    bool result_ok;
8774 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
8775
8776 /**
8777  * A dynamically-allocated array of u64s of arbitrary size.
8778  * This corresponds to std::vector in C++
8779  */
8780 typedef struct LDKCVec_u64Z {
8781    /**
8782     * The elements in the array.
8783     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8784     */
8785    uint64_t *data;
8786    /**
8787     * The number of elements pointed to by `data`.
8788     */
8789    uintptr_t datalen;
8790 } LDKCVec_u64Z;
8791
8792
8793
8794 /**
8795  * Details about a node in the network, known from the network announcement.
8796  */
8797 typedef struct MUST_USE_STRUCT LDKNodeInfo {
8798    /**
8799     * A pointer to the opaque Rust object.
8800     * Nearly everywhere, inner must be non-null, however in places where
8801     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8802     */
8803    LDKnativeNodeInfo *inner;
8804    /**
8805     * Indicates that this is the only struct which contains the same pointer.
8806     * Rust functions which take ownership of an object provided via an argument require
8807     * this to be true and invalidate the object pointed to by inner.
8808     */
8809    bool is_owned;
8810 } LDKNodeInfo;
8811
8812 /**
8813  * The contents of CResult_NodeInfoDecodeErrorZ
8814  */
8815 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
8816    /**
8817     * A pointer to the contents in the success state.
8818     * Reading from this pointer when `result_ok` is not set is undefined.
8819     */
8820    struct LDKNodeInfo *result;
8821    /**
8822     * A pointer to the contents in the error state.
8823     * Reading from this pointer when `result_ok` is set is undefined.
8824     */
8825    struct LDKDecodeError *err;
8826 } LDKCResult_NodeInfoDecodeErrorZPtr;
8827
8828 /**
8829  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8830  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8831  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8832  */
8833 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
8834    /**
8835     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8836     * `err` or `result` depending on the state of `result_ok`.
8837     */
8838    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
8839    /**
8840     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8841     */
8842    bool result_ok;
8843 } LDKCResult_NodeInfoDecodeErrorZ;
8844
8845 /**
8846  * The contents of CResult_NetworkGraphDecodeErrorZ
8847  */
8848 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
8849    /**
8850     * A pointer to the contents in the success state.
8851     * Reading from this pointer when `result_ok` is not set is undefined.
8852     */
8853    struct LDKNetworkGraph *result;
8854    /**
8855     * A pointer to the contents in the error state.
8856     * Reading from this pointer when `result_ok` is set is undefined.
8857     */
8858    struct LDKDecodeError *err;
8859 } LDKCResult_NetworkGraphDecodeErrorZPtr;
8860
8861 /**
8862  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8863  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8864  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8865  */
8866 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
8867    /**
8868     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8869     * `err` or `result` depending on the state of `result_ok`.
8870     */
8871    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
8872    /**
8873     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8874     */
8875    bool result_ok;
8876 } LDKCResult_NetworkGraphDecodeErrorZ;
8877
8878 /**
8879  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
8880  */
8881 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
8882    /**
8883     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
8884     */
8885    LDKCOption_CVec_NetAddressZZ_Some,
8886    /**
8887     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
8888     */
8889    LDKCOption_CVec_NetAddressZZ_None,
8890    /**
8891     * Must be last for serialization purposes
8892     */
8893    LDKCOption_CVec_NetAddressZZ_Sentinel,
8894 } LDKCOption_CVec_NetAddressZZ_Tag;
8895
8896 typedef struct LDKCOption_CVec_NetAddressZZ {
8897    LDKCOption_CVec_NetAddressZZ_Tag tag;
8898    union {
8899       struct {
8900          struct LDKCVec_NetAddressZ some;
8901       };
8902    };
8903 } LDKCOption_CVec_NetAddressZZ;
8904
8905 /**
8906  * The contents of CResult_NetAddressDecodeErrorZ
8907  */
8908 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
8909    /**
8910     * A pointer to the contents in the success state.
8911     * Reading from this pointer when `result_ok` is not set is undefined.
8912     */
8913    struct LDKNetAddress *result;
8914    /**
8915     * A pointer to the contents in the error state.
8916     * Reading from this pointer when `result_ok` is set is undefined.
8917     */
8918    struct LDKDecodeError *err;
8919 } LDKCResult_NetAddressDecodeErrorZPtr;
8920
8921 /**
8922  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
8923  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
8924  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8925  */
8926 typedef struct LDKCResult_NetAddressDecodeErrorZ {
8927    /**
8928     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
8929     * `err` or `result` depending on the state of `result_ok`.
8930     */
8931    union LDKCResult_NetAddressDecodeErrorZPtr contents;
8932    /**
8933     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
8934     */
8935    bool result_ok;
8936 } LDKCResult_NetAddressDecodeErrorZ;
8937
8938
8939
8940 /**
8941  * An update_add_htlc message to be sent or received from a peer
8942  */
8943 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
8944    /**
8945     * A pointer to the opaque Rust object.
8946     * Nearly everywhere, inner must be non-null, however in places where
8947     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8948     */
8949    LDKnativeUpdateAddHTLC *inner;
8950    /**
8951     * Indicates that this is the only struct which contains the same pointer.
8952     * Rust functions which take ownership of an object provided via an argument require
8953     * this to be true and invalidate the object pointed to by inner.
8954     */
8955    bool is_owned;
8956 } LDKUpdateAddHTLC;
8957
8958 /**
8959  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8960  * This corresponds to std::vector in C++
8961  */
8962 typedef struct LDKCVec_UpdateAddHTLCZ {
8963    /**
8964     * The elements in the array.
8965     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8966     */
8967    struct LDKUpdateAddHTLC *data;
8968    /**
8969     * The number of elements pointed to by `data`.
8970     */
8971    uintptr_t datalen;
8972 } LDKCVec_UpdateAddHTLCZ;
8973
8974
8975
8976 /**
8977  * An update_fulfill_htlc message to be sent or received from a peer
8978  */
8979 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
8980    /**
8981     * A pointer to the opaque Rust object.
8982     * Nearly everywhere, inner must be non-null, however in places where
8983     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8984     */
8985    LDKnativeUpdateFulfillHTLC *inner;
8986    /**
8987     * Indicates that this is the only struct which contains the same pointer.
8988     * Rust functions which take ownership of an object provided via an argument require
8989     * this to be true and invalidate the object pointed to by inner.
8990     */
8991    bool is_owned;
8992 } LDKUpdateFulfillHTLC;
8993
8994 /**
8995  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8996  * This corresponds to std::vector in C++
8997  */
8998 typedef struct LDKCVec_UpdateFulfillHTLCZ {
8999    /**
9000     * The elements in the array.
9001     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9002     */
9003    struct LDKUpdateFulfillHTLC *data;
9004    /**
9005     * The number of elements pointed to by `data`.
9006     */
9007    uintptr_t datalen;
9008 } LDKCVec_UpdateFulfillHTLCZ;
9009
9010
9011
9012 /**
9013  * An update_fail_htlc message to be sent or received from a peer
9014  */
9015 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
9016    /**
9017     * A pointer to the opaque Rust object.
9018     * Nearly everywhere, inner must be non-null, however in places where
9019     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9020     */
9021    LDKnativeUpdateFailHTLC *inner;
9022    /**
9023     * Indicates that this is the only struct which contains the same pointer.
9024     * Rust functions which take ownership of an object provided via an argument require
9025     * this to be true and invalidate the object pointed to by inner.
9026     */
9027    bool is_owned;
9028 } LDKUpdateFailHTLC;
9029
9030 /**
9031  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9032  * This corresponds to std::vector in C++
9033  */
9034 typedef struct LDKCVec_UpdateFailHTLCZ {
9035    /**
9036     * The elements in the array.
9037     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9038     */
9039    struct LDKUpdateFailHTLC *data;
9040    /**
9041     * The number of elements pointed to by `data`.
9042     */
9043    uintptr_t datalen;
9044 } LDKCVec_UpdateFailHTLCZ;
9045
9046
9047
9048 /**
9049  * An update_fail_malformed_htlc message to be sent or received from a peer
9050  */
9051 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
9052    /**
9053     * A pointer to the opaque Rust object.
9054     * Nearly everywhere, inner must be non-null, however in places where
9055     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9056     */
9057    LDKnativeUpdateFailMalformedHTLC *inner;
9058    /**
9059     * Indicates that this is the only struct which contains the same pointer.
9060     * Rust functions which take ownership of an object provided via an argument require
9061     * this to be true and invalidate the object pointed to by inner.
9062     */
9063    bool is_owned;
9064 } LDKUpdateFailMalformedHTLC;
9065
9066 /**
9067  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9068  * This corresponds to std::vector in C++
9069  */
9070 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
9071    /**
9072     * The elements in the array.
9073     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9074     */
9075    struct LDKUpdateFailMalformedHTLC *data;
9076    /**
9077     * The number of elements pointed to by `data`.
9078     */
9079    uintptr_t datalen;
9080 } LDKCVec_UpdateFailMalformedHTLCZ;
9081
9082 /**
9083  * The contents of CResult_AcceptChannelDecodeErrorZ
9084  */
9085 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
9086    /**
9087     * A pointer to the contents in the success state.
9088     * Reading from this pointer when `result_ok` is not set is undefined.
9089     */
9090    struct LDKAcceptChannel *result;
9091    /**
9092     * A pointer to the contents in the error state.
9093     * Reading from this pointer when `result_ok` is set is undefined.
9094     */
9095    struct LDKDecodeError *err;
9096 } LDKCResult_AcceptChannelDecodeErrorZPtr;
9097
9098 /**
9099  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9100  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9101  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9102  */
9103 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
9104    /**
9105     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9106     * `err` or `result` depending on the state of `result_ok`.
9107     */
9108    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
9109    /**
9110     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9111     */
9112    bool result_ok;
9113 } LDKCResult_AcceptChannelDecodeErrorZ;
9114
9115 /**
9116  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9117  */
9118 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
9119    /**
9120     * A pointer to the contents in the success state.
9121     * Reading from this pointer when `result_ok` is not set is undefined.
9122     */
9123    struct LDKAnnouncementSignatures *result;
9124    /**
9125     * A pointer to the contents in the error state.
9126     * Reading from this pointer when `result_ok` is set is undefined.
9127     */
9128    struct LDKDecodeError *err;
9129 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
9130
9131 /**
9132  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9133  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9134  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9135  */
9136 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
9137    /**
9138     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9139     * `err` or `result` depending on the state of `result_ok`.
9140     */
9141    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
9142    /**
9143     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9144     */
9145    bool result_ok;
9146 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
9147
9148 /**
9149  * The contents of CResult_ChannelReestablishDecodeErrorZ
9150  */
9151 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
9152    /**
9153     * A pointer to the contents in the success state.
9154     * Reading from this pointer when `result_ok` is not set is undefined.
9155     */
9156    struct LDKChannelReestablish *result;
9157    /**
9158     * A pointer to the contents in the error state.
9159     * Reading from this pointer when `result_ok` is set is undefined.
9160     */
9161    struct LDKDecodeError *err;
9162 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
9163
9164 /**
9165  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9166  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9167  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9168  */
9169 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
9170    /**
9171     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9172     * `err` or `result` depending on the state of `result_ok`.
9173     */
9174    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
9175    /**
9176     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9177     */
9178    bool result_ok;
9179 } LDKCResult_ChannelReestablishDecodeErrorZ;
9180
9181 /**
9182  * The contents of CResult_ClosingSignedDecodeErrorZ
9183  */
9184 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
9185    /**
9186     * A pointer to the contents in the success state.
9187     * Reading from this pointer when `result_ok` is not set is undefined.
9188     */
9189    struct LDKClosingSigned *result;
9190    /**
9191     * A pointer to the contents in the error state.
9192     * Reading from this pointer when `result_ok` is set is undefined.
9193     */
9194    struct LDKDecodeError *err;
9195 } LDKCResult_ClosingSignedDecodeErrorZPtr;
9196
9197 /**
9198  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9199  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9200  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9201  */
9202 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
9203    /**
9204     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9205     * `err` or `result` depending on the state of `result_ok`.
9206     */
9207    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
9208    /**
9209     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9210     */
9211    bool result_ok;
9212 } LDKCResult_ClosingSignedDecodeErrorZ;
9213
9214
9215
9216 /**
9217  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
9218  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
9219  * to use.
9220  */
9221 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
9222    /**
9223     * A pointer to the opaque Rust object.
9224     * Nearly everywhere, inner must be non-null, however in places where
9225     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9226     */
9227    LDKnativeClosingSignedFeeRange *inner;
9228    /**
9229     * Indicates that this is the only struct which contains the same pointer.
9230     * Rust functions which take ownership of an object provided via an argument require
9231     * this to be true and invalidate the object pointed to by inner.
9232     */
9233    bool is_owned;
9234 } LDKClosingSignedFeeRange;
9235
9236 /**
9237  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9238  */
9239 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9240    /**
9241     * A pointer to the contents in the success state.
9242     * Reading from this pointer when `result_ok` is not set is undefined.
9243     */
9244    struct LDKClosingSignedFeeRange *result;
9245    /**
9246     * A pointer to the contents in the error state.
9247     * Reading from this pointer when `result_ok` is set is undefined.
9248     */
9249    struct LDKDecodeError *err;
9250 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
9251
9252 /**
9253  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9254  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9255  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9256  */
9257 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
9258    /**
9259     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9260     * `err` or `result` depending on the state of `result_ok`.
9261     */
9262    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
9263    /**
9264     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9265     */
9266    bool result_ok;
9267 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
9268
9269
9270
9271 /**
9272  * A commitment_signed message to be sent or received from a peer
9273  */
9274 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
9275    /**
9276     * A pointer to the opaque Rust object.
9277     * Nearly everywhere, inner must be non-null, however in places where
9278     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9279     */
9280    LDKnativeCommitmentSigned *inner;
9281    /**
9282     * Indicates that this is the only struct which contains the same pointer.
9283     * Rust functions which take ownership of an object provided via an argument require
9284     * this to be true and invalidate the object pointed to by inner.
9285     */
9286    bool is_owned;
9287 } LDKCommitmentSigned;
9288
9289 /**
9290  * The contents of CResult_CommitmentSignedDecodeErrorZ
9291  */
9292 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
9293    /**
9294     * A pointer to the contents in the success state.
9295     * Reading from this pointer when `result_ok` is not set is undefined.
9296     */
9297    struct LDKCommitmentSigned *result;
9298    /**
9299     * A pointer to the contents in the error state.
9300     * Reading from this pointer when `result_ok` is set is undefined.
9301     */
9302    struct LDKDecodeError *err;
9303 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
9304
9305 /**
9306  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9307  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9308  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9309  */
9310 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
9311    /**
9312     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9313     * `err` or `result` depending on the state of `result_ok`.
9314     */
9315    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
9316    /**
9317     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9318     */
9319    bool result_ok;
9320 } LDKCResult_CommitmentSignedDecodeErrorZ;
9321
9322 /**
9323  * The contents of CResult_FundingCreatedDecodeErrorZ
9324  */
9325 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
9326    /**
9327     * A pointer to the contents in the success state.
9328     * Reading from this pointer when `result_ok` is not set is undefined.
9329     */
9330    struct LDKFundingCreated *result;
9331    /**
9332     * A pointer to the contents in the error state.
9333     * Reading from this pointer when `result_ok` is set is undefined.
9334     */
9335    struct LDKDecodeError *err;
9336 } LDKCResult_FundingCreatedDecodeErrorZPtr;
9337
9338 /**
9339  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9340  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9341  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9342  */
9343 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
9344    /**
9345     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9346     * `err` or `result` depending on the state of `result_ok`.
9347     */
9348    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
9349    /**
9350     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9351     */
9352    bool result_ok;
9353 } LDKCResult_FundingCreatedDecodeErrorZ;
9354
9355 /**
9356  * The contents of CResult_FundingSignedDecodeErrorZ
9357  */
9358 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
9359    /**
9360     * A pointer to the contents in the success state.
9361     * Reading from this pointer when `result_ok` is not set is undefined.
9362     */
9363    struct LDKFundingSigned *result;
9364    /**
9365     * A pointer to the contents in the error state.
9366     * Reading from this pointer when `result_ok` is set is undefined.
9367     */
9368    struct LDKDecodeError *err;
9369 } LDKCResult_FundingSignedDecodeErrorZPtr;
9370
9371 /**
9372  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9373  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9374  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9375  */
9376 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
9377    /**
9378     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9379     * `err` or `result` depending on the state of `result_ok`.
9380     */
9381    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
9382    /**
9383     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9384     */
9385    bool result_ok;
9386 } LDKCResult_FundingSignedDecodeErrorZ;
9387
9388 /**
9389  * The contents of CResult_FundingLockedDecodeErrorZ
9390  */
9391 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
9392    /**
9393     * A pointer to the contents in the success state.
9394     * Reading from this pointer when `result_ok` is not set is undefined.
9395     */
9396    struct LDKFundingLocked *result;
9397    /**
9398     * A pointer to the contents in the error state.
9399     * Reading from this pointer when `result_ok` is set is undefined.
9400     */
9401    struct LDKDecodeError *err;
9402 } LDKCResult_FundingLockedDecodeErrorZPtr;
9403
9404 /**
9405  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
9406  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
9407  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9408  */
9409 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
9410    /**
9411     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
9412     * `err` or `result` depending on the state of `result_ok`.
9413     */
9414    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
9415    /**
9416     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
9417     */
9418    bool result_ok;
9419 } LDKCResult_FundingLockedDecodeErrorZ;
9420
9421
9422
9423 /**
9424  * An init message to be sent or received from a peer
9425  */
9426 typedef struct MUST_USE_STRUCT LDKInit {
9427    /**
9428     * A pointer to the opaque Rust object.
9429     * Nearly everywhere, inner must be non-null, however in places where
9430     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9431     */
9432    LDKnativeInit *inner;
9433    /**
9434     * Indicates that this is the only struct which contains the same pointer.
9435     * Rust functions which take ownership of an object provided via an argument require
9436     * this to be true and invalidate the object pointed to by inner.
9437     */
9438    bool is_owned;
9439 } LDKInit;
9440
9441 /**
9442  * The contents of CResult_InitDecodeErrorZ
9443  */
9444 typedef union LDKCResult_InitDecodeErrorZPtr {
9445    /**
9446     * A pointer to the contents in the success state.
9447     * Reading from this pointer when `result_ok` is not set is undefined.
9448     */
9449    struct LDKInit *result;
9450    /**
9451     * A pointer to the contents in the error state.
9452     * Reading from this pointer when `result_ok` is set is undefined.
9453     */
9454    struct LDKDecodeError *err;
9455 } LDKCResult_InitDecodeErrorZPtr;
9456
9457 /**
9458  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9459  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9460  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9461  */
9462 typedef struct LDKCResult_InitDecodeErrorZ {
9463    /**
9464     * The contents of this CResult_InitDecodeErrorZ, accessible via either
9465     * `err` or `result` depending on the state of `result_ok`.
9466     */
9467    union LDKCResult_InitDecodeErrorZPtr contents;
9468    /**
9469     * Whether this CResult_InitDecodeErrorZ represents a success state.
9470     */
9471    bool result_ok;
9472 } LDKCResult_InitDecodeErrorZ;
9473
9474 /**
9475  * The contents of CResult_OpenChannelDecodeErrorZ
9476  */
9477 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
9478    /**
9479     * A pointer to the contents in the success state.
9480     * Reading from this pointer when `result_ok` is not set is undefined.
9481     */
9482    struct LDKOpenChannel *result;
9483    /**
9484     * A pointer to the contents in the error state.
9485     * Reading from this pointer when `result_ok` is set is undefined.
9486     */
9487    struct LDKDecodeError *err;
9488 } LDKCResult_OpenChannelDecodeErrorZPtr;
9489
9490 /**
9491  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9492  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9493  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9494  */
9495 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
9496    /**
9497     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9498     * `err` or `result` depending on the state of `result_ok`.
9499     */
9500    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
9501    /**
9502     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9503     */
9504    bool result_ok;
9505 } LDKCResult_OpenChannelDecodeErrorZ;
9506
9507 /**
9508  * The contents of CResult_RevokeAndACKDecodeErrorZ
9509  */
9510 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
9511    /**
9512     * A pointer to the contents in the success state.
9513     * Reading from this pointer when `result_ok` is not set is undefined.
9514     */
9515    struct LDKRevokeAndACK *result;
9516    /**
9517     * A pointer to the contents in the error state.
9518     * Reading from this pointer when `result_ok` is set is undefined.
9519     */
9520    struct LDKDecodeError *err;
9521 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
9522
9523 /**
9524  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9525  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9526  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9527  */
9528 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
9529    /**
9530     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9531     * `err` or `result` depending on the state of `result_ok`.
9532     */
9533    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
9534    /**
9535     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9536     */
9537    bool result_ok;
9538 } LDKCResult_RevokeAndACKDecodeErrorZ;
9539
9540 /**
9541  * The contents of CResult_ShutdownDecodeErrorZ
9542  */
9543 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
9544    /**
9545     * A pointer to the contents in the success state.
9546     * Reading from this pointer when `result_ok` is not set is undefined.
9547     */
9548    struct LDKShutdown *result;
9549    /**
9550     * A pointer to the contents in the error state.
9551     * Reading from this pointer when `result_ok` is set is undefined.
9552     */
9553    struct LDKDecodeError *err;
9554 } LDKCResult_ShutdownDecodeErrorZPtr;
9555
9556 /**
9557  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9558  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9559  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9560  */
9561 typedef struct LDKCResult_ShutdownDecodeErrorZ {
9562    /**
9563     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9564     * `err` or `result` depending on the state of `result_ok`.
9565     */
9566    union LDKCResult_ShutdownDecodeErrorZPtr contents;
9567    /**
9568     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9569     */
9570    bool result_ok;
9571 } LDKCResult_ShutdownDecodeErrorZ;
9572
9573 /**
9574  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
9575  */
9576 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
9577    /**
9578     * A pointer to the contents in the success state.
9579     * Reading from this pointer when `result_ok` is not set is undefined.
9580     */
9581    struct LDKUpdateFailHTLC *result;
9582    /**
9583     * A pointer to the contents in the error state.
9584     * Reading from this pointer when `result_ok` is set is undefined.
9585     */
9586    struct LDKDecodeError *err;
9587 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
9588
9589 /**
9590  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9591  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9592  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9593  */
9594 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
9595    /**
9596     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9597     * `err` or `result` depending on the state of `result_ok`.
9598     */
9599    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
9600    /**
9601     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9602     */
9603    bool result_ok;
9604 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
9605
9606 /**
9607  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9608  */
9609 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9610    /**
9611     * A pointer to the contents in the success state.
9612     * Reading from this pointer when `result_ok` is not set is undefined.
9613     */
9614    struct LDKUpdateFailMalformedHTLC *result;
9615    /**
9616     * A pointer to the contents in the error state.
9617     * Reading from this pointer when `result_ok` is set is undefined.
9618     */
9619    struct LDKDecodeError *err;
9620 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
9621
9622 /**
9623  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9624  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9625  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9626  */
9627 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
9628    /**
9629     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9630     * `err` or `result` depending on the state of `result_ok`.
9631     */
9632    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
9633    /**
9634     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9635     */
9636    bool result_ok;
9637 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
9638
9639
9640
9641 /**
9642  * An update_fee message to be sent or received from a peer
9643  */
9644 typedef struct MUST_USE_STRUCT LDKUpdateFee {
9645    /**
9646     * A pointer to the opaque Rust object.
9647     * Nearly everywhere, inner must be non-null, however in places where
9648     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9649     */
9650    LDKnativeUpdateFee *inner;
9651    /**
9652     * Indicates that this is the only struct which contains the same pointer.
9653     * Rust functions which take ownership of an object provided via an argument require
9654     * this to be true and invalidate the object pointed to by inner.
9655     */
9656    bool is_owned;
9657 } LDKUpdateFee;
9658
9659 /**
9660  * The contents of CResult_UpdateFeeDecodeErrorZ
9661  */
9662 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
9663    /**
9664     * A pointer to the contents in the success state.
9665     * Reading from this pointer when `result_ok` is not set is undefined.
9666     */
9667    struct LDKUpdateFee *result;
9668    /**
9669     * A pointer to the contents in the error state.
9670     * Reading from this pointer when `result_ok` is set is undefined.
9671     */
9672    struct LDKDecodeError *err;
9673 } LDKCResult_UpdateFeeDecodeErrorZPtr;
9674
9675 /**
9676  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9677  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9678  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9679  */
9680 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
9681    /**
9682     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9683     * `err` or `result` depending on the state of `result_ok`.
9684     */
9685    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
9686    /**
9687     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9688     */
9689    bool result_ok;
9690 } LDKCResult_UpdateFeeDecodeErrorZ;
9691
9692 /**
9693  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9694  */
9695 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
9696    /**
9697     * A pointer to the contents in the success state.
9698     * Reading from this pointer when `result_ok` is not set is undefined.
9699     */
9700    struct LDKUpdateFulfillHTLC *result;
9701    /**
9702     * A pointer to the contents in the error state.
9703     * Reading from this pointer when `result_ok` is set is undefined.
9704     */
9705    struct LDKDecodeError *err;
9706 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
9707
9708 /**
9709  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9710  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9711  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9712  */
9713 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
9714    /**
9715     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9716     * `err` or `result` depending on the state of `result_ok`.
9717     */
9718    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
9719    /**
9720     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9721     */
9722    bool result_ok;
9723 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
9724
9725 /**
9726  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
9727  */
9728 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
9729    /**
9730     * A pointer to the contents in the success state.
9731     * Reading from this pointer when `result_ok` is not set is undefined.
9732     */
9733    struct LDKUpdateAddHTLC *result;
9734    /**
9735     * A pointer to the contents in the error state.
9736     * Reading from this pointer when `result_ok` is set is undefined.
9737     */
9738    struct LDKDecodeError *err;
9739 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
9740
9741 /**
9742  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9743  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9744  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9745  */
9746 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
9747    /**
9748     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9749     * `err` or `result` depending on the state of `result_ok`.
9750     */
9751    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
9752    /**
9753     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9754     */
9755    bool result_ok;
9756 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
9757
9758
9759
9760 /**
9761  * A ping message to be sent or received from a peer
9762  */
9763 typedef struct MUST_USE_STRUCT LDKPing {
9764    /**
9765     * A pointer to the opaque Rust object.
9766     * Nearly everywhere, inner must be non-null, however in places where
9767     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9768     */
9769    LDKnativePing *inner;
9770    /**
9771     * Indicates that this is the only struct which contains the same pointer.
9772     * Rust functions which take ownership of an object provided via an argument require
9773     * this to be true and invalidate the object pointed to by inner.
9774     */
9775    bool is_owned;
9776 } LDKPing;
9777
9778 /**
9779  * The contents of CResult_PingDecodeErrorZ
9780  */
9781 typedef union LDKCResult_PingDecodeErrorZPtr {
9782    /**
9783     * A pointer to the contents in the success state.
9784     * Reading from this pointer when `result_ok` is not set is undefined.
9785     */
9786    struct LDKPing *result;
9787    /**
9788     * A pointer to the contents in the error state.
9789     * Reading from this pointer when `result_ok` is set is undefined.
9790     */
9791    struct LDKDecodeError *err;
9792 } LDKCResult_PingDecodeErrorZPtr;
9793
9794 /**
9795  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
9796  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
9797  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9798  */
9799 typedef struct LDKCResult_PingDecodeErrorZ {
9800    /**
9801     * The contents of this CResult_PingDecodeErrorZ, accessible via either
9802     * `err` or `result` depending on the state of `result_ok`.
9803     */
9804    union LDKCResult_PingDecodeErrorZPtr contents;
9805    /**
9806     * Whether this CResult_PingDecodeErrorZ represents a success state.
9807     */
9808    bool result_ok;
9809 } LDKCResult_PingDecodeErrorZ;
9810
9811
9812
9813 /**
9814  * A pong message to be sent or received from a peer
9815  */
9816 typedef struct MUST_USE_STRUCT LDKPong {
9817    /**
9818     * A pointer to the opaque Rust object.
9819     * Nearly everywhere, inner must be non-null, however in places where
9820     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9821     */
9822    LDKnativePong *inner;
9823    /**
9824     * Indicates that this is the only struct which contains the same pointer.
9825     * Rust functions which take ownership of an object provided via an argument require
9826     * this to be true and invalidate the object pointed to by inner.
9827     */
9828    bool is_owned;
9829 } LDKPong;
9830
9831 /**
9832  * The contents of CResult_PongDecodeErrorZ
9833  */
9834 typedef union LDKCResult_PongDecodeErrorZPtr {
9835    /**
9836     * A pointer to the contents in the success state.
9837     * Reading from this pointer when `result_ok` is not set is undefined.
9838     */
9839    struct LDKPong *result;
9840    /**
9841     * A pointer to the contents in the error state.
9842     * Reading from this pointer when `result_ok` is set is undefined.
9843     */
9844    struct LDKDecodeError *err;
9845 } LDKCResult_PongDecodeErrorZPtr;
9846
9847 /**
9848  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
9849  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
9850  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9851  */
9852 typedef struct LDKCResult_PongDecodeErrorZ {
9853    /**
9854     * The contents of this CResult_PongDecodeErrorZ, accessible via either
9855     * `err` or `result` depending on the state of `result_ok`.
9856     */
9857    union LDKCResult_PongDecodeErrorZPtr contents;
9858    /**
9859     * Whether this CResult_PongDecodeErrorZ represents a success state.
9860     */
9861    bool result_ok;
9862 } LDKCResult_PongDecodeErrorZ;
9863
9864 /**
9865  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
9866  */
9867 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9868    /**
9869     * A pointer to the contents in the success state.
9870     * Reading from this pointer when `result_ok` is not set is undefined.
9871     */
9872    struct LDKUnsignedChannelAnnouncement *result;
9873    /**
9874     * A pointer to the contents in the error state.
9875     * Reading from this pointer when `result_ok` is set is undefined.
9876     */
9877    struct LDKDecodeError *err;
9878 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
9879
9880 /**
9881  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9882  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9883  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9884  */
9885 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
9886    /**
9887     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
9888     * `err` or `result` depending on the state of `result_ok`.
9889     */
9890    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
9891    /**
9892     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
9893     */
9894    bool result_ok;
9895 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
9896
9897 /**
9898  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
9899  */
9900 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
9901    /**
9902     * A pointer to the contents in the success state.
9903     * Reading from this pointer when `result_ok` is not set is undefined.
9904     */
9905    struct LDKChannelAnnouncement *result;
9906    /**
9907     * A pointer to the contents in the error state.
9908     * Reading from this pointer when `result_ok` is set is undefined.
9909     */
9910    struct LDKDecodeError *err;
9911 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
9912
9913 /**
9914  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9915  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9916  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9917  */
9918 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
9919    /**
9920     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
9921     * `err` or `result` depending on the state of `result_ok`.
9922     */
9923    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
9924    /**
9925     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
9926     */
9927    bool result_ok;
9928 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
9929
9930
9931
9932 /**
9933  * The unsigned part of a channel_update
9934  */
9935 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
9936    /**
9937     * A pointer to the opaque Rust object.
9938     * Nearly everywhere, inner must be non-null, however in places where
9939     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9940     */
9941    LDKnativeUnsignedChannelUpdate *inner;
9942    /**
9943     * Indicates that this is the only struct which contains the same pointer.
9944     * Rust functions which take ownership of an object provided via an argument require
9945     * this to be true and invalidate the object pointed to by inner.
9946     */
9947    bool is_owned;
9948 } LDKUnsignedChannelUpdate;
9949
9950 /**
9951  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
9952  */
9953 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
9954    /**
9955     * A pointer to the contents in the success state.
9956     * Reading from this pointer when `result_ok` is not set is undefined.
9957     */
9958    struct LDKUnsignedChannelUpdate *result;
9959    /**
9960     * A pointer to the contents in the error state.
9961     * Reading from this pointer when `result_ok` is set is undefined.
9962     */
9963    struct LDKDecodeError *err;
9964 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
9965
9966 /**
9967  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
9968  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9969  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9970  */
9971 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
9972    /**
9973     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
9974     * `err` or `result` depending on the state of `result_ok`.
9975     */
9976    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
9977    /**
9978     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
9979     */
9980    bool result_ok;
9981 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
9982
9983 /**
9984  * The contents of CResult_ChannelUpdateDecodeErrorZ
9985  */
9986 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
9987    /**
9988     * A pointer to the contents in the success state.
9989     * Reading from this pointer when `result_ok` is not set is undefined.
9990     */
9991    struct LDKChannelUpdate *result;
9992    /**
9993     * A pointer to the contents in the error state.
9994     * Reading from this pointer when `result_ok` is set is undefined.
9995     */
9996    struct LDKDecodeError *err;
9997 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
9998
9999 /**
10000  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10001  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10002  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10003  */
10004 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
10005    /**
10006     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10007     * `err` or `result` depending on the state of `result_ok`.
10008     */
10009    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
10010    /**
10011     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10012     */
10013    bool result_ok;
10014 } LDKCResult_ChannelUpdateDecodeErrorZ;
10015
10016 /**
10017  * The contents of CResult_ErrorMessageDecodeErrorZ
10018  */
10019 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
10020    /**
10021     * A pointer to the contents in the success state.
10022     * Reading from this pointer when `result_ok` is not set is undefined.
10023     */
10024    struct LDKErrorMessage *result;
10025    /**
10026     * A pointer to the contents in the error state.
10027     * Reading from this pointer when `result_ok` is set is undefined.
10028     */
10029    struct LDKDecodeError *err;
10030 } LDKCResult_ErrorMessageDecodeErrorZPtr;
10031
10032 /**
10033  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10034  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10035  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10036  */
10037 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
10038    /**
10039     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10040     * `err` or `result` depending on the state of `result_ok`.
10041     */
10042    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
10043    /**
10044     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10045     */
10046    bool result_ok;
10047 } LDKCResult_ErrorMessageDecodeErrorZ;
10048
10049 /**
10050  * The contents of CResult_WarningMessageDecodeErrorZ
10051  */
10052 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
10053    /**
10054     * A pointer to the contents in the success state.
10055     * Reading from this pointer when `result_ok` is not set is undefined.
10056     */
10057    struct LDKWarningMessage *result;
10058    /**
10059     * A pointer to the contents in the error state.
10060     * Reading from this pointer when `result_ok` is set is undefined.
10061     */
10062    struct LDKDecodeError *err;
10063 } LDKCResult_WarningMessageDecodeErrorZPtr;
10064
10065 /**
10066  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
10067  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10068  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10069  */
10070 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
10071    /**
10072     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
10073     * `err` or `result` depending on the state of `result_ok`.
10074     */
10075    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
10076    /**
10077     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
10078     */
10079    bool result_ok;
10080 } LDKCResult_WarningMessageDecodeErrorZ;
10081
10082
10083
10084 /**
10085  * The unsigned part of a node_announcement
10086  */
10087 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
10088    /**
10089     * A pointer to the opaque Rust object.
10090     * Nearly everywhere, inner must be non-null, however in places where
10091     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10092     */
10093    LDKnativeUnsignedNodeAnnouncement *inner;
10094    /**
10095     * Indicates that this is the only struct which contains the same pointer.
10096     * Rust functions which take ownership of an object provided via an argument require
10097     * this to be true and invalidate the object pointed to by inner.
10098     */
10099    bool is_owned;
10100 } LDKUnsignedNodeAnnouncement;
10101
10102 /**
10103  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10104  */
10105 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10106    /**
10107     * A pointer to the contents in the success state.
10108     * Reading from this pointer when `result_ok` is not set is undefined.
10109     */
10110    struct LDKUnsignedNodeAnnouncement *result;
10111    /**
10112     * A pointer to the contents in the error state.
10113     * Reading from this pointer when `result_ok` is set is undefined.
10114     */
10115    struct LDKDecodeError *err;
10116 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
10117
10118 /**
10119  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10120  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10121  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10122  */
10123 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
10124    /**
10125     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10126     * `err` or `result` depending on the state of `result_ok`.
10127     */
10128    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
10129    /**
10130     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10131     */
10132    bool result_ok;
10133 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
10134
10135 /**
10136  * The contents of CResult_NodeAnnouncementDecodeErrorZ
10137  */
10138 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
10139    /**
10140     * A pointer to the contents in the success state.
10141     * Reading from this pointer when `result_ok` is not set is undefined.
10142     */
10143    struct LDKNodeAnnouncement *result;
10144    /**
10145     * A pointer to the contents in the error state.
10146     * Reading from this pointer when `result_ok` is set is undefined.
10147     */
10148    struct LDKDecodeError *err;
10149 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
10150
10151 /**
10152  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10153  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10154  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10155  */
10156 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
10157    /**
10158     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10159     * `err` or `result` depending on the state of `result_ok`.
10160     */
10161    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
10162    /**
10163     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10164     */
10165    bool result_ok;
10166 } LDKCResult_NodeAnnouncementDecodeErrorZ;
10167
10168 /**
10169  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10170  */
10171 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
10172    /**
10173     * A pointer to the contents in the success state.
10174     * Reading from this pointer when `result_ok` is not set is undefined.
10175     */
10176    struct LDKQueryShortChannelIds *result;
10177    /**
10178     * A pointer to the contents in the error state.
10179     * Reading from this pointer when `result_ok` is set is undefined.
10180     */
10181    struct LDKDecodeError *err;
10182 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
10183
10184 /**
10185  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10186  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10187  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10188  */
10189 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
10190    /**
10191     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10192     * `err` or `result` depending on the state of `result_ok`.
10193     */
10194    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
10195    /**
10196     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10197     */
10198    bool result_ok;
10199 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
10200
10201
10202
10203 /**
10204  * A reply_short_channel_ids_end message is sent as a reply to a
10205  * query_short_channel_ids message. The query recipient makes a best
10206  * effort to respond based on their local network view which may not be
10207  * a perfect view of the network.
10208  */
10209 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
10210    /**
10211     * A pointer to the opaque Rust object.
10212     * Nearly everywhere, inner must be non-null, however in places where
10213     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10214     */
10215    LDKnativeReplyShortChannelIdsEnd *inner;
10216    /**
10217     * Indicates that this is the only struct which contains the same pointer.
10218     * Rust functions which take ownership of an object provided via an argument require
10219     * this to be true and invalidate the object pointed to by inner.
10220     */
10221    bool is_owned;
10222 } LDKReplyShortChannelIdsEnd;
10223
10224 /**
10225  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10226  */
10227 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10228    /**
10229     * A pointer to the contents in the success state.
10230     * Reading from this pointer when `result_ok` is not set is undefined.
10231     */
10232    struct LDKReplyShortChannelIdsEnd *result;
10233    /**
10234     * A pointer to the contents in the error state.
10235     * Reading from this pointer when `result_ok` is set is undefined.
10236     */
10237    struct LDKDecodeError *err;
10238 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
10239
10240 /**
10241  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10242  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10243  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10244  */
10245 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
10246    /**
10247     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10248     * `err` or `result` depending on the state of `result_ok`.
10249     */
10250    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
10251    /**
10252     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10253     */
10254    bool result_ok;
10255 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
10256
10257 /**
10258  * The contents of CResult_QueryChannelRangeDecodeErrorZ
10259  */
10260 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
10261    /**
10262     * A pointer to the contents in the success state.
10263     * Reading from this pointer when `result_ok` is not set is undefined.
10264     */
10265    struct LDKQueryChannelRange *result;
10266    /**
10267     * A pointer to the contents in the error state.
10268     * Reading from this pointer when `result_ok` is set is undefined.
10269     */
10270    struct LDKDecodeError *err;
10271 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
10272
10273 /**
10274  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10275  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10276  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10277  */
10278 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
10279    /**
10280     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10281     * `err` or `result` depending on the state of `result_ok`.
10282     */
10283    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
10284    /**
10285     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10286     */
10287    bool result_ok;
10288 } LDKCResult_QueryChannelRangeDecodeErrorZ;
10289
10290 /**
10291  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
10292  */
10293 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
10294    /**
10295     * A pointer to the contents in the success state.
10296     * Reading from this pointer when `result_ok` is not set is undefined.
10297     */
10298    struct LDKReplyChannelRange *result;
10299    /**
10300     * A pointer to the contents in the error state.
10301     * Reading from this pointer when `result_ok` is set is undefined.
10302     */
10303    struct LDKDecodeError *err;
10304 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
10305
10306 /**
10307  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10308  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10309  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10310  */
10311 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
10312    /**
10313     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10314     * `err` or `result` depending on the state of `result_ok`.
10315     */
10316    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
10317    /**
10318     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10319     */
10320    bool result_ok;
10321 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
10322
10323 /**
10324  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
10325  */
10326 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
10327    /**
10328     * A pointer to the contents in the success state.
10329     * Reading from this pointer when `result_ok` is not set is undefined.
10330     */
10331    struct LDKGossipTimestampFilter *result;
10332    /**
10333     * A pointer to the contents in the error state.
10334     * Reading from this pointer when `result_ok` is set is undefined.
10335     */
10336    struct LDKDecodeError *err;
10337 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
10338
10339 /**
10340  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10341  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10342  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10343  */
10344 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
10345    /**
10346     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10347     * `err` or `result` depending on the state of `result_ok`.
10348     */
10349    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
10350    /**
10351     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10352     */
10353    bool result_ok;
10354 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
10355
10356 /**
10357  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
10358  * This corresponds to std::vector in C++
10359  */
10360 typedef struct LDKCVec_PhantomRouteHintsZ {
10361    /**
10362     * The elements in the array.
10363     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10364     */
10365    struct LDKPhantomRouteHints *data;
10366    /**
10367     * The number of elements pointed to by `data`.
10368     */
10369    uintptr_t datalen;
10370 } LDKCVec_PhantomRouteHintsZ;
10371
10372 /**
10373  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
10374  * may occur.
10375  */
10376 typedef enum LDKSignOrCreationError_Tag {
10377    /**
10378     * An error occurred during signing
10379     */
10380    LDKSignOrCreationError_SignError,
10381    /**
10382     * An error occurred while building the transaction
10383     */
10384    LDKSignOrCreationError_CreationError,
10385    /**
10386     * Must be last for serialization purposes
10387     */
10388    LDKSignOrCreationError_Sentinel,
10389 } LDKSignOrCreationError_Tag;
10390
10391 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
10392    LDKSignOrCreationError_Tag tag;
10393    union {
10394       struct {
10395          enum LDKCreationError creation_error;
10396       };
10397    };
10398 } LDKSignOrCreationError;
10399
10400 /**
10401  * The contents of CResult_InvoiceSignOrCreationErrorZ
10402  */
10403 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
10404    /**
10405     * A pointer to the contents in the success state.
10406     * Reading from this pointer when `result_ok` is not set is undefined.
10407     */
10408    struct LDKInvoice *result;
10409    /**
10410     * A pointer to the contents in the error state.
10411     * Reading from this pointer when `result_ok` is set is undefined.
10412     */
10413    struct LDKSignOrCreationError *err;
10414 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
10415
10416 /**
10417  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10418  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10419  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10420  */
10421 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
10422    /**
10423     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
10424     * `err` or `result` depending on the state of `result_ok`.
10425     */
10426    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
10427    /**
10428     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
10429     */
10430    bool result_ok;
10431 } LDKCResult_InvoiceSignOrCreationErrorZ;
10432
10433
10434
10435 /**
10436  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
10437  *
10438  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
10439  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
10440  * the return value of [`Filter::register_output`].
10441  *
10442  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
10443  * may have been spent there. See [`Filter::register_output`] for details.
10444  *
10445  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
10446  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
10447  */
10448 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
10449    /**
10450     * A pointer to the opaque Rust object.
10451     * Nearly everywhere, inner must be non-null, however in places where
10452     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10453     */
10454    LDKnativeWatchedOutput *inner;
10455    /**
10456     * Indicates that this is the only struct which contains the same pointer.
10457     * Rust functions which take ownership of an object provided via an argument require
10458     * this to be true and invalidate the object pointed to by inner.
10459     */
10460    bool is_owned;
10461 } LDKWatchedOutput;
10462
10463 /**
10464  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
10465  * channels.
10466  *
10467  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
10468  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
10469  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
10470  * receiving full blocks from a chain source, any further filtering is unnecessary.
10471  *
10472  * After an output has been registered, subsequent block retrievals from the chain source must not
10473  * exclude any transactions matching the new criteria nor any in-block descendants of such
10474  * transactions.
10475  *
10476  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
10477  * should not block on I/O. Implementations should instead queue the newly monitored data to be
10478  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
10479  * invocation that has called the `Filter` must return [`TemporaryFailure`].
10480  *
10481  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
10482  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
10483  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
10484  */
10485 typedef struct LDKFilter {
10486    /**
10487     * An opaque pointer which is passed to your function implementations as an argument.
10488     * This has no meaning in the LDK, and can be NULL or any other value.
10489     */
10490    void *this_arg;
10491    /**
10492     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
10493     * a spending condition.
10494     */
10495    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
10496    /**
10497     * Registers interest in spends of a transaction output.
10498     *
10499     * Optionally, when `output.block_hash` is set, should return any transaction spending the
10500     * output that is found in the corresponding block along with its index.
10501     *
10502     * This return value is useful for Electrum clients in order to supply in-block descendant
10503     * transactions which otherwise were not included. This is not necessary for other clients if
10504     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
10505     * full block).
10506     */
10507    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
10508    /**
10509     * Frees any resources associated with this object given its this_arg pointer.
10510     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10511     */
10512    void (*free)(void *this_arg);
10513 } LDKFilter;
10514
10515 /**
10516  * An enum which can either contain a crate::lightning::chain::Filter or not
10517  */
10518 typedef enum LDKCOption_FilterZ_Tag {
10519    /**
10520     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
10521     */
10522    LDKCOption_FilterZ_Some,
10523    /**
10524     * When we're in this state, this COption_FilterZ contains nothing
10525     */
10526    LDKCOption_FilterZ_None,
10527    /**
10528     * Must be last for serialization purposes
10529     */
10530    LDKCOption_FilterZ_Sentinel,
10531 } LDKCOption_FilterZ_Tag;
10532
10533 typedef struct LDKCOption_FilterZ {
10534    LDKCOption_FilterZ_Tag tag;
10535    union {
10536       struct {
10537          struct LDKFilter some;
10538       };
10539    };
10540 } LDKCOption_FilterZ;
10541
10542
10543
10544 /**
10545  * A read-only reference to a current ChannelMonitor.
10546  *
10547  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
10548  * released.
10549  */
10550 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
10551    /**
10552     * A pointer to the opaque Rust object.
10553     * Nearly everywhere, inner must be non-null, however in places where
10554     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10555     */
10556    LDKnativeLockedChannelMonitor *inner;
10557    /**
10558     * Indicates that this is the only struct which contains the same pointer.
10559     * Rust functions which take ownership of an object provided via an argument require
10560     * this to be true and invalidate the object pointed to by inner.
10561     */
10562    bool is_owned;
10563 } LDKLockedChannelMonitor;
10564
10565 /**
10566  * The contents of CResult_LockedChannelMonitorNoneZ
10567  */
10568 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
10569    /**
10570     * A pointer to the contents in the success state.
10571     * Reading from this pointer when `result_ok` is not set is undefined.
10572     */
10573    struct LDKLockedChannelMonitor *result;
10574    /**
10575     * Note that this value is always NULL, as there are no contents in the Err variant
10576     */
10577    void *err;
10578 } LDKCResult_LockedChannelMonitorNoneZPtr;
10579
10580 /**
10581  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
10582  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
10583  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10584  */
10585 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
10586    /**
10587     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
10588     * `err` or `result` depending on the state of `result_ok`.
10589     */
10590    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
10591    /**
10592     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
10593     */
10594    bool result_ok;
10595 } LDKCResult_LockedChannelMonitorNoneZ;
10596
10597 /**
10598  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
10599  * This corresponds to std::vector in C++
10600  */
10601 typedef struct LDKCVec_OutPointZ {
10602    /**
10603     * The elements in the array.
10604     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10605     */
10606    struct LDKOutPoint *data;
10607    /**
10608     * The number of elements pointed to by `data`.
10609     */
10610    uintptr_t datalen;
10611 } LDKCVec_OutPointZ;
10612
10613 /**
10614  * A trait indicating an object may generate message send events
10615  */
10616 typedef struct LDKMessageSendEventsProvider {
10617    /**
10618     * An opaque pointer which is passed to your function implementations as an argument.
10619     * This has no meaning in the LDK, and can be NULL or any other value.
10620     */
10621    void *this_arg;
10622    /**
10623     * Gets the list of pending events which were generated by previous actions, clearing the list
10624     * in the process.
10625     */
10626    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
10627    /**
10628     * Frees any resources associated with this object given its this_arg pointer.
10629     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10630     */
10631    void (*free)(void *this_arg);
10632 } LDKMessageSendEventsProvider;
10633
10634 /**
10635  * A trait implemented for objects handling events from [`EventsProvider`].
10636  */
10637 typedef struct LDKEventHandler {
10638    /**
10639     * An opaque pointer which is passed to your function implementations as an argument.
10640     * This has no meaning in the LDK, and can be NULL or any other value.
10641     */
10642    void *this_arg;
10643    /**
10644     * Handles the given [`Event`].
10645     *
10646     * See [`EventsProvider`] for details that must be considered when implementing this method.
10647     */
10648    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
10649    /**
10650     * Frees any resources associated with this object given its this_arg pointer.
10651     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10652     */
10653    void (*free)(void *this_arg);
10654 } LDKEventHandler;
10655
10656 /**
10657  * A trait indicating an object may generate events.
10658  *
10659  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
10660  *
10661  * # Requirements
10662  *
10663  * See [`process_pending_events`] for requirements around event processing.
10664  *
10665  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
10666  * event since the last invocation. The handler must either act upon the event immediately
10667  * or preserve it for later handling.
10668  *
10669  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
10670  * consult the provider's documentation on the implication of processing events and how a handler
10671  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
10672  * [`ChainMonitor::process_pending_events`]).
10673  *
10674  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
10675  * own type(s).
10676  *
10677  * [`process_pending_events`]: Self::process_pending_events
10678  * [`handle_event`]: EventHandler::handle_event
10679  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
10680  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
10681  */
10682 typedef struct LDKEventsProvider {
10683    /**
10684     * An opaque pointer which is passed to your function implementations as an argument.
10685     * This has no meaning in the LDK, and can be NULL or any other value.
10686     */
10687    void *this_arg;
10688    /**
10689     * Processes any events generated since the last call using the given event handler.
10690     *
10691     * Subsequent calls must only process new events. However, handlers must be capable of handling
10692     * duplicate events across process restarts. This may occur if the provider was recovered from
10693     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
10694     */
10695    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
10696    /**
10697     * Frees any resources associated with this object given its this_arg pointer.
10698     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10699     */
10700    void (*free)(void *this_arg);
10701 } LDKEventsProvider;
10702
10703
10704
10705 /**
10706  * Configuration we set when applicable.
10707  *
10708  * Default::default() provides sane defaults.
10709  */
10710 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
10711    /**
10712     * A pointer to the opaque Rust object.
10713     * Nearly everywhere, inner must be non-null, however in places where
10714     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10715     */
10716    LDKnativeChannelHandshakeConfig *inner;
10717    /**
10718     * Indicates that this is the only struct which contains the same pointer.
10719     * Rust functions which take ownership of an object provided via an argument require
10720     * this to be true and invalidate the object pointed to by inner.
10721     */
10722    bool is_owned;
10723 } LDKChannelHandshakeConfig;
10724
10725
10726
10727 /**
10728  * Optional channel limits which are applied during channel creation.
10729  *
10730  * These limits are only applied to our counterparty's limits, not our own.
10731  *
10732  * Use 0/<type>::max_value() as appropriate to skip checking.
10733  *
10734  * Provides sane defaults for most configurations.
10735  *
10736  * Most additional limits are disabled except those with which specify a default in individual
10737  * field documentation. Note that this may result in barely-usable channels, but since they
10738  * are applied mostly only to incoming channels that's not much of a problem.
10739  */
10740 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
10741    /**
10742     * A pointer to the opaque Rust object.
10743     * Nearly everywhere, inner must be non-null, however in places where
10744     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10745     */
10746    LDKnativeChannelHandshakeLimits *inner;
10747    /**
10748     * Indicates that this is the only struct which contains the same pointer.
10749     * Rust functions which take ownership of an object provided via an argument require
10750     * this to be true and invalidate the object pointed to by inner.
10751     */
10752    bool is_owned;
10753 } LDKChannelHandshakeLimits;
10754
10755
10756
10757 /**
10758  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
10759  *
10760  * Default::default() provides sane defaults for most configurations
10761  * (but currently with 0 relay fees!)
10762  */
10763 typedef struct MUST_USE_STRUCT LDKUserConfig {
10764    /**
10765     * A pointer to the opaque Rust object.
10766     * Nearly everywhere, inner must be non-null, however in places where
10767     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10768     */
10769    LDKnativeUserConfig *inner;
10770    /**
10771     * Indicates that this is the only struct which contains the same pointer.
10772     * Rust functions which take ownership of an object provided via an argument require
10773     * this to be true and invalidate the object pointed to by inner.
10774     */
10775    bool is_owned;
10776 } LDKUserConfig;
10777
10778
10779
10780 /**
10781  * The best known block as identified by its hash and height.
10782  */
10783 typedef struct MUST_USE_STRUCT LDKBestBlock {
10784    /**
10785     * A pointer to the opaque Rust object.
10786     * Nearly everywhere, inner must be non-null, however in places where
10787     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10788     */
10789    LDKnativeBestBlock *inner;
10790    /**
10791     * Indicates that this is the only struct which contains the same pointer.
10792     * Rust functions which take ownership of an object provided via an argument require
10793     * this to be true and invalidate the object pointed to by inner.
10794     */
10795    bool is_owned;
10796 } LDKBestBlock;
10797
10798 /**
10799  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
10800  * chain.
10801  *
10802  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
10803  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
10804  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
10805  * when needed.
10806  */
10807 typedef struct LDKListen {
10808    /**
10809     * An opaque pointer which is passed to your function implementations as an argument.
10810     * This has no meaning in the LDK, and can be NULL or any other value.
10811     */
10812    void *this_arg;
10813    /**
10814     * Notifies the listener that a block was added at the given height.
10815     */
10816    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
10817    /**
10818     * Notifies the listener that a block was removed at the given height.
10819     */
10820    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
10821    /**
10822     * Frees any resources associated with this object given its this_arg pointer.
10823     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10824     */
10825    void (*free)(void *this_arg);
10826 } LDKListen;
10827
10828 /**
10829  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
10830  * unconfirmed during a chain reorganization.
10831  *
10832  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
10833  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
10834  * related to registered transactions and outputs. Upon notification, it would pass along the
10835  * matching transactions using this interface.
10836  *
10837  * # Use
10838  *
10839  * The intended use is as follows:
10840  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
10841  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
10842  *   that has been reorganized out of the chain.
10843  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
10844  *
10845  * # Order
10846  *
10847  * Clients must call these methods in chain order. Specifically:
10848  * - Transactions confirmed in a block must be given before transactions confirmed in a later
10849  *   block.
10850  * - Dependent transactions within the same block must be given in topological order, possibly in
10851  *   separate calls.
10852  * - Unconfirmed transactions must be given after the original confirmations and before any
10853  *   reconfirmation.
10854  *
10855  * See individual method documentation for further details.
10856  *
10857  * [`transactions_confirmed`]: Self::transactions_confirmed
10858  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10859  * [`best_block_updated`]: Self::best_block_updated
10860  * [`get_relevant_txids`]: Self::get_relevant_txids
10861  */
10862 typedef struct LDKConfirm {
10863    /**
10864     * An opaque pointer which is passed to your function implementations as an argument.
10865     * This has no meaning in the LDK, and can be NULL or any other value.
10866     */
10867    void *this_arg;
10868    /**
10869     * Processes transactions confirmed in a block with a given header and height.
10870     *
10871     * Should be called for any transactions registered by [`Filter::register_tx`] or any
10872     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
10873     * appearing in the same block do not need to be included in the same call; instead, multiple
10874     * calls with additional transactions may be made so long as they are made in [chain order].
10875     *
10876     * May be called before or after [`best_block_updated`] for the corresponding block. However,
10877     * in the event of a chain reorganization, it must not be called with a `header` that is no
10878     * longer in the chain as of the last call to [`best_block_updated`].
10879     *
10880     * [chain order]: Confirm#Order
10881     * [`best_block_updated`]: Self::best_block_updated
10882     */
10883    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10884    /**
10885     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
10886     *
10887     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
10888     * reorganized out of the best chain. Once called, the given transaction should not be returned
10889     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
10890     *
10891     * [`get_relevant_txids`]: Self::get_relevant_txids
10892     * [`transactions_confirmed`]: Self::transactions_confirmed
10893     */
10894    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
10895    /**
10896     * Processes an update to the best header connected at the given height.
10897     *
10898     * Should be called when a new header is available but may be skipped for intermediary blocks
10899     * if they become available at the same time.
10900     */
10901    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
10902    /**
10903     * Returns transactions that should be monitored for reorganization out of the chain.
10904     *
10905     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
10906     * confirmations to be safe from a chain reorganization. Should not include any transactions
10907     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
10908     *
10909     * May be called to determine the subset of transactions that must still be monitored for
10910     * reorganization. Will be idempotent between calls but may change as a result of calls to the
10911     * other interface methods. Thus, this is useful to determine which transactions may need to be
10912     * given to [`transaction_unconfirmed`].
10913     *
10914     * [`transactions_confirmed`]: Self::transactions_confirmed
10915     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10916     */
10917    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
10918    /**
10919     * Frees any resources associated with this object given its this_arg pointer.
10920     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10921     */
10922    void (*free)(void *this_arg);
10923 } LDKConfirm;
10924
10925
10926
10927 /**
10928  * An opaque identifier describing a specific [`Persist`] method call.
10929  */
10930 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
10931    /**
10932     * A pointer to the opaque Rust object.
10933     * Nearly everywhere, inner must be non-null, however in places where
10934     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10935     */
10936    LDKnativeMonitorUpdateId *inner;
10937    /**
10938     * Indicates that this is the only struct which contains the same pointer.
10939     * Rust functions which take ownership of an object provided via an argument require
10940     * this to be true and invalidate the object pointed to by inner.
10941     */
10942    bool is_owned;
10943 } LDKMonitorUpdateId;
10944
10945 /**
10946  * `Persist` defines behavior for persisting channel monitors: this could mean
10947  * writing once to disk, and/or uploading to one or more backup services.
10948  *
10949  * Each method can return three possible values:
10950  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
10951  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
10952  *  * If persistence happens asynchronously, implementations should first ensure the
10953  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
10954  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
10955  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
10956  *    called with the corresponding [`MonitorUpdateId`].
10957  *
10958  *    Note that unlike the direct [`chain::Watch`] interface,
10959  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
10960  *
10961  *  * If persistence fails for some reason, implementations should return
10962  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
10963  *    closed without broadcasting the latest state. See
10964  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
10965  */
10966 typedef struct LDKPersist {
10967    /**
10968     * An opaque pointer which is passed to your function implementations as an argument.
10969     * This has no meaning in the LDK, and can be NULL or any other value.
10970     */
10971    void *this_arg;
10972    /**
10973     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
10974     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
10975     *
10976     * The data can be stored any way you want, but the identifier provided by LDK is the
10977     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
10978     * and the stored channel data). Note that you **must** persist every new monitor to disk.
10979     *
10980     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
10981     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
10982     *
10983     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
10984     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
10985     *
10986     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
10987     * [`Writeable::write`]: crate::util::ser::Writeable::write
10988     */
10989    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
10990    /**
10991     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
10992     * update.
10993     *
10994     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
10995     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
10996     * details.
10997     *
10998     * During blockchain synchronization operations, this may be called with no
10999     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
11000     * Note that after the full [`ChannelMonitor`] is persisted any previous
11001     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
11002     * applied to the persisted [`ChannelMonitor`] as they were already applied.
11003     *
11004     * If an implementer chooses to persist the updates only, they need to make
11005     * sure that all the updates are applied to the `ChannelMonitors` *before*
11006     * the set of channel monitors is given to the `ChannelManager`
11007     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
11008     * applying a monitor update to a monitor. If full `ChannelMonitors` are
11009     * persisted, then there is no need to persist individual updates.
11010     *
11011     * Note that there could be a performance tradeoff between persisting complete
11012     * channel monitors on every update vs. persisting only updates and applying
11013     * them in batches. The size of each monitor grows `O(number of state updates)`
11014     * whereas updates are small and `O(1)`.
11015     *
11016     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11017     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11018     *
11019     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
11020     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
11021     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11022     *
11023     * [`Writeable::write`]: crate::util::ser::Writeable::write
11024     *
11025     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
11026     */
11027    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);
11028    /**
11029     * Frees any resources associated with this object given its this_arg pointer.
11030     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11031     */
11032    void (*free)(void *this_arg);
11033 } LDKPersist;
11034
11035
11036
11037 /**
11038  * An implementation of [`chain::Watch`] for monitoring channels.
11039  *
11040  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
11041  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
11042  * or used independently to monitor channels remotely. See the [module-level documentation] for
11043  * details.
11044  *
11045  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11046  * [module-level documentation]: crate::chain::chainmonitor
11047  */
11048 typedef struct MUST_USE_STRUCT LDKChainMonitor {
11049    /**
11050     * A pointer to the opaque Rust object.
11051     * Nearly everywhere, inner must be non-null, however in places where
11052     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11053     */
11054    LDKnativeChainMonitor *inner;
11055    /**
11056     * Indicates that this is the only struct which contains the same pointer.
11057     * Rust functions which take ownership of an object provided via an argument require
11058     * this to be true and invalidate the object pointed to by inner.
11059     */
11060    bool is_owned;
11061 } LDKChainMonitor;
11062
11063
11064
11065 /**
11066  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
11067  * and derives keys from that.
11068  *
11069  * Your node_id is seed/0'
11070  * ChannelMonitor closes may use seed/1'
11071  * Cooperative closes may use seed/2'
11072  * The two close keys may be needed to claim on-chain funds!
11073  *
11074  * This struct cannot be used for nodes that wish to support receiving phantom payments;
11075  * [`PhantomKeysManager`] must be used instead.
11076  *
11077  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
11078  * previously issued invoices and attempts to pay previous invoices will fail.
11079  */
11080 typedef struct MUST_USE_STRUCT LDKKeysManager {
11081    /**
11082     * A pointer to the opaque Rust object.
11083     * Nearly everywhere, inner must be non-null, however in places where
11084     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11085     */
11086    LDKnativeKeysManager *inner;
11087    /**
11088     * Indicates that this is the only struct which contains the same pointer.
11089     * Rust functions which take ownership of an object provided via an argument require
11090     * this to be true and invalidate the object pointed to by inner.
11091     */
11092    bool is_owned;
11093 } LDKKeysManager;
11094
11095
11096
11097 /**
11098  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
11099  * payments.
11100  *
11101  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
11102  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
11103  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
11104  * itself without ever needing to forward to this fake node.
11105  *
11106  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
11107  * provide some fault tolerance, because payers will automatically retry paying other provided
11108  * nodes in the case that one node goes down.
11109  *
11110  * Note that multi-path payments are not supported in phantom invoices for security reasons.
11111  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
11112  * invoices and attempts to pay previous invoices will fail.
11113  */
11114 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
11115    /**
11116     * A pointer to the opaque Rust object.
11117     * Nearly everywhere, inner must be non-null, however in places where
11118     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11119     */
11120    LDKnativePhantomKeysManager *inner;
11121    /**
11122     * Indicates that this is the only struct which contains the same pointer.
11123     * Rust functions which take ownership of an object provided via an argument require
11124     * this to be true and invalidate the object pointed to by inner.
11125     */
11126    bool is_owned;
11127 } LDKPhantomKeysManager;
11128
11129
11130
11131 /**
11132  * Chain-related parameters used to construct a new `ChannelManager`.
11133  *
11134  * Typically, the block-specific parameters are derived from the best block hash for the network,
11135  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
11136  * are not needed when deserializing a previously constructed `ChannelManager`.
11137  */
11138 typedef struct MUST_USE_STRUCT LDKChainParameters {
11139    /**
11140     * A pointer to the opaque Rust object.
11141     * Nearly everywhere, inner must be non-null, however in places where
11142     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11143     */
11144    LDKnativeChainParameters *inner;
11145    /**
11146     * Indicates that this is the only struct which contains the same pointer.
11147     * Rust functions which take ownership of an object provided via an argument require
11148     * this to be true and invalidate the object pointed to by inner.
11149     */
11150    bool is_owned;
11151 } LDKChainParameters;
11152
11153 /**
11154  * A 3-byte byte array.
11155  */
11156 typedef struct LDKThreeBytes {
11157    /**
11158     * The three bytes
11159     */
11160    uint8_t data[3];
11161 } LDKThreeBytes;
11162
11163 /**
11164  * A trait to describe an object which can receive channel messages.
11165  *
11166  * Messages MAY be called in parallel when they originate from different their_node_ids, however
11167  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
11168  */
11169 typedef struct LDKChannelMessageHandler {
11170    /**
11171     * An opaque pointer which is passed to your function implementations as an argument.
11172     * This has no meaning in the LDK, and can be NULL or any other value.
11173     */
11174    void *this_arg;
11175    /**
11176     * Handle an incoming open_channel message from the given peer.
11177     */
11178    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
11179    /**
11180     * Handle an incoming accept_channel message from the given peer.
11181     */
11182    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
11183    /**
11184     * Handle an incoming funding_created message from the given peer.
11185     */
11186    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
11187    /**
11188     * Handle an incoming funding_signed message from the given peer.
11189     */
11190    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
11191    /**
11192     * Handle an incoming funding_locked message from the given peer.
11193     */
11194    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
11195    /**
11196     * Handle an incoming shutdown message from the given peer.
11197     */
11198    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);
11199    /**
11200     * Handle an incoming closing_signed message from the given peer.
11201     */
11202    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
11203    /**
11204     * Handle an incoming update_add_htlc message from the given peer.
11205     */
11206    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
11207    /**
11208     * Handle an incoming update_fulfill_htlc message from the given peer.
11209     */
11210    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
11211    /**
11212     * Handle an incoming update_fail_htlc message from the given peer.
11213     */
11214    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
11215    /**
11216     * Handle an incoming update_fail_malformed_htlc message from the given peer.
11217     */
11218    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
11219    /**
11220     * Handle an incoming commitment_signed message from the given peer.
11221     */
11222    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
11223    /**
11224     * Handle an incoming revoke_and_ack message from the given peer.
11225     */
11226    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
11227    /**
11228     * Handle an incoming update_fee message from the given peer.
11229     */
11230    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
11231    /**
11232     * Handle an incoming announcement_signatures message from the given peer.
11233     */
11234    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
11235    /**
11236     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
11237     * is believed to be possible in the future (eg they're sending us messages we don't
11238     * understand or indicate they require unknown feature bits), no_connection_possible is set
11239     * and any outstanding channels should be failed.
11240     */
11241    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
11242    /**
11243     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
11244     */
11245    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
11246    /**
11247     * Handle an incoming channel_reestablish message from the given peer.
11248     */
11249    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
11250    /**
11251     * Handle an incoming channel update from the given peer.
11252     */
11253    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
11254    /**
11255     * Handle an incoming error message from the given peer.
11256     */
11257    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
11258    /**
11259     * Implementation of MessageSendEventsProvider for this object.
11260     */
11261    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11262    /**
11263     * Frees any resources associated with this object given its this_arg pointer.
11264     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11265     */
11266    void (*free)(void *this_arg);
11267 } LDKChannelMessageHandler;
11268
11269
11270
11271 /**
11272  * Arguments for the creation of a ChannelManager that are not deserialized.
11273  *
11274  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
11275  * is:
11276  * 1) Deserialize all stored [`ChannelMonitor`]s.
11277  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
11278  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
11279  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
11280  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
11281  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
11282  *    same way you would handle a [`chain::Filter`] call using
11283  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
11284  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
11285  * 5) Disconnect/connect blocks on the [`ChannelManager`].
11286  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
11287  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
11288  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
11289  *    the next step.
11290  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
11291  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
11292  *
11293  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
11294  * call any other methods on the newly-deserialized [`ChannelManager`].
11295  *
11296  * Note that because some channels may be closed during deserialization, it is critical that you
11297  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
11298  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
11299  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
11300  * not force-close the same channels but consider them live), you may end up revoking a state for
11301  * which you've already broadcasted the transaction.
11302  *
11303  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
11304  */
11305 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
11306    /**
11307     * A pointer to the opaque Rust object.
11308     * Nearly everywhere, inner must be non-null, however in places where
11309     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11310     */
11311    LDKnativeChannelManagerReadArgs *inner;
11312    /**
11313     * Indicates that this is the only struct which contains the same pointer.
11314     * Rust functions which take ownership of an object provided via an argument require
11315     * this to be true and invalidate the object pointed to by inner.
11316     */
11317    bool is_owned;
11318 } LDKChannelManagerReadArgs;
11319
11320
11321
11322 /**
11323  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
11324  * This is used to convince the recipient that the channel is at a certain commitment
11325  * number even if they lost that data due to a local failure.  Of course, the peer may lie
11326  * and even later commitments may have been revoked.
11327  */
11328 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
11329    /**
11330     * A pointer to the opaque Rust object.
11331     * Nearly everywhere, inner must be non-null, however in places where
11332     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11333     */
11334    LDKnativeDataLossProtect *inner;
11335    /**
11336     * Indicates that this is the only struct which contains the same pointer.
11337     * Rust functions which take ownership of an object provided via an argument require
11338     * this to be true and invalidate the object pointed to by inner.
11339     */
11340    bool is_owned;
11341 } LDKDataLossProtect;
11342
11343 /**
11344  * A trait to describe an object which can receive routing messages.
11345  *
11346  * # Implementor DoS Warnings
11347  *
11348  * For `gossip_queries` messages there are potential DoS vectors when handling
11349  * inbound queries. Implementors using an on-disk network graph should be aware of
11350  * repeated disk I/O for queries accessing different parts of the network graph.
11351  */
11352 typedef struct LDKRoutingMessageHandler {
11353    /**
11354     * An opaque pointer which is passed to your function implementations as an argument.
11355     * This has no meaning in the LDK, and can be NULL or any other value.
11356     */
11357    void *this_arg;
11358    /**
11359     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
11360     * false or returning an Err otherwise.
11361     */
11362    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
11363    /**
11364     * Handle a channel_announcement message, returning true if it should be forwarded on, false
11365     * or returning an Err otherwise.
11366     */
11367    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
11368    /**
11369     * Handle an incoming channel_update message, returning true if it should be forwarded on,
11370     * false or returning an Err otherwise.
11371     */
11372    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
11373    /**
11374     * Gets a subset of the channel announcements and updates required to dump our routing table
11375     * to a remote node, starting at the short_channel_id indicated by starting_point and
11376     * including the batch_amount entries immediately higher in numerical value than starting_point.
11377     */
11378    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
11379    /**
11380     * Gets a subset of the node announcements required to dump our routing table to a remote node,
11381     * starting at the node *after* the provided publickey and including batch_amount entries
11382     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
11383     * If None is provided for starting_point, we start at the first node.
11384     *
11385     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
11386     */
11387    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
11388    /**
11389     * Called when a connection is established with a peer. This can be used to
11390     * perform routing table synchronization using a strategy defined by the
11391     * implementor.
11392     */
11393    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
11394    /**
11395     * Handles the reply of a query we initiated to learn about channels
11396     * for a given range of blocks. We can expect to receive one or more
11397     * replies to a single query.
11398     */
11399    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
11400    /**
11401     * Handles the reply of a query we initiated asking for routing gossip
11402     * messages for a list of channels. We should receive this message when
11403     * a node has completed its best effort to send us the pertaining routing
11404     * gossip messages.
11405     */
11406    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
11407    /**
11408     * Handles when a peer asks us to send a list of short_channel_ids
11409     * for the requested range of blocks.
11410     */
11411    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
11412    /**
11413     * Handles when a peer asks us to send routing gossip messages for a
11414     * list of short_channel_ids.
11415     */
11416    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
11417    /**
11418     * Implementation of MessageSendEventsProvider for this object.
11419     */
11420    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11421    /**
11422     * Frees any resources associated with this object given its this_arg pointer.
11423     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11424     */
11425    void (*free)(void *this_arg);
11426 } LDKRoutingMessageHandler;
11427
11428 /**
11429  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
11430  * decoders.
11431  */
11432 typedef struct LDKCustomMessageReader {
11433    /**
11434     * An opaque pointer which is passed to your function implementations as an argument.
11435     * This has no meaning in the LDK, and can be NULL or any other value.
11436     */
11437    void *this_arg;
11438    /**
11439     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
11440     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
11441     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
11442     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
11443     */
11444    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
11445    /**
11446     * Frees any resources associated with this object given its this_arg pointer.
11447     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11448     */
11449    void (*free)(void *this_arg);
11450 } LDKCustomMessageReader;
11451
11452 /**
11453  * Handler for BOLT1-compliant messages.
11454  */
11455 typedef struct LDKCustomMessageHandler {
11456    /**
11457     * An opaque pointer which is passed to your function implementations as an argument.
11458     * This has no meaning in the LDK, and can be NULL or any other value.
11459     */
11460    void *this_arg;
11461    /**
11462     * Called with the message type that was received and the buffer to be read.
11463     * Can return a `MessageHandlingError` if the message could not be handled.
11464     */
11465    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
11466    /**
11467     * Gets the list of pending messages which were generated by the custom message
11468     * handler, clearing the list in the process. The first tuple element must
11469     * correspond to the intended recipients node ids. If no connection to one of the
11470     * specified node does not exist, the message is simply not sent to it.
11471     */
11472    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
11473    /**
11474     * Implementation of CustomMessageReader for this object.
11475     */
11476    struct LDKCustomMessageReader CustomMessageReader;
11477    /**
11478     * Frees any resources associated with this object given its this_arg pointer.
11479     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11480     */
11481    void (*free)(void *this_arg);
11482 } LDKCustomMessageHandler;
11483
11484
11485
11486 /**
11487  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
11488  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
11489  */
11490 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
11491    /**
11492     * A pointer to the opaque Rust object.
11493     * Nearly everywhere, inner must be non-null, however in places where
11494     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11495     */
11496    LDKnativeIgnoringMessageHandler *inner;
11497    /**
11498     * Indicates that this is the only struct which contains the same pointer.
11499     * Rust functions which take ownership of an object provided via an argument require
11500     * this to be true and invalidate the object pointed to by inner.
11501     */
11502    bool is_owned;
11503 } LDKIgnoringMessageHandler;
11504
11505
11506
11507 /**
11508  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
11509  * You can provide one of these as the route_handler in a MessageHandler.
11510  */
11511 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
11512    /**
11513     * A pointer to the opaque Rust object.
11514     * Nearly everywhere, inner must be non-null, however in places where
11515     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11516     */
11517    LDKnativeErroringMessageHandler *inner;
11518    /**
11519     * Indicates that this is the only struct which contains the same pointer.
11520     * Rust functions which take ownership of an object provided via an argument require
11521     * this to be true and invalidate the object pointed to by inner.
11522     */
11523    bool is_owned;
11524 } LDKErroringMessageHandler;
11525
11526
11527
11528 /**
11529  * Provides references to trait impls which handle different types of messages.
11530  */
11531 typedef struct MUST_USE_STRUCT LDKMessageHandler {
11532    /**
11533     * A pointer to the opaque Rust object.
11534     * Nearly everywhere, inner must be non-null, however in places where
11535     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11536     */
11537    LDKnativeMessageHandler *inner;
11538    /**
11539     * Indicates that this is the only struct which contains the same pointer.
11540     * Rust functions which take ownership of an object provided via an argument require
11541     * this to be true and invalidate the object pointed to by inner.
11542     */
11543    bool is_owned;
11544 } LDKMessageHandler;
11545
11546 /**
11547  * Provides an object which can be used to send data to and which uniquely identifies a connection
11548  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
11549  * implement Hash to meet the PeerManager API.
11550  *
11551  * For efficiency, Clone should be relatively cheap for this type.
11552  *
11553  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
11554  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
11555  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
11556  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
11557  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
11558  * to simply use another value which is guaranteed to be globally unique instead.
11559  */
11560 typedef struct LDKSocketDescriptor {
11561    /**
11562     * An opaque pointer which is passed to your function implementations as an argument.
11563     * This has no meaning in the LDK, and can be NULL or any other value.
11564     */
11565    void *this_arg;
11566    /**
11567     * Attempts to send some data from the given slice to the peer.
11568     *
11569     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
11570     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
11571     * called and further write attempts may occur until that time.
11572     *
11573     * If the returned size is smaller than `data.len()`, a
11574     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
11575     * written. Additionally, until a `send_data` event completes fully, no further
11576     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
11577     * prevent denial-of-service issues, you should not read or buffer any data from the socket
11578     * until then.
11579     *
11580     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
11581     * (indicating that read events should be paused to prevent DoS in the send buffer),
11582     * `resume_read` may be set indicating that read events on this descriptor should resume. A
11583     * `resume_read` of false carries no meaning, and should not cause any action.
11584     */
11585    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
11586    /**
11587     * Disconnect the socket pointed to by this SocketDescriptor.
11588     *
11589     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
11590     * call (doing so is a noop).
11591     */
11592    void (*disconnect_socket)(void *this_arg);
11593    /**
11594     * Checks if two objects are equal given this object's this_arg pointer and another object.
11595     */
11596    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
11597    /**
11598     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
11599     * This is used, for example, for inclusion of this object in a hash map.
11600     */
11601    uint64_t (*hash)(const void *this_arg);
11602    /**
11603     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
11604     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
11605     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
11606     */
11607    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
11608    /**
11609     * Frees any resources associated with this object given its this_arg pointer.
11610     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11611     */
11612    void (*free)(void *this_arg);
11613 } LDKSocketDescriptor;
11614
11615
11616
11617 /**
11618  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
11619  * socket events into messages which it passes on to its [`MessageHandler`].
11620  *
11621  * Locks are taken internally, so you must never assume that reentrancy from a
11622  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
11623  *
11624  * Calls to [`read_event`] will decode relevant messages and pass them to the
11625  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
11626  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
11627  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
11628  * calls only after previous ones have returned.
11629  *
11630  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
11631  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
11632  * essentially you should default to using a SimpleRefPeerManager, and use a
11633  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
11634  * you're using lightning-net-tokio.
11635  *
11636  * [`read_event`]: PeerManager::read_event
11637  */
11638 typedef struct MUST_USE_STRUCT LDKPeerManager {
11639    /**
11640     * A pointer to the opaque Rust object.
11641     * Nearly everywhere, inner must be non-null, however in places where
11642     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11643     */
11644    LDKnativePeerManager *inner;
11645    /**
11646     * Indicates that this is the only struct which contains the same pointer.
11647     * Rust functions which take ownership of an object provided via an argument require
11648     * this to be true and invalidate the object pointed to by inner.
11649     */
11650    bool is_owned;
11651 } LDKPeerManager;
11652
11653
11654
11655 /**
11656  * Static channel fields used to build transactions given per-commitment fields, organized by
11657  * broadcaster/countersignatory.
11658  *
11659  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
11660  * as_holder_broadcastable and as_counterparty_broadcastable functions.
11661  */
11662 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
11663    /**
11664     * A pointer to the opaque Rust object.
11665     * Nearly everywhere, inner must be non-null, however in places where
11666     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11667     */
11668    LDKnativeDirectedChannelTransactionParameters *inner;
11669    /**
11670     * Indicates that this is the only struct which contains the same pointer.
11671     * Rust functions which take ownership of an object provided via an argument require
11672     * this to be true and invalidate the object pointed to by inner.
11673     */
11674    bool is_owned;
11675 } LDKDirectedChannelTransactionParameters;
11676
11677
11678
11679 /**
11680  * A read-only view of [`NetworkGraph`].
11681  */
11682 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
11683    /**
11684     * A pointer to the opaque Rust object.
11685     * Nearly everywhere, inner must be non-null, however in places where
11686     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11687     */
11688    LDKnativeReadOnlyNetworkGraph *inner;
11689    /**
11690     * Indicates that this is the only struct which contains the same pointer.
11691     * Rust functions which take ownership of an object provided via an argument require
11692     * this to be true and invalidate the object pointed to by inner.
11693     */
11694    bool is_owned;
11695 } LDKReadOnlyNetworkGraph;
11696
11697
11698
11699 /**
11700  * Receives and validates network updates from peers,
11701  * stores authentic and relevant data as a network graph.
11702  * This network graph is then used for routing payments.
11703  * Provides interface to help with initial routing sync by
11704  * serving historical announcements.
11705  *
11706  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
11707  * [`NetworkGraph`].
11708  */
11709 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
11710    /**
11711     * A pointer to the opaque Rust object.
11712     * Nearly everywhere, inner must be non-null, however in places where
11713     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11714     */
11715    LDKnativeNetGraphMsgHandler *inner;
11716    /**
11717     * Indicates that this is the only struct which contains the same pointer.
11718     * Rust functions which take ownership of an object provided via an argument require
11719     * this to be true and invalidate the object pointed to by inner.
11720     */
11721    bool is_owned;
11722 } LDKNetGraphMsgHandler;
11723
11724
11725
11726 /**
11727  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
11728  * source node to a target node.
11729  */
11730 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
11731    /**
11732     * A pointer to the opaque Rust object.
11733     * Nearly everywhere, inner must be non-null, however in places where
11734     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11735     */
11736    LDKnativeDirectedChannelInfo *inner;
11737    /**
11738     * Indicates that this is the only struct which contains the same pointer.
11739     * Rust functions which take ownership of an object provided via an argument require
11740     * this to be true and invalidate the object pointed to by inner.
11741     */
11742    bool is_owned;
11743 } LDKDirectedChannelInfo;
11744
11745 /**
11746  * The effective capacity of a channel for routing purposes.
11747  *
11748  * While this may be smaller than the actual channel capacity, amounts greater than
11749  * [`Self::as_msat`] should not be routed through the channel.
11750  */
11751 typedef enum LDKEffectiveCapacity_Tag {
11752    /**
11753     * The available liquidity in the channel known from being a channel counterparty, and thus a
11754     * direct hop.
11755     */
11756    LDKEffectiveCapacity_ExactLiquidity,
11757    /**
11758     * The maximum HTLC amount in one direction as advertised on the gossip network.
11759     */
11760    LDKEffectiveCapacity_MaximumHTLC,
11761    /**
11762     * The total capacity of the channel as determined by the funding transaction.
11763     */
11764    LDKEffectiveCapacity_Total,
11765    /**
11766     * A capacity sufficient to route any payment, typically used for private channels provided by
11767     * an invoice.
11768     */
11769    LDKEffectiveCapacity_Infinite,
11770    /**
11771     * A capacity that is unknown possibly because either the chain state is unavailable to know
11772     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
11773     */
11774    LDKEffectiveCapacity_Unknown,
11775    /**
11776     * Must be last for serialization purposes
11777     */
11778    LDKEffectiveCapacity_Sentinel,
11779 } LDKEffectiveCapacity_Tag;
11780
11781 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
11782    /**
11783     * Either the inbound or outbound liquidity depending on the direction, denominated in
11784     * millisatoshi.
11785     */
11786    uint64_t liquidity_msat;
11787 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
11788
11789 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
11790    /**
11791     * The maximum HTLC amount denominated in millisatoshi.
11792     */
11793    uint64_t amount_msat;
11794 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
11795
11796 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
11797    /**
11798     * The funding amount denominated in millisatoshi.
11799     */
11800    uint64_t capacity_msat;
11801 } LDKEffectiveCapacity_LDKTotal_Body;
11802
11803 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
11804    LDKEffectiveCapacity_Tag tag;
11805    union {
11806       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
11807       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
11808       LDKEffectiveCapacity_LDKTotal_Body total;
11809    };
11810 } LDKEffectiveCapacity;
11811
11812 /**
11813  * An interface used to score payment channels for path finding.
11814  *
11815  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
11816  */
11817 typedef struct LDKScore {
11818    /**
11819     * An opaque pointer which is passed to your function implementations as an argument.
11820     * This has no meaning in the LDK, and can be NULL or any other value.
11821     */
11822    void *this_arg;
11823    /**
11824     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
11825     * given channel in the direction from `source` to `target`.
11826     *
11827     * The channel's capacity (less any other MPP parts that are also being considered for use in
11828     * the same payment) is given by `capacity_msat`. It may be determined from various sources
11829     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
11830     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
11831     * Thus, implementations should be overflow-safe.
11832     */
11833    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);
11834    /**
11835     * Handles updating channel penalties after failing to route through a channel.
11836     */
11837    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
11838    /**
11839     * Handles updating channel penalties after successfully routing along a path.
11840     */
11841    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
11842    /**
11843     * Serialize the object into a byte array
11844     */
11845    struct LDKCVec_u8Z (*write)(const void *this_arg);
11846    /**
11847     * Frees any resources associated with this object given its this_arg pointer.
11848     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11849     */
11850    void (*free)(void *this_arg);
11851 } LDKScore;
11852
11853 /**
11854  * A scorer that is accessed under a lock.
11855  *
11856  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
11857  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
11858  * implementations. Internal locking would be detrimental to route finding performance and could
11859  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
11860  *
11861  * [`find_route`]: crate::routing::router::find_route
11862  */
11863 typedef struct LDKLockableScore {
11864    /**
11865     * An opaque pointer which is passed to your function implementations as an argument.
11866     * This has no meaning in the LDK, and can be NULL or any other value.
11867     */
11868    void *this_arg;
11869    /**
11870     * Returns the locked scorer.
11871     */
11872    struct LDKScore (*lock)(const void *this_arg);
11873    /**
11874     * Frees any resources associated with this object given its this_arg pointer.
11875     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11876     */
11877    void (*free)(void *this_arg);
11878 } LDKLockableScore;
11879
11880
11881
11882 /**
11883  * A concrete implementation of [`LockableScore`] which supports multi-threading.
11884  */
11885 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
11886    /**
11887     * A pointer to the opaque Rust object.
11888     * Nearly everywhere, inner must be non-null, however in places where
11889     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11890     */
11891    LDKnativeMultiThreadedLockableScore *inner;
11892    /**
11893     * Indicates that this is the only struct which contains the same pointer.
11894     * Rust functions which take ownership of an object provided via an argument require
11895     * this to be true and invalidate the object pointed to by inner.
11896     */
11897    bool is_owned;
11898 } LDKMultiThreadedLockableScore;
11899
11900
11901
11902 /**
11903  * Parameters for configuring [`ProbabilisticScorer`].
11904  *
11905  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
11906  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
11907  */
11908 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
11909    /**
11910     * A pointer to the opaque Rust object.
11911     * Nearly everywhere, inner must be non-null, however in places where
11912     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11913     */
11914    LDKnativeProbabilisticScoringParameters *inner;
11915    /**
11916     * Indicates that this is the only struct which contains the same pointer.
11917     * Rust functions which take ownership of an object provided via an argument require
11918     * this to be true and invalidate the object pointed to by inner.
11919     */
11920    bool is_owned;
11921 } LDKProbabilisticScoringParameters;
11922
11923
11924
11925 /**
11926  * FilesystemPersister persists channel data on disk, where each channel's
11927  * data is stored in a file named after its funding outpoint.
11928  *
11929  * Warning: this module does the best it can with calls to persist data, but it
11930  * can only guarantee that the data is passed to the drive. It is up to the
11931  * drive manufacturers to do the actual persistence properly, which they often
11932  * don't (especially on consumer-grade hardware). Therefore, it is up to the
11933  * user to validate their entire storage stack, to ensure the writes are
11934  * persistent.
11935  * Corollary: especially when dealing with larger amounts of money, it is best
11936  * practice to have multiple channel data backups and not rely only on one
11937  * FilesystemPersister.
11938  */
11939 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
11940    /**
11941     * A pointer to the opaque Rust object.
11942     * Nearly everywhere, inner must be non-null, however in places where
11943     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11944     */
11945    LDKnativeFilesystemPersister *inner;
11946    /**
11947     * Indicates that this is the only struct which contains the same pointer.
11948     * Rust functions which take ownership of an object provided via an argument require
11949     * this to be true and invalidate the object pointed to by inner.
11950     */
11951    bool is_owned;
11952 } LDKFilesystemPersister;
11953
11954
11955
11956 /**
11957  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
11958  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
11959  * responsibilities are:
11960  * * Processing [`Event`]s with a user-provided [`EventHandler`].
11961  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
11962  *   writing it to disk/backups by invoking the callback given to it at startup.
11963  *   [`ChannelManager`] persistence should be done in the background.
11964  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
11965  *   at the appropriate intervals.
11966  * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to
11967  *   [`BackgroundProcessor::start`]).
11968  *
11969  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
11970  * upon as doing so may result in high latency.
11971  *
11972  * # Note
11973  *
11974  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
11975  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
11976  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
11977  * unilateral chain closure fees are at risk.
11978  *
11979  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
11980  * [`Event`]: lightning::util::events::Event
11981  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
11982  */
11983 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
11984    /**
11985     * A pointer to the opaque Rust object.
11986     * Nearly everywhere, inner must be non-null, however in places where
11987     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11988     */
11989    LDKnativeBackgroundProcessor *inner;
11990    /**
11991     * Indicates that this is the only struct which contains the same pointer.
11992     * Rust functions which take ownership of an object provided via an argument require
11993     * this to be true and invalidate the object pointed to by inner.
11994     */
11995    bool is_owned;
11996 } LDKBackgroundProcessor;
11997
11998 /**
11999  * Trait that handles persisting a [`ChannelManager`] and [`NetworkGraph`] to disk.
12000  */
12001 typedef struct LDKPersister {
12002    /**
12003     * An opaque pointer which is passed to your function implementations as an argument.
12004     * This has no meaning in the LDK, and can be NULL or any other value.
12005     */
12006    void *this_arg;
12007    /**
12008     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
12009     * (which will cause the [`BackgroundProcessor`] which called this method to exit).
12010     */
12011    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
12012    /**
12013     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
12014     */
12015    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
12016    /**
12017     * Frees any resources associated with this object given its this_arg pointer.
12018     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12019     */
12020    void (*free)(void *this_arg);
12021 } LDKPersister;
12022
12023
12024
12025 /**
12026  * Data of the `RawInvoice` that is encoded in the data part
12027  */
12028 typedef struct MUST_USE_STRUCT LDKRawDataPart {
12029    /**
12030     * A pointer to the opaque Rust object.
12031     * Nearly everywhere, inner must be non-null, however in places where
12032     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12033     */
12034    LDKnativeRawDataPart *inner;
12035    /**
12036     * Indicates that this is the only struct which contains the same pointer.
12037     * Rust functions which take ownership of an object provided via an argument require
12038     * this to be true and invalidate the object pointed to by inner.
12039     */
12040    bool is_owned;
12041 } LDKRawDataPart;
12042
12043
12044
12045 /**
12046  * SHA-256 hash
12047  */
12048 typedef struct MUST_USE_STRUCT LDKSha256 {
12049    /**
12050     * A pointer to the opaque Rust object.
12051     * Nearly everywhere, inner must be non-null, however in places where
12052     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12053     */
12054    LDKnativeSha256 *inner;
12055    /**
12056     * Indicates that this is the only struct which contains the same pointer.
12057     * Rust functions which take ownership of an object provided via an argument require
12058     * this to be true and invalidate the object pointed to by inner.
12059     */
12060    bool is_owned;
12061 } LDKSha256;
12062
12063
12064
12065 /**
12066  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
12067  * expires
12068  */
12069 typedef struct MUST_USE_STRUCT LDKExpiryTime {
12070    /**
12071     * A pointer to the opaque Rust object.
12072     * Nearly everywhere, inner must be non-null, however in places where
12073     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12074     */
12075    LDKnativeExpiryTime *inner;
12076    /**
12077     * Indicates that this is the only struct which contains the same pointer.
12078     * Rust functions which take ownership of an object provided via an argument require
12079     * this to be true and invalidate the object pointed to by inner.
12080     */
12081    bool is_owned;
12082 } LDKExpiryTime;
12083
12084
12085
12086 /**
12087  * `min_final_cltv_expiry` to use for the last HTLC in the route
12088  */
12089 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
12090    /**
12091     * A pointer to the opaque Rust object.
12092     * Nearly everywhere, inner must be non-null, however in places where
12093     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12094     */
12095    LDKnativeMinFinalCltvExpiry *inner;
12096    /**
12097     * Indicates that this is the only struct which contains the same pointer.
12098     * Rust functions which take ownership of an object provided via an argument require
12099     * this to be true and invalidate the object pointed to by inner.
12100     */
12101    bool is_owned;
12102 } LDKMinFinalCltvExpiry;
12103
12104 /**
12105  * A 20-byte byte array.
12106  */
12107 typedef struct LDKTwentyBytes {
12108    /**
12109     * The twenty bytes
12110     */
12111    uint8_t data[20];
12112 } LDKTwentyBytes;
12113
12114 /**
12115  * Fallback address in case no LN payment is possible
12116  */
12117 typedef enum LDKFallback_Tag {
12118    LDKFallback_SegWitProgram,
12119    LDKFallback_PubKeyHash,
12120    LDKFallback_ScriptHash,
12121    /**
12122     * Must be last for serialization purposes
12123     */
12124    LDKFallback_Sentinel,
12125 } LDKFallback_Tag;
12126
12127 typedef struct LDKFallback_LDKSegWitProgram_Body {
12128    struct LDKu5 version;
12129    struct LDKCVec_u8Z program;
12130 } LDKFallback_LDKSegWitProgram_Body;
12131
12132 typedef struct MUST_USE_STRUCT LDKFallback {
12133    LDKFallback_Tag tag;
12134    union {
12135       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
12136       struct {
12137          struct LDKTwentyBytes pub_key_hash;
12138       };
12139       struct {
12140          struct LDKTwentyBytes script_hash;
12141       };
12142    };
12143 } LDKFallback;
12144
12145 /**
12146  * A trait defining behavior of an [`Invoice`] payer.
12147  */
12148 typedef struct LDKPayer {
12149    /**
12150     * An opaque pointer which is passed to your function implementations as an argument.
12151     * This has no meaning in the LDK, and can be NULL or any other value.
12152     */
12153    void *this_arg;
12154    /**
12155     * Returns the payer's node id.
12156     */
12157    struct LDKPublicKey (*node_id)(const void *this_arg);
12158    /**
12159     * Returns the payer's channels.
12160     */
12161    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
12162    /**
12163     * Sends a payment over the Lightning Network using the given [`Route`].
12164     *
12165     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
12166     */
12167    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
12168    /**
12169     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
12170     */
12171    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
12172    /**
12173     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
12174     */
12175    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
12176    /**
12177     * Signals that no further retries for the given payment will occur.
12178     */
12179    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
12180    /**
12181     * Frees any resources associated with this object given its this_arg pointer.
12182     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12183     */
12184    void (*free)(void *this_arg);
12185 } LDKPayer;
12186
12187 /**
12188  * A trait defining behavior for routing an [`Invoice`] payment.
12189  */
12190 typedef struct LDKRouter {
12191    /**
12192     * An opaque pointer which is passed to your function implementations as an argument.
12193     * This has no meaning in the LDK, and can be NULL or any other value.
12194     */
12195    void *this_arg;
12196    /**
12197     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
12198     *
12199     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
12200     */
12201    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);
12202    /**
12203     * Frees any resources associated with this object given its this_arg pointer.
12204     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12205     */
12206    void (*free)(void *this_arg);
12207 } LDKRouter;
12208
12209
12210
12211 /**
12212  * A utility for paying [`Invoice`]s and sending spontaneous payments.
12213  *
12214  * See [module-level documentation] for details.
12215  *
12216  * [module-level documentation]: crate::payment
12217  */
12218 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
12219    /**
12220     * A pointer to the opaque Rust object.
12221     * Nearly everywhere, inner must be non-null, however in places where
12222     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12223     */
12224    LDKnativeInvoicePayer *inner;
12225    /**
12226     * Indicates that this is the only struct which contains the same pointer.
12227     * Rust functions which take ownership of an object provided via an argument require
12228     * this to be true and invalidate the object pointed to by inner.
12229     */
12230    bool is_owned;
12231 } LDKInvoicePayer;
12232
12233
12234
12235 /**
12236  * Number of attempts to retry payment path failures for an [`Invoice`].
12237  *
12238  * Note that this is the number of *path* failures, not full payment retries. For multi-path
12239  * payments, if this is less than the total number of paths, we will never even retry all of the
12240  * payment's paths.
12241  */
12242 typedef struct MUST_USE_STRUCT LDKRetryAttempts {
12243    /**
12244     * A pointer to the opaque Rust object.
12245     * Nearly everywhere, inner must be non-null, however in places where
12246     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12247     */
12248    LDKnativeRetryAttempts *inner;
12249    /**
12250     * Indicates that this is the only struct which contains the same pointer.
12251     * Rust functions which take ownership of an object provided via an argument require
12252     * this to be true and invalidate the object pointed to by inner.
12253     */
12254    bool is_owned;
12255 } LDKRetryAttempts;
12256
12257
12258
12259 /**
12260  * A [`Router`] implemented using [`find_route`].
12261  */
12262 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
12263    /**
12264     * A pointer to the opaque Rust object.
12265     * Nearly everywhere, inner must be non-null, however in places where
12266     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12267     */
12268    LDKnativeDefaultRouter *inner;
12269    /**
12270     * Indicates that this is the only struct which contains the same pointer.
12271     * Rust functions which take ownership of an object provided via an argument require
12272     * this to be true and invalidate the object pointed to by inner.
12273     */
12274    bool is_owned;
12275 } LDKDefaultRouter;
12276
12277 extern const uintptr_t MAX_BUF_SIZE;
12278
12279 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
12280
12281 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
12282
12283 extern const uint32_t ANTI_REORG_DELAY;
12284
12285 extern const uint16_t BREAKDOWN_TIMEOUT;
12286
12287 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
12288
12289 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
12290
12291 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
12292
12293 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
12294
12295 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
12296
12297 extern const uint64_t MAX_TIMESTAMP;
12298
12299 extern const uint64_t DEFAULT_EXPIRY_TIME;
12300
12301 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
12302
12303 extern const uint8_t TAG_PAYMENT_HASH;
12304
12305 extern const uint8_t TAG_DESCRIPTION;
12306
12307 extern const uint8_t TAG_PAYEE_PUB_KEY;
12308
12309 extern const uint8_t TAG_DESCRIPTION_HASH;
12310
12311 extern const uint8_t TAG_EXPIRY_TIME;
12312
12313 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
12314
12315 extern const uint8_t TAG_FALLBACK;
12316
12317 extern const uint8_t TAG_PRIVATE_ROUTE;
12318
12319 extern const uint8_t TAG_PAYMENT_SECRET;
12320
12321 extern const uint8_t TAG_FEATURES;
12322
12323 struct LDKStr _ldk_get_compiled_version(void);
12324
12325 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
12326
12327 /**
12328  * Frees the data buffer, if data_is_owned is set and datalen > 0.
12329  */
12330 void Transaction_free(struct LDKTransaction _res);
12331
12332 /**
12333  * Convenience function for constructing a new TxOut
12334  */
12335 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
12336
12337 /**
12338  * Frees the data pointed to by script_pubkey.
12339  */
12340 void TxOut_free(struct LDKTxOut _res);
12341
12342 /**
12343  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
12344  */
12345 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
12346
12347 /**
12348  * Frees the data buffer, if chars_is_owned is set and len > 0.
12349  */
12350 void Str_free(struct LDKStr _res);
12351
12352 #if defined(LDK_DEBUG_BUILD)
12353 /**
12354  * This function exists for memory safety testing purposes. It should never be used in production
12355  * code
12356  */
12357 const void *__unmangle_inner_ptr(const void *ptr);
12358 #endif
12359
12360 /**
12361  * Creates a new CResult_NoneNoneZ in the success state.
12362  */
12363 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
12364
12365 /**
12366  * Creates a new CResult_NoneNoneZ in the error state.
12367  */
12368 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
12369
12370 /**
12371  * Checks if the given object is currently in the success state
12372  */
12373 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
12374
12375 /**
12376  * Frees any resources used by the CResult_NoneNoneZ.
12377  */
12378 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
12379
12380 /**
12381  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
12382  * but with all dynamically-allocated buffers duplicated in new buffers.
12383  */
12384 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
12385
12386 /**
12387  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
12388  */
12389 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
12390
12391 /**
12392  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
12393  */
12394 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
12395
12396 /**
12397  * Checks if the given object is currently in the success state
12398  */
12399 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
12400
12401 /**
12402  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
12403  */
12404 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
12405
12406 /**
12407  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
12408  * but with all dynamically-allocated buffers duplicated in new buffers.
12409  */
12410 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
12411
12412 /**
12413  * Creates a new CResult_SecretKeyErrorZ in the success state.
12414  */
12415 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
12416
12417 /**
12418  * Creates a new CResult_SecretKeyErrorZ in the error state.
12419  */
12420 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
12421
12422 /**
12423  * Checks if the given object is currently in the success state
12424  */
12425 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
12426
12427 /**
12428  * Frees any resources used by the CResult_SecretKeyErrorZ.
12429  */
12430 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
12431
12432 /**
12433  * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
12434  * but with all dynamically-allocated buffers duplicated in new buffers.
12435  */
12436 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
12437
12438 /**
12439  * Creates a new CResult_PublicKeyErrorZ in the success state.
12440  */
12441 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
12442
12443 /**
12444  * Creates a new CResult_PublicKeyErrorZ in the error state.
12445  */
12446 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
12447
12448 /**
12449  * Checks if the given object is currently in the success state
12450  */
12451 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
12452
12453 /**
12454  * Frees any resources used by the CResult_PublicKeyErrorZ.
12455  */
12456 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
12457
12458 /**
12459  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
12460  * but with all dynamically-allocated buffers duplicated in new buffers.
12461  */
12462 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
12463
12464 /**
12465  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
12466  */
12467 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
12468
12469 /**
12470  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
12471  */
12472 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
12473
12474 /**
12475  * Checks if the given object is currently in the success state
12476  */
12477 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
12478
12479 /**
12480  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
12481  */
12482 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
12483
12484 /**
12485  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
12486  * but with all dynamically-allocated buffers duplicated in new buffers.
12487  */
12488 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
12489
12490 /**
12491  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
12492  */
12493 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
12494
12495 /**
12496  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
12497  */
12498 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
12499
12500 /**
12501  * Checks if the given object is currently in the success state
12502  */
12503 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
12504
12505 /**
12506  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
12507  */
12508 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
12509
12510 /**
12511  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
12512  * but with all dynamically-allocated buffers duplicated in new buffers.
12513  */
12514 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
12515
12516 /**
12517  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
12518  */
12519 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
12520
12521 /**
12522  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
12523  */
12524 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
12525
12526 /**
12527  * Checks if the given object is currently in the success state
12528  */
12529 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
12530
12531 /**
12532  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
12533  */
12534 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
12535
12536 /**
12537  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
12538  * but with all dynamically-allocated buffers duplicated in new buffers.
12539  */
12540 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
12541
12542 /**
12543  * Constructs a new COption_u32Z containing a u32
12544  */
12545 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
12546
12547 /**
12548  * Constructs a new COption_u32Z containing nothing
12549  */
12550 struct LDKCOption_u32Z COption_u32Z_none(void);
12551
12552 /**
12553  * Frees any resources associated with the u32, if we are in the Some state
12554  */
12555 void COption_u32Z_free(struct LDKCOption_u32Z _res);
12556
12557 /**
12558  * Creates a new COption_u32Z which has the same data as `orig`
12559  * but with all dynamically-allocated buffers duplicated in new buffers.
12560  */
12561 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
12562
12563 /**
12564  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
12565  */
12566 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
12567
12568 /**
12569  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
12570  */
12571 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
12572
12573 /**
12574  * Checks if the given object is currently in the success state
12575  */
12576 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
12577
12578 /**
12579  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
12580  */
12581 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
12582
12583 /**
12584  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
12585  * but with all dynamically-allocated buffers duplicated in new buffers.
12586  */
12587 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
12588
12589 /**
12590  * Constructs a new COption_NoneZ containing a
12591  */
12592 enum LDKCOption_NoneZ COption_NoneZ_some(void);
12593
12594 /**
12595  * Constructs a new COption_NoneZ containing nothing
12596  */
12597 enum LDKCOption_NoneZ COption_NoneZ_none(void);
12598
12599 /**
12600  * Frees any resources associated with the , if we are in the Some state
12601  */
12602 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
12603
12604 /**
12605  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
12606  */
12607 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
12608
12609 /**
12610  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
12611  */
12612 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
12613
12614 /**
12615  * Checks if the given object is currently in the success state
12616  */
12617 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
12618
12619 /**
12620  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
12621  */
12622 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
12623
12624 /**
12625  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
12626  * but with all dynamically-allocated buffers duplicated in new buffers.
12627  */
12628 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
12629
12630 /**
12631  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
12632  */
12633 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
12634
12635 /**
12636  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
12637  */
12638 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
12639
12640 /**
12641  * Checks if the given object is currently in the success state
12642  */
12643 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
12644
12645 /**
12646  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
12647  */
12648 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
12649
12650 /**
12651  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
12652  * but with all dynamically-allocated buffers duplicated in new buffers.
12653  */
12654 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
12655
12656 /**
12657  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12658  */
12659 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
12660
12661 /**
12662  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
12663  */
12664 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
12665
12666 /**
12667  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
12668  */
12669 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12670
12671 /**
12672  * Checks if the given object is currently in the success state
12673  */
12674 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12675
12676 /**
12677  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
12678  */
12679 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
12680
12681 /**
12682  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
12683  * but with all dynamically-allocated buffers duplicated in new buffers.
12684  */
12685 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12686
12687 /**
12688  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
12689  */
12690 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
12691
12692 /**
12693  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
12694  */
12695 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12696
12697 /**
12698  * Checks if the given object is currently in the success state
12699  */
12700 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12701
12702 /**
12703  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
12704  */
12705 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
12706
12707 /**
12708  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
12709  * but with all dynamically-allocated buffers duplicated in new buffers.
12710  */
12711 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12712
12713 /**
12714  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
12715  */
12716 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
12717
12718 /**
12719  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
12720  */
12721 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
12722
12723 /**
12724  * Checks if the given object is currently in the success state
12725  */
12726 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
12727
12728 /**
12729  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
12730  */
12731 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
12732
12733 /**
12734  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
12735  */
12736 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
12737
12738 /**
12739  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
12740  */
12741 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12742
12743 /**
12744  * Checks if the given object is currently in the success state
12745  */
12746 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12747
12748 /**
12749  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
12750  */
12751 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
12752
12753 /**
12754  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
12755  * but with all dynamically-allocated buffers duplicated in new buffers.
12756  */
12757 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12758
12759 /**
12760  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
12761  */
12762 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
12763
12764 /**
12765  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
12766  */
12767 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
12768
12769 /**
12770  * Checks if the given object is currently in the success state
12771  */
12772 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
12773
12774 /**
12775  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
12776  */
12777 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
12778
12779 /**
12780  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
12781  */
12782 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
12783
12784 /**
12785  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
12786  */
12787 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
12788
12789 /**
12790  * Checks if the given object is currently in the success state
12791  */
12792 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
12793
12794 /**
12795  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
12796  */
12797 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
12798
12799 /**
12800  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
12801  * but with all dynamically-allocated buffers duplicated in new buffers.
12802  */
12803 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
12804
12805 /**
12806  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
12807  */
12808 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
12809
12810 /**
12811  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
12812  */
12813 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
12814
12815 /**
12816  * Checks if the given object is currently in the success state
12817  */
12818 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
12819
12820 /**
12821  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
12822  */
12823 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
12824
12825 /**
12826  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
12827  * but with all dynamically-allocated buffers duplicated in new buffers.
12828  */
12829 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
12830
12831 /**
12832  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
12833  */
12834 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
12835
12836 /**
12837  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
12838  */
12839 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
12840
12841 /**
12842  * Checks if the given object is currently in the success state
12843  */
12844 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
12845
12846 /**
12847  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
12848  */
12849 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
12850
12851 /**
12852  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
12853  * but with all dynamically-allocated buffers duplicated in new buffers.
12854  */
12855 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
12856
12857 /**
12858  * Creates a new CResult_NoneErrorZ in the success state.
12859  */
12860 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
12861
12862 /**
12863  * Creates a new CResult_NoneErrorZ in the error state.
12864  */
12865 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
12866
12867 /**
12868  * Checks if the given object is currently in the success state
12869  */
12870 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
12871
12872 /**
12873  * Frees any resources used by the CResult_NoneErrorZ.
12874  */
12875 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
12876
12877 /**
12878  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
12879  * but with all dynamically-allocated buffers duplicated in new buffers.
12880  */
12881 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
12882
12883 /**
12884  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
12885  */
12886 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
12887
12888 /**
12889  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
12890  */
12891 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
12892
12893 /**
12894  * Checks if the given object is currently in the success state
12895  */
12896 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
12897
12898 /**
12899  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
12900  */
12901 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
12902
12903 /**
12904  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
12905  * but with all dynamically-allocated buffers duplicated in new buffers.
12906  */
12907 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
12908
12909 /**
12910  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12911  */
12912 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
12913
12914 /**
12915  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12916  */
12917 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
12918
12919 /**
12920  * Creates a new CResult_RouteDecodeErrorZ in the success state.
12921  */
12922 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
12923
12924 /**
12925  * Creates a new CResult_RouteDecodeErrorZ in the error state.
12926  */
12927 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
12928
12929 /**
12930  * Checks if the given object is currently in the success state
12931  */
12932 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
12933
12934 /**
12935  * Frees any resources used by the CResult_RouteDecodeErrorZ.
12936  */
12937 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
12938
12939 /**
12940  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
12941  * but with all dynamically-allocated buffers duplicated in new buffers.
12942  */
12943 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
12944
12945 /**
12946  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
12947  */
12948 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
12949
12950 /**
12951  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
12952  */
12953 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
12954
12955 /**
12956  * Checks if the given object is currently in the success state
12957  */
12958 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
12959
12960 /**
12961  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
12962  */
12963 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
12964
12965 /**
12966  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
12967  * but with all dynamically-allocated buffers duplicated in new buffers.
12968  */
12969 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
12970
12971 /**
12972  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12973  */
12974 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
12975
12976 /**
12977  * Constructs a new COption_u64Z containing a u64
12978  */
12979 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
12980
12981 /**
12982  * Constructs a new COption_u64Z containing nothing
12983  */
12984 struct LDKCOption_u64Z COption_u64Z_none(void);
12985
12986 /**
12987  * Frees any resources associated with the u64, if we are in the Some state
12988  */
12989 void COption_u64Z_free(struct LDKCOption_u64Z _res);
12990
12991 /**
12992  * Creates a new COption_u64Z which has the same data as `orig`
12993  * but with all dynamically-allocated buffers duplicated in new buffers.
12994  */
12995 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
12996
12997 /**
12998  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
12999  */
13000 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
13001
13002 /**
13003  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
13004  */
13005 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
13006
13007 /**
13008  * Checks if the given object is currently in the success state
13009  */
13010 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
13011
13012 /**
13013  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
13014  */
13015 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
13016
13017 /**
13018  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
13019  * but with all dynamically-allocated buffers duplicated in new buffers.
13020  */
13021 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
13022
13023 /**
13024  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13025  */
13026 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
13027
13028 /**
13029  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
13030  */
13031 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
13032
13033 /**
13034  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
13035  */
13036 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
13037
13038 /**
13039  * Checks if the given object is currently in the success state
13040  */
13041 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
13042
13043 /**
13044  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
13045  */
13046 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
13047
13048 /**
13049  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
13050  * but with all dynamically-allocated buffers duplicated in new buffers.
13051  */
13052 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
13053
13054 /**
13055  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
13056  */
13057 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
13058
13059 /**
13060  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
13061  */
13062 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
13063
13064 /**
13065  * Checks if the given object is currently in the success state
13066  */
13067 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
13068
13069 /**
13070  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
13071  */
13072 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
13073
13074 /**
13075  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
13076  * but with all dynamically-allocated buffers duplicated in new buffers.
13077  */
13078 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
13079
13080 /**
13081  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13082  */
13083 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
13084
13085 /**
13086  * Creates a new CResult_RouteLightningErrorZ in the success state.
13087  */
13088 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
13089
13090 /**
13091  * Creates a new CResult_RouteLightningErrorZ in the error state.
13092  */
13093 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
13094
13095 /**
13096  * Checks if the given object is currently in the success state
13097  */
13098 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
13099
13100 /**
13101  * Frees any resources used by the CResult_RouteLightningErrorZ.
13102  */
13103 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
13104
13105 /**
13106  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
13107  * but with all dynamically-allocated buffers duplicated in new buffers.
13108  */
13109 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
13110
13111 /**
13112  * Creates a new CResult_TxOutAccessErrorZ in the success state.
13113  */
13114 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
13115
13116 /**
13117  * Creates a new CResult_TxOutAccessErrorZ in the error state.
13118  */
13119 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
13120
13121 /**
13122  * Checks if the given object is currently in the success state
13123  */
13124 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
13125
13126 /**
13127  * Frees any resources used by the CResult_TxOutAccessErrorZ.
13128  */
13129 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
13130
13131 /**
13132  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
13133  * but with all dynamically-allocated buffers duplicated in new buffers.
13134  */
13135 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
13136
13137 /**
13138  * Creates a new tuple which has the same data as `orig`
13139  * but with all dynamically-allocated buffers duplicated in new buffers.
13140  */
13141 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
13142
13143 /**
13144  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
13145  */
13146 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
13147
13148 /**
13149  * Frees any resources used by the C2Tuple_usizeTransactionZ.
13150  */
13151 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
13152
13153 /**
13154  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13155  */
13156 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
13157
13158 /**
13159  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13160  */
13161 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
13162
13163 /**
13164  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
13165  */
13166 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
13167
13168 /**
13169  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
13170  */
13171 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
13172
13173 /**
13174  * Checks if the given object is currently in the success state
13175  */
13176 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
13177
13178 /**
13179  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
13180  */
13181 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
13182
13183 /**
13184  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
13185  * but with all dynamically-allocated buffers duplicated in new buffers.
13186  */
13187 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
13188
13189 /**
13190  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13191  */
13192 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
13193
13194 /**
13195  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
13196  */
13197 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
13198
13199 /**
13200  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
13201  */
13202 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
13203
13204 /**
13205  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
13206  */
13207 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
13208
13209 /**
13210  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
13211  * but with all dynamically-allocated buffers duplicated in new buffers.
13212  */
13213 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
13214
13215 /**
13216  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
13217  */
13218 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
13219
13220 /**
13221  * Constructs a new COption_ClosureReasonZ containing nothing
13222  */
13223 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
13224
13225 /**
13226  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
13227  */
13228 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
13229
13230 /**
13231  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
13232  * but with all dynamically-allocated buffers duplicated in new buffers.
13233  */
13234 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
13235
13236 /**
13237  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
13238  */
13239 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
13240
13241 /**
13242  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
13243  */
13244 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
13245
13246 /**
13247  * Checks if the given object is currently in the success state
13248  */
13249 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
13250
13251 /**
13252  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
13253  */
13254 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
13255
13256 /**
13257  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
13258  * but with all dynamically-allocated buffers duplicated in new buffers.
13259  */
13260 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
13261
13262 /**
13263  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
13264  */
13265 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
13266
13267 /**
13268  * Constructs a new COption_NetworkUpdateZ containing nothing
13269  */
13270 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
13271
13272 /**
13273  * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
13274  */
13275 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
13276
13277 /**
13278  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
13279  * but with all dynamically-allocated buffers duplicated in new buffers.
13280  */
13281 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
13282
13283 /**
13284  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13285  */
13286 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
13287
13288 /**
13289  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
13290  */
13291 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
13292
13293 /**
13294  * Constructs a new COption_EventZ containing nothing
13295  */
13296 struct LDKCOption_EventZ COption_EventZ_none(void);
13297
13298 /**
13299  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
13300  */
13301 void COption_EventZ_free(struct LDKCOption_EventZ _res);
13302
13303 /**
13304  * Creates a new COption_EventZ which has the same data as `orig`
13305  * but with all dynamically-allocated buffers duplicated in new buffers.
13306  */
13307 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
13308
13309 /**
13310  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
13311  */
13312 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
13313
13314 /**
13315  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
13316  */
13317 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
13318
13319 /**
13320  * Checks if the given object is currently in the success state
13321  */
13322 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
13323
13324 /**
13325  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
13326  */
13327 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
13328
13329 /**
13330  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
13331  * but with all dynamically-allocated buffers duplicated in new buffers.
13332  */
13333 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
13334
13335 /**
13336  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13337  */
13338 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
13339
13340 /**
13341  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
13342  */
13343 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
13344
13345 /**
13346  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
13347  */
13348 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
13349
13350 /**
13351  * Checks if the given object is currently in the success state
13352  */
13353 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
13354
13355 /**
13356  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
13357  */
13358 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
13359
13360 /**
13361  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
13362  * but with all dynamically-allocated buffers duplicated in new buffers.
13363  */
13364 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
13365
13366 /**
13367  * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
13368  */
13369 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
13370
13371 /**
13372  * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
13373  */
13374 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
13375
13376 /**
13377  * Checks if the given object is currently in the success state
13378  */
13379 bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o);
13380
13381 /**
13382  * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
13383  */
13384 void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
13385
13386 /**
13387  * Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig`
13388  * but with all dynamically-allocated buffers duplicated in new buffers.
13389  */
13390 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR orig);
13391
13392 /**
13393  * Creates a new CResult_ScorerDecodeErrorZ in the success state.
13394  */
13395 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
13396
13397 /**
13398  * Creates a new CResult_ScorerDecodeErrorZ in the error state.
13399  */
13400 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
13401
13402 /**
13403  * Checks if the given object is currently in the success state
13404  */
13405 bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o);
13406
13407 /**
13408  * Frees any resources used by the CResult_ScorerDecodeErrorZ.
13409  */
13410 void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
13411
13412 /**
13413  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
13414  */
13415 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
13416
13417 /**
13418  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
13419  */
13420 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
13421
13422 /**
13423  * Checks if the given object is currently in the success state
13424  */
13425 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
13426
13427 /**
13428  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
13429  */
13430 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
13431
13432 /**
13433  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
13434  */
13435 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
13436
13437 /**
13438  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
13439  */
13440 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13441
13442 /**
13443  * Checks if the given object is currently in the success state
13444  */
13445 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
13446
13447 /**
13448  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
13449  */
13450 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
13451
13452 /**
13453  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
13454  */
13455 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
13456
13457 /**
13458  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
13459  */
13460 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13461
13462 /**
13463  * Checks if the given object is currently in the success state
13464  */
13465 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
13466
13467 /**
13468  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
13469  */
13470 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
13471
13472 /**
13473  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
13474  */
13475 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
13476
13477 /**
13478  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
13479  */
13480 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13481
13482 /**
13483  * Checks if the given object is currently in the success state
13484  */
13485 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
13486
13487 /**
13488  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
13489  */
13490 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
13491
13492 /**
13493  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
13494  */
13495 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
13496
13497 /**
13498  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
13499  */
13500 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13501
13502 /**
13503  * Checks if the given object is currently in the success state
13504  */
13505 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
13506
13507 /**
13508  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
13509  */
13510 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
13511
13512 /**
13513  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
13514  */
13515 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
13516
13517 /**
13518  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
13519  */
13520 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13521
13522 /**
13523  * Checks if the given object is currently in the success state
13524  */
13525 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
13526
13527 /**
13528  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
13529  */
13530 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
13531
13532 /**
13533  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
13534  */
13535 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
13536
13537 /**
13538  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
13539  */
13540 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13541
13542 /**
13543  * Checks if the given object is currently in the success state
13544  */
13545 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13546
13547 /**
13548  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
13549  */
13550 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
13551
13552 /**
13553  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
13554  * but with all dynamically-allocated buffers duplicated in new buffers.
13555  */
13556 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13557
13558 /**
13559  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
13560  */
13561 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
13562
13563 /**
13564  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
13565  */
13566 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13567
13568 /**
13569  * Checks if the given object is currently in the success state
13570  */
13571 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13572
13573 /**
13574  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
13575  */
13576 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
13577
13578 /**
13579  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
13580  * but with all dynamically-allocated buffers duplicated in new buffers.
13581  */
13582 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13583
13584 /**
13585  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
13586  */
13587 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
13588
13589 /**
13590  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
13591  */
13592 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13593
13594 /**
13595  * Checks if the given object is currently in the success state
13596  */
13597 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13598
13599 /**
13600  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
13601  */
13602 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
13603
13604 /**
13605  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
13606  * but with all dynamically-allocated buffers duplicated in new buffers.
13607  */
13608 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13609
13610 /**
13611  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13612  */
13613 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
13614
13615 /**
13616  * Creates a new tuple which has the same data as `orig`
13617  * but with all dynamically-allocated buffers duplicated in new buffers.
13618  */
13619 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
13620
13621 /**
13622  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
13623  */
13624 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
13625
13626 /**
13627  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
13628  */
13629 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
13630
13631 /**
13632  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
13633  */
13634 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
13635
13636 /**
13637  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
13638  */
13639 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
13640
13641 /**
13642  * Checks if the given object is currently in the success state
13643  */
13644 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
13645
13646 /**
13647  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
13648  */
13649 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
13650
13651 /**
13652  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
13653  * but with all dynamically-allocated buffers duplicated in new buffers.
13654  */
13655 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
13656
13657 /**
13658  * Creates a new CResult_SignatureNoneZ in the success state.
13659  */
13660 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
13661
13662 /**
13663  * Creates a new CResult_SignatureNoneZ in the error state.
13664  */
13665 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
13666
13667 /**
13668  * Checks if the given object is currently in the success state
13669  */
13670 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
13671
13672 /**
13673  * Frees any resources used by the CResult_SignatureNoneZ.
13674  */
13675 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
13676
13677 /**
13678  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
13679  * but with all dynamically-allocated buffers duplicated in new buffers.
13680  */
13681 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
13682
13683 /**
13684  * Creates a new tuple which has the same data as `orig`
13685  * but with all dynamically-allocated buffers duplicated in new buffers.
13686  */
13687 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
13688
13689 /**
13690  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
13691  */
13692 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
13693
13694 /**
13695  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
13696  */
13697 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
13698
13699 /**
13700  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
13701  */
13702 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
13703
13704 /**
13705  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
13706  */
13707 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
13708
13709 /**
13710  * Checks if the given object is currently in the success state
13711  */
13712 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
13713
13714 /**
13715  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
13716  */
13717 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
13718
13719 /**
13720  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
13721  * but with all dynamically-allocated buffers duplicated in new buffers.
13722  */
13723 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
13724
13725 /**
13726  * Creates a new CResult_SecretKeyNoneZ in the success state.
13727  */
13728 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
13729
13730 /**
13731  * Creates a new CResult_SecretKeyNoneZ in the error state.
13732  */
13733 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
13734
13735 /**
13736  * Checks if the given object is currently in the success state
13737  */
13738 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
13739
13740 /**
13741  * Frees any resources used by the CResult_SecretKeyNoneZ.
13742  */
13743 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
13744
13745 /**
13746  * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
13747  * but with all dynamically-allocated buffers duplicated in new buffers.
13748  */
13749 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
13750
13751 /**
13752  * Creates a new CResult_SignDecodeErrorZ in the success state.
13753  */
13754 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
13755
13756 /**
13757  * Creates a new CResult_SignDecodeErrorZ in the error state.
13758  */
13759 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
13760
13761 /**
13762  * Checks if the given object is currently in the success state
13763  */
13764 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
13765
13766 /**
13767  * Frees any resources used by the CResult_SignDecodeErrorZ.
13768  */
13769 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
13770
13771 /**
13772  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
13773  * but with all dynamically-allocated buffers duplicated in new buffers.
13774  */
13775 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
13776
13777 /**
13778  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13779  */
13780 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
13781
13782 /**
13783  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
13784  */
13785 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
13786
13787 /**
13788  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
13789  */
13790 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
13791
13792 /**
13793  * Checks if the given object is currently in the success state
13794  */
13795 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
13796
13797 /**
13798  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
13799  */
13800 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
13801
13802 /**
13803  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
13804  * but with all dynamically-allocated buffers duplicated in new buffers.
13805  */
13806 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
13807
13808 /**
13809  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13810  */
13811 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
13812
13813 /**
13814  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13815  */
13816 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
13817
13818 /**
13819  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
13820  */
13821 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
13822
13823 /**
13824  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
13825  */
13826 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
13827
13828 /**
13829  * Checks if the given object is currently in the success state
13830  */
13831 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
13832
13833 /**
13834  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
13835  */
13836 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
13837
13838 /**
13839  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
13840  * but with all dynamically-allocated buffers duplicated in new buffers.
13841  */
13842 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
13843
13844 /**
13845  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
13846  */
13847 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
13848
13849 /**
13850  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
13851  */
13852 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
13853
13854 /**
13855  * Checks if the given object is currently in the success state
13856  */
13857 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
13858
13859 /**
13860  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
13861  */
13862 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
13863
13864 /**
13865  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
13866  * but with all dynamically-allocated buffers duplicated in new buffers.
13867  */
13868 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
13869
13870 /**
13871  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13872  */
13873 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
13874
13875 /**
13876  * Creates a new CResult_TransactionNoneZ in the success state.
13877  */
13878 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
13879
13880 /**
13881  * Creates a new CResult_TransactionNoneZ in the error state.
13882  */
13883 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
13884
13885 /**
13886  * Checks if the given object is currently in the success state
13887  */
13888 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
13889
13890 /**
13891  * Frees any resources used by the CResult_TransactionNoneZ.
13892  */
13893 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
13894
13895 /**
13896  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
13897  * but with all dynamically-allocated buffers duplicated in new buffers.
13898  */
13899 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
13900
13901 /**
13902  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
13903  */
13904 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
13905
13906 /**
13907  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
13908  */
13909 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
13910
13911 /**
13912  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13913  */
13914 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
13915
13916 /**
13917  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
13918  */
13919 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
13920
13921 /**
13922  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
13923  */
13924 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
13925
13926 /**
13927  * Checks if the given object is currently in the success state
13928  */
13929 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
13930
13931 /**
13932  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
13933  */
13934 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
13935
13936 /**
13937  * Constructs a new COption_u16Z containing a u16
13938  */
13939 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
13940
13941 /**
13942  * Constructs a new COption_u16Z containing nothing
13943  */
13944 struct LDKCOption_u16Z COption_u16Z_none(void);
13945
13946 /**
13947  * Frees any resources associated with the u16, if we are in the Some state
13948  */
13949 void COption_u16Z_free(struct LDKCOption_u16Z _res);
13950
13951 /**
13952  * Creates a new COption_u16Z which has the same data as `orig`
13953  * but with all dynamically-allocated buffers duplicated in new buffers.
13954  */
13955 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
13956
13957 /**
13958  * Creates a new CResult_NoneAPIErrorZ in the success state.
13959  */
13960 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
13961
13962 /**
13963  * Creates a new CResult_NoneAPIErrorZ in the error state.
13964  */
13965 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
13966
13967 /**
13968  * Checks if the given object is currently in the success state
13969  */
13970 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
13971
13972 /**
13973  * Frees any resources used by the CResult_NoneAPIErrorZ.
13974  */
13975 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
13976
13977 /**
13978  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
13979  * but with all dynamically-allocated buffers duplicated in new buffers.
13980  */
13981 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
13982
13983 /**
13984  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13985  */
13986 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
13987
13988 /**
13989  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13990  */
13991 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
13992
13993 /**
13994  * Creates a new CResult__u832APIErrorZ in the success state.
13995  */
13996 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
13997
13998 /**
13999  * Creates a new CResult__u832APIErrorZ in the error state.
14000  */
14001 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
14002
14003 /**
14004  * Checks if the given object is currently in the success state
14005  */
14006 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
14007
14008 /**
14009  * Frees any resources used by the CResult__u832APIErrorZ.
14010  */
14011 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
14012
14013 /**
14014  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
14015  * but with all dynamically-allocated buffers duplicated in new buffers.
14016  */
14017 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
14018
14019 /**
14020  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
14021  */
14022 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
14023
14024 /**
14025  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
14026  */
14027 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14028
14029 /**
14030  * Checks if the given object is currently in the success state
14031  */
14032 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
14033
14034 /**
14035  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
14036  */
14037 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
14038
14039 /**
14040  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
14041  * but with all dynamically-allocated buffers duplicated in new buffers.
14042  */
14043 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
14044
14045 /**
14046  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
14047  */
14048 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
14049
14050 /**
14051  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
14052  */
14053 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14054
14055 /**
14056  * Checks if the given object is currently in the success state
14057  */
14058 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
14059
14060 /**
14061  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
14062  */
14063 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
14064
14065 /**
14066  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
14067  * but with all dynamically-allocated buffers duplicated in new buffers.
14068  */
14069 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
14070
14071 /**
14072  * Creates a new tuple which has the same data as `orig`
14073  * but with all dynamically-allocated buffers duplicated in new buffers.
14074  */
14075 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
14076
14077 /**
14078  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
14079  */
14080 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14081
14082 /**
14083  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
14084  */
14085 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
14086
14087 /**
14088  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
14089  */
14090 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
14091
14092 /**
14093  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
14094  */
14095 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14096
14097 /**
14098  * Checks if the given object is currently in the success state
14099  */
14100 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
14101
14102 /**
14103  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
14104  */
14105 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
14106
14107 /**
14108  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
14109  * but with all dynamically-allocated buffers duplicated in new buffers.
14110  */
14111 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
14112
14113 /**
14114  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14115  */
14116 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
14117
14118 /**
14119  * Creates a new tuple which has the same data as `orig`
14120  * but with all dynamically-allocated buffers duplicated in new buffers.
14121  */
14122 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
14123
14124 /**
14125  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
14126  */
14127 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14128
14129 /**
14130  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
14131  */
14132 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
14133
14134 /**
14135  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
14136  */
14137 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14138
14139 /**
14140  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
14141  */
14142 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
14143
14144 /**
14145  * Checks if the given object is currently in the success state
14146  */
14147 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
14148
14149 /**
14150  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
14151  */
14152 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
14153
14154 /**
14155  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
14156  * but with all dynamically-allocated buffers duplicated in new buffers.
14157  */
14158 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
14159
14160 /**
14161  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
14162  */
14163 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14164
14165 /**
14166  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
14167  */
14168 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
14169
14170 /**
14171  * Checks if the given object is currently in the success state
14172  */
14173 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
14174
14175 /**
14176  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
14177  */
14178 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
14179
14180 /**
14181  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
14182  * but with all dynamically-allocated buffers duplicated in new buffers.
14183  */
14184 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
14185
14186 /**
14187  * Creates a new CResult_PaymentSecretNoneZ in the success state.
14188  */
14189 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
14190
14191 /**
14192  * Creates a new CResult_PaymentSecretNoneZ in the error state.
14193  */
14194 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
14195
14196 /**
14197  * Checks if the given object is currently in the success state
14198  */
14199 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
14200
14201 /**
14202  * Frees any resources used by the CResult_PaymentSecretNoneZ.
14203  */
14204 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
14205
14206 /**
14207  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
14208  * but with all dynamically-allocated buffers duplicated in new buffers.
14209  */
14210 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
14211
14212 /**
14213  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
14214  */
14215 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
14216
14217 /**
14218  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
14219  */
14220 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
14221
14222 /**
14223  * Checks if the given object is currently in the success state
14224  */
14225 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
14226
14227 /**
14228  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
14229  */
14230 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
14231
14232 /**
14233  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
14234  * but with all dynamically-allocated buffers duplicated in new buffers.
14235  */
14236 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
14237
14238 /**
14239  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
14240  */
14241 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
14242
14243 /**
14244  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
14245  */
14246 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
14247
14248 /**
14249  * Checks if the given object is currently in the success state
14250  */
14251 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
14252
14253 /**
14254  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
14255  */
14256 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
14257
14258 /**
14259  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
14260  * but with all dynamically-allocated buffers duplicated in new buffers.
14261  */
14262 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
14263
14264 /**
14265  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
14266  */
14267 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
14268
14269 /**
14270  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
14271  */
14272 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
14273
14274 /**
14275  * Checks if the given object is currently in the success state
14276  */
14277 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
14278
14279 /**
14280  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
14281  */
14282 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
14283
14284 /**
14285  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
14286  * but with all dynamically-allocated buffers duplicated in new buffers.
14287  */
14288 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
14289
14290 /**
14291  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
14292  */
14293 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
14294
14295 /**
14296  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
14297  */
14298 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
14299
14300 /**
14301  * Checks if the given object is currently in the success state
14302  */
14303 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
14304
14305 /**
14306  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
14307  */
14308 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
14309
14310 /**
14311  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
14312  * but with all dynamically-allocated buffers duplicated in new buffers.
14313  */
14314 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
14315
14316 /**
14317  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
14318  */
14319 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
14320
14321 /**
14322  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
14323  */
14324 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
14325
14326 /**
14327  * Checks if the given object is currently in the success state
14328  */
14329 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
14330
14331 /**
14332  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
14333  */
14334 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
14335
14336 /**
14337  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
14338  * but with all dynamically-allocated buffers duplicated in new buffers.
14339  */
14340 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
14341
14342 /**
14343  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
14344  */
14345 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
14346
14347 /**
14348  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
14349  */
14350 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
14351
14352 /**
14353  * Checks if the given object is currently in the success state
14354  */
14355 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
14356
14357 /**
14358  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
14359  */
14360 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
14361
14362 /**
14363  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
14364  * but with all dynamically-allocated buffers duplicated in new buffers.
14365  */
14366 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
14367
14368 /**
14369  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14370  */
14371 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
14372
14373 /**
14374  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
14375  */
14376 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
14377
14378 /**
14379  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
14380  */
14381 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
14382
14383 /**
14384  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
14385  */
14386 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
14387
14388 /**
14389  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
14390  */
14391 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
14392
14393 /**
14394  * Checks if the given object is currently in the success state
14395  */
14396 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
14397
14398 /**
14399  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
14400  */
14401 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
14402
14403 /**
14404  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
14405  */
14406 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
14407
14408 /**
14409  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
14410  */
14411 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
14412
14413 /**
14414  * Checks if the given object is currently in the success state
14415  */
14416 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
14417
14418 /**
14419  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
14420  */
14421 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
14422
14423 /**
14424  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
14425  * but with all dynamically-allocated buffers duplicated in new buffers.
14426  */
14427 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
14428
14429 /**
14430  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
14431  */
14432 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
14433
14434 /**
14435  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
14436  */
14437 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
14438
14439 /**
14440  * Checks if the given object is currently in the success state
14441  */
14442 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
14443
14444 /**
14445  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
14446  */
14447 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
14448
14449 /**
14450  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
14451  * but with all dynamically-allocated buffers duplicated in new buffers.
14452  */
14453 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
14454
14455 /**
14456  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
14457  */
14458 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
14459
14460 /**
14461  * Constructs a new COption_TypeZ containing nothing
14462  */
14463 struct LDKCOption_TypeZ COption_TypeZ_none(void);
14464
14465 /**
14466  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
14467  */
14468 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
14469
14470 /**
14471  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
14472  */
14473 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
14474
14475 /**
14476  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
14477  */
14478 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
14479
14480 /**
14481  * Checks if the given object is currently in the success state
14482  */
14483 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
14484
14485 /**
14486  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
14487  */
14488 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
14489
14490 /**
14491  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
14492  */
14493 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
14494
14495 /**
14496  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
14497  */
14498 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
14499
14500 /**
14501  * Checks if the given object is currently in the success state
14502  */
14503 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
14504
14505 /**
14506  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
14507  */
14508 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
14509
14510 /**
14511  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
14512  * but with all dynamically-allocated buffers duplicated in new buffers.
14513  */
14514 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
14515
14516 /**
14517  * Creates a new CResult_SiPrefixNoneZ in the success state.
14518  */
14519 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
14520
14521 /**
14522  * Creates a new CResult_SiPrefixNoneZ in the error state.
14523  */
14524 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
14525
14526 /**
14527  * Checks if the given object is currently in the success state
14528  */
14529 bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o);
14530
14531 /**
14532  * Frees any resources used by the CResult_SiPrefixNoneZ.
14533  */
14534 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
14535
14536 /**
14537  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
14538  * but with all dynamically-allocated buffers duplicated in new buffers.
14539  */
14540 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
14541
14542 /**
14543  * Creates a new CResult_InvoiceNoneZ in the success state.
14544  */
14545 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
14546
14547 /**
14548  * Creates a new CResult_InvoiceNoneZ in the error state.
14549  */
14550 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
14551
14552 /**
14553  * Checks if the given object is currently in the success state
14554  */
14555 bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o);
14556
14557 /**
14558  * Frees any resources used by the CResult_InvoiceNoneZ.
14559  */
14560 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
14561
14562 /**
14563  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
14564  * but with all dynamically-allocated buffers duplicated in new buffers.
14565  */
14566 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
14567
14568 /**
14569  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
14570  */
14571 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
14572
14573 /**
14574  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
14575  */
14576 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
14577
14578 /**
14579  * Checks if the given object is currently in the success state
14580  */
14581 bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o);
14582
14583 /**
14584  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
14585  */
14586 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
14587
14588 /**
14589  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
14590  * but with all dynamically-allocated buffers duplicated in new buffers.
14591  */
14592 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
14593
14594 /**
14595  * Creates a new tuple which has the same data as `orig`
14596  * but with all dynamically-allocated buffers duplicated in new buffers.
14597  */
14598 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
14599
14600 /**
14601  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
14602  */
14603 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
14604
14605 /**
14606  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
14607  */
14608 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
14609
14610 /**
14611  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
14612  */
14613 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
14614
14615 /**
14616  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
14617  */
14618 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
14619
14620 /**
14621  * Checks if the given object is currently in the success state
14622  */
14623 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
14624
14625 /**
14626  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
14627  */
14628 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
14629
14630 /**
14631  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
14632  * but with all dynamically-allocated buffers duplicated in new buffers.
14633  */
14634 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
14635
14636 /**
14637  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14638  */
14639 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
14640
14641 /**
14642  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
14643  */
14644 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
14645
14646 /**
14647  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
14648  */
14649 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
14650
14651 /**
14652  * Checks if the given object is currently in the success state
14653  */
14654 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
14655
14656 /**
14657  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
14658  */
14659 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
14660
14661 /**
14662  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
14663  * but with all dynamically-allocated buffers duplicated in new buffers.
14664  */
14665 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
14666
14667 /**
14668  * Creates a new CResult_NoneSemanticErrorZ in the success state.
14669  */
14670 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
14671
14672 /**
14673  * Creates a new CResult_NoneSemanticErrorZ in the error state.
14674  */
14675 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
14676
14677 /**
14678  * Checks if the given object is currently in the success state
14679  */
14680 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
14681
14682 /**
14683  * Frees any resources used by the CResult_NoneSemanticErrorZ.
14684  */
14685 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
14686
14687 /**
14688  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
14689  * but with all dynamically-allocated buffers duplicated in new buffers.
14690  */
14691 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
14692
14693 /**
14694  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
14695  */
14696 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
14697
14698 /**
14699  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
14700  */
14701 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
14702
14703 /**
14704  * Checks if the given object is currently in the success state
14705  */
14706 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
14707
14708 /**
14709  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
14710  */
14711 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
14712
14713 /**
14714  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
14715  * but with all dynamically-allocated buffers duplicated in new buffers.
14716  */
14717 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
14718
14719 /**
14720  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
14721  */
14722 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
14723
14724 /**
14725  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
14726  */
14727 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
14728
14729 /**
14730  * Checks if the given object is currently in the success state
14731  */
14732 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
14733
14734 /**
14735  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
14736  */
14737 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
14738
14739 /**
14740  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
14741  * but with all dynamically-allocated buffers duplicated in new buffers.
14742  */
14743 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
14744
14745 /**
14746  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
14747  */
14748 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
14749
14750 /**
14751  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
14752  */
14753 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
14754
14755 /**
14756  * Checks if the given object is currently in the success state
14757  */
14758 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
14759
14760 /**
14761  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
14762  */
14763 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
14764
14765 /**
14766  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
14767  * but with all dynamically-allocated buffers duplicated in new buffers.
14768  */
14769 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
14770
14771 /**
14772  * Creates a new CResult_StringErrorZ in the success state.
14773  */
14774 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
14775
14776 /**
14777  * Creates a new CResult_StringErrorZ in the error state.
14778  */
14779 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
14780
14781 /**
14782  * Checks if the given object is currently in the success state
14783  */
14784 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
14785
14786 /**
14787  * Frees any resources used by the CResult_StringErrorZ.
14788  */
14789 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
14790
14791 /**
14792  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
14793  */
14794 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
14795
14796 /**
14797  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
14798  */
14799 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
14800
14801 /**
14802  * Checks if the given object is currently in the success state
14803  */
14804 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
14805
14806 /**
14807  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
14808  */
14809 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
14810
14811 /**
14812  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
14813  * but with all dynamically-allocated buffers duplicated in new buffers.
14814  */
14815 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
14816
14817 /**
14818  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
14819  */
14820 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
14821
14822 /**
14823  * Constructs a new COption_MonitorEventZ containing nothing
14824  */
14825 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
14826
14827 /**
14828  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
14829  */
14830 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
14831
14832 /**
14833  * Creates a new COption_MonitorEventZ which has the same data as `orig`
14834  * but with all dynamically-allocated buffers duplicated in new buffers.
14835  */
14836 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
14837
14838 /**
14839  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
14840  */
14841 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
14842
14843 /**
14844  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
14845  */
14846 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
14847
14848 /**
14849  * Checks if the given object is currently in the success state
14850  */
14851 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
14852
14853 /**
14854  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
14855  */
14856 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
14857
14858 /**
14859  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
14860  * but with all dynamically-allocated buffers duplicated in new buffers.
14861  */
14862 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
14863
14864 /**
14865  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
14866  */
14867 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
14868
14869 /**
14870  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
14871  */
14872 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
14873
14874 /**
14875  * Checks if the given object is currently in the success state
14876  */
14877 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
14878
14879 /**
14880  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
14881  */
14882 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
14883
14884 /**
14885  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
14886  * but with all dynamically-allocated buffers duplicated in new buffers.
14887  */
14888 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
14889
14890 /**
14891  * Creates a new tuple which has the same data as `orig`
14892  * but with all dynamically-allocated buffers duplicated in new buffers.
14893  */
14894 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
14895
14896 /**
14897  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
14898  */
14899 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
14900
14901 /**
14902  * Frees any resources used by the C2Tuple_OutPointScriptZ.
14903  */
14904 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
14905
14906 /**
14907  * Creates a new tuple which has the same data as `orig`
14908  * but with all dynamically-allocated buffers duplicated in new buffers.
14909  */
14910 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
14911
14912 /**
14913  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
14914  */
14915 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
14916
14917 /**
14918  * Frees any resources used by the C2Tuple_u32ScriptZ.
14919  */
14920 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
14921
14922 /**
14923  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14924  */
14925 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
14926
14927 /**
14928  * Creates a new tuple which has the same data as `orig`
14929  * but with all dynamically-allocated buffers duplicated in new buffers.
14930  */
14931 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
14932
14933 /**
14934  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
14935  */
14936 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
14937
14938 /**
14939  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
14940  */
14941 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
14942
14943 /**
14944  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14945  */
14946 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
14947
14948 /**
14949  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14950  */
14951 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
14952
14953 /**
14954  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14955  */
14956 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
14957
14958 /**
14959  * Creates a new tuple which has the same data as `orig`
14960  * but with all dynamically-allocated buffers duplicated in new buffers.
14961  */
14962 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
14963
14964 /**
14965  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
14966  */
14967 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
14968
14969 /**
14970  * Frees any resources used by the C2Tuple_u32TxOutZ.
14971  */
14972 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
14973
14974 /**
14975  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14976  */
14977 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
14978
14979 /**
14980  * Creates a new tuple which has the same data as `orig`
14981  * but with all dynamically-allocated buffers duplicated in new buffers.
14982  */
14983 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
14984
14985 /**
14986  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
14987  */
14988 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
14989
14990 /**
14991  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
14992  */
14993 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
14994
14995 /**
14996  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14997  */
14998 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
14999
15000 /**
15001  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15002  */
15003 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
15004
15005 /**
15006  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
15007  */
15008 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
15009
15010 /**
15011  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
15012  */
15013 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
15014
15015 /**
15016  * Checks if the given object is currently in the success state
15017  */
15018 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
15019
15020 /**
15021  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
15022  */
15023 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
15024
15025 /**
15026  * Creates a new CResult_NoneLightningErrorZ in the success state.
15027  */
15028 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
15029
15030 /**
15031  * Creates a new CResult_NoneLightningErrorZ in the error state.
15032  */
15033 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
15034
15035 /**
15036  * Checks if the given object is currently in the success state
15037  */
15038 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
15039
15040 /**
15041  * Frees any resources used by the CResult_NoneLightningErrorZ.
15042  */
15043 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
15044
15045 /**
15046  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
15047  * but with all dynamically-allocated buffers duplicated in new buffers.
15048  */
15049 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
15050
15051 /**
15052  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
15053  */
15054 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
15055
15056 /**
15057  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
15058  */
15059 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
15060
15061 /**
15062  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15063  */
15064 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
15065
15066 /**
15067  * Creates a new CResult_boolLightningErrorZ in the success state.
15068  */
15069 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
15070
15071 /**
15072  * Creates a new CResult_boolLightningErrorZ in the error state.
15073  */
15074 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
15075
15076 /**
15077  * Checks if the given object is currently in the success state
15078  */
15079 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
15080
15081 /**
15082  * Frees any resources used by the CResult_boolLightningErrorZ.
15083  */
15084 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
15085
15086 /**
15087  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
15088  * but with all dynamically-allocated buffers duplicated in new buffers.
15089  */
15090 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
15091
15092 /**
15093  * Creates a new tuple which has the same data as `orig`
15094  * but with all dynamically-allocated buffers duplicated in new buffers.
15095  */
15096 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
15097
15098 /**
15099  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
15100  */
15101 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
15102
15103 /**
15104  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
15105  */
15106 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
15107
15108 /**
15109  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15110  */
15111 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
15112
15113 /**
15114  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15115  */
15116 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
15117
15118 /**
15119  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15120  */
15121 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
15122
15123 /**
15124  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
15125  */
15126 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
15127
15128 /**
15129  * Constructs a new COption_NetAddressZ containing nothing
15130  */
15131 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
15132
15133 /**
15134  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
15135  */
15136 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
15137
15138 /**
15139  * Creates a new COption_NetAddressZ which has the same data as `orig`
15140  * but with all dynamically-allocated buffers duplicated in new buffers.
15141  */
15142 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
15143
15144 /**
15145  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
15146  */
15147 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
15148
15149 /**
15150  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
15151  */
15152 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15153
15154 /**
15155  * Checks if the given object is currently in the success state
15156  */
15157 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
15158
15159 /**
15160  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
15161  */
15162 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
15163
15164 /**
15165  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
15166  * but with all dynamically-allocated buffers duplicated in new buffers.
15167  */
15168 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
15169
15170 /**
15171  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
15172  */
15173 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
15174
15175 /**
15176  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
15177  */
15178 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
15179
15180 /**
15181  * Checks if the given object is currently in the success state
15182  */
15183 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
15184
15185 /**
15186  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
15187  */
15188 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
15189
15190 /**
15191  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
15192  * but with all dynamically-allocated buffers duplicated in new buffers.
15193  */
15194 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
15195
15196 /**
15197  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
15198  */
15199 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
15200
15201 /**
15202  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
15203  */
15204 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15205
15206 /**
15207  * Checks if the given object is currently in the success state
15208  */
15209 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
15210
15211 /**
15212  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
15213  */
15214 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
15215
15216 /**
15217  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
15218  * but with all dynamically-allocated buffers duplicated in new buffers.
15219  */
15220 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
15221
15222 /**
15223  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
15224  */
15225 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
15226
15227 /**
15228  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
15229  */
15230 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
15231
15232 /**
15233  * Checks if the given object is currently in the success state
15234  */
15235 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
15236
15237 /**
15238  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
15239  */
15240 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
15241
15242 /**
15243  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
15244  * but with all dynamically-allocated buffers duplicated in new buffers.
15245  */
15246 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
15247
15248 /**
15249  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
15250  */
15251 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
15252
15253 /**
15254  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
15255  */
15256 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
15257
15258 /**
15259  * Checks if the given object is currently in the success state
15260  */
15261 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
15262
15263 /**
15264  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
15265  */
15266 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
15267
15268 /**
15269  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
15270  * but with all dynamically-allocated buffers duplicated in new buffers.
15271  */
15272 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
15273
15274 /**
15275  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
15276  */
15277 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
15278
15279 /**
15280  * Constructs a new COption_AccessZ containing nothing
15281  */
15282 struct LDKCOption_AccessZ COption_AccessZ_none(void);
15283
15284 /**
15285  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
15286  */
15287 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
15288
15289 /**
15290  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
15291  */
15292 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
15293
15294 /**
15295  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
15296  */
15297 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
15298
15299 /**
15300  * Checks if the given object is currently in the success state
15301  */
15302 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
15303
15304 /**
15305  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
15306  */
15307 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
15308
15309 /**
15310  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
15311  * but with all dynamically-allocated buffers duplicated in new buffers.
15312  */
15313 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
15314
15315 /**
15316  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
15317  */
15318 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
15319
15320 /**
15321  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
15322  */
15323 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
15324
15325 /**
15326  * Checks if the given object is currently in the success state
15327  */
15328 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
15329
15330 /**
15331  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
15332  */
15333 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
15334
15335 /**
15336  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
15337  * but with all dynamically-allocated buffers duplicated in new buffers.
15338  */
15339 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
15340
15341 /**
15342  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
15343  */
15344 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
15345
15346 /**
15347  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
15348  */
15349 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
15350
15351 /**
15352  * Checks if the given object is currently in the success state
15353  */
15354 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
15355
15356 /**
15357  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
15358  */
15359 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
15360
15361 /**
15362  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
15363  * but with all dynamically-allocated buffers duplicated in new buffers.
15364  */
15365 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
15366
15367 /**
15368  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
15369  */
15370 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
15371
15372 /**
15373  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
15374  */
15375 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
15376
15377 /**
15378  * Checks if the given object is currently in the success state
15379  */
15380 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
15381
15382 /**
15383  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
15384  */
15385 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
15386
15387 /**
15388  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
15389  * but with all dynamically-allocated buffers duplicated in new buffers.
15390  */
15391 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
15392
15393 /**
15394  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15395  */
15396 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
15397
15398 /**
15399  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
15400  */
15401 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
15402
15403 /**
15404  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
15405  */
15406 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
15407
15408 /**
15409  * Checks if the given object is currently in the success state
15410  */
15411 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
15412
15413 /**
15414  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
15415  */
15416 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
15417
15418 /**
15419  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
15420  * but with all dynamically-allocated buffers duplicated in new buffers.
15421  */
15422 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
15423
15424 /**
15425  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
15426  */
15427 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
15428
15429 /**
15430  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
15431  */
15432 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
15433
15434 /**
15435  * Checks if the given object is currently in the success state
15436  */
15437 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
15438
15439 /**
15440  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
15441  */
15442 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
15443
15444 /**
15445  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
15446  * but with all dynamically-allocated buffers duplicated in new buffers.
15447  */
15448 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
15449
15450 /**
15451  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
15452  */
15453 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
15454
15455 /**
15456  * Constructs a new COption_CVec_NetAddressZZ containing nothing
15457  */
15458 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
15459
15460 /**
15461  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
15462  */
15463 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
15464
15465 /**
15466  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
15467  * but with all dynamically-allocated buffers duplicated in new buffers.
15468  */
15469 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
15470
15471 /**
15472  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
15473  */
15474 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
15475
15476 /**
15477  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
15478  */
15479 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
15480
15481 /**
15482  * Checks if the given object is currently in the success state
15483  */
15484 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
15485
15486 /**
15487  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
15488  */
15489 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
15490
15491 /**
15492  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
15493  * but with all dynamically-allocated buffers duplicated in new buffers.
15494  */
15495 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
15496
15497 /**
15498  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15499  */
15500 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
15501
15502 /**
15503  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15504  */
15505 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
15506
15507 /**
15508  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15509  */
15510 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
15511
15512 /**
15513  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15514  */
15515 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
15516
15517 /**
15518  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15519  */
15520 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
15521
15522 /**
15523  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15524  */
15525 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
15526
15527 /**
15528  * Checks if the given object is currently in the success state
15529  */
15530 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
15531
15532 /**
15533  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
15534  */
15535 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
15536
15537 /**
15538  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
15539  * but with all dynamically-allocated buffers duplicated in new buffers.
15540  */
15541 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
15542
15543 /**
15544  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
15545  */
15546 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
15547
15548 /**
15549  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
15550  */
15551 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
15552
15553 /**
15554  * Checks if the given object is currently in the success state
15555  */
15556 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
15557
15558 /**
15559  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
15560  */
15561 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
15562
15563 /**
15564  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
15565  * but with all dynamically-allocated buffers duplicated in new buffers.
15566  */
15567 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
15568
15569 /**
15570  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
15571  */
15572 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
15573
15574 /**
15575  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
15576  */
15577 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
15578
15579 /**
15580  * Checks if the given object is currently in the success state
15581  */
15582 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
15583
15584 /**
15585  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
15586  */
15587 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
15588
15589 /**
15590  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
15591  * but with all dynamically-allocated buffers duplicated in new buffers.
15592  */
15593 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
15594
15595 /**
15596  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
15597  */
15598 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
15599
15600 /**
15601  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
15602  */
15603 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
15604
15605 /**
15606  * Checks if the given object is currently in the success state
15607  */
15608 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
15609
15610 /**
15611  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
15612  */
15613 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
15614
15615 /**
15616  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
15617  * but with all dynamically-allocated buffers duplicated in new buffers.
15618  */
15619 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
15620
15621 /**
15622  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
15623  */
15624 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
15625
15626 /**
15627  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
15628  */
15629 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
15630
15631 /**
15632  * Checks if the given object is currently in the success state
15633  */
15634 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
15635
15636 /**
15637  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
15638  */
15639 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
15640
15641 /**
15642  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
15643  * but with all dynamically-allocated buffers duplicated in new buffers.
15644  */
15645 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
15646
15647 /**
15648  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
15649  */
15650 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
15651
15652 /**
15653  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
15654  */
15655 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
15656
15657 /**
15658  * Checks if the given object is currently in the success state
15659  */
15660 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
15661
15662 /**
15663  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
15664  */
15665 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
15666
15667 /**
15668  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
15669  * but with all dynamically-allocated buffers duplicated in new buffers.
15670  */
15671 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
15672
15673 /**
15674  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
15675  */
15676 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
15677
15678 /**
15679  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
15680  */
15681 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
15682
15683 /**
15684  * Checks if the given object is currently in the success state
15685  */
15686 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
15687
15688 /**
15689  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
15690  */
15691 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
15692
15693 /**
15694  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
15695  * but with all dynamically-allocated buffers duplicated in new buffers.
15696  */
15697 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
15698
15699 /**
15700  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
15701  */
15702 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
15703
15704 /**
15705  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
15706  */
15707 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
15708
15709 /**
15710  * Checks if the given object is currently in the success state
15711  */
15712 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
15713
15714 /**
15715  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
15716  */
15717 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
15718
15719 /**
15720  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
15721  * but with all dynamically-allocated buffers duplicated in new buffers.
15722  */
15723 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
15724
15725 /**
15726  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
15727  */
15728 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
15729
15730 /**
15731  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
15732  */
15733 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
15734
15735 /**
15736  * Checks if the given object is currently in the success state
15737  */
15738 bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o);
15739
15740 /**
15741  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
15742  */
15743 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
15744
15745 /**
15746  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
15747  * but with all dynamically-allocated buffers duplicated in new buffers.
15748  */
15749 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
15750
15751 /**
15752  * Creates a new CResult_InitDecodeErrorZ in the success state.
15753  */
15754 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
15755
15756 /**
15757  * Creates a new CResult_InitDecodeErrorZ in the error state.
15758  */
15759 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
15760
15761 /**
15762  * Checks if the given object is currently in the success state
15763  */
15764 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
15765
15766 /**
15767  * Frees any resources used by the CResult_InitDecodeErrorZ.
15768  */
15769 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
15770
15771 /**
15772  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15773  * but with all dynamically-allocated buffers duplicated in new buffers.
15774  */
15775 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
15776
15777 /**
15778  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15779  */
15780 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
15781
15782 /**
15783  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15784  */
15785 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
15786
15787 /**
15788  * Checks if the given object is currently in the success state
15789  */
15790 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
15791
15792 /**
15793  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15794  */
15795 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
15796
15797 /**
15798  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15799  * but with all dynamically-allocated buffers duplicated in new buffers.
15800  */
15801 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
15802
15803 /**
15804  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15805  */
15806 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
15807
15808 /**
15809  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15810  */
15811 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
15812
15813 /**
15814  * Checks if the given object is currently in the success state
15815  */
15816 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
15817
15818 /**
15819  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15820  */
15821 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
15822
15823 /**
15824  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15825  * but with all dynamically-allocated buffers duplicated in new buffers.
15826  */
15827 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
15828
15829 /**
15830  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15831  */
15832 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
15833
15834 /**
15835  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15836  */
15837 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
15838
15839 /**
15840  * Checks if the given object is currently in the success state
15841  */
15842 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
15843
15844 /**
15845  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15846  */
15847 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
15848
15849 /**
15850  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15851  * but with all dynamically-allocated buffers duplicated in new buffers.
15852  */
15853 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
15854
15855 /**
15856  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15857  */
15858 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
15859
15860 /**
15861  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15862  */
15863 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15864
15865 /**
15866  * Checks if the given object is currently in the success state
15867  */
15868 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
15869
15870 /**
15871  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15872  */
15873 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
15874
15875 /**
15876  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15877  * but with all dynamically-allocated buffers duplicated in new buffers.
15878  */
15879 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
15880
15881 /**
15882  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15883  */
15884 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
15885
15886 /**
15887  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15888  */
15889 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15890
15891 /**
15892  * Checks if the given object is currently in the success state
15893  */
15894 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
15895
15896 /**
15897  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15898  */
15899 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
15900
15901 /**
15902  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15903  * but with all dynamically-allocated buffers duplicated in new buffers.
15904  */
15905 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
15906
15907 /**
15908  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
15909  */
15910 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
15911
15912 /**
15913  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
15914  */
15915 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
15916
15917 /**
15918  * Checks if the given object is currently in the success state
15919  */
15920 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
15921
15922 /**
15923  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
15924  */
15925 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
15926
15927 /**
15928  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
15929  * but with all dynamically-allocated buffers duplicated in new buffers.
15930  */
15931 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
15932
15933 /**
15934  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
15935  */
15936 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
15937
15938 /**
15939  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
15940  */
15941 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15942
15943 /**
15944  * Checks if the given object is currently in the success state
15945  */
15946 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
15947
15948 /**
15949  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
15950  */
15951 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
15952
15953 /**
15954  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
15955  * but with all dynamically-allocated buffers duplicated in new buffers.
15956  */
15957 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
15958
15959 /**
15960  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
15961  */
15962 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
15963
15964 /**
15965  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
15966  */
15967 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15968
15969 /**
15970  * Checks if the given object is currently in the success state
15971  */
15972 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
15973
15974 /**
15975  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
15976  */
15977 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
15978
15979 /**
15980  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
15981  * but with all dynamically-allocated buffers duplicated in new buffers.
15982  */
15983 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
15984
15985 /**
15986  * Creates a new CResult_PingDecodeErrorZ in the success state.
15987  */
15988 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
15989
15990 /**
15991  * Creates a new CResult_PingDecodeErrorZ in the error state.
15992  */
15993 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
15994
15995 /**
15996  * Checks if the given object is currently in the success state
15997  */
15998 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
15999
16000 /**
16001  * Frees any resources used by the CResult_PingDecodeErrorZ.
16002  */
16003 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
16004
16005 /**
16006  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16007  * but with all dynamically-allocated buffers duplicated in new buffers.
16008  */
16009 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
16010
16011 /**
16012  * Creates a new CResult_PongDecodeErrorZ in the success state.
16013  */
16014 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
16015
16016 /**
16017  * Creates a new CResult_PongDecodeErrorZ in the error state.
16018  */
16019 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
16020
16021 /**
16022  * Checks if the given object is currently in the success state
16023  */
16024 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
16025
16026 /**
16027  * Frees any resources used by the CResult_PongDecodeErrorZ.
16028  */
16029 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
16030
16031 /**
16032  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16033  * but with all dynamically-allocated buffers duplicated in new buffers.
16034  */
16035 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
16036
16037 /**
16038  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16039  */
16040 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
16041
16042 /**
16043  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16044  */
16045 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16046
16047 /**
16048  * Checks if the given object is currently in the success state
16049  */
16050 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16051
16052 /**
16053  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16054  */
16055 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
16056
16057 /**
16058  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16059  * but with all dynamically-allocated buffers duplicated in new buffers.
16060  */
16061 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16062
16063 /**
16064  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16065  */
16066 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
16067
16068 /**
16069  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16070  */
16071 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16072
16073 /**
16074  * Checks if the given object is currently in the success state
16075  */
16076 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16077
16078 /**
16079  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16080  */
16081 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
16082
16083 /**
16084  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16085  * but with all dynamically-allocated buffers duplicated in new buffers.
16086  */
16087 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16088
16089 /**
16090  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16091  */
16092 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
16093
16094 /**
16095  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16096  */
16097 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16098
16099 /**
16100  * Checks if the given object is currently in the success state
16101  */
16102 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16103
16104 /**
16105  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16106  */
16107 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
16108
16109 /**
16110  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16111  * but with all dynamically-allocated buffers duplicated in new buffers.
16112  */
16113 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16114
16115 /**
16116  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16117  */
16118 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
16119
16120 /**
16121  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16122  */
16123 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16124
16125 /**
16126  * Checks if the given object is currently in the success state
16127  */
16128 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16129
16130 /**
16131  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16132  */
16133 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
16134
16135 /**
16136  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16137  * but with all dynamically-allocated buffers duplicated in new buffers.
16138  */
16139 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16140
16141 /**
16142  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16143  */
16144 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
16145
16146 /**
16147  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16148  */
16149 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
16150
16151 /**
16152  * Checks if the given object is currently in the success state
16153  */
16154 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
16155
16156 /**
16157  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16158  */
16159 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
16160
16161 /**
16162  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16163  * but with all dynamically-allocated buffers duplicated in new buffers.
16164  */
16165 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
16166
16167 /**
16168  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16169  */
16170 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
16171
16172 /**
16173  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16174  */
16175 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
16176
16177 /**
16178  * Checks if the given object is currently in the success state
16179  */
16180 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
16181
16182 /**
16183  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16184  */
16185 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
16186
16187 /**
16188  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16189  * but with all dynamically-allocated buffers duplicated in new buffers.
16190  */
16191 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
16192
16193 /**
16194  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16195  */
16196 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
16197
16198 /**
16199  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16200  */
16201 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16202
16203 /**
16204  * Checks if the given object is currently in the success state
16205  */
16206 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16207
16208 /**
16209  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16210  */
16211 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
16212
16213 /**
16214  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16215  * but with all dynamically-allocated buffers duplicated in new buffers.
16216  */
16217 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16218
16219 /**
16220  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16221  */
16222 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
16223
16224 /**
16225  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16226  */
16227 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16228
16229 /**
16230  * Checks if the given object is currently in the success state
16231  */
16232 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16233
16234 /**
16235  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16236  */
16237 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
16238
16239 /**
16240  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16241  * but with all dynamically-allocated buffers duplicated in new buffers.
16242  */
16243 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16244
16245 /**
16246  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16247  */
16248 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
16249
16250 /**
16251  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16252  */
16253 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
16254
16255 /**
16256  * Checks if the given object is currently in the success state
16257  */
16258 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
16259
16260 /**
16261  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16262  */
16263 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
16264
16265 /**
16266  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16267  * but with all dynamically-allocated buffers duplicated in new buffers.
16268  */
16269 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
16270
16271 /**
16272  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16273  */
16274 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
16275
16276 /**
16277  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16278  */
16279 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
16280
16281 /**
16282  * Checks if the given object is currently in the success state
16283  */
16284 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
16285
16286 /**
16287  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16288  */
16289 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
16290
16291 /**
16292  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16293  * but with all dynamically-allocated buffers duplicated in new buffers.
16294  */
16295 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
16296
16297 /**
16298  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16299  */
16300 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
16301
16302 /**
16303  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16304  */
16305 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16306
16307 /**
16308  * Checks if the given object is currently in the success state
16309  */
16310 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
16311
16312 /**
16313  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16314  */
16315 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
16316
16317 /**
16318  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16319  * but with all dynamically-allocated buffers duplicated in new buffers.
16320  */
16321 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16322
16323 /**
16324  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16325  */
16326 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
16327
16328 /**
16329  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16330  */
16331 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16332
16333 /**
16334  * Checks if the given object is currently in the success state
16335  */
16336 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
16337
16338 /**
16339  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16340  */
16341 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
16342
16343 /**
16344  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16345  * but with all dynamically-allocated buffers duplicated in new buffers.
16346  */
16347 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16348
16349 /**
16350  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16351  */
16352 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
16353
16354 /**
16355  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16356  */
16357 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
16358
16359 /**
16360  * Checks if the given object is currently in the success state
16361  */
16362 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
16363
16364 /**
16365  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16366  */
16367 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
16368
16369 /**
16370  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16371  * but with all dynamically-allocated buffers duplicated in new buffers.
16372  */
16373 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
16374
16375 /**
16376  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16377  */
16378 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
16379
16380 /**
16381  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16382  */
16383 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
16384
16385 /**
16386  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16387  */
16388 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
16389
16390 /**
16391  * Checks if the given object is currently in the success state
16392  */
16393 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
16394
16395 /**
16396  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16397  */
16398 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
16399
16400 /**
16401  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16402  * but with all dynamically-allocated buffers duplicated in new buffers.
16403  */
16404 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
16405
16406 /**
16407  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16408  */
16409 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
16410
16411 /**
16412  * Constructs a new COption_FilterZ containing nothing
16413  */
16414 struct LDKCOption_FilterZ COption_FilterZ_none(void);
16415
16416 /**
16417  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16418  */
16419 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
16420
16421 /**
16422  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16423  */
16424 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
16425
16426 /**
16427  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16428  */
16429 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
16430
16431 /**
16432  * Checks if the given object is currently in the success state
16433  */
16434 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
16435
16436 /**
16437  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16438  */
16439 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
16440
16441 /**
16442  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16443  */
16444 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
16445
16446 /**
16447  * Frees any resources used by the PaymentPurpose
16448  */
16449 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
16450
16451 /**
16452  * Creates a copy of the PaymentPurpose
16453  */
16454 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
16455
16456 /**
16457  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
16458  */
16459 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
16460
16461 /**
16462  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
16463  */
16464 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
16465
16466 /**
16467  * Frees any resources used by the ClosureReason
16468  */
16469 void ClosureReason_free(struct LDKClosureReason this_ptr);
16470
16471 /**
16472  * Creates a copy of the ClosureReason
16473  */
16474 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
16475
16476 /**
16477  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
16478  */
16479 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
16480
16481 /**
16482  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
16483  */
16484 struct LDKClosureReason ClosureReason_holder_force_closed(void);
16485
16486 /**
16487  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
16488  */
16489 struct LDKClosureReason ClosureReason_cooperative_closure(void);
16490
16491 /**
16492  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
16493  */
16494 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
16495
16496 /**
16497  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
16498  */
16499 struct LDKClosureReason ClosureReason_funding_timed_out(void);
16500
16501 /**
16502  * Utility method to constructs a new ProcessingError-variant ClosureReason
16503  */
16504 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
16505
16506 /**
16507  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
16508  */
16509 struct LDKClosureReason ClosureReason_disconnected_peer(void);
16510
16511 /**
16512  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
16513  */
16514 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
16515
16516 /**
16517  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
16518  */
16519 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
16520
16521 /**
16522  * Read a ClosureReason from a byte array, created by ClosureReason_write
16523  */
16524 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
16525
16526 /**
16527  * Frees any resources used by the Event
16528  */
16529 void Event_free(struct LDKEvent this_ptr);
16530
16531 /**
16532  * Creates a copy of the Event
16533  */
16534 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
16535
16536 /**
16537  * Utility method to constructs a new FundingGenerationReady-variant Event
16538  */
16539 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);
16540
16541 /**
16542  * Utility method to constructs a new PaymentReceived-variant Event
16543  */
16544 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
16545
16546 /**
16547  * Utility method to constructs a new PaymentSent-variant Event
16548  */
16549 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
16550
16551 /**
16552  * Utility method to constructs a new PaymentPathFailed-variant Event
16553  */
16554 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);
16555
16556 /**
16557  * Utility method to constructs a new PaymentFailed-variant Event
16558  */
16559 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
16560
16561 /**
16562  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
16563  */
16564 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
16565
16566 /**
16567  * Utility method to constructs a new SpendableOutputs-variant Event
16568  */
16569 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
16570
16571 /**
16572  * Utility method to constructs a new PaymentForwarded-variant Event
16573  */
16574 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
16575
16576 /**
16577  * Utility method to constructs a new ChannelClosed-variant Event
16578  */
16579 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
16580
16581 /**
16582  * Utility method to constructs a new DiscardFunding-variant Event
16583  */
16584 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
16585
16586 /**
16587  * Utility method to constructs a new PaymentPathSuccessful-variant Event
16588  */
16589 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
16590
16591 /**
16592  * Utility method to constructs a new OpenChannelRequest-variant Event
16593  */
16594 struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type);
16595
16596 /**
16597  * Serialize the Event object into a byte array which can be read by Event_read
16598  */
16599 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
16600
16601 /**
16602  * Read a Event from a byte array, created by Event_write
16603  */
16604 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
16605
16606 /**
16607  * Frees any resources used by the MessageSendEvent
16608  */
16609 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
16610
16611 /**
16612  * Creates a copy of the MessageSendEvent
16613  */
16614 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
16615
16616 /**
16617  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
16618  */
16619 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
16620
16621 /**
16622  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
16623  */
16624 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
16625
16626 /**
16627  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
16628  */
16629 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
16630
16631 /**
16632  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
16633  */
16634 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
16635
16636 /**
16637  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
16638  */
16639 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
16640
16641 /**
16642  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
16643  */
16644 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
16645
16646 /**
16647  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
16648  */
16649 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
16650
16651 /**
16652  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
16653  */
16654 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
16655
16656 /**
16657  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
16658  */
16659 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
16660
16661 /**
16662  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
16663  */
16664 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
16665
16666 /**
16667  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
16668  */
16669 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
16670
16671 /**
16672  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
16673  */
16674 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
16675
16676 /**
16677  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
16678  */
16679 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
16680
16681 /**
16682  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
16683  */
16684 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
16685
16686 /**
16687  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
16688  */
16689 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
16690
16691 /**
16692  * Utility method to constructs a new HandleError-variant MessageSendEvent
16693  */
16694 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
16695
16696 /**
16697  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
16698  */
16699 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
16700
16701 /**
16702  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
16703  */
16704 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
16705
16706 /**
16707  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
16708  */
16709 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
16710
16711 /**
16712  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
16713  */
16714 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
16715
16716 /**
16717  * Calls the free function if one is set
16718  */
16719 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
16720
16721 /**
16722  * Calls the free function if one is set
16723  */
16724 void EventsProvider_free(struct LDKEventsProvider this_ptr);
16725
16726 /**
16727  * Calls the free function if one is set
16728  */
16729 void EventHandler_free(struct LDKEventHandler this_ptr);
16730
16731 /**
16732  * Frees any resources used by the APIError
16733  */
16734 void APIError_free(struct LDKAPIError this_ptr);
16735
16736 /**
16737  * Creates a copy of the APIError
16738  */
16739 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
16740
16741 /**
16742  * Utility method to constructs a new APIMisuseError-variant APIError
16743  */
16744 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
16745
16746 /**
16747  * Utility method to constructs a new FeeRateTooHigh-variant APIError
16748  */
16749 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
16750
16751 /**
16752  * Utility method to constructs a new RouteError-variant APIError
16753  */
16754 struct LDKAPIError APIError_route_error(struct LDKStr err);
16755
16756 /**
16757  * Utility method to constructs a new ChannelUnavailable-variant APIError
16758  */
16759 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
16760
16761 /**
16762  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
16763  */
16764 struct LDKAPIError APIError_monitor_update_failed(void);
16765
16766 /**
16767  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
16768  */
16769 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
16770
16771 /**
16772  * Creates a digital signature of a message given a SecretKey, like the node's secret.
16773  * 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.
16774  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
16775  */
16776 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
16777
16778 /**
16779  * Recovers the PublicKey of the signer of the message given the message and the signature.
16780  */
16781 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
16782
16783 /**
16784  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
16785  * and the PublicKey.
16786  */
16787 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
16788
16789 /**
16790  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
16791  */
16792 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
16793
16794 /**
16795  * Creates a copy of the Level
16796  */
16797 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
16798
16799 /**
16800  * Utility method to constructs a new Gossip-variant Level
16801  */
16802 enum LDKLevel Level_gossip(void);
16803
16804 /**
16805  * Utility method to constructs a new Trace-variant Level
16806  */
16807 enum LDKLevel Level_trace(void);
16808
16809 /**
16810  * Utility method to constructs a new Debug-variant Level
16811  */
16812 enum LDKLevel Level_debug(void);
16813
16814 /**
16815  * Utility method to constructs a new Info-variant Level
16816  */
16817 enum LDKLevel Level_info(void);
16818
16819 /**
16820  * Utility method to constructs a new Warn-variant Level
16821  */
16822 enum LDKLevel Level_warn(void);
16823
16824 /**
16825  * Utility method to constructs a new Error-variant Level
16826  */
16827 enum LDKLevel Level_error(void);
16828
16829 /**
16830  * Checks if two Levels contain equal inner contents.
16831  * This ignores pointers and is_owned flags and looks at the values in fields.
16832  */
16833 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
16834
16835 /**
16836  * Checks if two Levels contain equal inner contents.
16837  */
16838 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
16839
16840 /**
16841  * Returns the most verbose logging level.
16842  */
16843 MUST_USE_RES enum LDKLevel Level_max(void);
16844
16845 /**
16846  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
16847  */
16848 void Record_free(struct LDKRecord this_obj);
16849
16850 /**
16851  * The verbosity level of the message.
16852  */
16853 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
16854
16855 /**
16856  * The verbosity level of the message.
16857  */
16858 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
16859
16860 /**
16861  * The message body.
16862  */
16863 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
16864
16865 /**
16866  * The message body.
16867  */
16868 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
16869
16870 /**
16871  * The module path of the message.
16872  */
16873 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
16874
16875 /**
16876  * The module path of the message.
16877  */
16878 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
16879
16880 /**
16881  * The source file containing the message.
16882  */
16883 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
16884
16885 /**
16886  * The source file containing the message.
16887  */
16888 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
16889
16890 /**
16891  * The line containing the message.
16892  */
16893 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
16894
16895 /**
16896  * The line containing the message.
16897  */
16898 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
16899
16900 /**
16901  * Creates a copy of the Record
16902  */
16903 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
16904
16905 /**
16906  * Calls the free function if one is set
16907  */
16908 void Logger_free(struct LDKLogger this_ptr);
16909
16910 /**
16911  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
16912  */
16913 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
16914
16915 /**
16916  * Confirmations we will wait for before considering the channel locked in.
16917  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
16918  * equivalent limit applied to outbound channels).
16919  *
16920  * Default value: 6.
16921  */
16922 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
16923
16924 /**
16925  * Confirmations we will wait for before considering the channel locked in.
16926  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
16927  * equivalent limit applied to outbound channels).
16928  *
16929  * Default value: 6.
16930  */
16931 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
16932
16933 /**
16934  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
16935  * the number of blocks we have to punish our counterparty if they broadcast a revoked
16936  * transaction).
16937  *
16938  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
16939  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
16940  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
16941  * possibly with time in between to RBF the spending transaction).
16942  *
16943  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
16944  * case of an honest unilateral channel close, which implicitly decrease the economic value of
16945  * our channel.
16946  *
16947  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
16948  * can tweak config to ask for more security, not less.
16949  */
16950 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
16951
16952 /**
16953  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
16954  * the number of blocks we have to punish our counterparty if they broadcast a revoked
16955  * transaction).
16956  *
16957  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
16958  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
16959  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
16960  * possibly with time in between to RBF the spending transaction).
16961  *
16962  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
16963  * case of an honest unilateral channel close, which implicitly decrease the economic value of
16964  * our channel.
16965  *
16966  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
16967  * can tweak config to ask for more security, not less.
16968  */
16969 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
16970
16971 /**
16972  * Set to the smallest value HTLC we will accept to process.
16973  *
16974  * This value is sent to our counterparty on channel-open and we close the channel any time
16975  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
16976  *
16977  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
16978  * by the protocol.
16979  */
16980 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
16981
16982 /**
16983  * Set to the smallest value HTLC we will accept to process.
16984  *
16985  * This value is sent to our counterparty on channel-open and we close the channel any time
16986  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
16987  *
16988  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
16989  * by the protocol.
16990  */
16991 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
16992
16993 /**
16994  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
16995  * BOLTs) option for outbound private channels. This provides better privacy by not including
16996  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
16997  * relay HTLCs to us using the channel's SCID alias.
16998  *
16999  * If this option is set, channels may be created that will not be readable by LDK versions
17000  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
17001  * [`DecodeError:InvalidValue`].
17002  *
17003  * Note that setting this to true does *not* prevent us from opening channels with
17004  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
17005  * private channel without that option.
17006  *
17007  * Ignored if the channel is negotiated to be announced, see
17008  * [`ChannelConfig::announced_channel`] and
17009  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
17010  *
17011  * Default value: false. This value is likely to change to true in the future.
17012  *
17013  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17014  * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
17015  */
17016 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17017
17018 /**
17019  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
17020  * BOLTs) option for outbound private channels. This provides better privacy by not including
17021  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
17022  * relay HTLCs to us using the channel's SCID alias.
17023  *
17024  * If this option is set, channels may be created that will not be readable by LDK versions
17025  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
17026  * [`DecodeError:InvalidValue`].
17027  *
17028  * Note that setting this to true does *not* prevent us from opening channels with
17029  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
17030  * private channel without that option.
17031  *
17032  * Ignored if the channel is negotiated to be announced, see
17033  * [`ChannelConfig::announced_channel`] and
17034  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
17035  *
17036  * Default value: false. This value is likely to change to true in the future.
17037  *
17038  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17039  * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
17040  */
17041 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
17042
17043 /**
17044  * Constructs a new ChannelHandshakeConfig given each field
17045  */
17046 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, bool negotiate_scid_privacy_arg);
17047
17048 /**
17049  * Creates a copy of the ChannelHandshakeConfig
17050  */
17051 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
17052
17053 /**
17054  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
17055  */
17056 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
17057
17058 /**
17059  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
17060  */
17061 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
17062
17063 /**
17064  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
17065  * only applies to inbound channels.
17066  *
17067  * Default value: 0.
17068  */
17069 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17070
17071 /**
17072  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
17073  * only applies to inbound channels.
17074  *
17075  * Default value: 0.
17076  */
17077 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17078
17079 /**
17080  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
17081  * you to limit the maximum minimum-size they can require.
17082  *
17083  * Default value: u64::max_value.
17084  */
17085 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17086
17087 /**
17088  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
17089  * you to limit the maximum minimum-size they can require.
17090  *
17091  * Default value: u64::max_value.
17092  */
17093 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17094
17095 /**
17096  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17097  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17098  *
17099  * Default value: 0.
17100  */
17101 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17102
17103 /**
17104  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17105  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17106  *
17107  * Default value: 0.
17108  */
17109 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17110
17111 /**
17112  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17113  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17114  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17115  *
17116  * Default value: u64::max_value.
17117  */
17118 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17119
17120 /**
17121  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17122  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17123  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17124  *
17125  * Default value: u64::max_value.
17126  */
17127 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17128
17129 /**
17130  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17131  * time. This allows you to set a minimum such value.
17132  *
17133  * Default value: 0.
17134  */
17135 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17136
17137 /**
17138  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17139  * time. This allows you to set a minimum such value.
17140  *
17141  * Default value: 0.
17142  */
17143 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17144
17145 /**
17146  * Before a channel is usable the funding transaction will need to be confirmed by at least a
17147  * certain number of blocks, specified by the node which is not the funder (as the funder can
17148  * assume they aren't going to double-spend themselves).
17149  * This config allows you to set a limit on the maximum amount of time to wait.
17150  *
17151  * Default value: 144, or roughly one day and only applies to outbound channels.
17152  */
17153 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17154
17155 /**
17156  * Before a channel is usable the funding transaction will need to be confirmed by at least a
17157  * certain number of blocks, specified by the node which is not the funder (as the funder can
17158  * assume they aren't going to double-spend themselves).
17159  * This config allows you to set a limit on the maximum amount of time to wait.
17160  *
17161  * Default value: 144, or roughly one day and only applies to outbound channels.
17162  */
17163 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
17164
17165 /**
17166  * Set to force an incoming channel to match our announced channel preference in
17167  * [`ChannelConfig::announced_channel`].
17168  *
17169  * For a node which is not online reliably, this should be set to true and
17170  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
17171  * channels will ever be opened.
17172  *
17173  * Default value: true.
17174  */
17175 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17176
17177 /**
17178  * Set to force an incoming channel to match our announced channel preference in
17179  * [`ChannelConfig::announced_channel`].
17180  *
17181  * For a node which is not online reliably, this should be set to true and
17182  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
17183  * channels will ever be opened.
17184  *
17185  * Default value: true.
17186  */
17187 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
17188
17189 /**
17190  * Set to the amount of time we're willing to wait to claim money back to us.
17191  *
17192  * Not checking this value would be a security issue, as our peer would be able to set it to
17193  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17194  *
17195  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17196  * reduce the loss of having useless locked funds (if your peer accepts)
17197  */
17198 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17199
17200 /**
17201  * Set to the amount of time we're willing to wait to claim money back to us.
17202  *
17203  * Not checking this value would be a security issue, as our peer would be able to set it to
17204  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17205  *
17206  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17207  * reduce the loss of having useless locked funds (if your peer accepts)
17208  */
17209 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17210
17211 /**
17212  * Constructs a new ChannelHandshakeLimits given each field
17213  */
17214 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);
17215
17216 /**
17217  * Creates a copy of the ChannelHandshakeLimits
17218  */
17219 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
17220
17221 /**
17222  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
17223  */
17224 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
17225
17226 /**
17227  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
17228  */
17229 void ChannelConfig_free(struct LDKChannelConfig this_obj);
17230
17231 /**
17232  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17233  * over the channel.
17234  * This may be allowed to change at runtime in a later update, however doing so must result in
17235  * update messages sent to notify all nodes of our updated relay fee.
17236  *
17237  * Default value: 0.
17238  */
17239 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17240
17241 /**
17242  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17243  * over the channel.
17244  * This may be allowed to change at runtime in a later update, however doing so must result in
17245  * update messages sent to notify all nodes of our updated relay fee.
17246  *
17247  * Default value: 0.
17248  */
17249 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17250
17251 /**
17252  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17253  * excess of [`forwarding_fee_proportional_millionths`].
17254  * This may be allowed to change at runtime in a later update, however doing so must result in
17255  * update messages sent to notify all nodes of our updated relay fee.
17256  *
17257  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17258  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17259  * this node.
17260  *
17261  * Default value: 1000.
17262  *
17263  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17264  */
17265 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17266
17267 /**
17268  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17269  * excess of [`forwarding_fee_proportional_millionths`].
17270  * This may be allowed to change at runtime in a later update, however doing so must result in
17271  * update messages sent to notify all nodes of our updated relay fee.
17272  *
17273  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17274  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17275  * this node.
17276  *
17277  * Default value: 1000.
17278  *
17279  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17280  */
17281 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17282
17283 /**
17284  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17285  * the channel this config applies to.
17286  *
17287  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17288  * HTLC balance when a channel appears on-chain whereas
17289  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17290  * (non-HTLC-encumbered) balance.
17291  *
17292  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17293  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17294  * commitment transaction at least once per this many blocks (minus some margin to allow us
17295  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17296  * the spending transaction).
17297  *
17298  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17299  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17300  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17301  *
17302  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17303  */
17304 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17305
17306 /**
17307  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17308  * the channel this config applies to.
17309  *
17310  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17311  * HTLC balance when a channel appears on-chain whereas
17312  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17313  * (non-HTLC-encumbered) balance.
17314  *
17315  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17316  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17317  * commitment transaction at least once per this many blocks (minus some margin to allow us
17318  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17319  * the spending transaction).
17320  *
17321  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17322  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17323  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17324  *
17325  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17326  */
17327 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
17328
17329 /**
17330  * Set to announce the channel publicly and notify all nodes that they can route via this
17331  * channel.
17332  *
17333  * This should only be set to true for nodes which expect to be online reliably.
17334  *
17335  * As the node which funds a channel picks this value this will only apply for new outbound
17336  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17337  *
17338  * This cannot be changed after the initial channel handshake.
17339  *
17340  * Default value: false.
17341  */
17342 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17343
17344 /**
17345  * Set to announce the channel publicly and notify all nodes that they can route via this
17346  * channel.
17347  *
17348  * This should only be set to true for nodes which expect to be online reliably.
17349  *
17350  * As the node which funds a channel picks this value this will only apply for new outbound
17351  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17352  *
17353  * This cannot be changed after the initial channel handshake.
17354  *
17355  * Default value: false.
17356  */
17357 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
17358
17359 /**
17360  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17361  * supports it, they will then enforce the mutual-close output to us matches what we provided
17362  * at intialization, preventing us from closing to an alternate pubkey.
17363  *
17364  * This is set to true by default to provide a slight increase in security, though ultimately
17365  * any attacker who is able to take control of a channel can just as easily send the funds via
17366  * lightning payments, so we never require that our counterparties support this option.
17367  *
17368  * This cannot be changed after a channel has been initialized.
17369  *
17370  * Default value: true.
17371  */
17372 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17373
17374 /**
17375  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17376  * supports it, they will then enforce the mutual-close output to us matches what we provided
17377  * at intialization, preventing us from closing to an alternate pubkey.
17378  *
17379  * This is set to true by default to provide a slight increase in security, though ultimately
17380  * any attacker who is able to take control of a channel can just as easily send the funds via
17381  * lightning payments, so we never require that our counterparties support this option.
17382  *
17383  * This cannot be changed after a channel has been initialized.
17384  *
17385  * Default value: true.
17386  */
17387 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
17388
17389 /**
17390  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
17391  * small to claim on-chain.
17392  *
17393  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
17394  * not be claimable on-chain, instead being turned into additional miner fees if either
17395  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
17396  * to such payments may be sustantial if there are many dust HTLCs present when the
17397  * channel is force-closed.
17398  *
17399  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
17400  * exposure across all three types per-channel. Setting this too low may prevent the
17401  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
17402  * important to prevent stealing of dust HTLCs by miners.
17403  *
17404  * Default value: 5_000_000 msat.
17405  */
17406 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17407
17408 /**
17409  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
17410  * small to claim on-chain.
17411  *
17412  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
17413  * not be claimable on-chain, instead being turned into additional miner fees if either
17414  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
17415  * to such payments may be sustantial if there are many dust HTLCs present when the
17416  * channel is force-closed.
17417  *
17418  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
17419  * exposure across all three types per-channel. Setting this too low may prevent the
17420  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
17421  * important to prevent stealing of dust HTLCs by miners.
17422  *
17423  * Default value: 5_000_000 msat.
17424  */
17425 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
17426
17427 /**
17428  * The additional fee we're willing to pay to avoid waiting for the counterparty's
17429  * `to_self_delay` to reclaim funds.
17430  *
17431  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
17432  * closing transaction which both sides find acceptable, ultimately paid by the channel
17433  * funder/initiator.
17434  *
17435  * When we are the funder, because we have to pay the channel closing fee, we bound the
17436  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
17437  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
17438  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
17439  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
17440  * funds.
17441  *
17442  * When we are not the funder, we require the closing transaction fee pay at least our
17443  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
17444  * Thus, this value is ignored when we are not the funder.
17445  *
17446  * Default value: 1000 satoshis.
17447  *
17448  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
17449  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
17450  */
17451 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17452
17453 /**
17454  * The additional fee we're willing to pay to avoid waiting for the counterparty's
17455  * `to_self_delay` to reclaim funds.
17456  *
17457  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
17458  * closing transaction which both sides find acceptable, ultimately paid by the channel
17459  * funder/initiator.
17460  *
17461  * When we are the funder, because we have to pay the channel closing fee, we bound the
17462  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
17463  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
17464  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
17465  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
17466  * funds.
17467  *
17468  * When we are not the funder, we require the closing transaction fee pay at least our
17469  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
17470  * Thus, this value is ignored when we are not the funder.
17471  *
17472  * Default value: 1000 satoshis.
17473  *
17474  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
17475  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
17476  */
17477 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
17478
17479 /**
17480  * Constructs a new ChannelConfig given each field
17481  */
17482 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);
17483
17484 /**
17485  * Creates a copy of the ChannelConfig
17486  */
17487 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
17488
17489 /**
17490  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
17491  */
17492 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
17493
17494 /**
17495  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
17496  */
17497 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
17498
17499 /**
17500  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
17501  */
17502 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
17503
17504 /**
17505  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
17506  */
17507 void UserConfig_free(struct LDKUserConfig this_obj);
17508
17509 /**
17510  * Channel config that we propose to our counterparty.
17511  */
17512 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17513
17514 /**
17515  * Channel config that we propose to our counterparty.
17516  */
17517 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
17518
17519 /**
17520  * Limits applied to our counterparty's proposed channel config settings.
17521  */
17522 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17523
17524 /**
17525  * Limits applied to our counterparty's proposed channel config settings.
17526  */
17527 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
17528
17529 /**
17530  * Channel config which affects behavior during channel lifetime.
17531  */
17532 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17533
17534 /**
17535  * Channel config which affects behavior during channel lifetime.
17536  */
17537 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
17538
17539 /**
17540  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
17541  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
17542  * node which is not online reliably.
17543  *
17544  * For nodes which are not online reliably, you should set all channels to *not* be announced
17545  * (using [`ChannelConfig::announced_channel`] and
17546  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
17547  * ensure you are not exposed to any forwarding risk.
17548  *
17549  * Note that because you cannot change a channel's announced state after creation, there is no
17550  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
17551  * from a publicly-announced forwarding node to a private non-forwarding node you must close
17552  * all your channels and open new ones. For privacy, you should also change your node_id
17553  * (swapping all private and public key material for new ones) at that time.
17554  *
17555  * Default value: false.
17556  */
17557 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17558
17559 /**
17560  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
17561  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
17562  * node which is not online reliably.
17563  *
17564  * For nodes which are not online reliably, you should set all channels to *not* be announced
17565  * (using [`ChannelConfig::announced_channel`] and
17566  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
17567  * ensure you are not exposed to any forwarding risk.
17568  *
17569  * Note that because you cannot change a channel's announced state after creation, there is no
17570  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
17571  * from a publicly-announced forwarding node to a private non-forwarding node you must close
17572  * all your channels and open new ones. For privacy, you should also change your node_id
17573  * (swapping all private and public key material for new ones) at that time.
17574  *
17575  * Default value: false.
17576  */
17577 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17578
17579 /**
17580  * If this is set to false, we do not accept inbound requests to open a new channel.
17581  * Default value: true.
17582  */
17583 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17584
17585 /**
17586  * If this is set to false, we do not accept inbound requests to open a new channel.
17587  * Default value: true.
17588  */
17589 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17590
17591 /**
17592  * If this is set to true, the user needs to manually accept inbound requests to open a new
17593  * channel.
17594  *
17595  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
17596  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
17597  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
17598  * user explicitly chooses to accept the request.
17599  *
17600  * Default value: false.
17601  *
17602  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
17603  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
17604  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
17605  */
17606 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17607
17608 /**
17609  * If this is set to true, the user needs to manually accept inbound requests to open a new
17610  * channel.
17611  *
17612  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
17613  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
17614  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
17615  * user explicitly chooses to accept the request.
17616  *
17617  * Default value: false.
17618  *
17619  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
17620  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
17621  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
17622  */
17623 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17624
17625 /**
17626  * Constructs a new UserConfig given each field
17627  */
17628 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);
17629
17630 /**
17631  * Creates a copy of the UserConfig
17632  */
17633 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
17634
17635 /**
17636  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
17637  */
17638 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
17639
17640 /**
17641  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
17642  */
17643 void BestBlock_free(struct LDKBestBlock this_obj);
17644
17645 /**
17646  * Creates a copy of the BestBlock
17647  */
17648 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
17649
17650 /**
17651  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
17652  * network.
17653  */
17654 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
17655
17656 /**
17657  * Returns a `BestBlock` as identified by the given block hash and height.
17658  */
17659 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
17660
17661 /**
17662  * Returns the best block hash.
17663  */
17664 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
17665
17666 /**
17667  * Returns the best block height.
17668  */
17669 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
17670
17671 /**
17672  * Creates a copy of the AccessError
17673  */
17674 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
17675
17676 /**
17677  * Utility method to constructs a new UnknownChain-variant AccessError
17678  */
17679 enum LDKAccessError AccessError_unknown_chain(void);
17680
17681 /**
17682  * Utility method to constructs a new UnknownTx-variant AccessError
17683  */
17684 enum LDKAccessError AccessError_unknown_tx(void);
17685
17686 /**
17687  * Calls the free function if one is set
17688  */
17689 void Access_free(struct LDKAccess this_ptr);
17690
17691 /**
17692  * Calls the free function if one is set
17693  */
17694 void Listen_free(struct LDKListen this_ptr);
17695
17696 /**
17697  * Calls the free function if one is set
17698  */
17699 void Confirm_free(struct LDKConfirm this_ptr);
17700
17701 /**
17702  * Creates a copy of the ChannelMonitorUpdateErr
17703  */
17704 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
17705
17706 /**
17707  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
17708  */
17709 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
17710
17711 /**
17712  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
17713  */
17714 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
17715
17716 /**
17717  * Calls the free function if one is set
17718  */
17719 void Watch_free(struct LDKWatch this_ptr);
17720
17721 /**
17722  * Calls the free function if one is set
17723  */
17724 void Filter_free(struct LDKFilter this_ptr);
17725
17726 /**
17727  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
17728  */
17729 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
17730
17731 /**
17732  * First block where the transaction output may have been spent.
17733  *
17734  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17735  */
17736 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17737
17738 /**
17739  * First block where the transaction output may have been spent.
17740  *
17741  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17742  */
17743 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17744
17745 /**
17746  * Outpoint identifying the transaction output.
17747  */
17748 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17749
17750 /**
17751  * Outpoint identifying the transaction output.
17752  */
17753 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
17754
17755 /**
17756  * Spending condition of the transaction output.
17757  */
17758 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17759
17760 /**
17761  * Spending condition of the transaction output.
17762  */
17763 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
17764
17765 /**
17766  * Constructs a new WatchedOutput given each field
17767  */
17768 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
17769
17770 /**
17771  * Creates a copy of the WatchedOutput
17772  */
17773 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
17774
17775 /**
17776  * Checks if two WatchedOutputs contain equal inner contents.
17777  */
17778 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
17779
17780 /**
17781  * Calls the free function if one is set
17782  */
17783 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
17784
17785 /**
17786  * Creates a copy of the ConfirmationTarget
17787  */
17788 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
17789
17790 /**
17791  * Utility method to constructs a new Background-variant ConfirmationTarget
17792  */
17793 enum LDKConfirmationTarget ConfirmationTarget_background(void);
17794
17795 /**
17796  * Utility method to constructs a new Normal-variant ConfirmationTarget
17797  */
17798 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
17799
17800 /**
17801  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
17802  */
17803 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
17804
17805 /**
17806  * Checks if two ConfirmationTargets contain equal inner contents.
17807  * This ignores pointers and is_owned flags and looks at the values in fields.
17808  */
17809 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
17810
17811 /**
17812  * Calls the free function if one is set
17813  */
17814 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
17815
17816 /**
17817  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
17818  */
17819 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
17820
17821 /**
17822  * Creates a copy of the MonitorUpdateId
17823  */
17824 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
17825
17826 /**
17827  * Checks if two MonitorUpdateIds contain equal inner contents.
17828  */
17829 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
17830
17831 /**
17832  * Checks if two MonitorUpdateIds contain equal inner contents.
17833  * This ignores pointers and is_owned flags and looks at the values in fields.
17834  * Two objects with NULL inner values will be considered "equal" here.
17835  */
17836 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
17837
17838 /**
17839  * Calls the free function if one is set
17840  */
17841 void Persist_free(struct LDKPersist this_ptr);
17842
17843 /**
17844  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
17845  */
17846 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
17847
17848 /**
17849  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
17850  */
17851 void ChainMonitor_free(struct LDKChainMonitor this_obj);
17852
17853 /**
17854  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
17855  *
17856  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
17857  * will call back to it indicating transactions and outputs of interest. This allows clients to
17858  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
17859  * always need to fetch full blocks absent another means for determining which blocks contain
17860  * transactions relevant to the watched channels.
17861  */
17862 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
17863
17864 /**
17865  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
17866  * claims which are awaiting confirmation.
17867  *
17868  * Includes the balances from each [`ChannelMonitor`] *except* those included in
17869  * `ignored_channels`, allowing you to filter out balances from channels which are still open
17870  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
17871  *
17872  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
17873  * inclusion in the return value.
17874  */
17875 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
17876
17877 /**
17878  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
17879  * such [`ChannelMonitor`] is currently being monitored for.
17880  *
17881  * Note that the result holds a mutex over our monitor set, and should not be held
17882  * indefinitely.
17883  */
17884 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
17885
17886 /**
17887  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
17888  *
17889  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
17890  * monitoring for on-chain state resolutions.
17891  */
17892 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17893
17894 /**
17895  * Indicates the persistence of a [`ChannelMonitor`] has completed after
17896  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
17897  *
17898  * Thus, the anticipated use is, at a high level:
17899  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
17900  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
17901  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
17902  *  2) once all remote copies are updated, you call this function with the
17903  *     `completed_update_id` that completed, and once all pending updates have completed the
17904  *     channel will be re-enabled.
17905  *
17906  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
17907  * registered [`ChannelMonitor`]s.
17908  */
17909 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);
17910
17911 /**
17912  * Constructs a new Listen which calls the relevant methods on this_arg.
17913  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
17914  */
17915 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17916
17917 /**
17918  * Constructs a new Confirm which calls the relevant methods on this_arg.
17919  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
17920  */
17921 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17922
17923 /**
17924  * Constructs a new Watch which calls the relevant methods on this_arg.
17925  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
17926  */
17927 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17928
17929 /**
17930  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
17931  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
17932  */
17933 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17934
17935 /**
17936  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
17937  */
17938 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
17939
17940 /**
17941  * The sequence number of this update. Updates *must* be replayed in-order according to this
17942  * sequence number (and updates may panic if they are not). The update_id values are strictly
17943  * increasing and increase by one for each new update, with one exception specified below.
17944  *
17945  * This sequence number is also used to track up to which points updates which returned
17946  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
17947  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
17948  *
17949  * The only instance where update_id values are not strictly increasing is the case where we
17950  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
17951  * its docs for more details.
17952  */
17953 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
17954
17955 /**
17956  * The sequence number of this update. Updates *must* be replayed in-order according to this
17957  * sequence number (and updates may panic if they are not). The update_id values are strictly
17958  * increasing and increase by one for each new update, with one exception specified below.
17959  *
17960  * This sequence number is also used to track up to which points updates which returned
17961  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
17962  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
17963  *
17964  * The only instance where update_id values are not strictly increasing is the case where we
17965  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
17966  * its docs for more details.
17967  */
17968 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
17969
17970 /**
17971  * Creates a copy of the ChannelMonitorUpdate
17972  */
17973 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
17974
17975 /**
17976  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
17977  */
17978 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
17979
17980 /**
17981  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
17982  */
17983 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
17984
17985 /**
17986  * Frees any resources used by the MonitorEvent
17987  */
17988 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
17989
17990 /**
17991  * Creates a copy of the MonitorEvent
17992  */
17993 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
17994
17995 /**
17996  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
17997  */
17998 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
17999
18000 /**
18001  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
18002  */
18003 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
18004
18005 /**
18006  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
18007  */
18008 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
18009
18010 /**
18011  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
18012  */
18013 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
18014
18015 /**
18016  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
18017  */
18018 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
18019
18020 /**
18021  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
18022  */
18023 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
18024
18025 /**
18026  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
18027  */
18028 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
18029
18030 /**
18031  * Creates a copy of the HTLCUpdate
18032  */
18033 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
18034
18035 /**
18036  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
18037  */
18038 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
18039
18040 /**
18041  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
18042  */
18043 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
18044
18045 /**
18046  * Frees any resources used by the Balance
18047  */
18048 void Balance_free(struct LDKBalance this_ptr);
18049
18050 /**
18051  * Creates a copy of the Balance
18052  */
18053 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
18054
18055 /**
18056  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
18057  */
18058 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
18059
18060 /**
18061  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
18062  */
18063 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
18064
18065 /**
18066  * Utility method to constructs a new ContentiousClaimable-variant Balance
18067  */
18068 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
18069
18070 /**
18071  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
18072  */
18073 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
18074
18075 /**
18076  * Checks if two Balances contain equal inner contents.
18077  * This ignores pointers and is_owned flags and looks at the values in fields.
18078  */
18079 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
18080
18081 /**
18082  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
18083  */
18084 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
18085
18086 /**
18087  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
18088  */
18089 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
18090
18091 /**
18092  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
18093  * itself.
18094  *
18095  * panics if the given update is not the next update by update_id.
18096  */
18097 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);
18098
18099 /**
18100  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
18101  * ChannelMonitor.
18102  */
18103 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18104
18105 /**
18106  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
18107  */
18108 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18109
18110 /**
18111  * Gets a list of txids, with their output scripts (in the order they appear in the
18112  * transaction), which we must learn about spends of via block_connected().
18113  */
18114 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18115
18116 /**
18117  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
18118  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
18119  * have been registered.
18120  */
18121 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
18122
18123 /**
18124  * Get the list of HTLCs who's status has been updated on chain. This should be called by
18125  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
18126  */
18127 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18128
18129 /**
18130  * Gets the list of pending events which were generated by previous actions, clearing the list
18131  * in the process.
18132  *
18133  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
18134  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
18135  * no internal locking in ChannelMonitors.
18136  */
18137 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18138
18139 /**
18140  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
18141  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
18142  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
18143  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
18144  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
18145  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
18146  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
18147  * out-of-band the other node operator to coordinate with him if option is available to you.
18148  * In any-case, choice is up to the user.
18149  */
18150 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);
18151
18152 /**
18153  * Processes transactions in a newly connected block, which may result in any of the following:
18154  * - update the monitor's state against resolved HTLCs
18155  * - punish the counterparty in the case of seeing a revoked commitment transaction
18156  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
18157  * - detect settled outputs for later spending
18158  * - schedule and bump any in-flight claims
18159  *
18160  * Returns any new outputs to watch from `txdata`; after called, these are also included in
18161  * [`get_outputs_to_watch`].
18162  *
18163  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
18164  */
18165 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);
18166
18167 /**
18168  * Determines if the disconnected block contained any transactions of interest and updates
18169  * appropriately.
18170  */
18171 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);
18172
18173 /**
18174  * Processes transactions confirmed in a block with the given header and height, returning new
18175  * outputs to watch. See [`block_connected`] for details.
18176  *
18177  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
18178  * blocks. See [`chain::Confirm`] for calling expectations.
18179  *
18180  * [`block_connected`]: Self::block_connected
18181  */
18182 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);
18183
18184 /**
18185  * Processes a transaction that was reorganized out of the chain.
18186  *
18187  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
18188  * than blocks. See [`chain::Confirm`] for calling expectations.
18189  *
18190  * [`block_disconnected`]: Self::block_disconnected
18191  */
18192 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);
18193
18194 /**
18195  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
18196  * [`block_connected`] for details.
18197  *
18198  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
18199  * blocks. See [`chain::Confirm`] for calling expectations.
18200  *
18201  * [`block_connected`]: Self::block_connected
18202  */
18203 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);
18204
18205 /**
18206  * Returns the set of txids that should be monitored for re-organization out of the chain.
18207  */
18208 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18209
18210 /**
18211  * Gets the latest best block which was connected either via the [`chain::Listen`] or
18212  * [`chain::Confirm`] interfaces.
18213  */
18214 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18215
18216 /**
18217  * Gets the balances in this channel which are either claimable by us if we were to
18218  * force-close the channel now or which are claimable on-chain (possibly awaiting
18219  * confirmation).
18220  *
18221  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
18222  * included here until an [`Event::SpendableOutputs`] event has been generated for the
18223  * balance, or until our counterparty has claimed the balance and accrued several
18224  * confirmations on the claim transaction.
18225  *
18226  * Note that the balances available when you or your counterparty have broadcasted revoked
18227  * state(s) may not be fully captured here.
18228  *
18229  * See [`Balance`] for additional details on the types of claimable balances which
18230  * may be returned here and their meanings.
18231  */
18232 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18233
18234 /**
18235  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
18236  */
18237 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
18238
18239 /**
18240  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
18241  */
18242 void OutPoint_free(struct LDKOutPoint this_obj);
18243
18244 /**
18245  * The referenced transaction's txid.
18246  */
18247 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
18248
18249 /**
18250  * The referenced transaction's txid.
18251  */
18252 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18253
18254 /**
18255  * The index of the referenced output in its transaction's vout.
18256  */
18257 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
18258
18259 /**
18260  * The index of the referenced output in its transaction's vout.
18261  */
18262 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
18263
18264 /**
18265  * Constructs a new OutPoint given each field
18266  */
18267 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
18268
18269 /**
18270  * Creates a copy of the OutPoint
18271  */
18272 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
18273
18274 /**
18275  * Checks if two OutPoints contain equal inner contents.
18276  * This ignores pointers and is_owned flags and looks at the values in fields.
18277  * Two objects with NULL inner values will be considered "equal" here.
18278  */
18279 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
18280
18281 /**
18282  * Checks if two OutPoints contain equal inner contents.
18283  */
18284 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
18285
18286 /**
18287  * Convert an `OutPoint` to a lightning channel id.
18288  */
18289 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
18290
18291 /**
18292  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
18293  */
18294 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
18295
18296 /**
18297  * Read a OutPoint from a byte array, created by OutPoint_write
18298  */
18299 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
18300
18301 /**
18302  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
18303  */
18304 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
18305
18306 /**
18307  * The outpoint which is spendable
18308  */
18309 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18310
18311 /**
18312  * The outpoint which is spendable
18313  */
18314 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18315
18316 /**
18317  * Per commitment point to derive delayed_payment_key by key holder
18318  */
18319 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18320
18321 /**
18322  * Per commitment point to derive delayed_payment_key by key holder
18323  */
18324 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18325
18326 /**
18327  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
18328  * the witness_script.
18329  */
18330 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18331
18332 /**
18333  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
18334  * the witness_script.
18335  */
18336 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
18337
18338 /**
18339  * The output which is referenced by the given outpoint
18340  */
18341 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
18342
18343 /**
18344  * The revocation point specific to the commitment transaction which was broadcast. Used to
18345  * derive the witnessScript for this output.
18346  */
18347 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18348
18349 /**
18350  * The revocation point specific to the commitment transaction which was broadcast. Used to
18351  * derive the witnessScript for this output.
18352  */
18353 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18354
18355 /**
18356  * Arbitrary identification information returned by a call to
18357  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18358  * the channel to spend the output.
18359  */
18360 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
18361
18362 /**
18363  * Arbitrary identification information returned by a call to
18364  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18365  * the channel to spend the output.
18366  */
18367 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18368
18369 /**
18370  * The value of the channel which this output originated from, possibly indirectly.
18371  */
18372 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18373
18374 /**
18375  * The value of the channel which this output originated from, possibly indirectly.
18376  */
18377 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
18378
18379 /**
18380  * Constructs a new DelayedPaymentOutputDescriptor given each field
18381  */
18382 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);
18383
18384 /**
18385  * Creates a copy of the DelayedPaymentOutputDescriptor
18386  */
18387 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
18388
18389 /**
18390  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
18391  */
18392 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
18393
18394 /**
18395  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
18396  */
18397 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
18398
18399 /**
18400  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
18401  */
18402 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
18403
18404 /**
18405  * The outpoint which is spendable
18406  */
18407 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18408
18409 /**
18410  * The outpoint which is spendable
18411  */
18412 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18413
18414 /**
18415  * The output which is referenced by the given outpoint
18416  */
18417 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
18418
18419 /**
18420  * Arbitrary identification information returned by a call to
18421  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18422  * the channel to spend the output.
18423  */
18424 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
18425
18426 /**
18427  * Arbitrary identification information returned by a call to
18428  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18429  * the channel to spend the output.
18430  */
18431 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18432
18433 /**
18434  * The value of the channel which this transactions spends.
18435  */
18436 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18437
18438 /**
18439  * The value of the channel which this transactions spends.
18440  */
18441 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
18442
18443 /**
18444  * Constructs a new StaticPaymentOutputDescriptor given each field
18445  */
18446 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);
18447
18448 /**
18449  * Creates a copy of the StaticPaymentOutputDescriptor
18450  */
18451 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
18452
18453 /**
18454  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
18455  */
18456 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
18457
18458 /**
18459  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
18460  */
18461 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
18462
18463 /**
18464  * Frees any resources used by the SpendableOutputDescriptor
18465  */
18466 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
18467
18468 /**
18469  * Creates a copy of the SpendableOutputDescriptor
18470  */
18471 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
18472
18473 /**
18474  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
18475  */
18476 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
18477
18478 /**
18479  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
18480  */
18481 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
18482
18483 /**
18484  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
18485  */
18486 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
18487
18488 /**
18489  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
18490  */
18491 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
18492
18493 /**
18494  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
18495  */
18496 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
18497
18498 /**
18499  * Calls the free function if one is set
18500  */
18501 void BaseSign_free(struct LDKBaseSign this_ptr);
18502
18503 /**
18504  * Creates a copy of a Sign
18505  */
18506 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
18507
18508 /**
18509  * Calls the free function if one is set
18510  */
18511 void Sign_free(struct LDKSign this_ptr);
18512
18513 /**
18514  * Creates a copy of the Recipient
18515  */
18516 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
18517
18518 /**
18519  * Utility method to constructs a new Node-variant Recipient
18520  */
18521 enum LDKRecipient Recipient_node(void);
18522
18523 /**
18524  * Utility method to constructs a new PhantomNode-variant Recipient
18525  */
18526 enum LDKRecipient Recipient_phantom_node(void);
18527
18528 /**
18529  * Calls the free function if one is set
18530  */
18531 void KeysInterface_free(struct LDKKeysInterface this_ptr);
18532
18533 /**
18534  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
18535  */
18536 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
18537
18538 /**
18539  * Private key of anchor tx
18540  */
18541 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18542
18543 /**
18544  * Private key of anchor tx
18545  */
18546 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18547
18548 /**
18549  * Holder secret key for blinded revocation pubkey
18550  */
18551 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18552
18553 /**
18554  * Holder secret key for blinded revocation pubkey
18555  */
18556 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18557
18558 /**
18559  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
18560  */
18561 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18562
18563 /**
18564  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
18565  */
18566 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18567
18568 /**
18569  * Holder secret key used in HTLC tx
18570  */
18571 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18572
18573 /**
18574  * Holder secret key used in HTLC tx
18575  */
18576 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18577
18578 /**
18579  * Holder htlc secret key used in commitment tx htlc outputs
18580  */
18581 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18582
18583 /**
18584  * Holder htlc secret key used in commitment tx htlc outputs
18585  */
18586 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18587
18588 /**
18589  * Commitment seed
18590  */
18591 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18592
18593 /**
18594  * Commitment seed
18595  */
18596 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18597
18598 /**
18599  * Creates a copy of the InMemorySigner
18600  */
18601 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
18602
18603 /**
18604  * Create a new InMemorySigner
18605  */
18606 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);
18607
18608 /**
18609  * Counterparty pubkeys.
18610  * Will panic if ready_channel wasn't called.
18611  */
18612 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18613
18614 /**
18615  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
18616  * transactions, ie the amount of time that we have to wait to recover our funds if we
18617  * broadcast a transaction.
18618  * Will panic if ready_channel wasn't called.
18619  */
18620 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18621
18622 /**
18623  * The contest_delay value specified by us and applied on transactions broadcastable
18624  * by our counterparty, ie the amount of time that they have to wait to recover their funds
18625  * if they broadcast a transaction.
18626  * Will panic if ready_channel wasn't called.
18627  */
18628 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18629
18630 /**
18631  * Whether the holder is the initiator
18632  * Will panic if ready_channel wasn't called.
18633  */
18634 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18635
18636 /**
18637  * Funding outpoint
18638  * Will panic if ready_channel wasn't called.
18639  */
18640 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18641
18642 /**
18643  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
18644  * building transactions.
18645  *
18646  * Will panic if ready_channel wasn't called.
18647  */
18648 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18649
18650 /**
18651  * Whether anchors should be used.
18652  * Will panic if ready_channel wasn't called.
18653  */
18654 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18655
18656 /**
18657  * Sign the single input of spend_tx at index `input_idx` which spends the output
18658  * described by descriptor, returning the witness stack for the input.
18659  *
18660  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
18661  * is not spending the outpoint described by `descriptor.outpoint`,
18662  * or if an output descriptor script_pubkey does not match the one we can spend.
18663  */
18664 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);
18665
18666 /**
18667  * Sign the single input of spend_tx at index `input_idx` which spends the output
18668  * described by descriptor, returning the witness stack for the input.
18669  *
18670  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
18671  * is not spending the outpoint described by `descriptor.outpoint`, does not have a
18672  * sequence set to `descriptor.to_self_delay`, or if an output descriptor
18673  * script_pubkey does not match the one we can spend.
18674  */
18675 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);
18676
18677 /**
18678  * Constructs a new BaseSign which calls the relevant methods on this_arg.
18679  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
18680  */
18681 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18682
18683 /**
18684  * Constructs a new Sign which calls the relevant methods on this_arg.
18685  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
18686  */
18687 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18688
18689 /**
18690  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
18691  */
18692 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
18693
18694 /**
18695  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
18696  */
18697 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
18698
18699 /**
18700  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
18701  */
18702 void KeysManager_free(struct LDKKeysManager this_obj);
18703
18704 /**
18705  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
18706  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
18707  * starting_time isn't strictly required to actually be a time, but it must absolutely,
18708  * without a doubt, be unique to this instance. ie if you start multiple times with the same
18709  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
18710  * simply use the current time (with very high precision).
18711  *
18712  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
18713  * obviously, starting_time should be unique every time you reload the library - it is only
18714  * used to generate new ephemeral key data (which will be stored by the individual channel if
18715  * necessary).
18716  *
18717  * Note that the seed is required to recover certain on-chain funds independent of
18718  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
18719  * channel, and some on-chain during-closing funds.
18720  *
18721  * Note that until the 0.1 release there is no guarantee of backward compatibility between
18722  * versions. Once the library is more fully supported, the docs will be updated to include a
18723  * detailed description of the guarantee.
18724  */
18725 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
18726
18727 /**
18728  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
18729  *
18730  * Key derivation parameters are accessible through a per-channel secrets
18731  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
18732  * onchain output detection for which a corresponding delayed_payment_key must be derived.
18733  */
18734 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]);
18735
18736 /**
18737  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
18738  * output to the given change destination (if sufficient change value remains). The
18739  * transaction will have a feerate, at least, of the given value.
18740  *
18741  * Returns `Err(())` if the output value is greater than the input value minus required fee,
18742  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
18743  * does not match the one we can spend.
18744  *
18745  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
18746  *
18747  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
18748  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
18749  */
18750 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);
18751
18752 /**
18753  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
18754  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
18755  */
18756 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
18757
18758 /**
18759  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
18760  */
18761 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
18762
18763 /**
18764  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
18765  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
18766  */
18767 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
18768
18769 /**
18770  * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
18771  * that is shared across all nodes that intend to participate in [phantom node payments] together.
18772  *
18773  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
18774  * `starting_time_nanos`.
18775  *
18776  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
18777  * same across restarts, or else inbound payments may fail.
18778  *
18779  * [phantom node payments]: PhantomKeysManager
18780  */
18781 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]);
18782
18783 /**
18784  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
18785  */
18786 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);
18787
18788 /**
18789  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
18790  */
18791 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]);
18792
18793 /**
18794  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
18795  */
18796 void ChannelManager_free(struct LDKChannelManager this_obj);
18797
18798 /**
18799  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
18800  */
18801 void ChainParameters_free(struct LDKChainParameters this_obj);
18802
18803 /**
18804  * The network for determining the `chain_hash` in Lightning messages.
18805  */
18806 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
18807
18808 /**
18809  * The network for determining the `chain_hash` in Lightning messages.
18810  */
18811 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
18812
18813 /**
18814  * The hash and height of the latest block successfully connected.
18815  *
18816  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
18817  */
18818 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
18819
18820 /**
18821  * The hash and height of the latest block successfully connected.
18822  *
18823  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
18824  */
18825 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
18826
18827 /**
18828  * Constructs a new ChainParameters given each field
18829  */
18830 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
18831
18832 /**
18833  * Creates a copy of the ChainParameters
18834  */
18835 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
18836
18837 /**
18838  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
18839  */
18840 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
18841
18842 /**
18843  * Base routing fee in millisatoshis.
18844  */
18845 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
18846
18847 /**
18848  * Base routing fee in millisatoshis.
18849  */
18850 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
18851
18852 /**
18853  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
18854  */
18855 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
18856
18857 /**
18858  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
18859  */
18860 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
18861
18862 /**
18863  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
18864  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
18865  * `cltv_expiry_delta` for more details.
18866  */
18867 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
18868
18869 /**
18870  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
18871  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
18872  * `cltv_expiry_delta` for more details.
18873  */
18874 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
18875
18876 /**
18877  * Constructs a new CounterpartyForwardingInfo given each field
18878  */
18879 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);
18880
18881 /**
18882  * Creates a copy of the CounterpartyForwardingInfo
18883  */
18884 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
18885
18886 /**
18887  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
18888  */
18889 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
18890
18891 /**
18892  * The node_id of our counterparty
18893  */
18894 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18895
18896 /**
18897  * The node_id of our counterparty
18898  */
18899 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18900
18901 /**
18902  * The Features the channel counterparty provided upon last connection.
18903  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
18904  * many routing-relevant features are present in the init context.
18905  */
18906 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18907
18908 /**
18909  * The Features the channel counterparty provided upon last connection.
18910  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
18911  * many routing-relevant features are present in the init context.
18912  */
18913 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
18914
18915 /**
18916  * The value, in satoshis, that must always be held in the channel for our counterparty. This
18917  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
18918  * claiming at least this value on chain.
18919  *
18920  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
18921  *
18922  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
18923  */
18924 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18925
18926 /**
18927  * The value, in satoshis, that must always be held in the channel for our counterparty. This
18928  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
18929  * claiming at least this value on chain.
18930  *
18931  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
18932  *
18933  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
18934  */
18935 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
18936
18937 /**
18938  * Information on the fees and requirements that the counterparty requires when forwarding
18939  * payments to us through this channel.
18940  *
18941  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18942  */
18943 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18944
18945 /**
18946  * Information on the fees and requirements that the counterparty requires when forwarding
18947  * payments to us through this channel.
18948  *
18949  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18950  */
18951 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
18952
18953 /**
18954  * Constructs a new ChannelCounterparty given each field
18955  */
18956 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);
18957
18958 /**
18959  * Creates a copy of the ChannelCounterparty
18960  */
18961 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
18962
18963 /**
18964  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
18965  */
18966 void ChannelDetails_free(struct LDKChannelDetails this_obj);
18967
18968 /**
18969  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
18970  * thereafter this is the txid of the funding transaction xor the funding transaction output).
18971  * Note that this means this value is *not* persistent - it can change once during the
18972  * lifetime of the channel.
18973  */
18974 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
18975
18976 /**
18977  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
18978  * thereafter this is the txid of the funding transaction xor the funding transaction output).
18979  * Note that this means this value is *not* persistent - it can change once during the
18980  * lifetime of the channel.
18981  */
18982 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18983
18984 /**
18985  * Parameters which apply to our counterparty. See individual fields for more information.
18986  */
18987 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18988
18989 /**
18990  * Parameters which apply to our counterparty. See individual fields for more information.
18991  */
18992 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
18993
18994 /**
18995  * The Channel's funding transaction output, if we've negotiated the funding transaction with
18996  * our counterparty already.
18997  *
18998  * Note that, if this has been set, `channel_id` will be equivalent to
18999  * `funding_txo.unwrap().to_channel_id()`.
19000  *
19001  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19002  */
19003 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19004
19005 /**
19006  * The Channel's funding transaction output, if we've negotiated the funding transaction with
19007  * our counterparty already.
19008  *
19009  * Note that, if this has been set, `channel_id` will be equivalent to
19010  * `funding_txo.unwrap().to_channel_id()`.
19011  *
19012  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19013  */
19014 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19015
19016 /**
19017  * The features which this channel operates with. See individual features for more info.
19018  *
19019  * `None` until negotiation completes and the channel type is finalized.
19020  *
19021  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19022  */
19023 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19024
19025 /**
19026  * The features which this channel operates with. See individual features for more info.
19027  *
19028  * `None` until negotiation completes and the channel type is finalized.
19029  *
19030  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19031  */
19032 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
19033
19034 /**
19035  * The position of the funding transaction in the chain. None if the funding transaction has
19036  * not yet been confirmed and the channel fully opened.
19037  *
19038  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
19039  * payments instead of this. See [`get_inbound_payment_scid`].
19040  *
19041  * [`inbound_scid_alias`]: Self::inbound_scid_alias
19042  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
19043  */
19044 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19045
19046 /**
19047  * The position of the funding transaction in the chain. None if the funding transaction has
19048  * not yet been confirmed and the channel fully opened.
19049  *
19050  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
19051  * payments instead of this. See [`get_inbound_payment_scid`].
19052  *
19053  * [`inbound_scid_alias`]: Self::inbound_scid_alias
19054  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
19055  */
19056 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19057
19058 /**
19059  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
19060  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
19061  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
19062  * when they see a payment to be routed to us.
19063  *
19064  * Our counterparty may choose to rotate this value at any time, though will always recognize
19065  * previous values for inbound payment forwarding.
19066  *
19067  * [`short_channel_id`]: Self::short_channel_id
19068  */
19069 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19070
19071 /**
19072  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
19073  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
19074  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
19075  * when they see a payment to be routed to us.
19076  *
19077  * Our counterparty may choose to rotate this value at any time, though will always recognize
19078  * previous values for inbound payment forwarding.
19079  *
19080  * [`short_channel_id`]: Self::short_channel_id
19081  */
19082 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19083
19084 /**
19085  * The value, in satoshis, of this channel as appears in the funding output
19086  */
19087 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19088
19089 /**
19090  * The value, in satoshis, of this channel as appears in the funding output
19091  */
19092 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19093
19094 /**
19095  * The value, in satoshis, that must always be held in the channel for us. This value ensures
19096  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
19097  * this value on chain.
19098  *
19099  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
19100  *
19101  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19102  *
19103  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
19104  */
19105 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19106
19107 /**
19108  * The value, in satoshis, that must always be held in the channel for us. This value ensures
19109  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
19110  * this value on chain.
19111  *
19112  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
19113  *
19114  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19115  *
19116  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
19117  */
19118 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19119
19120 /**
19121  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
19122  */
19123 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19124
19125 /**
19126  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
19127  */
19128 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19129
19130 /**
19131  * Our total balance.  This is the amount we would get if we close the channel.
19132  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
19133  * amount is not likely to be recoverable on close.
19134  *
19135  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
19136  * balance is not available for inclusion in new outbound HTLCs). This further does not include
19137  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
19138  * This does not consider any on-chain fees.
19139  *
19140  * See also [`ChannelDetails::outbound_capacity_msat`]
19141  */
19142 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19143
19144 /**
19145  * Our total balance.  This is the amount we would get if we close the channel.
19146  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
19147  * amount is not likely to be recoverable on close.
19148  *
19149  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
19150  * balance is not available for inclusion in new outbound HTLCs). This further does not include
19151  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
19152  * This does not consider any on-chain fees.
19153  *
19154  * See also [`ChannelDetails::outbound_capacity_msat`]
19155  */
19156 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19157
19158 /**
19159  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
19160  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19161  * available for inclusion in new outbound HTLCs). This further does not include any pending
19162  * outgoing HTLCs which are awaiting some other resolution to be sent.
19163  *
19164  * See also [`ChannelDetails::balance_msat`]
19165  *
19166  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19167  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
19168  * should be able to spend nearly this amount.
19169  */
19170 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19171
19172 /**
19173  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
19174  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19175  * available for inclusion in new outbound HTLCs). This further does not include any pending
19176  * outgoing HTLCs which are awaiting some other resolution to be sent.
19177  *
19178  * See also [`ChannelDetails::balance_msat`]
19179  *
19180  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19181  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
19182  * should be able to spend nearly this amount.
19183  */
19184 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19185
19186 /**
19187  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
19188  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19189  * available for inclusion in new inbound HTLCs).
19190  * Note that there are some corner cases not fully handled here, so the actual available
19191  * inbound capacity may be slightly higher than this.
19192  *
19193  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19194  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
19195  * However, our counterparty should be able to spend nearly this amount.
19196  */
19197 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19198
19199 /**
19200  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
19201  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19202  * available for inclusion in new inbound HTLCs).
19203  * Note that there are some corner cases not fully handled here, so the actual available
19204  * inbound capacity may be slightly higher than this.
19205  *
19206  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19207  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
19208  * However, our counterparty should be able to spend nearly this amount.
19209  */
19210 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19211
19212 /**
19213  * The number of required confirmations on the funding transaction before the funding will be
19214  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
19215  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
19216  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
19217  * [`ChannelHandshakeLimits::max_minimum_depth`].
19218  *
19219  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19220  *
19221  * [`is_outbound`]: ChannelDetails::is_outbound
19222  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
19223  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
19224  */
19225 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19226
19227 /**
19228  * The number of required confirmations on the funding transaction before the funding will be
19229  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
19230  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
19231  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
19232  * [`ChannelHandshakeLimits::max_minimum_depth`].
19233  *
19234  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19235  *
19236  * [`is_outbound`]: ChannelDetails::is_outbound
19237  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
19238  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
19239  */
19240 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
19241
19242 /**
19243  * The number of blocks (after our commitment transaction confirms) that we will need to wait
19244  * until we can claim our funds after we force-close the channel. During this time our
19245  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
19246  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
19247  * time to claim our non-HTLC-encumbered funds.
19248  *
19249  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19250  */
19251 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19252
19253 /**
19254  * The number of blocks (after our commitment transaction confirms) that we will need to wait
19255  * until we can claim our funds after we force-close the channel. During this time our
19256  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
19257  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
19258  * time to claim our non-HTLC-encumbered funds.
19259  *
19260  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19261  */
19262 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
19263
19264 /**
19265  * True if the channel was initiated (and thus funded) by us.
19266  */
19267 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19268
19269 /**
19270  * True if the channel was initiated (and thus funded) by us.
19271  */
19272 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19273
19274 /**
19275  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
19276  * channel is not currently being shut down. `funding_locked` message exchange implies the
19277  * required confirmation count has been reached (and we were connected to the peer at some
19278  * point after the funding transaction received enough confirmations). The required
19279  * confirmation count is provided in [`confirmations_required`].
19280  *
19281  * [`confirmations_required`]: ChannelDetails::confirmations_required
19282  */
19283 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19284
19285 /**
19286  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
19287  * channel is not currently being shut down. `funding_locked` message exchange implies the
19288  * required confirmation count has been reached (and we were connected to the peer at some
19289  * point after the funding transaction received enough confirmations). The required
19290  * confirmation count is provided in [`confirmations_required`].
19291  *
19292  * [`confirmations_required`]: ChannelDetails::confirmations_required
19293  */
19294 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19295
19296 /**
19297  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
19298  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
19299  *
19300  * This is a strict superset of `is_funding_locked`.
19301  */
19302 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19303
19304 /**
19305  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
19306  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
19307  *
19308  * This is a strict superset of `is_funding_locked`.
19309  */
19310 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19311
19312 /**
19313  * True if this channel is (or will be) publicly-announced.
19314  */
19315 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19316
19317 /**
19318  * True if this channel is (or will be) publicly-announced.
19319  */
19320 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19321
19322 /**
19323  * Constructs a new ChannelDetails given each field
19324  */
19325 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t 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);
19326
19327 /**
19328  * Creates a copy of the ChannelDetails
19329  */
19330 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
19331
19332 /**
19333  * Gets the current SCID which should be used to identify this channel for inbound payments.
19334  * This should be used for providing invoice hints or in any other context where our
19335  * counterparty will forward a payment to us.
19336  *
19337  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
19338  * [`ChannelDetails::short_channel_id`]. See those for more information.
19339  */
19340 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
19341
19342 /**
19343  * Frees any resources used by the PaymentSendFailure
19344  */
19345 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
19346
19347 /**
19348  * Creates a copy of the PaymentSendFailure
19349  */
19350 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
19351
19352 /**
19353  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
19354  */
19355 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
19356
19357 /**
19358  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
19359  */
19360 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
19361
19362 /**
19363  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
19364  */
19365 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
19366
19367 /**
19368  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
19369  */
19370 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
19371
19372 /**
19373  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
19374  */
19375 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
19376
19377 /**
19378  * The list of channels to be included in the invoice route hints.
19379  */
19380 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19381
19382 /**
19383  * The list of channels to be included in the invoice route hints.
19384  */
19385 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
19386
19387 /**
19388  * A fake scid used for representing the phantom node's fake channel in generating the invoice
19389  * route hints.
19390  */
19391 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19392
19393 /**
19394  * A fake scid used for representing the phantom node's fake channel in generating the invoice
19395  * route hints.
19396  */
19397 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
19398
19399 /**
19400  * The pubkey of the real backing node that would ultimately receive the payment.
19401  */
19402 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19403
19404 /**
19405  * The pubkey of the real backing node that would ultimately receive the payment.
19406  */
19407 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19408
19409 /**
19410  * Constructs a new PhantomRouteHints given each field
19411  */
19412 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
19413
19414 /**
19415  * Creates a copy of the PhantomRouteHints
19416  */
19417 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
19418
19419 /**
19420  * Constructs a new ChannelManager to hold several channels and route between them.
19421  *
19422  * This is the main \"logic hub\" for all channel-related actions, and implements
19423  * ChannelMessageHandler.
19424  *
19425  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
19426  *
19427  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
19428  *
19429  * Users need to notify the new ChannelManager when a new block is connected or
19430  * disconnected using its `block_connected` and `block_disconnected` methods, starting
19431  * from after `params.latest_hash`.
19432  */
19433 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);
19434
19435 /**
19436  * Gets the current configuration applied to all new channels,  as
19437  */
19438 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
19439
19440 /**
19441  * Creates a new outbound channel to the given remote node and with the given value.
19442  *
19443  * `user_channel_id` will be provided back as in
19444  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
19445  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
19446  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
19447  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
19448  * ignored.
19449  *
19450  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
19451  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
19452  *
19453  * Note that we do not check if you are currently connected to the given peer. If no
19454  * connection is available, the outbound `open_channel` message may fail to send, resulting in
19455  * the channel eventually being silently forgotten (dropped on reload).
19456  *
19457  * Returns the new Channel's temporary `channel_id`. This ID will appear as
19458  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
19459  * [`ChannelDetails::channel_id`] until after
19460  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
19461  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
19462  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
19463  *
19464  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
19465  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
19466  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
19467  *
19468  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
19469  */
19470 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);
19471
19472 /**
19473  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
19474  * more information.
19475  */
19476 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19477
19478 /**
19479  * Gets the list of usable channels, in random order. Useful as an argument to
19480  * get_route to ensure non-announced channels are used.
19481  *
19482  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
19483  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
19484  * are.
19485  */
19486 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19487
19488 /**
19489  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
19490  * will be accepted on the given channel, and after additional timeout/the closing of all
19491  * pending HTLCs, the channel will be closed on chain.
19492  *
19493  *  * If we are the channel initiator, we will pay between our [`Background`] and
19494  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
19495  *    estimate.
19496  *  * If our counterparty is the channel initiator, we will require a channel closing
19497  *    transaction feerate of at least our [`Background`] feerate or the feerate which
19498  *    would appear on a force-closure transaction, whichever is lower. We will allow our
19499  *    counterparty to pay as much fee as they'd like, however.
19500  *
19501  * May generate a SendShutdown message event on success, which should be relayed.
19502  *
19503  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
19504  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
19505  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
19506  */
19507 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
19508
19509 /**
19510  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
19511  * will be accepted on the given channel, and after additional timeout/the closing of all
19512  * pending HTLCs, the channel will be closed on chain.
19513  *
19514  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
19515  * the channel being closed or not:
19516  *  * If we are the channel initiator, we will pay at least this feerate on the closing
19517  *    transaction. The upper-bound is set by
19518  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
19519  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
19520  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
19521  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
19522  *    will appear on a force-closure transaction, whichever is lower).
19523  *
19524  * May generate a SendShutdown message event on success, which should be relayed.
19525  *
19526  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
19527  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
19528  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
19529  */
19530 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);
19531
19532 /**
19533  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
19534  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
19535  */
19536 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
19537
19538 /**
19539  * Force close all channels, immediately broadcasting the latest local commitment transaction
19540  * for each to the chain and rejecting new HTLCs on each.
19541  */
19542 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19543
19544 /**
19545  * Sends a payment along a given route.
19546  *
19547  * Value parameters are provided via the last hop in route, see documentation for RouteHop
19548  * fields for more info.
19549  *
19550  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
19551  * payment), we don't do anything to stop you! We always try to ensure that if the provided
19552  * next hop knows the preimage to payment_hash they can claim an additional amount as
19553  * specified in the last hop in the route! Thus, you should probably do your own
19554  * payment_preimage tracking (which you should already be doing as they represent \"proof of
19555  * payment\") and prevent double-sends yourself.
19556  *
19557  * May generate SendHTLCs message(s) event on success, which should be relayed.
19558  *
19559  * Each path may have a different return value, and PaymentSendValue may return a Vec with
19560  * each entry matching the corresponding-index entry in the route paths, see
19561  * PaymentSendFailure for more info.
19562  *
19563  * In general, a path may raise:
19564  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
19565  *    node public key) is specified.
19566  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
19567  *    (including due to previous monitor update failure or new permanent monitor update
19568  *    failure).
19569  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
19570  *    relevant updates.
19571  *
19572  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
19573  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
19574  * different route unless you intend to pay twice!
19575  *
19576  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
19577  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
19578  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
19579  * must not contain multiple paths as multi-path payments require a recipient-provided
19580  * payment_secret.
19581  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
19582  * bit set (either as required or as available). If multiple paths are present in the Route,
19583  * we assume the invoice had the basic_mpp feature set.
19584  *
19585  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
19586  */
19587 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);
19588
19589 /**
19590  * Retries a payment along the given [`Route`].
19591  *
19592  * Errors returned are a superset of those returned from [`send_payment`], so see
19593  * [`send_payment`] documentation for more details on errors. This method will also error if the
19594  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
19595  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
19596  * further retries have been disabled with [`abandon_payment`].
19597  *
19598  * [`send_payment`]: [`ChannelManager::send_payment`]
19599  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
19600  */
19601 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);
19602
19603 /**
19604  * Signals that no further retries for the given payment will occur.
19605  *
19606  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
19607  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
19608  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
19609  * pending HTLCs for this payment.
19610  *
19611  * Note that calling this method does *not* prevent a payment from succeeding. You must still
19612  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
19613  * determine the ultimate status of a payment.
19614  *
19615  * [`retry_payment`]: Self::retry_payment
19616  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
19617  * [`Event::PaymentSent`]: events::Event::PaymentSent
19618  */
19619 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
19620
19621 /**
19622  * Send a spontaneous payment, which is a payment that does not require the recipient to have
19623  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
19624  * the preimage, it must be a cryptographically secure random value that no intermediate node
19625  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
19626  * never reach the recipient.
19627  *
19628  * See [`send_payment`] documentation for more details on the return value of this function.
19629  *
19630  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
19631  * [`send_payment`] for more information about the risks of duplicate preimage usage.
19632  *
19633  * Note that `route` must have exactly one path.
19634  *
19635  * [`send_payment`]: Self::send_payment
19636  *
19637  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
19638  */
19639 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);
19640
19641 /**
19642  * Call this upon creation of a funding transaction for the given channel.
19643  *
19644  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
19645  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
19646  *
19647  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
19648  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
19649  *
19650  * May panic if the output found in the funding transaction is duplicative with some other
19651  * channel (note that this should be trivially prevented by using unique funding transaction
19652  * keys per-channel).
19653  *
19654  * Do NOT broadcast the funding transaction yourself. When we have safely received our
19655  * counterparty's signature the funding transaction will automatically be broadcast via the
19656  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
19657  *
19658  * Note that this includes RBF or similar transaction replacement strategies - lightning does
19659  * not currently support replacing a funding transaction on an existing channel. Instead,
19660  * create a new channel with a conflicting funding transaction.
19661  *
19662  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
19663  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
19664  */
19665 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);
19666
19667 /**
19668  * Regenerates channel_announcements and generates a signed node_announcement from the given
19669  * arguments, providing them in corresponding events via
19670  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
19671  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
19672  * announcement to ensure that the lightning P2P network is aware of the channels we have and
19673  * our network addresses.
19674  *
19675  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
19676  * node to humans. They carry no in-protocol meaning.
19677  *
19678  * `addresses` represent the set (possibly empty) of socket addresses on which this node
19679  * accepts incoming connections. These will be included in the node_announcement, publicly
19680  * tying these addresses together and to this node. If you wish to preserve user privacy,
19681  * addresses should likely contain only Tor Onion addresses.
19682  *
19683  * Panics if `addresses` is absurdly large (more than 500).
19684  *
19685  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
19686  */
19687 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
19688
19689 /**
19690  * Processes HTLCs which are pending waiting on random forward delay.
19691  *
19692  * Should only really ever be called in response to a PendingHTLCsForwardable event.
19693  * Will likely generate further events.
19694  */
19695 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
19696
19697 /**
19698  * Performs actions which should happen on startup and roughly once per minute thereafter.
19699  *
19700  * This currently includes:
19701  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
19702  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
19703  *    than a minute, informing the network that they should no longer attempt to route over
19704  *    the channel.
19705  *
19706  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
19707  * estimate fetches.
19708  */
19709 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
19710
19711 /**
19712  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
19713  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
19714  * along the path (including in our own channel on which we received it).
19715  * Returns false if no payment was found to fail backwards, true if the process of failing the
19716  * HTLC backwards has been started.
19717  */
19718 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
19719
19720 /**
19721  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
19722  * [`MessageSendEvent`]s needed to claim the payment.
19723  *
19724  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
19725  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
19726  * event matches your expectation. If you fail to do so and call this method, you may provide
19727  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
19728  *
19729  * Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now
19730  * pending for processing via [`get_and_clear_pending_msg_events`].
19731  *
19732  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
19733  * [`create_inbound_payment`]: Self::create_inbound_payment
19734  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19735  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
19736  */
19737 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
19738
19739 /**
19740  * Gets the node_id held by this ChannelManager
19741  */
19742 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
19743
19744 /**
19745  * Called to accept a request to open a channel after [`Event::OpenChannelRequest`] has been
19746  * triggered.
19747  *
19748  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted.
19749  *
19750  * For inbound channels, the `user_channel_id` parameter will be provided back in
19751  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
19752  * with which `accept_inbound_channel` call.
19753  *
19754  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
19755  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
19756  */
19757 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], uint64_t user_channel_id);
19758
19759 /**
19760  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
19761  * to pay us.
19762  *
19763  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
19764  * [`PaymentHash`] and [`PaymentPreimage`] for you.
19765  *
19766  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
19767  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
19768  * passed directly to [`claim_funds`].
19769  *
19770  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
19771  *
19772  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
19773  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
19774  *
19775  * # Note
19776  *
19777  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
19778  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
19779  *
19780  * Errors if `min_value_msat` is greater than total bitcoin supply.
19781  *
19782  * [`claim_funds`]: Self::claim_funds
19783  * [`PaymentReceived`]: events::Event::PaymentReceived
19784  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
19785  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19786  */
19787 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);
19788
19789 /**
19790  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
19791  * serialized state with LDK node(s) running 0.0.103 and earlier.
19792  *
19793  * May panic if `invoice_expiry_delta_secs` is greater than one year.
19794  *
19795  * # Note
19796  * This method is deprecated and will be removed soon.
19797  *
19798  * [`create_inbound_payment`]: Self::create_inbound_payment
19799  */
19800 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);
19801
19802 /**
19803  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
19804  * stored external to LDK.
19805  *
19806  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
19807  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
19808  * the `min_value_msat` provided here, if one is provided.
19809  *
19810  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
19811  * note that LDK will not stop you from registering duplicate payment hashes for inbound
19812  * payments.
19813  *
19814  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
19815  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
19816  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
19817  * sender \"proof-of-payment\" unless they have paid the required amount.
19818  *
19819  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
19820  * in excess of the current time. This should roughly match the expiry time set in the invoice.
19821  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
19822  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
19823  * invoices when no timeout is set.
19824  *
19825  * Note that we use block header time to time-out pending inbound payments (with some margin
19826  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
19827  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
19828  * If you need exact expiry semantics, you should enforce them upon receipt of
19829  * [`PaymentReceived`].
19830  *
19831  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
19832  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
19833  *
19834  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
19835  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
19836  *
19837  * # Note
19838  *
19839  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
19840  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
19841  *
19842  * Errors if `min_value_msat` is greater than total bitcoin supply.
19843  *
19844  * [`create_inbound_payment`]: Self::create_inbound_payment
19845  * [`PaymentReceived`]: events::Event::PaymentReceived
19846  */
19847 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);
19848
19849 /**
19850  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
19851  * serialized state with LDK node(s) running 0.0.103 and earlier.
19852  *
19853  * May panic if `invoice_expiry_delta_secs` is greater than one year.
19854  *
19855  * # Note
19856  * This method is deprecated and will be removed soon.
19857  *
19858  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19859  */
19860 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);
19861
19862 /**
19863  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
19864  * previously returned from [`create_inbound_payment`].
19865  *
19866  * [`create_inbound_payment`]: Self::create_inbound_payment
19867  */
19868 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);
19869
19870 /**
19871  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
19872  * are used when constructing the phantom invoice's route hints.
19873  *
19874  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
19875  */
19876 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
19877
19878 /**
19879  * Gets route hints for use in receiving [phantom node payments].
19880  *
19881  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
19882  */
19883 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
19884
19885 /**
19886  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
19887  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
19888  */
19889 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
19890
19891 /**
19892  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
19893  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
19894  */
19895 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
19896
19897 /**
19898  * Constructs a new Listen which calls the relevant methods on this_arg.
19899  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
19900  */
19901 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
19902
19903 /**
19904  * Constructs a new Confirm which calls the relevant methods on this_arg.
19905  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
19906  */
19907 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
19908
19909 /**
19910  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
19911  * indicating whether persistence is necessary. Only one listener on
19912  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
19913  * up.
19914  *
19915  * Note that this method is not available with the `no-std` feature.
19916  */
19917 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
19918
19919 /**
19920  * Blocks until ChannelManager needs to be persisted. Only one listener on
19921  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
19922  * up.
19923  */
19924 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
19925
19926 /**
19927  * Gets the latest best block which was connected either via the [`chain::Listen`] or
19928  * [`chain::Confirm`] interfaces.
19929  */
19930 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
19931
19932 /**
19933  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
19934  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
19935  */
19936 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
19937
19938 /**
19939  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
19940  */
19941 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
19942
19943 /**
19944  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
19945  */
19946 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
19947
19948 /**
19949  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
19950  */
19951 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
19952
19953 /**
19954  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
19955  */
19956 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
19957
19958 /**
19959  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
19960  */
19961 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
19962
19963 /**
19964  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
19965  */
19966 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
19967
19968 /**
19969  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
19970  */
19971 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
19972
19973 /**
19974  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
19975  */
19976 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
19977
19978 /**
19979  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
19980  */
19981 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
19982
19983 /**
19984  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
19985  */
19986 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
19987
19988 /**
19989  * The keys provider which will give us relevant keys. Some keys will be loaded during
19990  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
19991  * signing data.
19992  */
19993 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19994
19995 /**
19996  * The keys provider which will give us relevant keys. Some keys will be loaded during
19997  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
19998  * signing data.
19999  */
20000 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
20001
20002 /**
20003  * The fee_estimator for use in the ChannelManager in the future.
20004  *
20005  * No calls to the FeeEstimator will be made during deserialization.
20006  */
20007 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20008
20009 /**
20010  * The fee_estimator for use in the ChannelManager in the future.
20011  *
20012  * No calls to the FeeEstimator will be made during deserialization.
20013  */
20014 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
20015
20016 /**
20017  * The chain::Watch for use in the ChannelManager in the future.
20018  *
20019  * No calls to the chain::Watch will be made during deserialization. It is assumed that
20020  * you have deserialized ChannelMonitors separately and will add them to your
20021  * chain::Watch after deserializing this ChannelManager.
20022  */
20023 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20024
20025 /**
20026  * The chain::Watch for use in the ChannelManager in the future.
20027  *
20028  * No calls to the chain::Watch will be made during deserialization. It is assumed that
20029  * you have deserialized ChannelMonitors separately and will add them to your
20030  * chain::Watch after deserializing this ChannelManager.
20031  */
20032 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
20033
20034 /**
20035  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
20036  * used to broadcast the latest local commitment transactions of channels which must be
20037  * force-closed during deserialization.
20038  */
20039 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20040
20041 /**
20042  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
20043  * used to broadcast the latest local commitment transactions of channels which must be
20044  * force-closed during deserialization.
20045  */
20046 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
20047
20048 /**
20049  * The Logger for use in the ChannelManager and which may be used to log information during
20050  * deserialization.
20051  */
20052 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20053
20054 /**
20055  * The Logger for use in the ChannelManager and which may be used to log information during
20056  * deserialization.
20057  */
20058 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
20059
20060 /**
20061  * Default settings used for new channels. Any existing channels will continue to use the
20062  * runtime settings which were stored when the ChannelManager was serialized.
20063  */
20064 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20065
20066 /**
20067  * Default settings used for new channels. Any existing channels will continue to use the
20068  * runtime settings which were stored when the ChannelManager was serialized.
20069  */
20070 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
20071
20072 /**
20073  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
20074  * HashMap for you. This is primarily useful for C bindings where it is not practical to
20075  * populate a HashMap directly from C.
20076  */
20077 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);
20078
20079 /**
20080  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
20081  */
20082 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
20083
20084 /**
20085  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
20086  */
20087 void DecodeError_free(struct LDKDecodeError this_obj);
20088
20089 /**
20090  * Creates a copy of the DecodeError
20091  */
20092 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
20093
20094 /**
20095  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
20096  */
20097 void Init_free(struct LDKInit this_obj);
20098
20099 /**
20100  * The relevant features which the sender supports
20101  */
20102 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
20103
20104 /**
20105  * The relevant features which the sender supports
20106  */
20107 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
20108
20109 /**
20110  * The receipient's network address. This adds the option to report a remote IP address
20111  * back to a connecting peer using the init message. A node can decide to use that information
20112  * to discover a potential update to its public IPv4 address (NAT) and use
20113  * that for a node_announcement update message containing the new address.
20114  */
20115 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
20116
20117 /**
20118  * The receipient's network address. This adds the option to report a remote IP address
20119  * back to a connecting peer using the init message. A node can decide to use that information
20120  * to discover a potential update to its public IPv4 address (NAT) and use
20121  * that for a node_announcement update message containing the new address.
20122  */
20123 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
20124
20125 /**
20126  * Constructs a new Init given each field
20127  */
20128 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
20129
20130 /**
20131  * Creates a copy of the Init
20132  */
20133 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
20134
20135 /**
20136  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
20137  */
20138 void ErrorMessage_free(struct LDKErrorMessage this_obj);
20139
20140 /**
20141  * The channel ID involved in the error.
20142  *
20143  * All-0s indicates a general error unrelated to a specific channel, after which all channels
20144  * with the sending peer should be closed.
20145  */
20146 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
20147
20148 /**
20149  * The channel ID involved in the error.
20150  *
20151  * All-0s indicates a general error unrelated to a specific channel, after which all channels
20152  * with the sending peer should be closed.
20153  */
20154 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20155
20156 /**
20157  * A possibly human-readable error description.
20158  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20159  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20160  * the terminal emulator or the logging subsystem.
20161  */
20162 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
20163
20164 /**
20165  * A possibly human-readable error description.
20166  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20167  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20168  * the terminal emulator or the logging subsystem.
20169  */
20170 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
20171
20172 /**
20173  * Constructs a new ErrorMessage given each field
20174  */
20175 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
20176
20177 /**
20178  * Creates a copy of the ErrorMessage
20179  */
20180 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
20181
20182 /**
20183  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
20184  */
20185 void WarningMessage_free(struct LDKWarningMessage this_obj);
20186
20187 /**
20188  * The channel ID involved in the warning.
20189  *
20190  * All-0s indicates a warning unrelated to a specific channel.
20191  */
20192 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
20193
20194 /**
20195  * The channel ID involved in the warning.
20196  *
20197  * All-0s indicates a warning unrelated to a specific channel.
20198  */
20199 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20200
20201 /**
20202  * A possibly human-readable warning description.
20203  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20204  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20205  * the terminal emulator or the logging subsystem.
20206  */
20207 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
20208
20209 /**
20210  * A possibly human-readable warning description.
20211  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20212  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20213  * the terminal emulator or the logging subsystem.
20214  */
20215 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
20216
20217 /**
20218  * Constructs a new WarningMessage given each field
20219  */
20220 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
20221
20222 /**
20223  * Creates a copy of the WarningMessage
20224  */
20225 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
20226
20227 /**
20228  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
20229  */
20230 void Ping_free(struct LDKPing this_obj);
20231
20232 /**
20233  * The desired response length
20234  */
20235 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
20236
20237 /**
20238  * The desired response length
20239  */
20240 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
20241
20242 /**
20243  * The ping packet size.
20244  * This field is not sent on the wire. byteslen zeros are sent.
20245  */
20246 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
20247
20248 /**
20249  * The ping packet size.
20250  * This field is not sent on the wire. byteslen zeros are sent.
20251  */
20252 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
20253
20254 /**
20255  * Constructs a new Ping given each field
20256  */
20257 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
20258
20259 /**
20260  * Creates a copy of the Ping
20261  */
20262 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
20263
20264 /**
20265  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
20266  */
20267 void Pong_free(struct LDKPong this_obj);
20268
20269 /**
20270  * The pong packet size.
20271  * This field is not sent on the wire. byteslen zeros are sent.
20272  */
20273 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
20274
20275 /**
20276  * The pong packet size.
20277  * This field is not sent on the wire. byteslen zeros are sent.
20278  */
20279 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
20280
20281 /**
20282  * Constructs a new Pong given each field
20283  */
20284 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
20285
20286 /**
20287  * Creates a copy of the Pong
20288  */
20289 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
20290
20291 /**
20292  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
20293  */
20294 void OpenChannel_free(struct LDKOpenChannel this_obj);
20295
20296 /**
20297  * The genesis hash of the blockchain where the channel is to be opened
20298  */
20299 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
20300
20301 /**
20302  * The genesis hash of the blockchain where the channel is to be opened
20303  */
20304 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20305
20306 /**
20307  * A temporary channel ID, until the funding outpoint is announced
20308  */
20309 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
20310
20311 /**
20312  * A temporary channel ID, until the funding outpoint is announced
20313  */
20314 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20315
20316 /**
20317  * The channel value
20318  */
20319 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20320
20321 /**
20322  * The channel value
20323  */
20324 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20325
20326 /**
20327  * The amount to push to the counterparty as part of the open, in milli-satoshi
20328  */
20329 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20330
20331 /**
20332  * The amount to push to the counterparty as part of the open, in milli-satoshi
20333  */
20334 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20335
20336 /**
20337  * The threshold below which outputs on transactions broadcast by sender will be omitted
20338  */
20339 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20340
20341 /**
20342  * The threshold below which outputs on transactions broadcast by sender will be omitted
20343  */
20344 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20345
20346 /**
20347  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20348  */
20349 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20350
20351 /**
20352  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20353  */
20354 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20355
20356 /**
20357  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20358  */
20359 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20360
20361 /**
20362  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20363  */
20364 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20365
20366 /**
20367  * The minimum HTLC size incoming to sender, in milli-satoshi
20368  */
20369 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20370
20371 /**
20372  * The minimum HTLC size incoming to sender, in milli-satoshi
20373  */
20374 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20375
20376 /**
20377  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
20378  */
20379 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20380
20381 /**
20382  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
20383  */
20384 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
20385
20386 /**
20387  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20388  */
20389 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20390
20391 /**
20392  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20393  */
20394 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
20395
20396 /**
20397  * The maximum number of inbound HTLCs towards sender
20398  */
20399 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20400
20401 /**
20402  * The maximum number of inbound HTLCs towards sender
20403  */
20404 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
20405
20406 /**
20407  * The sender's key controlling the funding transaction
20408  */
20409 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20410
20411 /**
20412  * The sender's key controlling the funding transaction
20413  */
20414 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20415
20416 /**
20417  * Used to derive a revocation key for transactions broadcast by counterparty
20418  */
20419 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20420
20421 /**
20422  * Used to derive a revocation key for transactions broadcast by counterparty
20423  */
20424 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20425
20426 /**
20427  * A payment key to sender for transactions broadcast by counterparty
20428  */
20429 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20430
20431 /**
20432  * A payment key to sender for transactions broadcast by counterparty
20433  */
20434 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20435
20436 /**
20437  * Used to derive a payment key to sender for transactions broadcast by sender
20438  */
20439 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20440
20441 /**
20442  * Used to derive a payment key to sender for transactions broadcast by sender
20443  */
20444 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20445
20446 /**
20447  * Used to derive an HTLC payment key to sender
20448  */
20449 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20450
20451 /**
20452  * Used to derive an HTLC payment key to sender
20453  */
20454 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20455
20456 /**
20457  * The first to-be-broadcast-by-sender transaction's per commitment point
20458  */
20459 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20460
20461 /**
20462  * The first to-be-broadcast-by-sender transaction's per commitment point
20463  */
20464 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20465
20466 /**
20467  * Channel flags
20468  */
20469 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20470
20471 /**
20472  * Channel flags
20473  */
20474 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
20475
20476 /**
20477  * The channel type that this channel will represent. If none is set, we derive the channel
20478  * type from the intersection of our feature bits with our counterparty's feature bits from
20479  * the Init message.
20480  *
20481  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20482  */
20483 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20484
20485 /**
20486  * The channel type that this channel will represent. If none is set, we derive the channel
20487  * type from the intersection of our feature bits with our counterparty's feature bits from
20488  * the Init message.
20489  *
20490  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20491  */
20492 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
20493
20494 /**
20495  * Creates a copy of the OpenChannel
20496  */
20497 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
20498
20499 /**
20500  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
20501  */
20502 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
20503
20504 /**
20505  * A temporary channel ID, until the funding outpoint is announced
20506  */
20507 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
20508
20509 /**
20510  * A temporary channel ID, until the funding outpoint is announced
20511  */
20512 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20513
20514 /**
20515  * The threshold below which outputs on transactions broadcast by sender will be omitted
20516  */
20517 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20518
20519 /**
20520  * The threshold below which outputs on transactions broadcast by sender will be omitted
20521  */
20522 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20523
20524 /**
20525  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20526  */
20527 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20528
20529 /**
20530  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20531  */
20532 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20533
20534 /**
20535  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20536  */
20537 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20538
20539 /**
20540  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20541  */
20542 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20543
20544 /**
20545  * The minimum HTLC size incoming to sender, in milli-satoshi
20546  */
20547 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20548
20549 /**
20550  * The minimum HTLC size incoming to sender, in milli-satoshi
20551  */
20552 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20553
20554 /**
20555  * Minimum depth of the funding transaction before the channel is considered open
20556  */
20557 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20558
20559 /**
20560  * Minimum depth of the funding transaction before the channel is considered open
20561  */
20562 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
20563
20564 /**
20565  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20566  */
20567 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20568
20569 /**
20570  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20571  */
20572 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
20573
20574 /**
20575  * The maximum number of inbound HTLCs towards sender
20576  */
20577 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20578
20579 /**
20580  * The maximum number of inbound HTLCs towards sender
20581  */
20582 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
20583
20584 /**
20585  * The sender's key controlling the funding transaction
20586  */
20587 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20588
20589 /**
20590  * The sender's key controlling the funding transaction
20591  */
20592 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20593
20594 /**
20595  * Used to derive a revocation key for transactions broadcast by counterparty
20596  */
20597 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20598
20599 /**
20600  * Used to derive a revocation key for transactions broadcast by counterparty
20601  */
20602 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20603
20604 /**
20605  * A payment key to sender for transactions broadcast by counterparty
20606  */
20607 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20608
20609 /**
20610  * A payment key to sender for transactions broadcast by counterparty
20611  */
20612 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20613
20614 /**
20615  * Used to derive a payment key to sender for transactions broadcast by sender
20616  */
20617 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20618
20619 /**
20620  * Used to derive a payment key to sender for transactions broadcast by sender
20621  */
20622 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20623
20624 /**
20625  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
20626  */
20627 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20628
20629 /**
20630  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
20631  */
20632 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20633
20634 /**
20635  * The first to-be-broadcast-by-sender transaction's per commitment point
20636  */
20637 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20638
20639 /**
20640  * The first to-be-broadcast-by-sender transaction's per commitment point
20641  */
20642 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20643
20644 /**
20645  * The channel type that this channel will represent. If none is set, we derive the channel
20646  * type from the intersection of our feature bits with our counterparty's feature bits from
20647  * the Init message.
20648  *
20649  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
20650  *
20651  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20652  */
20653 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20654
20655 /**
20656  * The channel type that this channel will represent. If none is set, we derive the channel
20657  * type from the intersection of our feature bits with our counterparty's feature bits from
20658  * the Init message.
20659  *
20660  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
20661  *
20662  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20663  */
20664 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
20665
20666 /**
20667  * Creates a copy of the AcceptChannel
20668  */
20669 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
20670
20671 /**
20672  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
20673  */
20674 void FundingCreated_free(struct LDKFundingCreated this_obj);
20675
20676 /**
20677  * A temporary channel ID, until the funding is established
20678  */
20679 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
20680
20681 /**
20682  * A temporary channel ID, until the funding is established
20683  */
20684 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20685
20686 /**
20687  * The funding transaction ID
20688  */
20689 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
20690
20691 /**
20692  * The funding transaction ID
20693  */
20694 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20695
20696 /**
20697  * The specific output index funding this channel
20698  */
20699 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
20700
20701 /**
20702  * The specific output index funding this channel
20703  */
20704 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
20705
20706 /**
20707  * The signature of the channel initiator (funder) on the initial commitment transaction
20708  */
20709 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
20710
20711 /**
20712  * The signature of the channel initiator (funder) on the initial commitment transaction
20713  */
20714 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
20715
20716 /**
20717  * Constructs a new FundingCreated given each field
20718  */
20719 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);
20720
20721 /**
20722  * Creates a copy of the FundingCreated
20723  */
20724 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
20725
20726 /**
20727  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
20728  */
20729 void FundingSigned_free(struct LDKFundingSigned this_obj);
20730
20731 /**
20732  * The channel ID
20733  */
20734 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
20735
20736 /**
20737  * The channel ID
20738  */
20739 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20740
20741 /**
20742  * The signature of the channel acceptor (fundee) on the initial commitment transaction
20743  */
20744 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
20745
20746 /**
20747  * The signature of the channel acceptor (fundee) on the initial commitment transaction
20748  */
20749 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
20750
20751 /**
20752  * Constructs a new FundingSigned given each field
20753  */
20754 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
20755
20756 /**
20757  * Creates a copy of the FundingSigned
20758  */
20759 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
20760
20761 /**
20762  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
20763  */
20764 void FundingLocked_free(struct LDKFundingLocked this_obj);
20765
20766 /**
20767  * The channel ID
20768  */
20769 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
20770
20771 /**
20772  * The channel ID
20773  */
20774 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20775
20776 /**
20777  * The per-commitment point of the second commitment transaction
20778  */
20779 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
20780
20781 /**
20782  * The per-commitment point of the second commitment transaction
20783  */
20784 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20785
20786 /**
20787  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
20788  * to be forwarded over this SCID and forward them to this messages' recipient.
20789  */
20790 struct LDKCOption_u64Z FundingLocked_get_short_channel_id_alias(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
20791
20792 /**
20793  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
20794  * to be forwarded over this SCID and forward them to this messages' recipient.
20795  */
20796 void FundingLocked_set_short_channel_id_alias(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20797
20798 /**
20799  * Constructs a new FundingLocked given each field
20800  */
20801 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg);
20802
20803 /**
20804  * Creates a copy of the FundingLocked
20805  */
20806 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
20807
20808 /**
20809  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
20810  */
20811 void Shutdown_free(struct LDKShutdown this_obj);
20812
20813 /**
20814  * The channel ID
20815  */
20816 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
20817
20818 /**
20819  * The channel ID
20820  */
20821 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20822
20823 /**
20824  * The destination of this peer's funds on closing.
20825  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
20826  */
20827 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
20828
20829 /**
20830  * The destination of this peer's funds on closing.
20831  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
20832  */
20833 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
20834
20835 /**
20836  * Constructs a new Shutdown given each field
20837  */
20838 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
20839
20840 /**
20841  * Creates a copy of the Shutdown
20842  */
20843 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
20844
20845 /**
20846  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
20847  */
20848 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
20849
20850 /**
20851  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
20852  * transaction.
20853  */
20854 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
20855
20856 /**
20857  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
20858  * transaction.
20859  */
20860 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
20861
20862 /**
20863  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
20864  * transaction.
20865  */
20866 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
20867
20868 /**
20869  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
20870  * transaction.
20871  */
20872 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
20873
20874 /**
20875  * Constructs a new ClosingSignedFeeRange given each field
20876  */
20877 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
20878
20879 /**
20880  * Creates a copy of the ClosingSignedFeeRange
20881  */
20882 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
20883
20884 /**
20885  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
20886  */
20887 void ClosingSigned_free(struct LDKClosingSigned this_obj);
20888
20889 /**
20890  * The channel ID
20891  */
20892 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
20893
20894 /**
20895  * The channel ID
20896  */
20897 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20898
20899 /**
20900  * The proposed total fee for the closing transaction
20901  */
20902 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
20903
20904 /**
20905  * The proposed total fee for the closing transaction
20906  */
20907 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
20908
20909 /**
20910  * A signature on the closing transaction
20911  */
20912 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
20913
20914 /**
20915  * A signature on the closing transaction
20916  */
20917 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
20918
20919 /**
20920  * The minimum and maximum fees which the sender is willing to accept, provided only by new
20921  * nodes.
20922  *
20923  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20924  */
20925 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
20926
20927 /**
20928  * The minimum and maximum fees which the sender is willing to accept, provided only by new
20929  * nodes.
20930  *
20931  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20932  */
20933 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
20934
20935 /**
20936  * Constructs a new ClosingSigned given each field
20937  */
20938 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);
20939
20940 /**
20941  * Creates a copy of the ClosingSigned
20942  */
20943 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
20944
20945 /**
20946  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
20947  */
20948 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
20949
20950 /**
20951  * The channel ID
20952  */
20953 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
20954
20955 /**
20956  * The channel ID
20957  */
20958 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20959
20960 /**
20961  * The HTLC ID
20962  */
20963 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
20964
20965 /**
20966  * The HTLC ID
20967  */
20968 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
20969
20970 /**
20971  * The HTLC value in milli-satoshi
20972  */
20973 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
20974
20975 /**
20976  * The HTLC value in milli-satoshi
20977  */
20978 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
20979
20980 /**
20981  * The payment hash, the pre-image of which controls HTLC redemption
20982  */
20983 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
20984
20985 /**
20986  * The payment hash, the pre-image of which controls HTLC redemption
20987  */
20988 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20989
20990 /**
20991  * The expiry height of the HTLC
20992  */
20993 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
20994
20995 /**
20996  * The expiry height of the HTLC
20997  */
20998 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
20999
21000 /**
21001  * Creates a copy of the UpdateAddHTLC
21002  */
21003 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
21004
21005 /**
21006  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
21007  */
21008 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
21009
21010 /**
21011  * The channel ID
21012  */
21013 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
21014
21015 /**
21016  * The channel ID
21017  */
21018 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21019
21020 /**
21021  * The HTLC ID
21022  */
21023 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
21024
21025 /**
21026  * The HTLC ID
21027  */
21028 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
21029
21030 /**
21031  * The pre-image of the payment hash, allowing HTLC redemption
21032  */
21033 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
21034
21035 /**
21036  * The pre-image of the payment hash, allowing HTLC redemption
21037  */
21038 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21039
21040 /**
21041  * Constructs a new UpdateFulfillHTLC given each field
21042  */
21043 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
21044
21045 /**
21046  * Creates a copy of the UpdateFulfillHTLC
21047  */
21048 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
21049
21050 /**
21051  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
21052  */
21053 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
21054
21055 /**
21056  * The channel ID
21057  */
21058 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
21059
21060 /**
21061  * The channel ID
21062  */
21063 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21064
21065 /**
21066  * The HTLC ID
21067  */
21068 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
21069
21070 /**
21071  * The HTLC ID
21072  */
21073 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
21074
21075 /**
21076  * Creates a copy of the UpdateFailHTLC
21077  */
21078 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
21079
21080 /**
21081  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
21082  */
21083 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
21084
21085 /**
21086  * The channel ID
21087  */
21088 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
21089
21090 /**
21091  * The channel ID
21092  */
21093 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21094
21095 /**
21096  * The HTLC ID
21097  */
21098 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
21099
21100 /**
21101  * The HTLC ID
21102  */
21103 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
21104
21105 /**
21106  * The failure code
21107  */
21108 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
21109
21110 /**
21111  * The failure code
21112  */
21113 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
21114
21115 /**
21116  * Creates a copy of the UpdateFailMalformedHTLC
21117  */
21118 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
21119
21120 /**
21121  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
21122  */
21123 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
21124
21125 /**
21126  * The channel ID
21127  */
21128 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
21129
21130 /**
21131  * The channel ID
21132  */
21133 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21134
21135 /**
21136  * A signature on the commitment transaction
21137  */
21138 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
21139
21140 /**
21141  * A signature on the commitment transaction
21142  */
21143 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
21144
21145 /**
21146  * Signatures on the HTLC transactions
21147  */
21148 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
21149
21150 /**
21151  * Constructs a new CommitmentSigned given each field
21152  */
21153 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
21154
21155 /**
21156  * Creates a copy of the CommitmentSigned
21157  */
21158 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
21159
21160 /**
21161  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
21162  */
21163 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
21164
21165 /**
21166  * The channel ID
21167  */
21168 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
21169
21170 /**
21171  * The channel ID
21172  */
21173 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21174
21175 /**
21176  * The secret corresponding to the per-commitment point
21177  */
21178 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
21179
21180 /**
21181  * The secret corresponding to the per-commitment point
21182  */
21183 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21184
21185 /**
21186  * The next sender-broadcast commitment transaction's per-commitment point
21187  */
21188 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
21189
21190 /**
21191  * The next sender-broadcast commitment transaction's per-commitment point
21192  */
21193 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21194
21195 /**
21196  * Constructs a new RevokeAndACK given each field
21197  */
21198 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);
21199
21200 /**
21201  * Creates a copy of the RevokeAndACK
21202  */
21203 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
21204
21205 /**
21206  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
21207  */
21208 void UpdateFee_free(struct LDKUpdateFee this_obj);
21209
21210 /**
21211  * The channel ID
21212  */
21213 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
21214
21215 /**
21216  * The channel ID
21217  */
21218 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21219
21220 /**
21221  * Fee rate per 1000-weight of the transaction
21222  */
21223 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
21224
21225 /**
21226  * Fee rate per 1000-weight of the transaction
21227  */
21228 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
21229
21230 /**
21231  * Constructs a new UpdateFee given each field
21232  */
21233 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
21234
21235 /**
21236  * Creates a copy of the UpdateFee
21237  */
21238 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
21239
21240 /**
21241  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
21242  */
21243 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
21244
21245 /**
21246  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
21247  * belonging to the recipient
21248  */
21249 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
21250
21251 /**
21252  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
21253  * belonging to the recipient
21254  */
21255 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21256
21257 /**
21258  * The sender's per-commitment point for their current commitment transaction
21259  */
21260 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
21261
21262 /**
21263  * The sender's per-commitment point for their current commitment transaction
21264  */
21265 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21266
21267 /**
21268  * Constructs a new DataLossProtect given each field
21269  */
21270 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
21271
21272 /**
21273  * Creates a copy of the DataLossProtect
21274  */
21275 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
21276
21277 /**
21278  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
21279  */
21280 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
21281
21282 /**
21283  * The channel ID
21284  */
21285 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
21286
21287 /**
21288  * The channel ID
21289  */
21290 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21291
21292 /**
21293  * The next commitment number for the sender
21294  */
21295 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
21296
21297 /**
21298  * The next commitment number for the sender
21299  */
21300 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
21301
21302 /**
21303  * The next commitment number for the recipient
21304  */
21305 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
21306
21307 /**
21308  * The next commitment number for the recipient
21309  */
21310 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
21311
21312 /**
21313  * Creates a copy of the ChannelReestablish
21314  */
21315 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
21316
21317 /**
21318  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
21319  */
21320 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
21321
21322 /**
21323  * The channel ID
21324  */
21325 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
21326
21327 /**
21328  * The channel ID
21329  */
21330 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21331
21332 /**
21333  * The short channel ID
21334  */
21335 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21336
21337 /**
21338  * The short channel ID
21339  */
21340 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
21341
21342 /**
21343  * A signature by the node key
21344  */
21345 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21346
21347 /**
21348  * A signature by the node key
21349  */
21350 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
21351
21352 /**
21353  * A signature by the funding key
21354  */
21355 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21356
21357 /**
21358  * A signature by the funding key
21359  */
21360 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
21361
21362 /**
21363  * Constructs a new AnnouncementSignatures given each field
21364  */
21365 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);
21366
21367 /**
21368  * Creates a copy of the AnnouncementSignatures
21369  */
21370 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
21371
21372 /**
21373  * Frees any resources used by the NetAddress
21374  */
21375 void NetAddress_free(struct LDKNetAddress this_ptr);
21376
21377 /**
21378  * Creates a copy of the NetAddress
21379  */
21380 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
21381
21382 /**
21383  * Utility method to constructs a new IPv4-variant NetAddress
21384  */
21385 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
21386
21387 /**
21388  * Utility method to constructs a new IPv6-variant NetAddress
21389  */
21390 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
21391
21392 /**
21393  * Utility method to constructs a new OnionV2-variant NetAddress
21394  */
21395 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
21396
21397 /**
21398  * Utility method to constructs a new OnionV3-variant NetAddress
21399  */
21400 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
21401
21402 /**
21403  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
21404  */
21405 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
21406
21407 /**
21408  * Read a NetAddress from a byte array, created by NetAddress_write
21409  */
21410 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
21411
21412 /**
21413  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
21414  */
21415 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
21416
21417 /**
21418  * The advertised features
21419  */
21420 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21421
21422 /**
21423  * The advertised features
21424  */
21425 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
21426
21427 /**
21428  * A strictly monotonic announcement counter, with gaps allowed
21429  */
21430 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21431
21432 /**
21433  * A strictly monotonic announcement counter, with gaps allowed
21434  */
21435 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
21436
21437 /**
21438  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
21439  * to this node).
21440  */
21441 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21442
21443 /**
21444  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
21445  * to this node).
21446  */
21447 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21448
21449 /**
21450  * An RGB color for UI purposes
21451  */
21452 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
21453
21454 /**
21455  * An RGB color for UI purposes
21456  */
21457 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
21458
21459 /**
21460  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
21461  * of uniqueness.
21462  */
21463 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
21464
21465 /**
21466  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
21467  * of uniqueness.
21468  */
21469 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21470
21471 /**
21472  * List of addresses on which this node is reachable
21473  */
21474 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
21475
21476 /**
21477  * Creates a copy of the UnsignedNodeAnnouncement
21478  */
21479 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
21480
21481 /**
21482  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
21483  */
21484 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
21485
21486 /**
21487  * The signature by the node key
21488  */
21489 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
21490
21491 /**
21492  * The signature by the node key
21493  */
21494 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21495
21496 /**
21497  * The actual content of the announcement
21498  */
21499 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
21500
21501 /**
21502  * The actual content of the announcement
21503  */
21504 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
21505
21506 /**
21507  * Constructs a new NodeAnnouncement given each field
21508  */
21509 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
21510
21511 /**
21512  * Creates a copy of the NodeAnnouncement
21513  */
21514 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
21515
21516 /**
21517  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
21518  */
21519 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
21520
21521 /**
21522  * The advertised channel features
21523  */
21524 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21525
21526 /**
21527  * The advertised channel features
21528  */
21529 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
21530
21531 /**
21532  * The genesis hash of the blockchain where the channel is to be opened
21533  */
21534 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
21535
21536 /**
21537  * The genesis hash of the blockchain where the channel is to be opened
21538  */
21539 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21540
21541 /**
21542  * The short channel ID
21543  */
21544 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21545
21546 /**
21547  * The short channel ID
21548  */
21549 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
21550
21551 /**
21552  * One of the two node_ids which are endpoints of this channel
21553  */
21554 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21555
21556 /**
21557  * One of the two node_ids which are endpoints of this channel
21558  */
21559 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21560
21561 /**
21562  * The other of the two node_ids which are endpoints of this channel
21563  */
21564 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21565
21566 /**
21567  * The other of the two node_ids which are endpoints of this channel
21568  */
21569 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21570
21571 /**
21572  * The funding key for the first node
21573  */
21574 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21575
21576 /**
21577  * The funding key for the first node
21578  */
21579 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21580
21581 /**
21582  * The funding key for the second node
21583  */
21584 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21585
21586 /**
21587  * The funding key for the second node
21588  */
21589 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21590
21591 /**
21592  * Creates a copy of the UnsignedChannelAnnouncement
21593  */
21594 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
21595
21596 /**
21597  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
21598  */
21599 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
21600
21601 /**
21602  * Authentication of the announcement by the first public node
21603  */
21604 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21605
21606 /**
21607  * Authentication of the announcement by the first public node
21608  */
21609 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21610
21611 /**
21612  * Authentication of the announcement by the second public node
21613  */
21614 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21615
21616 /**
21617  * Authentication of the announcement by the second public node
21618  */
21619 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21620
21621 /**
21622  * Proof of funding UTXO ownership by the first public node
21623  */
21624 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21625
21626 /**
21627  * Proof of funding UTXO ownership by the first public node
21628  */
21629 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21630
21631 /**
21632  * Proof of funding UTXO ownership by the second public node
21633  */
21634 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21635
21636 /**
21637  * Proof of funding UTXO ownership by the second public node
21638  */
21639 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21640
21641 /**
21642  * The actual announcement
21643  */
21644 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21645
21646 /**
21647  * The actual announcement
21648  */
21649 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
21650
21651 /**
21652  * Constructs a new ChannelAnnouncement given each field
21653  */
21654 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);
21655
21656 /**
21657  * Creates a copy of the ChannelAnnouncement
21658  */
21659 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
21660
21661 /**
21662  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
21663  */
21664 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
21665
21666 /**
21667  * The genesis hash of the blockchain where the channel is to be opened
21668  */
21669 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
21670
21671 /**
21672  * The genesis hash of the blockchain where the channel is to be opened
21673  */
21674 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21675
21676 /**
21677  * The short channel ID
21678  */
21679 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21680
21681 /**
21682  * The short channel ID
21683  */
21684 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
21685
21686 /**
21687  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
21688  */
21689 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21690
21691 /**
21692  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
21693  */
21694 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21695
21696 /**
21697  * Channel flags
21698  */
21699 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21700
21701 /**
21702  * Channel flags
21703  */
21704 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
21705
21706 /**
21707  * The number of blocks such that if:
21708  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
21709  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
21710  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
21711  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
21712  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
21713  * forwarding. Note that the HTLC sender is the one who originally sets this value when
21714  * constructing the route.
21715  */
21716 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21717
21718 /**
21719  * The number of blocks such that if:
21720  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
21721  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
21722  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
21723  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
21724  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
21725  * forwarding. Note that the HTLC sender is the one who originally sets this value when
21726  * constructing the route.
21727  */
21728 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
21729
21730 /**
21731  * The minimum HTLC size incoming to sender, in milli-satoshi
21732  */
21733 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21734
21735 /**
21736  * The minimum HTLC size incoming to sender, in milli-satoshi
21737  */
21738 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
21739
21740 /**
21741  * The base HTLC fee charged by sender, in milli-satoshi
21742  */
21743 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21744
21745 /**
21746  * The base HTLC fee charged by sender, in milli-satoshi
21747  */
21748 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21749
21750 /**
21751  * The amount to fee multiplier, in micro-satoshi
21752  */
21753 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21754
21755 /**
21756  * The amount to fee multiplier, in micro-satoshi
21757  */
21758 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21759
21760 /**
21761  * Creates a copy of the UnsignedChannelUpdate
21762  */
21763 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
21764
21765 /**
21766  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
21767  */
21768 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
21769
21770 /**
21771  * A signature of the channel update
21772  */
21773 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
21774
21775 /**
21776  * A signature of the channel update
21777  */
21778 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
21779
21780 /**
21781  * The actual channel update
21782  */
21783 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
21784
21785 /**
21786  * The actual channel update
21787  */
21788 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
21789
21790 /**
21791  * Constructs a new ChannelUpdate given each field
21792  */
21793 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
21794
21795 /**
21796  * Creates a copy of the ChannelUpdate
21797  */
21798 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
21799
21800 /**
21801  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
21802  */
21803 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
21804
21805 /**
21806  * The genesis hash of the blockchain being queried
21807  */
21808 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
21809
21810 /**
21811  * The genesis hash of the blockchain being queried
21812  */
21813 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21814
21815 /**
21816  * The height of the first block for the channel UTXOs being queried
21817  */
21818 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
21819
21820 /**
21821  * The height of the first block for the channel UTXOs being queried
21822  */
21823 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21824
21825 /**
21826  * The number of blocks to include in the query results
21827  */
21828 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
21829
21830 /**
21831  * The number of blocks to include in the query results
21832  */
21833 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21834
21835 /**
21836  * Constructs a new QueryChannelRange given each field
21837  */
21838 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
21839
21840 /**
21841  * Creates a copy of the QueryChannelRange
21842  */
21843 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
21844
21845 /**
21846  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
21847  */
21848 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
21849
21850 /**
21851  * The genesis hash of the blockchain being queried
21852  */
21853 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
21854
21855 /**
21856  * The genesis hash of the blockchain being queried
21857  */
21858 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21859
21860 /**
21861  * The height of the first block in the range of the reply
21862  */
21863 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
21864
21865 /**
21866  * The height of the first block in the range of the reply
21867  */
21868 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21869
21870 /**
21871  * The number of blocks included in the range of the reply
21872  */
21873 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
21874
21875 /**
21876  * The number of blocks included in the range of the reply
21877  */
21878 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21879
21880 /**
21881  * True when this is the final reply for a query
21882  */
21883 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
21884
21885 /**
21886  * True when this is the final reply for a query
21887  */
21888 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
21889
21890 /**
21891  * The short_channel_ids in the channel range
21892  */
21893 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
21894
21895 /**
21896  * Constructs a new ReplyChannelRange given each field
21897  */
21898 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);
21899
21900 /**
21901  * Creates a copy of the ReplyChannelRange
21902  */
21903 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
21904
21905 /**
21906  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
21907  */
21908 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
21909
21910 /**
21911  * The genesis hash of the blockchain being queried
21912  */
21913 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
21914
21915 /**
21916  * The genesis hash of the blockchain being queried
21917  */
21918 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21919
21920 /**
21921  * The short_channel_ids that are being queried
21922  */
21923 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
21924
21925 /**
21926  * Constructs a new QueryShortChannelIds given each field
21927  */
21928 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
21929
21930 /**
21931  * Creates a copy of the QueryShortChannelIds
21932  */
21933 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
21934
21935 /**
21936  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
21937  */
21938 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
21939
21940 /**
21941  * The genesis hash of the blockchain that was queried
21942  */
21943 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
21944
21945 /**
21946  * The genesis hash of the blockchain that was queried
21947  */
21948 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21949
21950 /**
21951  * Indicates if the query recipient maintains up-to-date channel
21952  * information for the chain_hash
21953  */
21954 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
21955
21956 /**
21957  * Indicates if the query recipient maintains up-to-date channel
21958  * information for the chain_hash
21959  */
21960 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
21961
21962 /**
21963  * Constructs a new ReplyShortChannelIdsEnd given each field
21964  */
21965 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
21966
21967 /**
21968  * Creates a copy of the ReplyShortChannelIdsEnd
21969  */
21970 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
21971
21972 /**
21973  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
21974  */
21975 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
21976
21977 /**
21978  * The genesis hash of the blockchain for channel and node information
21979  */
21980 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
21981
21982 /**
21983  * The genesis hash of the blockchain for channel and node information
21984  */
21985 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21986
21987 /**
21988  * The starting unix timestamp
21989  */
21990 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
21991
21992 /**
21993  * The starting unix timestamp
21994  */
21995 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
21996
21997 /**
21998  * The range of information in seconds
21999  */
22000 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
22001
22002 /**
22003  * The range of information in seconds
22004  */
22005 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
22006
22007 /**
22008  * Constructs a new GossipTimestampFilter given each field
22009  */
22010 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
22011
22012 /**
22013  * Creates a copy of the GossipTimestampFilter
22014  */
22015 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
22016
22017 /**
22018  * Frees any resources used by the ErrorAction
22019  */
22020 void ErrorAction_free(struct LDKErrorAction this_ptr);
22021
22022 /**
22023  * Creates a copy of the ErrorAction
22024  */
22025 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
22026
22027 /**
22028  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
22029  */
22030 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
22031
22032 /**
22033  * Utility method to constructs a new IgnoreError-variant ErrorAction
22034  */
22035 struct LDKErrorAction ErrorAction_ignore_error(void);
22036
22037 /**
22038  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
22039  */
22040 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
22041
22042 /**
22043  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
22044  */
22045 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
22046
22047 /**
22048  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
22049  */
22050 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
22051
22052 /**
22053  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
22054  */
22055 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
22056
22057 /**
22058  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
22059  */
22060 void LightningError_free(struct LDKLightningError this_obj);
22061
22062 /**
22063  * A human-readable message describing the error
22064  */
22065 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
22066
22067 /**
22068  * A human-readable message describing the error
22069  */
22070 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
22071
22072 /**
22073  * The action which should be taken against the offending peer.
22074  */
22075 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
22076
22077 /**
22078  * The action which should be taken against the offending peer.
22079  */
22080 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
22081
22082 /**
22083  * Constructs a new LightningError given each field
22084  */
22085 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
22086
22087 /**
22088  * Creates a copy of the LightningError
22089  */
22090 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
22091
22092 /**
22093  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
22094  */
22095 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
22096
22097 /**
22098  * update_add_htlc messages which should be sent
22099  */
22100 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22101
22102 /**
22103  * update_add_htlc messages which should be sent
22104  */
22105 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
22106
22107 /**
22108  * update_fulfill_htlc messages which should be sent
22109  */
22110 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22111
22112 /**
22113  * update_fulfill_htlc messages which should be sent
22114  */
22115 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
22116
22117 /**
22118  * update_fail_htlc messages which should be sent
22119  */
22120 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22121
22122 /**
22123  * update_fail_htlc messages which should be sent
22124  */
22125 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
22126
22127 /**
22128  * update_fail_malformed_htlc messages which should be sent
22129  */
22130 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22131
22132 /**
22133  * update_fail_malformed_htlc messages which should be sent
22134  */
22135 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
22136
22137 /**
22138  * An update_fee message which should be sent
22139  *
22140  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22141  */
22142 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22143
22144 /**
22145  * An update_fee message which should be sent
22146  *
22147  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22148  */
22149 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
22150
22151 /**
22152  * Finally, the commitment_signed message which should be sent
22153  */
22154 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22155
22156 /**
22157  * Finally, the commitment_signed message which should be sent
22158  */
22159 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
22160
22161 /**
22162  * Constructs a new CommitmentUpdate given each field
22163  */
22164 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);
22165
22166 /**
22167  * Creates a copy of the CommitmentUpdate
22168  */
22169 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
22170
22171 /**
22172  * Calls the free function if one is set
22173  */
22174 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
22175
22176 /**
22177  * Calls the free function if one is set
22178  */
22179 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
22180
22181 /**
22182  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
22183  */
22184 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
22185
22186 /**
22187  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
22188  */
22189 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
22190
22191 /**
22192  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
22193  */
22194 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
22195
22196 /**
22197  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
22198  */
22199 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
22200
22201 /**
22202  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
22203  */
22204 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
22205
22206 /**
22207  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
22208  */
22209 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
22210
22211 /**
22212  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
22213  */
22214 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
22215
22216 /**
22217  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
22218  */
22219 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
22220
22221 /**
22222  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
22223  */
22224 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
22225
22226 /**
22227  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
22228  */
22229 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
22230
22231 /**
22232  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
22233  */
22234 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
22235
22236 /**
22237  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
22238  */
22239 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
22240
22241 /**
22242  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
22243  */
22244 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
22245
22246 /**
22247  * Read a FundingCreated from a byte array, created by FundingCreated_write
22248  */
22249 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
22250
22251 /**
22252  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
22253  */
22254 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
22255
22256 /**
22257  * Read a FundingSigned from a byte array, created by FundingSigned_write
22258  */
22259 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
22260
22261 /**
22262  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
22263  */
22264 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
22265
22266 /**
22267  * Read a FundingLocked from a byte array, created by FundingLocked_write
22268  */
22269 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
22270
22271 /**
22272  * Serialize the Init object into a byte array which can be read by Init_read
22273  */
22274 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
22275
22276 /**
22277  * Read a Init from a byte array, created by Init_write
22278  */
22279 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
22280
22281 /**
22282  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
22283  */
22284 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
22285
22286 /**
22287  * Read a OpenChannel from a byte array, created by OpenChannel_write
22288  */
22289 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
22290
22291 /**
22292  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
22293  */
22294 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
22295
22296 /**
22297  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
22298  */
22299 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
22300
22301 /**
22302  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
22303  */
22304 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
22305
22306 /**
22307  * Read a Shutdown from a byte array, created by Shutdown_write
22308  */
22309 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
22310
22311 /**
22312  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
22313  */
22314 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
22315
22316 /**
22317  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
22318  */
22319 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
22320
22321 /**
22322  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
22323  */
22324 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
22325
22326 /**
22327  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
22328  */
22329 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
22330
22331 /**
22332  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
22333  */
22334 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
22335
22336 /**
22337  * Read a UpdateFee from a byte array, created by UpdateFee_write
22338  */
22339 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
22340
22341 /**
22342  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
22343  */
22344 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
22345
22346 /**
22347  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
22348  */
22349 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
22350
22351 /**
22352  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
22353  */
22354 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
22355
22356 /**
22357  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
22358  */
22359 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
22360
22361 /**
22362  * Serialize the Ping object into a byte array which can be read by Ping_read
22363  */
22364 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
22365
22366 /**
22367  * Read a Ping from a byte array, created by Ping_write
22368  */
22369 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
22370
22371 /**
22372  * Serialize the Pong object into a byte array which can be read by Pong_read
22373  */
22374 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
22375
22376 /**
22377  * Read a Pong from a byte array, created by Pong_write
22378  */
22379 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
22380
22381 /**
22382  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
22383  */
22384 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
22385
22386 /**
22387  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
22388  */
22389 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
22390
22391 /**
22392  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
22393  */
22394 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
22395
22396 /**
22397  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
22398  */
22399 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
22400
22401 /**
22402  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
22403  */
22404 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
22405
22406 /**
22407  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
22408  */
22409 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
22410
22411 /**
22412  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
22413  */
22414 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
22415
22416 /**
22417  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
22418  */
22419 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
22420
22421 /**
22422  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
22423  */
22424 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
22425
22426 /**
22427  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
22428  */
22429 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
22430
22431 /**
22432  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
22433  */
22434 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
22435
22436 /**
22437  * Read a WarningMessage from a byte array, created by WarningMessage_write
22438  */
22439 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
22440
22441 /**
22442  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
22443  */
22444 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
22445
22446 /**
22447  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
22448  */
22449 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
22450
22451 /**
22452  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
22453  */
22454 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
22455
22456 /**
22457  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
22458  */
22459 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
22460
22461 /**
22462  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
22463  */
22464 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
22465
22466 /**
22467  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
22468  */
22469 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
22470
22471 /**
22472  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
22473  */
22474 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
22475
22476 /**
22477  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
22478  */
22479 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
22480
22481 /**
22482  *\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
22483  */
22484 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
22485
22486 /**
22487  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
22488  */
22489 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
22490
22491 /**
22492  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
22493  */
22494 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
22495
22496 /**
22497  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
22498  */
22499 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
22500
22501 /**
22502  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
22503  */
22504 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
22505
22506 /**
22507  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
22508  */
22509 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
22510
22511 /**
22512  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
22513  */
22514 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
22515
22516 /**
22517  * Calls the free function if one is set
22518  */
22519 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
22520
22521 /**
22522  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
22523  */
22524 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
22525
22526 /**
22527  * Constructs a new IgnoringMessageHandler given each field
22528  */
22529 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
22530
22531 /**
22532  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22533  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22534  */
22535 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22536
22537 /**
22538  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
22539  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
22540  */
22541 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22542
22543 /**
22544  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
22545  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
22546  */
22547 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22548
22549 /**
22550  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
22551  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
22552  */
22553 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22554
22555 /**
22556  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
22557  */
22558 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
22559
22560 /**
22561  * Constructs a new ErroringMessageHandler
22562  */
22563 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
22564
22565 /**
22566  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22567  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22568  */
22569 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
22570
22571 /**
22572  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
22573  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
22574  */
22575 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
22576
22577 /**
22578  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
22579  */
22580 void MessageHandler_free(struct LDKMessageHandler this_obj);
22581
22582 /**
22583  * A message handler which handles messages specific to channels. Usually this is just a
22584  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
22585  *
22586  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
22587  */
22588 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
22589
22590 /**
22591  * A message handler which handles messages specific to channels. Usually this is just a
22592  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
22593  *
22594  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
22595  */
22596 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
22597
22598 /**
22599  * A message handler which handles messages updating our knowledge of the network channel
22600  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
22601  * [`IgnoringMessageHandler`].
22602  *
22603  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
22604  */
22605 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
22606
22607 /**
22608  * A message handler which handles messages updating our knowledge of the network channel
22609  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
22610  * [`IgnoringMessageHandler`].
22611  *
22612  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
22613  */
22614 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
22615
22616 /**
22617  * Constructs a new MessageHandler given each field
22618  */
22619 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
22620
22621 /**
22622  * Creates a copy of a SocketDescriptor
22623  */
22624 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
22625
22626 /**
22627  * Calls the free function if one is set
22628  */
22629 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
22630
22631 /**
22632  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
22633  */
22634 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
22635
22636 /**
22637  * Used to indicate that we probably can't make any future connections to this peer, implying
22638  * we should go ahead and force-close any channels we have with it.
22639  */
22640 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
22641
22642 /**
22643  * Used to indicate that we probably can't make any future connections to this peer, implying
22644  * we should go ahead and force-close any channels we have with it.
22645  */
22646 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
22647
22648 /**
22649  * Constructs a new PeerHandleError given each field
22650  */
22651 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
22652
22653 /**
22654  * Creates a copy of the PeerHandleError
22655  */
22656 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
22657
22658 /**
22659  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
22660  */
22661 void PeerManager_free(struct LDKPeerManager this_obj);
22662
22663 /**
22664  * Constructs a new PeerManager with the given message handlers and node_id secret key
22665  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
22666  * cryptographically secure random bytes.
22667  */
22668 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);
22669
22670 /**
22671  * Get the list of node ids for peers which have completed the initial handshake.
22672  *
22673  * For outbound connections, this will be the same as the their_node_id parameter passed in to
22674  * new_outbound_connection, however entries will only appear once the initial handshake has
22675  * completed and we are sure the remote peer has the private key for the given node_id.
22676  */
22677 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
22678
22679 /**
22680  * Indicates a new outbound connection has been established to a node with the given node_id
22681  * and an optional remote network address.
22682  *
22683  * The remote network address adds the option to report a remote IP address back to a connecting
22684  * peer using the init message.
22685  * The user should pass the remote network address of the host they are connected to.
22686  *
22687  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
22688  * descriptor but must disconnect the connection immediately.
22689  *
22690  * Returns a small number of bytes to send to the remote node (currently always 50).
22691  *
22692  * Panics if descriptor is duplicative with some other descriptor which has not yet been
22693  * [`socket_disconnected()`].
22694  *
22695  * [`socket_disconnected()`]: PeerManager::socket_disconnected
22696  */
22697 MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
22698
22699 /**
22700  * Indicates a new inbound connection has been established to a node with an optional remote
22701  * network address.
22702  *
22703  * The remote network address adds the option to report a remote IP address back to a connecting
22704  * peer using the init message.
22705  * The user should pass the remote network address of the host they are connected to.
22706  *
22707  * May refuse the connection by returning an Err, but will never write bytes to the remote end
22708  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
22709  * call socket_disconnected for the new descriptor but must disconnect the connection
22710  * immediately.
22711  *
22712  * Panics if descriptor is duplicative with some other descriptor which has not yet been
22713  * [`socket_disconnected()`].
22714  *
22715  * [`socket_disconnected()`]: PeerManager::socket_disconnected
22716  */
22717 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
22718
22719 /**
22720  * Indicates that there is room to write data to the given socket descriptor.
22721  *
22722  * May return an Err to indicate that the connection should be closed.
22723  *
22724  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
22725  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
22726  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
22727  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
22728  * sufficient!
22729  *
22730  * [`send_data`]: SocketDescriptor::send_data
22731  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
22732  */
22733 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
22734
22735 /**
22736  * Indicates that data was read from the given socket descriptor.
22737  *
22738  * May return an Err to indicate that the connection should be closed.
22739  *
22740  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
22741  * Thus, however, you should call [`process_events`] after any `read_event` to generate
22742  * [`send_data`] calls to handle responses.
22743  *
22744  * If `Ok(true)` is returned, further read_events should not be triggered until a
22745  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
22746  * send buffer).
22747  *
22748  * [`send_data`]: SocketDescriptor::send_data
22749  * [`process_events`]: PeerManager::process_events
22750  */
22751 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);
22752
22753 /**
22754  * Checks for any events generated by our handlers and processes them. Includes sending most
22755  * response messages as well as messages generated by calls to handler functions directly (eg
22756  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
22757  *
22758  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
22759  * issues!
22760  *
22761  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
22762  * or one of the other clients provided in our language bindings.
22763  *
22764  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
22765  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
22766  * [`send_data`]: SocketDescriptor::send_data
22767  */
22768 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
22769
22770 /**
22771  * Indicates that the given socket descriptor's connection is now closed.
22772  */
22773 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
22774
22775 /**
22776  * Disconnect a peer given its node id.
22777  *
22778  * Set `no_connection_possible` to true to prevent any further connection with this peer,
22779  * force-closing any channels we have with it.
22780  *
22781  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
22782  * peer. Thus, be very careful about reentrancy issues.
22783  *
22784  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
22785  */
22786 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
22787
22788 /**
22789  * Disconnects all currently-connected peers. This is useful on platforms where there may be
22790  * an indication that TCP sockets have stalled even if we weren't around to time them out
22791  * using regular ping/pongs.
22792  */
22793 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
22794
22795 /**
22796  * Send pings to each peer and disconnect those which did not respond to the last round of
22797  * pings.
22798  *
22799  * This may be called on any timescale you want, however, roughly once every ten seconds is
22800  * preferred. The call rate determines both how often we send a ping to our peers and how much
22801  * time they have to respond before we disconnect them.
22802  *
22803  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
22804  * issues!
22805  *
22806  * [`send_data`]: SocketDescriptor::send_data
22807  */
22808 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
22809
22810 /**
22811  * Gets the weight for an HTLC-Success transaction.
22812  */
22813 uint64_t htlc_success_tx_weight(bool opt_anchors);
22814
22815 /**
22816  * Gets the weight for an HTLC-Timeout transaction.
22817  */
22818 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
22819
22820 /**
22821  * Build the commitment secret from the seed and the commitment number
22822  */
22823 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
22824
22825 /**
22826  * Build a closing transaction
22827  */
22828 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);
22829
22830 /**
22831  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
22832  */
22833 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
22834
22835 /**
22836  * Creates a copy of the CounterpartyCommitmentSecrets
22837  */
22838 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
22839
22840 /**
22841  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
22842  */
22843 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
22844
22845 /**
22846  * Returns the minimum index of all stored secrets. Note that indexes start
22847  * at 1 << 48 and get decremented by one for each new secret.
22848  */
22849 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
22850
22851 /**
22852  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
22853  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
22854  */
22855 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
22856
22857 /**
22858  * Returns the secret at `idx`.
22859  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
22860  *
22861  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22862  */
22863 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
22864
22865 /**
22866  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
22867  */
22868 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
22869
22870 /**
22871  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
22872  */
22873 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
22874
22875 /**
22876  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
22877  * from the base secret and the per_commitment_point.
22878  *
22879  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22880  * generated (ie our own).
22881  */
22882 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
22883
22884 /**
22885  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
22886  * from the base point and the per_commitment_key. This is the public equivalent of
22887  * derive_private_key - using only public keys to derive a public key instead of private keys.
22888  *
22889  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22890  * generated (ie our own).
22891  */
22892 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
22893
22894 /**
22895  * Derives a per-commitment-transaction revocation key from its constituent parts.
22896  *
22897  * Only the cheating participant owns a valid witness to propagate a revoked
22898  * commitment transaction, thus per_commitment_secret always come from cheater
22899  * and revocation_base_secret always come from punisher, which is the broadcaster
22900  * of the transaction spending with this key knowledge.
22901  *
22902  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22903  * generated (ie our own).
22904  */
22905 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
22906
22907 /**
22908  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
22909  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
22910  * public key instead of private keys.
22911  *
22912  * Only the cheating participant owns a valid witness to propagate a revoked
22913  * commitment transaction, thus per_commitment_point always come from cheater
22914  * and revocation_base_point always come from punisher, which is the broadcaster
22915  * of the transaction spending with this key knowledge.
22916  *
22917  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22918  * generated (ie our own).
22919  */
22920 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
22921
22922 /**
22923  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
22924  */
22925 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
22926
22927 /**
22928  * The broadcaster's per-commitment public key which was used to derive the other keys.
22929  */
22930 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22931
22932 /**
22933  * The broadcaster's per-commitment public key which was used to derive the other keys.
22934  */
22935 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22936
22937 /**
22938  * The revocation key which is used to allow the broadcaster of the commitment
22939  * transaction to provide their counterparty the ability to punish them if they broadcast
22940  * an old state.
22941  */
22942 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22943
22944 /**
22945  * The revocation key which is used to allow the broadcaster of the commitment
22946  * transaction to provide their counterparty the ability to punish them if they broadcast
22947  * an old state.
22948  */
22949 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22950
22951 /**
22952  * Broadcaster's HTLC Key
22953  */
22954 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22955
22956 /**
22957  * Broadcaster's HTLC Key
22958  */
22959 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22960
22961 /**
22962  * Countersignatory's HTLC Key
22963  */
22964 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22965
22966 /**
22967  * Countersignatory's HTLC Key
22968  */
22969 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22970
22971 /**
22972  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
22973  */
22974 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22975
22976 /**
22977  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
22978  */
22979 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22980
22981 /**
22982  * Constructs a new TxCreationKeys given each field
22983  */
22984 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);
22985
22986 /**
22987  * Creates a copy of the TxCreationKeys
22988  */
22989 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
22990
22991 /**
22992  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
22993  */
22994 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
22995
22996 /**
22997  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
22998  */
22999 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
23000
23001 /**
23002  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
23003  */
23004 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
23005
23006 /**
23007  * The public key which is used to sign all commitment transactions, as it appears in the
23008  * on-chain channel lock-in 2-of-2 multisig output.
23009  */
23010 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23011
23012 /**
23013  * The public key which is used to sign all commitment transactions, as it appears in the
23014  * on-chain channel lock-in 2-of-2 multisig output.
23015  */
23016 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23017
23018 /**
23019  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
23020  * revocation keys. This is combined with the per-commitment-secret generated by the
23021  * counterparty to create a secret which the counterparty can reveal to revoke previous
23022  * states.
23023  */
23024 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23025
23026 /**
23027  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
23028  * revocation keys. This is combined with the per-commitment-secret generated by the
23029  * counterparty to create a secret which the counterparty can reveal to revoke previous
23030  * states.
23031  */
23032 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23033
23034 /**
23035  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
23036  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
23037  * static across every commitment transaction.
23038  */
23039 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23040
23041 /**
23042  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
23043  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
23044  * static across every commitment transaction.
23045  */
23046 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23047
23048 /**
23049  * The base point which is used (with derive_public_key) to derive a per-commitment payment
23050  * public key which receives non-HTLC-encumbered funds which are only available for spending
23051  * after some delay (or can be claimed via the revocation path).
23052  */
23053 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23054
23055 /**
23056  * The base point which is used (with derive_public_key) to derive a per-commitment payment
23057  * public key which receives non-HTLC-encumbered funds which are only available for spending
23058  * after some delay (or can be claimed via the revocation path).
23059  */
23060 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23061
23062 /**
23063  * The base point which is used (with derive_public_key) to derive a per-commitment public key
23064  * which is used to encumber HTLC-in-flight outputs.
23065  */
23066 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23067
23068 /**
23069  * The base point which is used (with derive_public_key) to derive a per-commitment public key
23070  * which is used to encumber HTLC-in-flight outputs.
23071  */
23072 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23073
23074 /**
23075  * Constructs a new ChannelPublicKeys given each field
23076  */
23077 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);
23078
23079 /**
23080  * Creates a copy of the ChannelPublicKeys
23081  */
23082 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
23083
23084 /**
23085  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
23086  */
23087 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
23088
23089 /**
23090  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
23091  */
23092 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
23093
23094 /**
23095  * Create per-state keys from channel base points and the per-commitment point.
23096  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
23097  */
23098 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);
23099
23100 /**
23101  * Generate per-state keys from channel static keys.
23102  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
23103  */
23104 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);
23105
23106 /**
23107  * A script either spendable by the revocation
23108  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
23109  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
23110  */
23111 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
23112
23113 /**
23114  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
23115  */
23116 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
23117
23118 /**
23119  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
23120  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
23121  * need to compare this value to whether the commitment transaction in question is that of
23122  * the counterparty or our own.
23123  */
23124 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23125
23126 /**
23127  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
23128  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
23129  * need to compare this value to whether the commitment transaction in question is that of
23130  * the counterparty or our own.
23131  */
23132 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
23133
23134 /**
23135  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
23136  * this divided by 1000.
23137  */
23138 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23139
23140 /**
23141  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
23142  * this divided by 1000.
23143  */
23144 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
23145
23146 /**
23147  * The CLTV lock-time at which this HTLC expires.
23148  */
23149 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23150
23151 /**
23152  * The CLTV lock-time at which this HTLC expires.
23153  */
23154 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
23155
23156 /**
23157  * The hash of the preimage which unlocks this HTLC.
23158  */
23159 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
23160
23161 /**
23162  * The hash of the preimage which unlocks this HTLC.
23163  */
23164 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23165
23166 /**
23167  * The position within the commitment transactions' outputs. This may be None if the value is
23168  * below the dust limit (in which case no output appears in the commitment transaction and the
23169  * value is spent to additional transaction fees).
23170  */
23171 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23172
23173 /**
23174  * The position within the commitment transactions' outputs. This may be None if the value is
23175  * below the dust limit (in which case no output appears in the commitment transaction and the
23176  * value is spent to additional transaction fees).
23177  */
23178 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
23179
23180 /**
23181  * Constructs a new HTLCOutputInCommitment given each field
23182  */
23183 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);
23184
23185 /**
23186  * Creates a copy of the HTLCOutputInCommitment
23187  */
23188 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
23189
23190 /**
23191  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
23192  */
23193 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
23194
23195 /**
23196  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
23197  */
23198 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
23199
23200 /**
23201  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
23202  * does not need to have its previous_output_index filled.
23203  */
23204 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
23205
23206 /**
23207  * Gets the redeemscript for a funding output from the two funding public keys.
23208  * Note that the order of funding public keys does not matter.
23209  */
23210 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
23211
23212 /**
23213  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
23214  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
23215  * transaction which needs signing, and can be used to construct an HTLC transaction which is
23216  * broadcastable given a counterparty HTLC signature.
23217  *
23218  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
23219  * commitment transaction).
23220  */
23221 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);
23222
23223 /**
23224  * Gets the witnessScript for an anchor output from the funding public key.
23225  * The witness in the spending input must be:
23226  * <BIP 143 funding_signature>
23227  * After 16 blocks of confirmation, an alternative satisfying witness could be:
23228  * <>
23229  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
23230  */
23231 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
23232
23233 /**
23234  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23235  */
23236 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
23237
23238 /**
23239  * Holder public keys
23240  */
23241 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23242
23243 /**
23244  * Holder public keys
23245  */
23246 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
23247
23248 /**
23249  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
23250  */
23251 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23252
23253 /**
23254  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
23255  */
23256 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
23257
23258 /**
23259  * Whether the holder is the initiator of this channel.
23260  * This is an input to the commitment number obscure factor computation.
23261  */
23262 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23263
23264 /**
23265  * Whether the holder is the initiator of this channel.
23266  * This is an input to the commitment number obscure factor computation.
23267  */
23268 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
23269
23270 /**
23271  * The late-bound counterparty channel transaction parameters.
23272  * These parameters are populated at the point in the protocol where the counterparty provides them.
23273  *
23274  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23275  */
23276 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23277
23278 /**
23279  * The late-bound counterparty channel transaction parameters.
23280  * These parameters are populated at the point in the protocol where the counterparty provides them.
23281  *
23282  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23283  */
23284 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
23285
23286 /**
23287  * The late-bound funding outpoint
23288  *
23289  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23290  */
23291 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23292
23293 /**
23294  * The late-bound funding outpoint
23295  *
23296  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23297  */
23298 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
23299
23300 /**
23301  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
23302  */
23303 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23304
23305 /**
23306  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
23307  */
23308 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
23309
23310 /**
23311  * Constructs a new ChannelTransactionParameters given each field
23312  */
23313 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);
23314
23315 /**
23316  * Creates a copy of the ChannelTransactionParameters
23317  */
23318 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
23319
23320 /**
23321  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23322  */
23323 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
23324
23325 /**
23326  * Counter-party public keys
23327  */
23328 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
23329
23330 /**
23331  * Counter-party public keys
23332  */
23333 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
23334
23335 /**
23336  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
23337  */
23338 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
23339
23340 /**
23341  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
23342  */
23343 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
23344
23345 /**
23346  * Constructs a new CounterpartyChannelTransactionParameters given each field
23347  */
23348 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
23349
23350 /**
23351  * Creates a copy of the CounterpartyChannelTransactionParameters
23352  */
23353 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
23354
23355 /**
23356  * Whether the late bound parameters are populated.
23357  */
23358 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23359
23360 /**
23361  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
23362  * given that the holder is the broadcaster.
23363  *
23364  * self.is_populated() must be true before calling this function.
23365  */
23366 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23367
23368 /**
23369  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
23370  * given that the counterparty is the broadcaster.
23371  *
23372  * self.is_populated() must be true before calling this function.
23373  */
23374 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23375
23376 /**
23377  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
23378  */
23379 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
23380
23381 /**
23382  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
23383  */
23384 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
23385
23386 /**
23387  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
23388  */
23389 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
23390
23391 /**
23392  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
23393  */
23394 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
23395
23396 /**
23397  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23398  */
23399 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
23400
23401 /**
23402  * Get the channel pubkeys for the broadcaster
23403  */
23404 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23405
23406 /**
23407  * Get the channel pubkeys for the countersignatory
23408  */
23409 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23410
23411 /**
23412  * Get the contest delay applicable to the transactions.
23413  * Note that the contest delay was selected by the countersignatory.
23414  */
23415 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23416
23417 /**
23418  * Whether the channel is outbound from the broadcaster.
23419  *
23420  * The boolean representing the side that initiated the channel is
23421  * an input to the commitment number obscure factor computation.
23422  */
23423 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23424
23425 /**
23426  * The funding outpoint
23427  */
23428 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23429
23430 /**
23431  * Whether to use anchors for this channel
23432  */
23433 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23434
23435 /**
23436  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
23437  */
23438 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
23439
23440 /**
23441  * Our counterparty's signature for the transaction
23442  */
23443 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
23444
23445 /**
23446  * Our counterparty's signature for the transaction
23447  */
23448 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
23449
23450 /**
23451  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
23452  */
23453 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
23454
23455 /**
23456  * Creates a copy of the HolderCommitmentTransaction
23457  */
23458 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
23459
23460 /**
23461  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
23462  */
23463 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
23464
23465 /**
23466  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
23467  */
23468 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
23469
23470 /**
23471  * Create a new holder transaction with the given counterparty signatures.
23472  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
23473  */
23474 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);
23475
23476 /**
23477  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
23478  */
23479 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
23480
23481 /**
23482  * The commitment transaction
23483  */
23484 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
23485
23486 /**
23487  * The commitment transaction
23488  */
23489 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
23490
23491 /**
23492  * The txid for the commitment transaction.
23493  *
23494  * This is provided as a performance optimization, instead of calling transaction.txid()
23495  * multiple times.
23496  */
23497 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
23498
23499 /**
23500  * The txid for the commitment transaction.
23501  *
23502  * This is provided as a performance optimization, instead of calling transaction.txid()
23503  * multiple times.
23504  */
23505 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23506
23507 /**
23508  * Constructs a new BuiltCommitmentTransaction given each field
23509  */
23510 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
23511
23512 /**
23513  * Creates a copy of the BuiltCommitmentTransaction
23514  */
23515 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
23516
23517 /**
23518  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
23519  */
23520 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
23521
23522 /**
23523  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
23524  */
23525 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
23526
23527 /**
23528  * Get the SIGHASH_ALL sighash value of the transaction.
23529  *
23530  * This can be used to verify a signature.
23531  */
23532 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);
23533
23534 /**
23535  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
23536  * because we are about to broadcast a holder transaction.
23537  */
23538 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);
23539
23540 /**
23541  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
23542  */
23543 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
23544
23545 /**
23546  * Creates a copy of the ClosingTransaction
23547  */
23548 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
23549
23550 /**
23551  * Checks if two ClosingTransactions contain equal inner contents.
23552  */
23553 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
23554
23555 /**
23556  * Construct an object of the class
23557  */
23558 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);
23559
23560 /**
23561  * Trust our pre-built transaction.
23562  *
23563  * Applies a wrapper which allows access to the transaction.
23564  *
23565  * This should only be used if you fully trust the builder of this object. It should not
23566  * be used by an external signer - instead use the verify function.
23567  */
23568 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23569
23570 /**
23571  * Verify our pre-built transaction.
23572  *
23573  * Applies a wrapper which allows access to the transaction.
23574  *
23575  * An external validating signer must call this method before signing
23576  * or using the built transaction.
23577  */
23578 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
23579
23580 /**
23581  * The value to be sent to the holder, or zero if the output will be omitted
23582  */
23583 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23584
23585 /**
23586  * The value to be sent to the counterparty, or zero if the output will be omitted
23587  */
23588 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23589
23590 /**
23591  * The destination of the holder's output
23592  */
23593 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23594
23595 /**
23596  * The destination of the counterparty's output
23597  */
23598 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23599
23600 /**
23601  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
23602  */
23603 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
23604
23605 /**
23606  * The pre-built Bitcoin commitment transaction
23607  */
23608 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
23609
23610 /**
23611  * Get the SIGHASH_ALL sighash value of the transaction.
23612  *
23613  * This can be used to verify a signature.
23614  */
23615 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);
23616
23617 /**
23618  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
23619  * because we are about to broadcast a holder transaction.
23620  */
23621 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);
23622
23623 /**
23624  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
23625  */
23626 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
23627
23628 /**
23629  * Creates a copy of the CommitmentTransaction
23630  */
23631 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
23632
23633 /**
23634  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
23635  */
23636 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
23637
23638 /**
23639  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
23640  */
23641 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
23642
23643 /**
23644  * The backwards-counting commitment number
23645  */
23646 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23647
23648 /**
23649  * The value to be sent to the broadcaster
23650  */
23651 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23652
23653 /**
23654  * The value to be sent to the counterparty
23655  */
23656 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23657
23658 /**
23659  * The feerate paid per 1000-weight-unit in this commitment transaction.
23660  */
23661 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23662
23663 /**
23664  * Trust our pre-built transaction and derived transaction creation public keys.
23665  *
23666  * Applies a wrapper which allows access to these fields.
23667  *
23668  * This should only be used if you fully trust the builder of this object.  It should not
23669  * be used by an external signer - instead use the verify function.
23670  */
23671 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23672
23673 /**
23674  * Verify our pre-built transaction and derived transaction creation public keys.
23675  *
23676  * Applies a wrapper which allows access to these fields.
23677  *
23678  * An external validating signer must call this method before signing
23679  * or using the built transaction.
23680  */
23681 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);
23682
23683 /**
23684  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
23685  */
23686 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
23687
23688 /**
23689  * The transaction ID of the built Bitcoin transaction
23690  */
23691 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23692
23693 /**
23694  * The pre-built Bitcoin commitment transaction
23695  */
23696 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23697
23698 /**
23699  * The pre-calculated transaction creation public keys.
23700  */
23701 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23702
23703 /**
23704  * Should anchors be used.
23705  */
23706 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23707
23708 /**
23709  * Get a signature for each HTLC which was included in the commitment transaction (ie for
23710  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
23711  *
23712  * The returned Vec has one entry for each HTLC, and in the same order.
23713  *
23714  * This function is only valid in the holder commitment context, it always uses SigHashType::All.
23715  */
23716 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);
23717
23718 /**
23719  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
23720  * shared secret first. This prevents on-chain observers from discovering how many commitment
23721  * transactions occurred in a channel before it was closed.
23722  *
23723  * This function gets the shared secret from relevant channel public keys and can be used to
23724  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
23725  */
23726 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
23727
23728 /**
23729  * Checks if two InitFeaturess contain equal inner contents.
23730  * This ignores pointers and is_owned flags and looks at the values in fields.
23731  * Two objects with NULL inner values will be considered "equal" here.
23732  */
23733 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
23734
23735 /**
23736  * Checks if two NodeFeaturess contain equal inner contents.
23737  * This ignores pointers and is_owned flags and looks at the values in fields.
23738  * Two objects with NULL inner values will be considered "equal" here.
23739  */
23740 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
23741
23742 /**
23743  * Checks if two ChannelFeaturess contain equal inner contents.
23744  * This ignores pointers and is_owned flags and looks at the values in fields.
23745  * Two objects with NULL inner values will be considered "equal" here.
23746  */
23747 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
23748
23749 /**
23750  * Checks if two InvoiceFeaturess contain equal inner contents.
23751  * This ignores pointers and is_owned flags and looks at the values in fields.
23752  * Two objects with NULL inner values will be considered "equal" here.
23753  */
23754 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
23755
23756 /**
23757  * Checks if two ChannelTypeFeaturess contain equal inner contents.
23758  * This ignores pointers and is_owned flags and looks at the values in fields.
23759  * Two objects with NULL inner values will be considered "equal" here.
23760  */
23761 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
23762
23763 /**
23764  * Creates a copy of the InitFeatures
23765  */
23766 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
23767
23768 /**
23769  * Creates a copy of the NodeFeatures
23770  */
23771 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
23772
23773 /**
23774  * Creates a copy of the ChannelFeatures
23775  */
23776 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
23777
23778 /**
23779  * Creates a copy of the InvoiceFeatures
23780  */
23781 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
23782
23783 /**
23784  * Creates a copy of the ChannelTypeFeatures
23785  */
23786 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
23787
23788 /**
23789  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
23790  */
23791 void InitFeatures_free(struct LDKInitFeatures this_obj);
23792
23793 /**
23794  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
23795  */
23796 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
23797
23798 /**
23799  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
23800  */
23801 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
23802
23803 /**
23804  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
23805  */
23806 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
23807
23808 /**
23809  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
23810  */
23811 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
23812
23813 /**
23814  * Create a blank Features with no features set
23815  */
23816 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
23817
23818 /**
23819  * Creates a Features with the bits set which are known by the implementation
23820  */
23821 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
23822
23823 /**
23824  * Returns true if this `Features` object contains unknown feature flags which are set as
23825  * \"required\".
23826  */
23827 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
23828
23829 /**
23830  * Create a blank Features with no features set
23831  */
23832 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
23833
23834 /**
23835  * Creates a Features with the bits set which are known by the implementation
23836  */
23837 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
23838
23839 /**
23840  * Returns true if this `Features` object contains unknown feature flags which are set as
23841  * \"required\".
23842  */
23843 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
23844
23845 /**
23846  * Create a blank Features with no features set
23847  */
23848 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
23849
23850 /**
23851  * Creates a Features with the bits set which are known by the implementation
23852  */
23853 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
23854
23855 /**
23856  * Returns true if this `Features` object contains unknown feature flags which are set as
23857  * \"required\".
23858  */
23859 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
23860
23861 /**
23862  * Create a blank Features with no features set
23863  */
23864 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
23865
23866 /**
23867  * Creates a Features with the bits set which are known by the implementation
23868  */
23869 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
23870
23871 /**
23872  * Returns true if this `Features` object contains unknown feature flags which are set as
23873  * \"required\".
23874  */
23875 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
23876
23877 /**
23878  * Create a blank Features with no features set
23879  */
23880 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
23881
23882 /**
23883  * Creates a Features with the bits set which are known by the implementation
23884  */
23885 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
23886
23887 /**
23888  * Returns true if this `Features` object contains unknown feature flags which are set as
23889  * \"required\".
23890  */
23891 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
23892
23893 /**
23894  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
23895  */
23896 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
23897
23898 /**
23899  * Read a InitFeatures from a byte array, created by InitFeatures_write
23900  */
23901 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
23902
23903 /**
23904  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
23905  */
23906 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
23907
23908 /**
23909  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
23910  */
23911 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
23912
23913 /**
23914  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
23915  */
23916 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
23917
23918 /**
23919  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
23920  */
23921 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
23922
23923 /**
23924  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
23925  */
23926 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
23927
23928 /**
23929  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
23930  */
23931 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
23932
23933 /**
23934  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
23935  */
23936 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
23937
23938 /**
23939  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
23940  */
23941 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
23942
23943 /**
23944  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
23945  */
23946 void ShutdownScript_free(struct LDKShutdownScript this_obj);
23947
23948 /**
23949  * Creates a copy of the ShutdownScript
23950  */
23951 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
23952
23953 /**
23954  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
23955  */
23956 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
23957
23958 /**
23959  * The script that did not meet the requirements from [BOLT #2].
23960  *
23961  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
23962  */
23963 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
23964
23965 /**
23966  * The script that did not meet the requirements from [BOLT #2].
23967  *
23968  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
23969  */
23970 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
23971
23972 /**
23973  * Constructs a new InvalidShutdownScript given each field
23974  */
23975 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
23976
23977 /**
23978  * Creates a copy of the InvalidShutdownScript
23979  */
23980 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
23981
23982 /**
23983  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
23984  */
23985 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
23986
23987 /**
23988  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
23989  */
23990 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
23991
23992 /**
23993  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
23994  */
23995 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
23996
23997 /**
23998  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
23999  */
24000 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
24001
24002 /**
24003  * Generates a witness script pubkey from the given segwit version and program.
24004  *
24005  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
24006  * [`ShutdownScript::new_p2wsh`] instead.
24007  *
24008  * # Errors
24009  *
24010  * This function may return an error if `program` is invalid for the segwit `version`.
24011  */
24012 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
24013
24014 /**
24015  * Converts the shutdown script into the underlying [`Script`].
24016  */
24017 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
24018
24019 /**
24020  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
24021  *
24022  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24023  */
24024 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
24025
24026 /**
24027  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
24028  *
24029  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
24030  */
24031 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
24032
24033 /**
24034  * Calls the free function if one is set
24035  */
24036 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
24037
24038 /**
24039  * Calls the free function if one is set
24040  */
24041 void Type_free(struct LDKType this_ptr);
24042
24043 /**
24044  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
24045  */
24046 void NodeId_free(struct LDKNodeId this_obj);
24047
24048 /**
24049  * Creates a copy of the NodeId
24050  */
24051 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
24052
24053 /**
24054  * Create a new NodeId from a public key
24055  */
24056 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
24057
24058 /**
24059  * Get the public key slice from this NodeId
24060  */
24061 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
24062
24063 /**
24064  * Checks if two NodeIds contain equal inner contents.
24065  */
24066 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
24067
24068 /**
24069  * Serialize the NodeId object into a byte array which can be read by NodeId_read
24070  */
24071 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
24072
24073 /**
24074  * Read a NodeId from a byte array, created by NodeId_write
24075  */
24076 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
24077
24078 /**
24079  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
24080  */
24081 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
24082
24083 /**
24084  * Creates a copy of the NetworkGraph
24085  */
24086 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
24087
24088 /**
24089  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
24090  */
24091 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
24092
24093 /**
24094  * Frees any resources used by the NetworkUpdate
24095  */
24096 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
24097
24098 /**
24099  * Creates a copy of the NetworkUpdate
24100  */
24101 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
24102
24103 /**
24104  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
24105  */
24106 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
24107
24108 /**
24109  * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
24110  */
24111 struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
24112
24113 /**
24114  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
24115  */
24116 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
24117
24118 /**
24119  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
24120  */
24121 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
24122
24123 /**
24124  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
24125  */
24126 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
24127
24128 /**
24129  * Constructs a new EventHandler which calls the relevant methods on this_arg.
24130  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
24131  */
24132 struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
24133
24134 /**
24135  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
24136  */
24137 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
24138
24139 /**
24140  * Creates a new tracker of the actual state of the network of channels and nodes,
24141  * assuming an existing Network Graph.
24142  * Chain monitor is used to make sure announced channels exist on-chain,
24143  * channel data is correct, and that the announcement is signed with
24144  * channel owners' keys.
24145  */
24146 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
24147
24148 /**
24149  * Adds a provider used to check new announcements. Does not affect
24150  * existing announcements unless they are updated.
24151  * Add, update or remove the provider would replace the current one.
24152  */
24153 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
24154
24155 /**
24156  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
24157  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
24158  */
24159 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
24160
24161 /**
24162  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
24163  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
24164  */
24165 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
24166
24167 /**
24168  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
24169  */
24170 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
24171
24172 /**
24173  * When the last update to the channel direction was issued.
24174  * Value is opaque, as set in the announcement.
24175  */
24176 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24177
24178 /**
24179  * When the last update to the channel direction was issued.
24180  * Value is opaque, as set in the announcement.
24181  */
24182 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
24183
24184 /**
24185  * Whether the channel can be currently used for payments (in this one direction).
24186  */
24187 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24188
24189 /**
24190  * Whether the channel can be currently used for payments (in this one direction).
24191  */
24192 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
24193
24194 /**
24195  * The difference in CLTV values that you must have when routing through this channel.
24196  */
24197 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24198
24199 /**
24200  * The difference in CLTV values that you must have when routing through this channel.
24201  */
24202 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
24203
24204 /**
24205  * The minimum value, which must be relayed to the next hop via the channel
24206  */
24207 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24208
24209 /**
24210  * The minimum value, which must be relayed to the next hop via the channel
24211  */
24212 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
24213
24214 /**
24215  * The maximum value which may be relayed to the next hop via the channel.
24216  */
24217 struct LDKCOption_u64Z ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24218
24219 /**
24220  * The maximum value which may be relayed to the next hop via the channel.
24221  */
24222 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24223
24224 /**
24225  * Fees charged when the channel is used for routing
24226  */
24227 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24228
24229 /**
24230  * Fees charged when the channel is used for routing
24231  */
24232 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
24233
24234 /**
24235  * Most recent update for the channel received from the network
24236  * Mostly redundant with the data we store in fields explicitly.
24237  * Everything else is useful only for sending out for initial routing sync.
24238  * Not stored if contains excess data to prevent DoS.
24239  *
24240  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24241  */
24242 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24243
24244 /**
24245  * Most recent update for the channel received from the network
24246  * Mostly redundant with the data we store in fields explicitly.
24247  * Everything else is useful only for sending out for initial routing sync.
24248  * Not stored if contains excess data to prevent DoS.
24249  *
24250  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24251  */
24252 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
24253
24254 /**
24255  * Constructs a new ChannelUpdateInfo given each field
24256  */
24257 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);
24258
24259 /**
24260  * Creates a copy of the ChannelUpdateInfo
24261  */
24262 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
24263
24264 /**
24265  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
24266  */
24267 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
24268
24269 /**
24270  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
24271  */
24272 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
24273
24274 /**
24275  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
24276  */
24277 void ChannelInfo_free(struct LDKChannelInfo this_obj);
24278
24279 /**
24280  * Protocol features of a channel communicated during its announcement
24281  */
24282 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24283
24284 /**
24285  * Protocol features of a channel communicated during its announcement
24286  */
24287 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
24288
24289 /**
24290  * Source node of the first direction of a channel
24291  */
24292 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24293
24294 /**
24295  * Source node of the first direction of a channel
24296  */
24297 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
24298
24299 /**
24300  * Details about the first direction of a channel
24301  *
24302  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24303  */
24304 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24305
24306 /**
24307  * Details about the first direction of a channel
24308  *
24309  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24310  */
24311 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
24312
24313 /**
24314  * Source node of the second direction of a channel
24315  */
24316 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24317
24318 /**
24319  * Source node of the second direction of a channel
24320  */
24321 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
24322
24323 /**
24324  * Details about the second direction of a channel
24325  *
24326  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24327  */
24328 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24329
24330 /**
24331  * Details about the second direction of a channel
24332  *
24333  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24334  */
24335 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
24336
24337 /**
24338  * The channel capacity as seen on-chain, if chain lookup is available.
24339  */
24340 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24341
24342 /**
24343  * The channel capacity as seen on-chain, if chain lookup is available.
24344  */
24345 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24346
24347 /**
24348  * An initial announcement of the channel
24349  * Mostly redundant with the data we store in fields explicitly.
24350  * Everything else is useful only for sending out for initial routing sync.
24351  * Not stored if contains excess data to prevent DoS.
24352  *
24353  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24354  */
24355 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24356
24357 /**
24358  * An initial announcement of the channel
24359  * Mostly redundant with the data we store in fields explicitly.
24360  * Everything else is useful only for sending out for initial routing sync.
24361  * Not stored if contains excess data to prevent DoS.
24362  *
24363  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24364  */
24365 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
24366
24367 /**
24368  * Creates a copy of the ChannelInfo
24369  */
24370 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
24371
24372 /**
24373  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
24374  */
24375 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
24376
24377 /**
24378  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
24379  */
24380 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
24381
24382 /**
24383  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
24384  */
24385 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
24386
24387 /**
24388  * Creates a copy of the DirectedChannelInfo
24389  */
24390 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
24391
24392 /**
24393  * Returns information for the channel.
24394  */
24395 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
24396
24397 /**
24398  * Returns information for the direction.
24399  *
24400  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24401  */
24402 MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
24403
24404 /**
24405  * Returns the [`EffectiveCapacity`] of the channel in the direction.
24406  *
24407  * This is either the total capacity from the funding transaction, if known, or the
24408  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
24409  * whichever is smaller.
24410  */
24411 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
24412
24413 /**
24414  * Frees any resources used by the EffectiveCapacity
24415  */
24416 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
24417
24418 /**
24419  * Creates a copy of the EffectiveCapacity
24420  */
24421 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
24422
24423 /**
24424  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
24425  */
24426 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
24427
24428 /**
24429  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
24430  */
24431 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
24432
24433 /**
24434  * Utility method to constructs a new Total-variant EffectiveCapacity
24435  */
24436 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat);
24437
24438 /**
24439  * Utility method to constructs a new Infinite-variant EffectiveCapacity
24440  */
24441 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
24442
24443 /**
24444  * Utility method to constructs a new Unknown-variant EffectiveCapacity
24445  */
24446 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
24447
24448 /**
24449  * Returns the effective capacity denominated in millisatoshi.
24450  */
24451 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
24452
24453 /**
24454  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
24455  */
24456 void RoutingFees_free(struct LDKRoutingFees this_obj);
24457
24458 /**
24459  * Flat routing fee in satoshis
24460  */
24461 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
24462
24463 /**
24464  * Flat routing fee in satoshis
24465  */
24466 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
24467
24468 /**
24469  * Liquidity-based routing fee in millionths of a routed amount.
24470  * In other words, 10000 is 1%.
24471  */
24472 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
24473
24474 /**
24475  * Liquidity-based routing fee in millionths of a routed amount.
24476  * In other words, 10000 is 1%.
24477  */
24478 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
24479
24480 /**
24481  * Constructs a new RoutingFees given each field
24482  */
24483 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
24484
24485 /**
24486  * Checks if two RoutingFeess contain equal inner contents.
24487  * This ignores pointers and is_owned flags and looks at the values in fields.
24488  * Two objects with NULL inner values will be considered "equal" here.
24489  */
24490 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
24491
24492 /**
24493  * Creates a copy of the RoutingFees
24494  */
24495 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
24496
24497 /**
24498  * Checks if two RoutingFeess contain equal inner contents.
24499  */
24500 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
24501
24502 /**
24503  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
24504  */
24505 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
24506
24507 /**
24508  * Read a RoutingFees from a byte array, created by RoutingFees_write
24509  */
24510 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
24511
24512 /**
24513  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
24514  */
24515 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
24516
24517 /**
24518  * Protocol features the node announced support for
24519  */
24520 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
24521
24522 /**
24523  * Protocol features the node announced support for
24524  */
24525 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
24526
24527 /**
24528  * When the last known update to the node state was issued.
24529  * Value is opaque, as set in the announcement.
24530  */
24531 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
24532
24533 /**
24534  * When the last known update to the node state was issued.
24535  * Value is opaque, as set in the announcement.
24536  */
24537 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
24538
24539 /**
24540  * Color assigned to the node
24541  */
24542 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
24543
24544 /**
24545  * Color assigned to the node
24546  */
24547 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
24548
24549 /**
24550  * Moniker assigned to the node.
24551  * May be invalid or malicious (eg control chars),
24552  * should not be exposed to the user.
24553  */
24554 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
24555
24556 /**
24557  * Moniker assigned to the node.
24558  * May be invalid or malicious (eg control chars),
24559  * should not be exposed to the user.
24560  */
24561 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24562
24563 /**
24564  * Internet-level addresses via which one can connect to the node
24565  */
24566 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
24567
24568 /**
24569  * An initial announcement of the node
24570  * Mostly redundant with the data we store in fields explicitly.
24571  * Everything else is useful only for sending out for initial routing sync.
24572  * Not stored if contains excess data to prevent DoS.
24573  *
24574  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24575  */
24576 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
24577
24578 /**
24579  * An initial announcement of the node
24580  * Mostly redundant with the data we store in fields explicitly.
24581  * Everything else is useful only for sending out for initial routing sync.
24582  * Not stored if contains excess data to prevent DoS.
24583  *
24584  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24585  */
24586 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
24587
24588 /**
24589  * Constructs a new NodeAnnouncementInfo given each field
24590  */
24591 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);
24592
24593 /**
24594  * Creates a copy of the NodeAnnouncementInfo
24595  */
24596 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
24597
24598 /**
24599  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
24600  */
24601 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
24602
24603 /**
24604  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
24605  */
24606 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
24607
24608 /**
24609  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
24610  */
24611 void NodeInfo_free(struct LDKNodeInfo this_obj);
24612
24613 /**
24614  * All valid channels a node has announced
24615  */
24616 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
24617
24618 /**
24619  * Lowest fees enabling routing via any of the enabled, known channels to a node.
24620  * The two fields (flat and proportional fee) are independent,
24621  * meaning they don't have to refer to the same channel.
24622  *
24623  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24624  */
24625 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
24626
24627 /**
24628  * Lowest fees enabling routing via any of the enabled, known channels to a node.
24629  * The two fields (flat and proportional fee) are independent,
24630  * meaning they don't have to refer to the same channel.
24631  *
24632  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24633  */
24634 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
24635
24636 /**
24637  * More information about a node from node_announcement.
24638  * Optional because we store a Node entry after learning about it from
24639  * a channel announcement, but before receiving a node announcement.
24640  *
24641  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24642  */
24643 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
24644
24645 /**
24646  * More information about a node from node_announcement.
24647  * Optional because we store a Node entry after learning about it from
24648  * a channel announcement, but before receiving a node announcement.
24649  *
24650  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24651  */
24652 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
24653
24654 /**
24655  * Constructs a new NodeInfo given each field
24656  */
24657 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
24658
24659 /**
24660  * Creates a copy of the NodeInfo
24661  */
24662 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
24663
24664 /**
24665  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
24666  */
24667 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
24668
24669 /**
24670  * Read a NodeInfo from a byte array, created by NodeInfo_write
24671  */
24672 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
24673
24674 /**
24675  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
24676  */
24677 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
24678
24679 /**
24680  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
24681  */
24682 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
24683
24684 /**
24685  * Creates a new, empty, network graph.
24686  */
24687 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
24688
24689 /**
24690  * Returns a read-only view of the network graph.
24691  */
24692 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
24693
24694 /**
24695  * For an already known node (from channel announcements), update its stored properties from a
24696  * given node announcement.
24697  *
24698  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
24699  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
24700  * routing messages from a source using a protocol other than the lightning P2P protocol.
24701  */
24702 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
24703
24704 /**
24705  * For an already known node (from channel announcements), update its stored properties from a
24706  * given node announcement without verifying the associated signatures. Because we aren't
24707  * given the associated signatures here we cannot relay the node announcement to any of our
24708  * peers.
24709  */
24710 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);
24711
24712 /**
24713  * Store or update channel info from a channel announcement.
24714  *
24715  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
24716  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
24717  * routing messages from a source using a protocol other than the lightning P2P protocol.
24718  *
24719  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
24720  * the corresponding UTXO exists on chain and is correctly-formatted.
24721  */
24722 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);
24723
24724 /**
24725  * Store or update channel info from a channel announcement without verifying the associated
24726  * signatures. Because we aren't given the associated signatures here we cannot relay the
24727  * channel announcement to any of our peers.
24728  *
24729  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
24730  * the corresponding UTXO exists on chain and is correctly-formatted.
24731  */
24732 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);
24733
24734 /**
24735  * Close a channel if a corresponding HTLC fail was sent.
24736  * If permanent, removes a channel from the local storage.
24737  * May cause the removal of nodes too, if this was their last channel.
24738  * If not permanent, makes channels unavailable for routing.
24739  */
24740 void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
24741
24742 /**
24743  * Marks a node in the graph as failed.
24744  */
24745 void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
24746
24747 /**
24748  * Removes information about channels that we haven't heard any updates about in some time.
24749  * This can be used regularly to prune the network graph of channels that likely no longer
24750  * exist.
24751  *
24752  * While there is no formal requirement that nodes regularly re-broadcast their channel
24753  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
24754  * pruning occur for updates which are at least two weeks old, which we implement here.
24755  *
24756  * Note that for users of the `lightning-background-processor` crate this method may be
24757  * automatically called regularly for you.
24758  *
24759  * This method is only available with the `std` feature. See
24760  * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
24761  */
24762 void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
24763
24764 /**
24765  * Removes information about channels that we haven't heard any updates about in some time.
24766  * This can be used regularly to prune the network graph of channels that likely no longer
24767  * exist.
24768  *
24769  * While there is no formal requirement that nodes regularly re-broadcast their channel
24770  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
24771  * pruning occur for updates which are at least two weeks old, which we implement here.
24772  *
24773  * This function takes the current unix time as an argument. For users with the `std` feature
24774  * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
24775  */
24776 void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
24777
24778 /**
24779  * For an already known (from announcement) channel, update info about one of the directions
24780  * of the channel.
24781  *
24782  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
24783  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
24784  * routing messages from a source using a protocol other than the lightning P2P protocol.
24785  *
24786  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
24787  * materially in the future will be rejected.
24788  */
24789 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
24790
24791 /**
24792  * For an already known (from announcement) channel, update info about one of the directions
24793  * of the channel without verifying the associated signatures. Because we aren't given the
24794  * associated signatures here we cannot relay the channel update to any of our peers.
24795  *
24796  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
24797  * materially in the future will be rejected.
24798  */
24799 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
24800
24801 /**
24802  * Get network addresses by node id.
24803  * Returns None if the requested node is completely unknown,
24804  * or if node announcement for the node was never received.
24805  */
24806 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
24807
24808 /**
24809  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
24810  */
24811 void RouteHop_free(struct LDKRouteHop this_obj);
24812
24813 /**
24814  * The node_id of the node at this hop.
24815  */
24816 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24817
24818 /**
24819  * The node_id of the node at this hop.
24820  */
24821 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24822
24823 /**
24824  * The node_announcement features of the node at this hop. For the last hop, these may be
24825  * amended to match the features present in the invoice this node generated.
24826  */
24827 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24828
24829 /**
24830  * The node_announcement features of the node at this hop. For the last hop, these may be
24831  * amended to match the features present in the invoice this node generated.
24832  */
24833 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
24834
24835 /**
24836  * The channel that should be used from the previous hop to reach this node.
24837  */
24838 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24839
24840 /**
24841  * The channel that should be used from the previous hop to reach this node.
24842  */
24843 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
24844
24845 /**
24846  * The channel_announcement features of the channel that should be used from the previous hop
24847  * to reach this node.
24848  */
24849 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24850
24851 /**
24852  * The channel_announcement features of the channel that should be used from the previous hop
24853  * to reach this node.
24854  */
24855 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
24856
24857 /**
24858  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
24859  * For the last hop, this should be the full value of the payment (might be more than
24860  * requested if we had to match htlc_minimum_msat).
24861  */
24862 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24863
24864 /**
24865  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
24866  * For the last hop, this should be the full value of the payment (might be more than
24867  * requested if we had to match htlc_minimum_msat).
24868  */
24869 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
24870
24871 /**
24872  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
24873  * expected at the destination, in excess of the current block height.
24874  */
24875 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24876
24877 /**
24878  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
24879  * expected at the destination, in excess of the current block height.
24880  */
24881 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
24882
24883 /**
24884  * Constructs a new RouteHop given each field
24885  */
24886 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);
24887
24888 /**
24889  * Creates a copy of the RouteHop
24890  */
24891 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
24892
24893 /**
24894  * Checks if two RouteHops contain equal inner contents.
24895  */
24896 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
24897
24898 /**
24899  * Checks if two RouteHops contain equal inner contents.
24900  * This ignores pointers and is_owned flags and looks at the values in fields.
24901  * Two objects with NULL inner values will be considered "equal" here.
24902  */
24903 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
24904
24905 /**
24906  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
24907  */
24908 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
24909
24910 /**
24911  * Read a RouteHop from a byte array, created by RouteHop_write
24912  */
24913 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
24914
24915 /**
24916  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
24917  */
24918 void Route_free(struct LDKRoute this_obj);
24919
24920 /**
24921  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
24922  * last RouteHop in each path must be the same.
24923  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
24924  * destination. Thus, this must always be at least length one. While the maximum length of any
24925  * given path is variable, keeping the length of any path to less than 20 should currently
24926  * ensure it is viable.
24927  */
24928 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
24929
24930 /**
24931  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
24932  * last RouteHop in each path must be the same.
24933  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
24934  * destination. Thus, this must always be at least length one. While the maximum length of any
24935  * given path is variable, keeping the length of any path to less than 20 should currently
24936  * ensure it is viable.
24937  */
24938 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
24939
24940 /**
24941  * The `payment_params` parameter passed to [`find_route`].
24942  * This is used by `ChannelManager` to track information which may be required for retries,
24943  * provided back to you via [`Event::PaymentPathFailed`].
24944  *
24945  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
24946  *
24947  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24948  */
24949 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
24950
24951 /**
24952  * The `payment_params` parameter passed to [`find_route`].
24953  * This is used by `ChannelManager` to track information which may be required for retries,
24954  * provided back to you via [`Event::PaymentPathFailed`].
24955  *
24956  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
24957  *
24958  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24959  */
24960 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
24961
24962 /**
24963  * Constructs a new Route given each field
24964  */
24965 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
24966
24967 /**
24968  * Creates a copy of the Route
24969  */
24970 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
24971
24972 /**
24973  * Checks if two Routes contain equal inner contents.
24974  */
24975 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
24976
24977 /**
24978  * Checks if two Routes contain equal inner contents.
24979  * This ignores pointers and is_owned flags and looks at the values in fields.
24980  * Two objects with NULL inner values will be considered "equal" here.
24981  */
24982 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
24983
24984 /**
24985  * Returns the total amount of fees paid on this [`Route`].
24986  *
24987  * This doesn't include any extra payment made to the recipient, which can happen in excess of
24988  * the amount passed to [`find_route`]'s `params.final_value_msat`.
24989  */
24990 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
24991
24992 /**
24993  * Returns the total amount paid on this [`Route`], excluding the fees.
24994  */
24995 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
24996
24997 /**
24998  * Serialize the Route object into a byte array which can be read by Route_read
24999  */
25000 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
25001
25002 /**
25003  * Read a Route from a byte array, created by Route_write
25004  */
25005 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
25006
25007 /**
25008  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
25009  */
25010 void RouteParameters_free(struct LDKRouteParameters this_obj);
25011
25012 /**
25013  * The parameters of the failed payment path.
25014  */
25015 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
25016
25017 /**
25018  * The parameters of the failed payment path.
25019  */
25020 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
25021
25022 /**
25023  * The amount in msats sent on the failed payment path.
25024  */
25025 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
25026
25027 /**
25028  * The amount in msats sent on the failed payment path.
25029  */
25030 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
25031
25032 /**
25033  * The CLTV on the final hop of the failed payment path.
25034  */
25035 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
25036
25037 /**
25038  * The CLTV on the final hop of the failed payment path.
25039  */
25040 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
25041
25042 /**
25043  * Constructs a new RouteParameters given each field
25044  */
25045 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);
25046
25047 /**
25048  * Creates a copy of the RouteParameters
25049  */
25050 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
25051
25052 /**
25053  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
25054  */
25055 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
25056
25057 /**
25058  * Read a RouteParameters from a byte array, created by RouteParameters_write
25059  */
25060 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
25061
25062 /**
25063  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
25064  */
25065 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
25066
25067 /**
25068  * The node id of the payee.
25069  */
25070 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
25071
25072 /**
25073  * The node id of the payee.
25074  */
25075 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25076
25077 /**
25078  * Features supported by the payee.
25079  *
25080  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
25081  * does not contain any features.
25082  *
25083  * [`for_keysend`]: Self::for_keysend
25084  *
25085  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25086  */
25087 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
25088
25089 /**
25090  * Features supported by the payee.
25091  *
25092  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
25093  * does not contain any features.
25094  *
25095  * [`for_keysend`]: Self::for_keysend
25096  *
25097  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25098  */
25099 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
25100
25101 /**
25102  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
25103  */
25104 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
25105
25106 /**
25107  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
25108  */
25109 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
25110
25111 /**
25112  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
25113  */
25114 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
25115
25116 /**
25117  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
25118  */
25119 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25120
25121 /**
25122  * The maximum total CLTV delta we accept for the route.
25123  */
25124 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
25125
25126 /**
25127  * The maximum total CLTV delta we accept for the route.
25128  */
25129 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
25130
25131 /**
25132  * Constructs a new PaymentParameters given each field
25133  */
25134 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);
25135
25136 /**
25137  * Creates a copy of the PaymentParameters
25138  */
25139 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
25140
25141 /**
25142  * Checks if two PaymentParameterss contain equal inner contents.
25143  */
25144 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
25145
25146 /**
25147  * Checks if two PaymentParameterss contain equal inner contents.
25148  * This ignores pointers and is_owned flags and looks at the values in fields.
25149  * Two objects with NULL inner values will be considered "equal" here.
25150  */
25151 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
25152
25153 /**
25154  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
25155  */
25156 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
25157
25158 /**
25159  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
25160  */
25161 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
25162
25163 /**
25164  * Creates a payee with the node id of the given `pubkey`.
25165  */
25166 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
25167
25168 /**
25169  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
25170  */
25171 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
25172
25173 /**
25174  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
25175  */
25176 void RouteHint_free(struct LDKRouteHint this_obj);
25177
25178 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
25179
25180 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
25181
25182 /**
25183  * Constructs a new RouteHint given each field
25184  */
25185 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
25186
25187 /**
25188  * Creates a copy of the RouteHint
25189  */
25190 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
25191
25192 /**
25193  * Checks if two RouteHints contain equal inner contents.
25194  */
25195 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
25196
25197 /**
25198  * Checks if two RouteHints contain equal inner contents.
25199  * This ignores pointers and is_owned flags and looks at the values in fields.
25200  * Two objects with NULL inner values will be considered "equal" here.
25201  */
25202 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
25203
25204 /**
25205  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
25206  */
25207 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
25208
25209 /**
25210  * Read a RouteHint from a byte array, created by RouteHint_write
25211  */
25212 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
25213
25214 /**
25215  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
25216  */
25217 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
25218
25219 /**
25220  * The node_id of the non-target end of the route
25221  */
25222 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25223
25224 /**
25225  * The node_id of the non-target end of the route
25226  */
25227 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25228
25229 /**
25230  * The short_channel_id of this channel
25231  */
25232 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25233
25234 /**
25235  * The short_channel_id of this channel
25236  */
25237 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
25238
25239 /**
25240  * The fees which must be paid to use this channel
25241  */
25242 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25243
25244 /**
25245  * The fees which must be paid to use this channel
25246  */
25247 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
25248
25249 /**
25250  * The difference in CLTV values between this node and the next node.
25251  */
25252 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25253
25254 /**
25255  * The difference in CLTV values between this node and the next node.
25256  */
25257 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
25258
25259 /**
25260  * The minimum value, in msat, which must be relayed to the next hop.
25261  */
25262 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25263
25264 /**
25265  * The minimum value, in msat, which must be relayed to the next hop.
25266  */
25267 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25268
25269 /**
25270  * The maximum value in msat available for routing with a single HTLC.
25271  */
25272 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25273
25274 /**
25275  * The maximum value in msat available for routing with a single HTLC.
25276  */
25277 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25278
25279 /**
25280  * Constructs a new RouteHintHop given each field
25281  */
25282 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);
25283
25284 /**
25285  * Creates a copy of the RouteHintHop
25286  */
25287 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
25288
25289 /**
25290  * Checks if two RouteHintHops contain equal inner contents.
25291  */
25292 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
25293
25294 /**
25295  * Checks if two RouteHintHops contain equal inner contents.
25296  * This ignores pointers and is_owned flags and looks at the values in fields.
25297  * Two objects with NULL inner values will be considered "equal" here.
25298  */
25299 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
25300
25301 /**
25302  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
25303  */
25304 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
25305
25306 /**
25307  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
25308  */
25309 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
25310
25311 /**
25312  * Finds a route from us (payer) to the given target node (payee).
25313  *
25314  * If the payee provided features in their invoice, they should be provided via `params.payee`.
25315  * Without this, MPP will only be used if the payee's features are available in the network graph.
25316  *
25317  * Private routing paths between a public node and the target may be included in `params.payee`.
25318  *
25319  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
25320  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
25321  * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
25322  *
25323  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
25324  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
25325  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
25326  *
25327  * # Note
25328  *
25329  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
25330  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
25331  * function.
25332  *
25333  * # Panics
25334  *
25335  * Panics if first_hops contains channels without short_channel_ids;
25336  * [`ChannelManager::list_usable_channels`] will never include such channels.
25337  *
25338  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
25339  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
25340  *
25341  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
25342  */
25343 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, const uint8_t (*random_seed_bytes)[32]);
25344
25345 /**
25346  * Calls the free function if one is set
25347  */
25348 void Score_free(struct LDKScore this_ptr);
25349
25350 /**
25351  * Calls the free function if one is set
25352  */
25353 void LockableScore_free(struct LDKLockableScore this_ptr);
25354
25355 /**
25356  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
25357  */
25358 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
25359
25360 /**
25361  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
25362  */
25363 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
25364
25365 /**
25366  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
25367  */
25368 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
25369
25370 /**
25371  * Creates a copy of the FixedPenaltyScorer
25372  */
25373 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
25374
25375 /**
25376  * Creates a new scorer using `penalty_msat`.
25377  */
25378 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
25379
25380 /**
25381  * Constructs a new Score which calls the relevant methods on this_arg.
25382  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
25383  */
25384 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
25385
25386 /**
25387  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
25388  */
25389 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
25390
25391 /**
25392  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
25393  */
25394 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
25395
25396 /**
25397  * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
25398  */
25399 void Scorer_free(struct LDKScorer this_obj);
25400
25401 /**
25402  * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
25403  */
25404 void ScoringParameters_free(struct LDKScoringParameters this_obj);
25405
25406 /**
25407  * A fixed penalty in msats to apply to each channel.
25408  *
25409  * Default value: 500 msat
25410  */
25411 uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25412
25413 /**
25414  * A fixed penalty in msats to apply to each channel.
25415  *
25416  * Default value: 500 msat
25417  */
25418 void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25419
25420 /**
25421  * A penalty in msats to apply to a channel upon failing to relay a payment.
25422  *
25423  * This accumulates for each failure but may be reduced over time based on
25424  * [`failure_penalty_half_life`] or when successfully routing through a channel.
25425  *
25426  * Default value: 1,024,000 msat
25427  *
25428  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
25429  */
25430 uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25431
25432 /**
25433  * A penalty in msats to apply to a channel upon failing to relay a payment.
25434  *
25435  * This accumulates for each failure but may be reduced over time based on
25436  * [`failure_penalty_half_life`] or when successfully routing through a channel.
25437  *
25438  * Default value: 1,024,000 msat
25439  *
25440  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
25441  */
25442 void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25443
25444 /**
25445  * When the amount being sent over a channel is this many 1024ths of the total channel
25446  * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
25447  *
25448  * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
25449  *
25450  * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
25451  */
25452 uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25453
25454 /**
25455  * When the amount being sent over a channel is this many 1024ths of the total channel
25456  * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
25457  *
25458  * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
25459  *
25460  * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
25461  */
25462 void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val);
25463
25464 /**
25465  * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
25466  * over the channel exceeds [`overuse_penalty_start_1024th`] by.
25467  *
25468  * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
25469  *                to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
25470  *
25471  * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
25472  */
25473 uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25474
25475 /**
25476  * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
25477  * over the channel exceeds [`overuse_penalty_start_1024th`] by.
25478  *
25479  * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
25480  *                to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
25481  *
25482  * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
25483  */
25484 void ScoringParameters_set_overuse_penalty_msat_per_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25485
25486 /**
25487  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
25488  * cut in half.
25489  *
25490  * Successfully routing through a channel will immediately cut the penalty in half as well.
25491  *
25492  * Default value: 1 hour
25493  *
25494  * # Note
25495  *
25496  * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
25497  * never decay.
25498  *
25499  * [`failure_penalty_msat`]: Self::failure_penalty_msat
25500  */
25501 uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25502
25503 /**
25504  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
25505  * cut in half.
25506  *
25507  * Successfully routing through a channel will immediately cut the penalty in half as well.
25508  *
25509  * Default value: 1 hour
25510  *
25511  * # Note
25512  *
25513  * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
25514  * never decay.
25515  *
25516  * [`failure_penalty_msat`]: Self::failure_penalty_msat
25517  */
25518 void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25519
25520 /**
25521  * Constructs a new ScoringParameters given each field
25522  */
25523 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);
25524
25525 /**
25526  * Creates a copy of the ScoringParameters
25527  */
25528 struct LDKScoringParameters ScoringParameters_clone(const struct LDKScoringParameters *NONNULL_PTR orig);
25529
25530 /**
25531  * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
25532  */
25533 struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj);
25534
25535 /**
25536  * Read a ScoringParameters from a byte array, created by ScoringParameters_write
25537  */
25538 struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser);
25539
25540 /**
25541  * Creates a new scorer using the given scoring parameters.
25542  */
25543 MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
25544
25545 /**
25546  * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
25547  */
25548 MUST_USE_RES struct LDKScorer Scorer_default(void);
25549
25550 /**
25551  * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
25552  */
25553 MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
25554
25555 /**
25556  * Constructs a new Score which calls the relevant methods on this_arg.
25557  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
25558  */
25559 struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
25560
25561 /**
25562  * Serialize the Scorer object into a byte array which can be read by Scorer_read
25563  */
25564 struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj);
25565
25566 /**
25567  * Read a Scorer from a byte array, created by Scorer_write
25568  */
25569 struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
25570
25571 /**
25572  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
25573  */
25574 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
25575
25576 /**
25577  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
25578  */
25579 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
25580
25581 /**
25582  * A fixed penalty in msats to apply to each channel.
25583  *
25584  * Default value: 500 msat
25585  */
25586 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
25587
25588 /**
25589  * A fixed penalty in msats to apply to each channel.
25590  *
25591  * Default value: 500 msat
25592  */
25593 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25594
25595 /**
25596  * A multiplier used in conjunction with the negative `log10` of the channel's success
25597  * probability for a payment to determine the liquidity penalty.
25598  *
25599  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
25600  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
25601  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
25602  * lower bounding the success probability to `0.01`) when the amount falls within the
25603  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
25604  * result in a `u64::max_value` penalty, however.
25605  *
25606  * Default value: 40,000 msat
25607  *
25608  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
25609  */
25610 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
25611
25612 /**
25613  * A multiplier used in conjunction with the negative `log10` of the channel's success
25614  * probability for a payment to determine the liquidity penalty.
25615  *
25616  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
25617  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
25618  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
25619  * lower bounding the success probability to `0.01`) when the amount falls within the
25620  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
25621  * result in a `u64::max_value` penalty, however.
25622  *
25623  * Default value: 40,000 msat
25624  *
25625  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
25626  */
25627 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25628
25629 /**
25630  * The time required to elapse before any knowledge learned about channel liquidity balances is
25631  * cut in half.
25632  *
25633  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
25634  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
25635  * the certainty of the channel liquidity balance.
25636  *
25637  * Default value: 1 hour
25638  *
25639  * # Note
25640  *
25641  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
25642  * liquidity knowledge will never decay except when the bounds cross.
25643  */
25644 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
25645
25646 /**
25647  * The time required to elapse before any knowledge learned about channel liquidity balances is
25648  * cut in half.
25649  *
25650  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
25651  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
25652  * the certainty of the channel liquidity balance.
25653  *
25654  * Default value: 1 hour
25655  *
25656  * # Note
25657  *
25658  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
25659  * liquidity knowledge will never decay except when the bounds cross.
25660  */
25661 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25662
25663 /**
25664  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
25665  * channel's success probability for the payment to determine the amount penalty.
25666  *
25667  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
25668  * fees plus penalty) for large payments. The penalty is computed as the product of this
25669  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
25670  * success probability.
25671  *
25672  * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
25673  *
25674  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
25675  * the amount will result in a penalty of the multiplier. And, as the success probability
25676  * decreases, the negative `log10` weighting will increase dramatically. For higher success
25677  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
25678  * fall below `1`.
25679  *
25680  * Default value: 256 msat
25681  */
25682 uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
25683
25684 /**
25685  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
25686  * channel's success probability for the payment to determine the amount penalty.
25687  *
25688  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
25689  * fees plus penalty) for large payments. The penalty is computed as the product of this
25690  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
25691  * success probability.
25692  *
25693  * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
25694  *
25695  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
25696  * the amount will result in a penalty of the multiplier. And, as the success probability
25697  * decreases, the negative `log10` weighting will increase dramatically. For higher success
25698  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
25699  * fall below `1`.
25700  *
25701  * Default value: 256 msat
25702  */
25703 void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25704
25705 /**
25706  * Constructs a new ProbabilisticScoringParameters given each field
25707  */
25708 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg, uint64_t amount_penalty_multiplier_msat_arg);
25709
25710 /**
25711  * Creates a copy of the ProbabilisticScoringParameters
25712  */
25713 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
25714
25715 /**
25716  * Creates a new scorer using the given scoring parameters for sending payments from a node
25717  * through a network graph.
25718  */
25719 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
25720
25721 /**
25722  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
25723  */
25724 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
25725
25726 /**
25727  * Constructs a new Score which calls the relevant methods on this_arg.
25728  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
25729  */
25730 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
25731
25732 /**
25733  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
25734  */
25735 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
25736
25737 /**
25738  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
25739  */
25740 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b);
25741
25742 /**
25743  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
25744  */
25745 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
25746
25747 /**
25748  * Initialize a new FilesystemPersister and set the path to the individual channels'
25749  * files.
25750  */
25751 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
25752
25753 /**
25754  * Get the directory which was provided when this persister was initialized.
25755  */
25756 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
25757
25758 /**
25759  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
25760  * initialization, within a file called \"manager\".
25761  */
25762 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
25763
25764 /**
25765  * Write the provided `NetworkGraph` to the path provided at `FilesystemPersister`
25766  * initialization, within a file called \"network_graph\"
25767  */
25768 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_network_graph(struct LDKStr data_dir, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
25769
25770 /**
25771  * Read `ChannelMonitor`s from disk.
25772  */
25773 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
25774
25775 /**
25776  * Constructs a new Persist which calls the relevant methods on this_arg.
25777  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
25778  */
25779 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
25780
25781 /**
25782  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
25783  */
25784 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
25785
25786 /**
25787  * Calls the free function if one is set
25788  */
25789 void Persister_free(struct LDKPersister this_ptr);
25790
25791 /**
25792  * Start a background thread that takes care of responsibilities enumerated in the [top-level
25793  * documentation].
25794  *
25795  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
25796  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
25797  * either [`join`] or [`stop`].
25798  *
25799  * # Data Persistence
25800  *
25801  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
25802  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
25803  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
25804  * provided implementation.
25805  *
25806  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk. See
25807  * [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. See [`FilesystemPersister::persist_network_graph`]
25808  * for Rust-Lightning's provided implementation.
25809  *
25810  * Typically, users should either implement [`Persister::persist_manager`] to never return an
25811  * error or call [`join`] and handle any error that may arise. For the latter case,
25812  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
25813  *
25814  * # Event Handling
25815  *
25816  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
25817  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
25818  * functionality implemented by other handlers.
25819  * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
25820  *
25821  * [top-level documentation]: BackgroundProcessor
25822  * [`join`]: Self::join
25823  * [`stop`]: Self::stop
25824  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
25825  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
25826  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
25827  * [`FilesystemPersister::persist_network_graph`]: lightning_persister::FilesystemPersister::persist_network_graph
25828  * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
25829  * [`NetworkGraph::write`]: lightning::routing::network_graph::NetworkGraph#impl-Writeable
25830  *
25831  * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
25832  */
25833 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
25834
25835 /**
25836  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
25837  * [`ChannelManager`].
25838  *
25839  * # Panics
25840  *
25841  * This function panics if the background thread has panicked such as while persisting or
25842  * handling events.
25843  *
25844  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
25845  */
25846 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
25847
25848 /**
25849  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
25850  * [`ChannelManager`].
25851  *
25852  * # Panics
25853  *
25854  * This function panics if the background thread has panicked such as while persisting or
25855  * handling events.
25856  *
25857  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
25858  */
25859 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
25860
25861 /**
25862  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
25863  */
25864 void Invoice_free(struct LDKInvoice this_obj);
25865
25866 /**
25867  * Checks if two Invoices contain equal inner contents.
25868  * This ignores pointers and is_owned flags and looks at the values in fields.
25869  * Two objects with NULL inner values will be considered "equal" here.
25870  */
25871 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
25872
25873 /**
25874  * Creates a copy of the Invoice
25875  */
25876 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
25877
25878 /**
25879  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
25880  */
25881 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
25882
25883 /**
25884  * Checks if two SignedRawInvoices contain equal inner contents.
25885  * This ignores pointers and is_owned flags and looks at the values in fields.
25886  * Two objects with NULL inner values will be considered "equal" here.
25887  */
25888 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
25889
25890 /**
25891  * Creates a copy of the SignedRawInvoice
25892  */
25893 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
25894
25895 /**
25896  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
25897  */
25898 void RawInvoice_free(struct LDKRawInvoice this_obj);
25899
25900 /**
25901  * data part
25902  */
25903 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
25904
25905 /**
25906  * data part
25907  */
25908 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
25909
25910 /**
25911  * Checks if two RawInvoices contain equal inner contents.
25912  * This ignores pointers and is_owned flags and looks at the values in fields.
25913  * Two objects with NULL inner values will be considered "equal" here.
25914  */
25915 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
25916
25917 /**
25918  * Creates a copy of the RawInvoice
25919  */
25920 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
25921
25922 /**
25923  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
25924  */
25925 void RawDataPart_free(struct LDKRawDataPart this_obj);
25926
25927 /**
25928  * generation time of the invoice
25929  */
25930 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
25931
25932 /**
25933  * generation time of the invoice
25934  */
25935 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
25936
25937 /**
25938  * Checks if two RawDataParts contain equal inner contents.
25939  * This ignores pointers and is_owned flags and looks at the values in fields.
25940  * Two objects with NULL inner values will be considered "equal" here.
25941  */
25942 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
25943
25944 /**
25945  * Creates a copy of the RawDataPart
25946  */
25947 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
25948
25949 /**
25950  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
25951  */
25952 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
25953
25954 /**
25955  * Checks if two PositiveTimestamps contain equal inner contents.
25956  * This ignores pointers and is_owned flags and looks at the values in fields.
25957  * Two objects with NULL inner values will be considered "equal" here.
25958  */
25959 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
25960
25961 /**
25962  * Creates a copy of the PositiveTimestamp
25963  */
25964 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
25965
25966 /**
25967  * Creates a copy of the SiPrefix
25968  */
25969 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
25970
25971 /**
25972  * Utility method to constructs a new Milli-variant SiPrefix
25973  */
25974 enum LDKSiPrefix SiPrefix_milli(void);
25975
25976 /**
25977  * Utility method to constructs a new Micro-variant SiPrefix
25978  */
25979 enum LDKSiPrefix SiPrefix_micro(void);
25980
25981 /**
25982  * Utility method to constructs a new Nano-variant SiPrefix
25983  */
25984 enum LDKSiPrefix SiPrefix_nano(void);
25985
25986 /**
25987  * Utility method to constructs a new Pico-variant SiPrefix
25988  */
25989 enum LDKSiPrefix SiPrefix_pico(void);
25990
25991 /**
25992  * Checks if two SiPrefixs contain equal inner contents.
25993  * This ignores pointers and is_owned flags and looks at the values in fields.
25994  */
25995 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
25996
25997 /**
25998  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
25999  * This is effectively 10^12 * the prefix multiplier
26000  */
26001 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
26002
26003 /**
26004  * Creates a copy of the Currency
26005  */
26006 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
26007
26008 /**
26009  * Utility method to constructs a new Bitcoin-variant Currency
26010  */
26011 enum LDKCurrency Currency_bitcoin(void);
26012
26013 /**
26014  * Utility method to constructs a new BitcoinTestnet-variant Currency
26015  */
26016 enum LDKCurrency Currency_bitcoin_testnet(void);
26017
26018 /**
26019  * Utility method to constructs a new Regtest-variant Currency
26020  */
26021 enum LDKCurrency Currency_regtest(void);
26022
26023 /**
26024  * Utility method to constructs a new Simnet-variant Currency
26025  */
26026 enum LDKCurrency Currency_simnet(void);
26027
26028 /**
26029  * Utility method to constructs a new Signet-variant Currency
26030  */
26031 enum LDKCurrency Currency_signet(void);
26032
26033 /**
26034  * Checks if two Currencys contain equal inner contents.
26035  */
26036 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
26037
26038 /**
26039  * Checks if two Currencys contain equal inner contents.
26040  * This ignores pointers and is_owned flags and looks at the values in fields.
26041  */
26042 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
26043
26044 /**
26045  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
26046  */
26047 void Sha256_free(struct LDKSha256 this_obj);
26048
26049 /**
26050  * Creates a copy of the Sha256
26051  */
26052 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
26053
26054 /**
26055  * Checks if two Sha256s contain equal inner contents.
26056  */
26057 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
26058
26059 /**
26060  * Checks if two Sha256s contain equal inner contents.
26061  * This ignores pointers and is_owned flags and looks at the values in fields.
26062  * Two objects with NULL inner values will be considered "equal" here.
26063  */
26064 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
26065
26066 /**
26067  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
26068  */
26069 void Description_free(struct LDKDescription this_obj);
26070
26071 /**
26072  * Creates a copy of the Description
26073  */
26074 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
26075
26076 /**
26077  * Checks if two Descriptions contain equal inner contents.
26078  */
26079 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
26080
26081 /**
26082  * Checks if two Descriptions contain equal inner contents.
26083  * This ignores pointers and is_owned flags and looks at the values in fields.
26084  * Two objects with NULL inner values will be considered "equal" here.
26085  */
26086 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
26087
26088 /**
26089  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
26090  */
26091 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
26092
26093 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
26094
26095 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26096
26097 /**
26098  * Constructs a new PayeePubKey given each field
26099  */
26100 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
26101
26102 /**
26103  * Creates a copy of the PayeePubKey
26104  */
26105 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
26106
26107 /**
26108  * Checks if two PayeePubKeys contain equal inner contents.
26109  */
26110 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
26111
26112 /**
26113  * Checks if two PayeePubKeys contain equal inner contents.
26114  * This ignores pointers and is_owned flags and looks at the values in fields.
26115  * Two objects with NULL inner values will be considered "equal" here.
26116  */
26117 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
26118
26119 /**
26120  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
26121  */
26122 void ExpiryTime_free(struct LDKExpiryTime this_obj);
26123
26124 /**
26125  * Creates a copy of the ExpiryTime
26126  */
26127 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
26128
26129 /**
26130  * Checks if two ExpiryTimes contain equal inner contents.
26131  */
26132 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
26133
26134 /**
26135  * Checks if two ExpiryTimes contain equal inner contents.
26136  * This ignores pointers and is_owned flags and looks at the values in fields.
26137  * Two objects with NULL inner values will be considered "equal" here.
26138  */
26139 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
26140
26141 /**
26142  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
26143  */
26144 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
26145
26146 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
26147
26148 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
26149
26150 /**
26151  * Constructs a new MinFinalCltvExpiry given each field
26152  */
26153 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
26154
26155 /**
26156  * Creates a copy of the MinFinalCltvExpiry
26157  */
26158 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
26159
26160 /**
26161  * Checks if two MinFinalCltvExpirys contain equal inner contents.
26162  */
26163 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
26164
26165 /**
26166  * Checks if two MinFinalCltvExpirys contain equal inner contents.
26167  * This ignores pointers and is_owned flags and looks at the values in fields.
26168  * Two objects with NULL inner values will be considered "equal" here.
26169  */
26170 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
26171
26172 /**
26173  * Frees any resources used by the Fallback
26174  */
26175 void Fallback_free(struct LDKFallback this_ptr);
26176
26177 /**
26178  * Creates a copy of the Fallback
26179  */
26180 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
26181
26182 /**
26183  * Utility method to constructs a new SegWitProgram-variant Fallback
26184  */
26185 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
26186
26187 /**
26188  * Utility method to constructs a new PubKeyHash-variant Fallback
26189  */
26190 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
26191
26192 /**
26193  * Utility method to constructs a new ScriptHash-variant Fallback
26194  */
26195 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
26196
26197 /**
26198  * Checks if two Fallbacks contain equal inner contents.
26199  */
26200 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
26201
26202 /**
26203  * Checks if two Fallbacks contain equal inner contents.
26204  * This ignores pointers and is_owned flags and looks at the values in fields.
26205  */
26206 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
26207
26208 /**
26209  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
26210  */
26211 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
26212
26213 /**
26214  * Creates a copy of the InvoiceSignature
26215  */
26216 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
26217
26218 /**
26219  * Checks if two InvoiceSignatures contain equal inner contents.
26220  * This ignores pointers and is_owned flags and looks at the values in fields.
26221  * Two objects with NULL inner values will be considered "equal" here.
26222  */
26223 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
26224
26225 /**
26226  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
26227  */
26228 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
26229
26230 /**
26231  * Creates a copy of the PrivateRoute
26232  */
26233 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
26234
26235 /**
26236  * Checks if two PrivateRoutes contain equal inner contents.
26237  */
26238 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
26239
26240 /**
26241  * Checks if two PrivateRoutes contain equal inner contents.
26242  * This ignores pointers and is_owned flags and looks at the values in fields.
26243  * Two objects with NULL inner values will be considered "equal" here.
26244  */
26245 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
26246
26247 /**
26248  * Disassembles the `SignedRawInvoice` into its three parts:
26249  *  1. raw invoice
26250  *  2. hash of the raw invoice
26251  *  3. signature
26252  */
26253 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
26254
26255 /**
26256  * The `RawInvoice` which was signed.
26257  */
26258 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
26259
26260 /**
26261  * The hash of the `RawInvoice` that was signed.
26262  */
26263 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
26264
26265 /**
26266  * InvoiceSignature for the invoice.
26267  */
26268 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
26269
26270 /**
26271  * Recovers the public key used for signing the invoice from the recoverable signature.
26272  */
26273 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
26274
26275 /**
26276  * Checks if the signature is valid for the included payee public key or if none exists if it's
26277  * valid for the recovered signature (which should always be true?).
26278  */
26279 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
26280
26281 /**
26282  * Calculate the hash of the encoded `RawInvoice`
26283  */
26284 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26285
26286 /**
26287  *
26288  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26289  */
26290 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26291
26292 /**
26293  *
26294  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26295  */
26296 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26297
26298 /**
26299  *
26300  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26301  */
26302 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26303
26304 /**
26305  *
26306  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26307  */
26308 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26309
26310 /**
26311  *
26312  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26313  */
26314 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26315
26316 /**
26317  *
26318  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26319  */
26320 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26321
26322 /**
26323  *
26324  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26325  */
26326 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26327
26328 /**
26329  *
26330  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26331  */
26332 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26333
26334 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26335
26336 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26337
26338 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
26339
26340 /**
26341  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
26342  *
26343  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
26344  */
26345 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
26346
26347 /**
26348  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
26349  * the range `0..=MAX_TIMESTAMP`.
26350  *
26351  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
26352  */
26353 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
26354
26355 /**
26356  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
26357  * `0..=MAX_TIMESTAMP`.
26358  *
26359  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
26360  */
26361 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
26362
26363 /**
26364  * Returns the Unix timestamp representing the stored time
26365  */
26366 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
26367
26368 /**
26369  * Returns the duration of the stored time since the Unix epoch
26370  */
26371 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
26372
26373 /**
26374  * Returns the [`SystemTime`] representing the stored time
26375  */
26376 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
26377
26378 /**
26379  * Transform the `Invoice` into it's unchecked version
26380  */
26381 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
26382
26383 /**
26384  * Check that the invoice is signed correctly and that key recovery works
26385  */
26386 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
26387
26388 /**
26389  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
26390  * ```
26391  * use lightning_invoice::*;
26392  *
26393  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
26394  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
26395  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
26396  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
26397  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
26398  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
26399  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
26400  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
26401  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
26402  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
26403  * j5r6drg6k6zcqj0fcwg\";
26404  *
26405  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
26406  *
26407  * assert!(Invoice::from_signed(signed).is_ok());
26408  * ```
26409  */
26410 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
26411
26412 /**
26413  * Returns the `Invoice`'s timestamp (should equal its creation time)
26414  */
26415 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
26416
26417 /**
26418  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
26419  */
26420 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
26421
26422 /**
26423  * Returns the hash to which we will receive the preimage on completion of the payment
26424  */
26425 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
26426
26427 /**
26428  * Get the payee's public key if one was included in the invoice
26429  *
26430  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26431  */
26432 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
26433
26434 /**
26435  * Get the payment secret if one was included in the invoice
26436  */
26437 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
26438
26439 /**
26440  * Get the invoice features if they were included in the invoice
26441  *
26442  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26443  */
26444 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
26445
26446 /**
26447  * Recover the payee's public key (only to be used if none was included in the invoice)
26448  */
26449 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
26450
26451 /**
26452  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
26453  */
26454 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
26455
26456 /**
26457  * Returns whether the invoice has expired.
26458  */
26459 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
26460
26461 /**
26462  * Returns whether the expiry time would pass at the given point in time.
26463  * `at_time` is the timestamp as a duration since the Unix epoch.
26464  */
26465 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
26466
26467 /**
26468  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
26469  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
26470  */
26471 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
26472
26473 /**
26474  * Returns a list of all routes included in the invoice
26475  */
26476 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
26477
26478 /**
26479  * Returns a list of all routes included in the invoice as the underlying hints
26480  */
26481 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
26482
26483 /**
26484  * Returns the currency for which the invoice was issued
26485  */
26486 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
26487
26488 /**
26489  * Returns the amount if specified in the invoice as millisatoshis.
26490  */
26491 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
26492
26493 /**
26494  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
26495  * returns `CreationError::DescriptionTooLong` otherwise
26496  *
26497  * Please note that single characters may use more than one byte due to UTF8 encoding.
26498  */
26499 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
26500
26501 /**
26502  * Returns the underlying description `String`
26503  */
26504 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
26505
26506 /**
26507  * Construct an `ExpiryTime` from seconds.
26508  */
26509 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
26510
26511 /**
26512  * Construct an `ExpiryTime` from a `Duration`.
26513  */
26514 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
26515
26516 /**
26517  * Returns the expiry time in seconds
26518  */
26519 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
26520
26521 /**
26522  * Returns a reference to the underlying `Duration` (=expiry time)
26523  */
26524 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
26525
26526 /**
26527  * Creates a new (partial) route from a list of hops
26528  */
26529 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
26530
26531 /**
26532  * Returns the underlying list of hops
26533  */
26534 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
26535
26536 /**
26537  * Creates a copy of the CreationError
26538  */
26539 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
26540
26541 /**
26542  * Utility method to constructs a new DescriptionTooLong-variant CreationError
26543  */
26544 enum LDKCreationError CreationError_description_too_long(void);
26545
26546 /**
26547  * Utility method to constructs a new RouteTooLong-variant CreationError
26548  */
26549 enum LDKCreationError CreationError_route_too_long(void);
26550
26551 /**
26552  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
26553  */
26554 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
26555
26556 /**
26557  * Utility method to constructs a new InvalidAmount-variant CreationError
26558  */
26559 enum LDKCreationError CreationError_invalid_amount(void);
26560
26561 /**
26562  * Utility method to constructs a new MissingRouteHints-variant CreationError
26563  */
26564 enum LDKCreationError CreationError_missing_route_hints(void);
26565
26566 /**
26567  * Checks if two CreationErrors contain equal inner contents.
26568  * This ignores pointers and is_owned flags and looks at the values in fields.
26569  */
26570 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
26571
26572 /**
26573  * Get the string representation of a CreationError object
26574  */
26575 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
26576
26577 /**
26578  * Creates a copy of the SemanticError
26579  */
26580 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
26581
26582 /**
26583  * Utility method to constructs a new NoPaymentHash-variant SemanticError
26584  */
26585 enum LDKSemanticError SemanticError_no_payment_hash(void);
26586
26587 /**
26588  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
26589  */
26590 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
26591
26592 /**
26593  * Utility method to constructs a new NoDescription-variant SemanticError
26594  */
26595 enum LDKSemanticError SemanticError_no_description(void);
26596
26597 /**
26598  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
26599  */
26600 enum LDKSemanticError SemanticError_multiple_descriptions(void);
26601
26602 /**
26603  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
26604  */
26605 enum LDKSemanticError SemanticError_no_payment_secret(void);
26606
26607 /**
26608  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
26609  */
26610 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
26611
26612 /**
26613  * Utility method to constructs a new InvalidFeatures-variant SemanticError
26614  */
26615 enum LDKSemanticError SemanticError_invalid_features(void);
26616
26617 /**
26618  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
26619  */
26620 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
26621
26622 /**
26623  * Utility method to constructs a new InvalidSignature-variant SemanticError
26624  */
26625 enum LDKSemanticError SemanticError_invalid_signature(void);
26626
26627 /**
26628  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
26629  */
26630 enum LDKSemanticError SemanticError_imprecise_amount(void);
26631
26632 /**
26633  * Checks if two SemanticErrors contain equal inner contents.
26634  * This ignores pointers and is_owned flags and looks at the values in fields.
26635  */
26636 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
26637
26638 /**
26639  * Get the string representation of a SemanticError object
26640  */
26641 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
26642
26643 /**
26644  * Frees any resources used by the SignOrCreationError
26645  */
26646 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
26647
26648 /**
26649  * Creates a copy of the SignOrCreationError
26650  */
26651 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
26652
26653 /**
26654  * Utility method to constructs a new SignError-variant SignOrCreationError
26655  */
26656 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
26657
26658 /**
26659  * Utility method to constructs a new CreationError-variant SignOrCreationError
26660  */
26661 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
26662
26663 /**
26664  * Checks if two SignOrCreationErrors contain equal inner contents.
26665  * This ignores pointers and is_owned flags and looks at the values in fields.
26666  */
26667 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
26668
26669 /**
26670  * Get the string representation of a SignOrCreationError object
26671  */
26672 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
26673
26674 /**
26675  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
26676  */
26677 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
26678
26679 /**
26680  * Calls the free function if one is set
26681  */
26682 void Payer_free(struct LDKPayer this_ptr);
26683
26684 /**
26685  * Calls the free function if one is set
26686  */
26687 void Router_free(struct LDKRouter this_ptr);
26688
26689 /**
26690  * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
26691  */
26692 void RetryAttempts_free(struct LDKRetryAttempts this_obj);
26693
26694 uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
26695
26696 void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
26697
26698 /**
26699  * Constructs a new RetryAttempts given each field
26700  */
26701 MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
26702
26703 /**
26704  * Creates a copy of the RetryAttempts
26705  */
26706 struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
26707
26708 /**
26709  * Checks if two RetryAttemptss contain equal inner contents.
26710  * This ignores pointers and is_owned flags and looks at the values in fields.
26711  * Two objects with NULL inner values will be considered "equal" here.
26712  */
26713 bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
26714
26715 /**
26716  * Checks if two RetryAttemptss contain equal inner contents.
26717  */
26718 uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
26719
26720 /**
26721  * Frees any resources used by the PaymentError
26722  */
26723 void PaymentError_free(struct LDKPaymentError this_ptr);
26724
26725 /**
26726  * Creates a copy of the PaymentError
26727  */
26728 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
26729
26730 /**
26731  * Utility method to constructs a new Invoice-variant PaymentError
26732  */
26733 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
26734
26735 /**
26736  * Utility method to constructs a new Routing-variant PaymentError
26737  */
26738 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
26739
26740 /**
26741  * Utility method to constructs a new Sending-variant PaymentError
26742  */
26743 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
26744
26745 /**
26746  * Creates an invoice payer that retries failed payment paths.
26747  *
26748  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
26749  * `retry_attempts` has been exceeded for a given [`Invoice`].
26750  */
26751 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);
26752
26753 /**
26754  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
26755  *
26756  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
26757  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
26758  * for you.
26759  */
26760 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
26761
26762 /**
26763  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
26764  * case a retry is needed.
26765  *
26766  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
26767  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
26768  * for you.
26769  */
26770 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);
26771
26772 /**
26773  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
26774  * case a retry is needed.
26775  *
26776  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
26777  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
26778  */
26779 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);
26780
26781 /**
26782  * Removes the payment cached by the given payment hash.
26783  *
26784  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
26785  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
26786  */
26787 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
26788
26789 /**
26790  * Constructs a new EventHandler which calls the relevant methods on this_arg.
26791  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
26792  */
26793 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
26794
26795 /**
26796  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
26797  * See [`PhantomKeysManager`] for more information on phantom node payments.
26798  *
26799  * `phantom_route_hints` parameter:
26800  * * Contains channel info for all nodes participating in the phantom invoice
26801  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
26802  *   participating node
26803  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
26804  *   updated when a channel becomes disabled or closes
26805  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
26806  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
26807  *   down
26808  *
26809  * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
26810  * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
26811  * participating node.
26812  *
26813  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
26814  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
26815  * requirement).
26816  *
26817  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
26818  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
26819  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
26820  */
26821 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);
26822
26823 /**
26824  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
26825  * See [`PhantomKeysManager`] for more information on phantom node payments.
26826  *
26827  * `phantom_route_hints` parameter:
26828  * * Contains channel info for all nodes participating in the phantom invoice
26829  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
26830  *   participating node
26831  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
26832  *   updated when a channel becomes disabled or closes
26833  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
26834  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
26835  *   down
26836  *
26837  * `description_hash` is a SHA-256 hash of the description text
26838  *
26839  * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
26840  * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
26841  * participating node.
26842  *
26843  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
26844  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
26845  * requirement).
26846  *
26847  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
26848  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
26849  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
26850  */
26851 struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
26852
26853 /**
26854  * Utility to construct an invoice. Generally, unless you want to do something like a custom
26855  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
26856  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
26857  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
26858  * that the payment secret is valid when the invoice is paid.
26859  */
26860 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);
26861
26862 /**
26863  * Utility to construct an invoice. Generally, unless you want to do something like a custom
26864  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
26865  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
26866  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
26867  * that the payment secret is valid when the invoice is paid.
26868  * Use this variant if you want to pass the `description_hash` to the invoice.
26869  */
26870 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash);
26871
26872 /**
26873  * See [`create_invoice_from_channelmanager_with_description_hash`]
26874  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
26875  * available and the current time is supplied by the caller.
26876  */
26877 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch);
26878
26879 /**
26880  * See [`create_invoice_from_channelmanager`]
26881  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
26882  * available and the current time is supplied by the caller.
26883  */
26884 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);
26885
26886 /**
26887  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
26888  */
26889 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
26890
26891 /**
26892  * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source
26893  * `random_seed_bytes`.
26894  */
26895 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes);
26896
26897 /**
26898  * Constructs a new Router which calls the relevant methods on this_arg.
26899  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
26900  */
26901 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
26902
26903 /**
26904  * Constructs a new Payer which calls the relevant methods on this_arg.
26905  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
26906  */
26907 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
26908
26909 /**
26910  * Read a SiPrefix object from a string
26911  */
26912 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
26913
26914 /**
26915  * Read a Invoice object from a string
26916  */
26917 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
26918
26919 /**
26920  * Read a SignedRawInvoice object from a string
26921  */
26922 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
26923
26924 /**
26925  * Get the string representation of a Invoice object
26926  */
26927 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
26928
26929 /**
26930  * Get the string representation of a SignedRawInvoice object
26931  */
26932 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
26933
26934 /**
26935  * Get the string representation of a Currency object
26936  */
26937 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
26938
26939 /**
26940  * Get the string representation of a SiPrefix object
26941  */
26942 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
26943
26944 #endif /* LDK_C_BINDINGS_H */
26945
26946 #include "ldk_ver.h"