Merge pull request #60 from TheBlueMatt/main
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.20.0 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include "ldk_rust_types.h"
12
13 /**
14  * An error when accessing the chain via [`Access`].
15  */
16 typedef enum LDKAccessError {
17    /**
18     * The requested chain is unknown.
19     */
20    LDKAccessError_UnknownChain,
21    /**
22     * The requested transaction doesn't exist or hasn't confirmed.
23     */
24    LDKAccessError_UnknownTx,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKAccessError_Sentinel,
29 } LDKAccessError;
30
31 /**
32  * An enum which can either contain a  or not
33  */
34 typedef enum LDKCOption_NoneZ {
35    /**
36     * When we're in this state, this COption_NoneZ contains a
37     */
38    LDKCOption_NoneZ_Some,
39    /**
40     * When we're in this state, this COption_NoneZ contains nothing
41     */
42    LDKCOption_NoneZ_None,
43    /**
44     * Must be last for serialization purposes
45     */
46    LDKCOption_NoneZ_Sentinel,
47 } LDKCOption_NoneZ;
48
49 /**
50  * An error enum representing a failure to persist a channel monitor update.
51  */
52 typedef enum LDKChannelMonitorUpdateErr {
53    /**
54     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
55     * our state failed, but is expected to succeed at some point in the future).
56     *
57     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
58     * submitting new commitment transactions to the counterparty. Once the update(s) that failed
59     * have been successfully applied, a [`MonitorEvent::UpdateCompleted`] event should be returned
60     * via [`Watch::release_pending_monitor_events`] which will then restore the channel to an
61     * operational state.
62     *
63     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
64     * you return a TemporaryFailure you must ensure that it is written to disk safely before
65     * writing out the latest ChannelManager state.
66     *
67     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
68     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
69     * to claim it on this channel) and those updates must be applied wherever they can be. At
70     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
71     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
72     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
73     * been \"frozen\".
74     *
75     * Note that even if updates made after TemporaryFailure succeed you must still provide a
76     * [`MonitorEvent::UpdateCompleted`] to ensure you have the latest monitor and re-enable
77     * normal channel operation. Note that this is normally generated through a call to
78     * [`ChainMonitor::channel_monitor_updated`].
79     *
80     * Note that the update being processed here will not be replayed for you when you return a
81     * [`MonitorEvent::UpdateCompleted`] event via [`Watch::release_pending_monitor_events`], so
82     * you must store the update itself on your own local disk prior to returning a
83     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
84     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
85     * reload-time.
86     *
87     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
88     * remote location (with local copies persisted immediately), it is anticipated that all
89     * updates will return TemporaryFailure until the remote copies could be updated.
90     *
91     * [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated
92     */
93    LDKChannelMonitorUpdateErr_TemporaryFailure,
94    /**
95     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
96     * different watchtower and cannot update with all watchtowers that were previously informed
97     * of this channel).
98     *
99     * At reception of this error, ChannelManager will force-close the channel and return at
100     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
101     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
102     * update must be rejected.
103     *
104     * This failure may also signal a failure to update the local persisted copy of one of
105     * the channel monitor instance.
106     *
107     * Note that even when you fail a holder commitment transaction update, you must store the
108     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
109     * broadcasts it (e.g distributed channel-monitor deployment)
110     *
111     * In case of distributed watchtowers deployment, the new version must be written to disk, as
112     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
113     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
114     * lagging behind on block processing.
115     */
116    LDKChannelMonitorUpdateErr_PermanentFailure,
117    /**
118     * Must be last for serialization purposes
119     */
120    LDKChannelMonitorUpdateErr_Sentinel,
121 } LDKChannelMonitorUpdateErr;
122
123 /**
124  * An enum that represents the speed at which we want a transaction to confirm used for feerate
125  * estimation.
126  */
127 typedef enum LDKConfirmationTarget {
128    /**
129     * We are happy with this transaction confirming slowly when feerate drops some.
130     */
131    LDKConfirmationTarget_Background,
132    /**
133     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
134     */
135    LDKConfirmationTarget_Normal,
136    /**
137     * We'd like this transaction to confirm in the next few blocks.
138     */
139    LDKConfirmationTarget_HighPriority,
140    /**
141     * Must be last for serialization purposes
142     */
143    LDKConfirmationTarget_Sentinel,
144 } LDKConfirmationTarget;
145
146 /**
147  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
148  */
149 typedef enum LDKCreationError {
150    /**
151     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
152     */
153    LDKCreationError_DescriptionTooLong,
154    /**
155     * The specified route has too many hops and can't be encoded
156     */
157    LDKCreationError_RouteTooLong,
158    /**
159     * The Unix timestamp of the supplied date is less than zero or greater than 35-bits
160     */
161    LDKCreationError_TimestampOutOfBounds,
162    /**
163     * The supplied millisatoshi amount was greater than the total bitcoin supply.
164     */
165    LDKCreationError_InvalidAmount,
166    /**
167     * Route hints were required for this invoice and were missing. Applies to
168     * [phantom invoices].
169     *
170     * [phantom invoices]: crate::utils::create_phantom_invoice
171     */
172    LDKCreationError_MissingRouteHints,
173    /**
174     * Must be last for serialization purposes
175     */
176    LDKCreationError_Sentinel,
177 } LDKCreationError;
178
179 /**
180  * Enum representing the crypto currencies (or networks) supported by this library
181  */
182 typedef enum LDKCurrency {
183    /**
184     * Bitcoin mainnet
185     */
186    LDKCurrency_Bitcoin,
187    /**
188     * Bitcoin testnet
189     */
190    LDKCurrency_BitcoinTestnet,
191    /**
192     * Bitcoin regtest
193     */
194    LDKCurrency_Regtest,
195    /**
196     * Bitcoin simnet
197     */
198    LDKCurrency_Simnet,
199    /**
200     * Bitcoin signet
201     */
202    LDKCurrency_Signet,
203    /**
204     * Must be last for serialization purposes
205     */
206    LDKCurrency_Sentinel,
207 } LDKCurrency;
208
209 /**
210  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
211  */
212 typedef enum LDKIOError {
213    LDKIOError_NotFound,
214    LDKIOError_PermissionDenied,
215    LDKIOError_ConnectionRefused,
216    LDKIOError_ConnectionReset,
217    LDKIOError_ConnectionAborted,
218    LDKIOError_NotConnected,
219    LDKIOError_AddrInUse,
220    LDKIOError_AddrNotAvailable,
221    LDKIOError_BrokenPipe,
222    LDKIOError_AlreadyExists,
223    LDKIOError_WouldBlock,
224    LDKIOError_InvalidInput,
225    LDKIOError_InvalidData,
226    LDKIOError_TimedOut,
227    LDKIOError_WriteZero,
228    LDKIOError_Interrupted,
229    LDKIOError_Other,
230    LDKIOError_UnexpectedEof,
231    /**
232     * Must be last for serialization purposes
233     */
234    LDKIOError_Sentinel,
235 } LDKIOError;
236
237 /**
238  * An enum representing the available verbosity levels of the logger.
239  */
240 typedef enum LDKLevel {
241    /**
242     * Designates extremely verbose information, including gossip-induced messages
243     */
244    LDKLevel_Gossip,
245    /**
246     * Designates very low priority, often extremely verbose, information
247     */
248    LDKLevel_Trace,
249    /**
250     * Designates lower priority information
251     */
252    LDKLevel_Debug,
253    /**
254     * Designates useful information
255     */
256    LDKLevel_Info,
257    /**
258     * Designates hazardous situations
259     */
260    LDKLevel_Warn,
261    /**
262     * Designates very serious errors
263     */
264    LDKLevel_Error,
265    /**
266     * Must be last for serialization purposes
267     */
268    LDKLevel_Sentinel,
269 } LDKLevel;
270
271 /**
272  * An enum representing the possible Bitcoin or test networks which we can run on
273  */
274 typedef enum LDKNetwork {
275    /**
276     * The main Bitcoin blockchain.
277     */
278    LDKNetwork_Bitcoin,
279    /**
280     * The testnet3 blockchain.
281     */
282    LDKNetwork_Testnet,
283    /**
284     * A local test blockchain.
285     */
286    LDKNetwork_Regtest,
287    /**
288     * A blockchain on which blocks are signed instead of mined.
289     */
290    LDKNetwork_Signet,
291    /**
292     * Must be last for serialization purposes
293     */
294    LDKNetwork_Sentinel,
295 } LDKNetwork;
296
297 /**
298  * Specifies the recipient of an invoice, to indicate to [`KeysInterface::sign_invoice`] what node
299  * secret key should be used to sign the invoice.
300  */
301 typedef enum LDKRecipient {
302    /**
303     * The invoice should be signed with the local node secret key.
304     */
305    LDKRecipient_Node,
306    /**
307     * The invoice should be signed with the phantom node secret key. This secret key must be the
308     * same for all nodes participating in the [phantom node payment].
309     *
310     * [phantom node payment]: PhantomKeysManager
311     */
312    LDKRecipient_PhantomNode,
313    /**
314     * Must be last for serialization purposes
315     */
316    LDKRecipient_Sentinel,
317 } LDKRecipient;
318
319 /**
320  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
321  */
322 typedef enum LDKSecp256k1Error {
323    /**
324     * Signature failed verification
325     */
326    LDKSecp256k1Error_IncorrectSignature,
327    /**
328     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
329     */
330    LDKSecp256k1Error_InvalidMessage,
331    /**
332     * Bad public key
333     */
334    LDKSecp256k1Error_InvalidPublicKey,
335    /**
336     * Bad signature
337     */
338    LDKSecp256k1Error_InvalidSignature,
339    /**
340     * Bad secret key
341     */
342    LDKSecp256k1Error_InvalidSecretKey,
343    /**
344     * Bad recovery id
345     */
346    LDKSecp256k1Error_InvalidRecoveryId,
347    /**
348     * Invalid tweak for add_assign or mul_assign
349     */
350    LDKSecp256k1Error_InvalidTweak,
351    /**
352     * tweak_add_check failed on an xonly public key
353     */
354    LDKSecp256k1Error_TweakCheckFailed,
355    /**
356     * Didn't pass enough memory to context creation with preallocated memory
357     */
358    LDKSecp256k1Error_NotEnoughMemory,
359    /**
360     * Must be last for serialization purposes
361     */
362    LDKSecp256k1Error_Sentinel,
363 } LDKSecp256k1Error;
364
365 /**
366  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
367  * requirements sections in BOLT #11
368  */
369 typedef enum LDKSemanticError {
370    /**
371     * The invoice is missing the mandatory payment hash
372     */
373    LDKSemanticError_NoPaymentHash,
374    /**
375     * The invoice has multiple payment hashes which isn't allowed
376     */
377    LDKSemanticError_MultiplePaymentHashes,
378    /**
379     * No description or description hash are part of the invoice
380     */
381    LDKSemanticError_NoDescription,
382    /**
383     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
384     */
385    LDKSemanticError_MultipleDescriptions,
386    /**
387     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
388     * should provide.
389     */
390    LDKSemanticError_NoPaymentSecret,
391    /**
392     * The invoice contains multiple payment secrets
393     */
394    LDKSemanticError_MultiplePaymentSecrets,
395    /**
396     * The invoice's features are invalid
397     */
398    LDKSemanticError_InvalidFeatures,
399    /**
400     * The recovery id doesn't fit the signature/pub key
401     */
402    LDKSemanticError_InvalidRecoveryId,
403    /**
404     * The invoice's signature is invalid
405     */
406    LDKSemanticError_InvalidSignature,
407    /**
408     * The invoice's amount was not a whole number of millisatoshis
409     */
410    LDKSemanticError_ImpreciseAmount,
411    /**
412     * Must be last for serialization purposes
413     */
414    LDKSemanticError_Sentinel,
415 } LDKSemanticError;
416
417 /**
418  * SI prefixes for the human readable part
419  */
420 typedef enum LDKSiPrefix {
421    /**
422     * 10^-3
423     */
424    LDKSiPrefix_Milli,
425    /**
426     * 10^-6
427     */
428    LDKSiPrefix_Micro,
429    /**
430     * 10^-9
431     */
432    LDKSiPrefix_Nano,
433    /**
434     * 10^-12
435     */
436    LDKSiPrefix_Pico,
437    /**
438     * Must be last for serialization purposes
439     */
440    LDKSiPrefix_Sentinel,
441 } LDKSiPrefix;
442
443 /**
444  * A Rust str object, ie a reference to a UTF8-valid string.
445  * This is *not* null-terminated so cannot be used directly as a C string!
446  */
447 typedef struct LDKStr {
448    /**
449     * A pointer to the string's bytes, in UTF8 encoding
450     */
451    const uint8_t *chars;
452    /**
453     * The number of bytes (not characters!) pointed to by `chars`
454     */
455    uintptr_t len;
456    /**
457     * Whether the data pointed to by `chars` should be freed or not.
458     */
459    bool chars_is_owned;
460 } LDKStr;
461
462 /**
463  * A serialized transaction, in (pointer, length) form.
464  *
465  * This type optionally owns its own memory, and thus the semantics around access change based on
466  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
467  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
468  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
469  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
470  * you would be invalid.
471  *
472  * Note that, while it may change in the future, because transactions on the Rust side are stored
473  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
474  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
475  * `data_is_owned` either set or unset at your discretion.
476  */
477 typedef struct LDKTransaction {
478    /**
479     * The serialized transaction data.
480     *
481     * This is non-const for your convenience, an object passed to Rust is never written to.
482     */
483    uint8_t *data;
484    /**
485     * The length of the serialized transaction
486     */
487    uintptr_t datalen;
488    /**
489     * Whether the data pointed to by `data` should be freed or not.
490     */
491    bool data_is_owned;
492 } LDKTransaction;
493
494 /**
495  * A dynamically-allocated array of u8s of arbitrary size.
496  * This corresponds to std::vector in C++
497  */
498 typedef struct LDKCVec_u8Z {
499    /**
500     * The elements in the array.
501     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
502     */
503    uint8_t *data;
504    /**
505     * The number of elements pointed to by `data`.
506     */
507    uintptr_t datalen;
508 } LDKCVec_u8Z;
509
510 /**
511  * A transaction output including a scriptPubKey and value.
512  * This type *does* own its own memory, so must be free'd appropriately.
513  */
514 typedef struct LDKTxOut {
515    /**
516     * The script_pubkey in this output
517     */
518    struct LDKCVec_u8Z script_pubkey;
519    /**
520     * The value, in satoshis, of this output
521     */
522    uint64_t value;
523 } LDKTxOut;
524
525 /**
526  * The contents of CResult_NoneNoneZ
527  */
528 typedef union LDKCResult_NoneNoneZPtr {
529    /**
530     * Note that this value is always NULL, as there are no contents in the OK variant
531     */
532    void *result;
533    /**
534     * Note that this value is always NULL, as there are no contents in the Err variant
535     */
536    void *err;
537 } LDKCResult_NoneNoneZPtr;
538
539 /**
540  * A CResult_NoneNoneZ represents the result of a fallible operation,
541  * containing a () on success and a () on failure.
542  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
543  */
544 typedef struct LDKCResult_NoneNoneZ {
545    /**
546     * The contents of this CResult_NoneNoneZ, accessible via either
547     * `err` or `result` depending on the state of `result_ok`.
548     */
549    union LDKCResult_NoneNoneZPtr contents;
550    /**
551     * Whether this CResult_NoneNoneZ represents a success state.
552     */
553    bool result_ok;
554 } LDKCResult_NoneNoneZ;
555
556
557
558 /**
559  * Implements the per-commitment secret storage scheme from
560  * [BOLT 3](https://github.com/lightningnetwork/lightning-rfc/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
561  *
562  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
563  * or so.
564  */
565 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
566    /**
567     * A pointer to the opaque Rust object.
568     * Nearly everywhere, inner must be non-null, however in places where
569     * the Rust equivalent takes an Option, it may be set to null to indicate None.
570     */
571    LDKnativeCounterpartyCommitmentSecrets *inner;
572    /**
573     * Indicates that this is the only struct which contains the same pointer.
574     * Rust functions which take ownership of an object provided via an argument require
575     * this to be true and invalidate the object pointed to by inner.
576     */
577    bool is_owned;
578 } LDKCounterpartyCommitmentSecrets;
579
580
581
582 /**
583  * An error in decoding a message or struct.
584  */
585 typedef struct MUST_USE_STRUCT LDKDecodeError {
586    /**
587     * A pointer to the opaque Rust object.
588     * Nearly everywhere, inner must be non-null, however in places where
589     * the Rust equivalent takes an Option, it may be set to null to indicate None.
590     */
591    LDKnativeDecodeError *inner;
592    /**
593     * Indicates that this is the only struct which contains the same pointer.
594     * Rust functions which take ownership of an object provided via an argument require
595     * this to be true and invalidate the object pointed to by inner.
596     */
597    bool is_owned;
598 } LDKDecodeError;
599
600 /**
601  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
602  */
603 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
604    /**
605     * A pointer to the contents in the success state.
606     * Reading from this pointer when `result_ok` is not set is undefined.
607     */
608    struct LDKCounterpartyCommitmentSecrets *result;
609    /**
610     * A pointer to the contents in the error state.
611     * Reading from this pointer when `result_ok` is set is undefined.
612     */
613    struct LDKDecodeError *err;
614 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
615
616 /**
617  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
618  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
619  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
620  */
621 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
622    /**
623     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
624     * `err` or `result` depending on the state of `result_ok`.
625     */
626    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
627    /**
628     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
629     */
630    bool result_ok;
631 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
632
633 /**
634  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
635  */
636 typedef struct LDKSecretKey {
637    /**
638     * The bytes of the secret key
639     */
640    uint8_t bytes[32];
641 } LDKSecretKey;
642
643 /**
644  * The contents of CResult_SecretKeyErrorZ
645  */
646 typedef union LDKCResult_SecretKeyErrorZPtr {
647    /**
648     * A pointer to the contents in the success state.
649     * Reading from this pointer when `result_ok` is not set is undefined.
650     */
651    struct LDKSecretKey *result;
652    /**
653     * A pointer to the contents in the error state.
654     * Reading from this pointer when `result_ok` is set is undefined.
655     */
656    enum LDKSecp256k1Error *err;
657 } LDKCResult_SecretKeyErrorZPtr;
658
659 /**
660  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
661  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
662  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
663  */
664 typedef struct LDKCResult_SecretKeyErrorZ {
665    /**
666     * The contents of this CResult_SecretKeyErrorZ, accessible via either
667     * `err` or `result` depending on the state of `result_ok`.
668     */
669    union LDKCResult_SecretKeyErrorZPtr contents;
670    /**
671     * Whether this CResult_SecretKeyErrorZ represents a success state.
672     */
673    bool result_ok;
674 } LDKCResult_SecretKeyErrorZ;
675
676 /**
677  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
678  */
679 typedef struct LDKPublicKey {
680    /**
681     * The bytes of the public key
682     */
683    uint8_t compressed_form[33];
684 } LDKPublicKey;
685
686 /**
687  * The contents of CResult_PublicKeyErrorZ
688  */
689 typedef union LDKCResult_PublicKeyErrorZPtr {
690    /**
691     * A pointer to the contents in the success state.
692     * Reading from this pointer when `result_ok` is not set is undefined.
693     */
694    struct LDKPublicKey *result;
695    /**
696     * A pointer to the contents in the error state.
697     * Reading from this pointer when `result_ok` is set is undefined.
698     */
699    enum LDKSecp256k1Error *err;
700 } LDKCResult_PublicKeyErrorZPtr;
701
702 /**
703  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
704  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
705  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
706  */
707 typedef struct LDKCResult_PublicKeyErrorZ {
708    /**
709     * The contents of this CResult_PublicKeyErrorZ, accessible via either
710     * `err` or `result` depending on the state of `result_ok`.
711     */
712    union LDKCResult_PublicKeyErrorZPtr contents;
713    /**
714     * Whether this CResult_PublicKeyErrorZ represents a success state.
715     */
716    bool result_ok;
717 } LDKCResult_PublicKeyErrorZ;
718
719
720
721 /**
722  * The set of public keys which are used in the creation of one commitment transaction.
723  * These are derived from the channel base keys and per-commitment data.
724  *
725  * A broadcaster key is provided from potential broadcaster of the computed transaction.
726  * A countersignatory key is coming from a protocol participant unable to broadcast the
727  * transaction.
728  *
729  * These keys are assumed to be good, either because the code derived them from
730  * channel basepoints via the new function, or they were obtained via
731  * CommitmentTransaction.trust().keys() because we trusted the source of the
732  * pre-calculated keys.
733  */
734 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
735    /**
736     * A pointer to the opaque Rust object.
737     * Nearly everywhere, inner must be non-null, however in places where
738     * the Rust equivalent takes an Option, it may be set to null to indicate None.
739     */
740    LDKnativeTxCreationKeys *inner;
741    /**
742     * Indicates that this is the only struct which contains the same pointer.
743     * Rust functions which take ownership of an object provided via an argument require
744     * this to be true and invalidate the object pointed to by inner.
745     */
746    bool is_owned;
747 } LDKTxCreationKeys;
748
749 /**
750  * The contents of CResult_TxCreationKeysDecodeErrorZ
751  */
752 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
753    /**
754     * A pointer to the contents in the success state.
755     * Reading from this pointer when `result_ok` is not set is undefined.
756     */
757    struct LDKTxCreationKeys *result;
758    /**
759     * A pointer to the contents in the error state.
760     * Reading from this pointer when `result_ok` is set is undefined.
761     */
762    struct LDKDecodeError *err;
763 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
764
765 /**
766  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
767  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
768  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
769  */
770 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
771    /**
772     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
773     * `err` or `result` depending on the state of `result_ok`.
774     */
775    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
776    /**
777     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
778     */
779    bool result_ok;
780 } LDKCResult_TxCreationKeysDecodeErrorZ;
781
782
783
784 /**
785  * One counterparty's public keys which do not change over the life of a channel.
786  */
787 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
788    /**
789     * A pointer to the opaque Rust object.
790     * Nearly everywhere, inner must be non-null, however in places where
791     * the Rust equivalent takes an Option, it may be set to null to indicate None.
792     */
793    LDKnativeChannelPublicKeys *inner;
794    /**
795     * Indicates that this is the only struct which contains the same pointer.
796     * Rust functions which take ownership of an object provided via an argument require
797     * this to be true and invalidate the object pointed to by inner.
798     */
799    bool is_owned;
800 } LDKChannelPublicKeys;
801
802 /**
803  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
804  */
805 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
806    /**
807     * A pointer to the contents in the success state.
808     * Reading from this pointer when `result_ok` is not set is undefined.
809     */
810    struct LDKChannelPublicKeys *result;
811    /**
812     * A pointer to the contents in the error state.
813     * Reading from this pointer when `result_ok` is set is undefined.
814     */
815    struct LDKDecodeError *err;
816 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
817
818 /**
819  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
820  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
821  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
822  */
823 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
824    /**
825     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
826     * `err` or `result` depending on the state of `result_ok`.
827     */
828    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
829    /**
830     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
831     */
832    bool result_ok;
833 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
834
835 /**
836  * The contents of CResult_TxCreationKeysErrorZ
837  */
838 typedef union LDKCResult_TxCreationKeysErrorZPtr {
839    /**
840     * A pointer to the contents in the success state.
841     * Reading from this pointer when `result_ok` is not set is undefined.
842     */
843    struct LDKTxCreationKeys *result;
844    /**
845     * A pointer to the contents in the error state.
846     * Reading from this pointer when `result_ok` is set is undefined.
847     */
848    enum LDKSecp256k1Error *err;
849 } LDKCResult_TxCreationKeysErrorZPtr;
850
851 /**
852  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
853  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
854  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
855  */
856 typedef struct LDKCResult_TxCreationKeysErrorZ {
857    /**
858     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
859     * `err` or `result` depending on the state of `result_ok`.
860     */
861    union LDKCResult_TxCreationKeysErrorZPtr contents;
862    /**
863     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
864     */
865    bool result_ok;
866 } LDKCResult_TxCreationKeysErrorZ;
867
868 /**
869  * An enum which can either contain a u32 or not
870  */
871 typedef enum LDKCOption_u32Z_Tag {
872    /**
873     * When we're in this state, this COption_u32Z contains a u32
874     */
875    LDKCOption_u32Z_Some,
876    /**
877     * When we're in this state, this COption_u32Z contains nothing
878     */
879    LDKCOption_u32Z_None,
880    /**
881     * Must be last for serialization purposes
882     */
883    LDKCOption_u32Z_Sentinel,
884 } LDKCOption_u32Z_Tag;
885
886 typedef struct LDKCOption_u32Z {
887    LDKCOption_u32Z_Tag tag;
888    union {
889       struct {
890          uint32_t some;
891       };
892    };
893 } LDKCOption_u32Z;
894
895
896
897 /**
898  * Information about an HTLC as it appears in a commitment transaction
899  */
900 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
901    /**
902     * A pointer to the opaque Rust object.
903     * Nearly everywhere, inner must be non-null, however in places where
904     * the Rust equivalent takes an Option, it may be set to null to indicate None.
905     */
906    LDKnativeHTLCOutputInCommitment *inner;
907    /**
908     * Indicates that this is the only struct which contains the same pointer.
909     * Rust functions which take ownership of an object provided via an argument require
910     * this to be true and invalidate the object pointed to by inner.
911     */
912    bool is_owned;
913 } LDKHTLCOutputInCommitment;
914
915 /**
916  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
917  */
918 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
919    /**
920     * A pointer to the contents in the success state.
921     * Reading from this pointer when `result_ok` is not set is undefined.
922     */
923    struct LDKHTLCOutputInCommitment *result;
924    /**
925     * A pointer to the contents in the error state.
926     * Reading from this pointer when `result_ok` is set is undefined.
927     */
928    struct LDKDecodeError *err;
929 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
930
931 /**
932  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
933  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
934  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
935  */
936 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
937    /**
938     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
939     * `err` or `result` depending on the state of `result_ok`.
940     */
941    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
942    /**
943     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
944     */
945    bool result_ok;
946 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
947
948
949
950 /**
951  * Late-bound per-channel counterparty data used to build transactions.
952  */
953 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
954    /**
955     * A pointer to the opaque Rust object.
956     * Nearly everywhere, inner must be non-null, however in places where
957     * the Rust equivalent takes an Option, it may be set to null to indicate None.
958     */
959    LDKnativeCounterpartyChannelTransactionParameters *inner;
960    /**
961     * Indicates that this is the only struct which contains the same pointer.
962     * Rust functions which take ownership of an object provided via an argument require
963     * this to be true and invalidate the object pointed to by inner.
964     */
965    bool is_owned;
966 } LDKCounterpartyChannelTransactionParameters;
967
968 /**
969  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
970  */
971 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
972    /**
973     * A pointer to the contents in the success state.
974     * Reading from this pointer when `result_ok` is not set is undefined.
975     */
976    struct LDKCounterpartyChannelTransactionParameters *result;
977    /**
978     * A pointer to the contents in the error state.
979     * Reading from this pointer when `result_ok` is set is undefined.
980     */
981    struct LDKDecodeError *err;
982 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
983
984 /**
985  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
986  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
987  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
988  */
989 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
990    /**
991     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
992     * `err` or `result` depending on the state of `result_ok`.
993     */
994    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
995    /**
996     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
997     */
998    bool result_ok;
999 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
1000
1001
1002
1003 /**
1004  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1005  * The fields are organized by holder/counterparty.
1006  *
1007  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1008  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1009  */
1010 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1011    /**
1012     * A pointer to the opaque Rust object.
1013     * Nearly everywhere, inner must be non-null, however in places where
1014     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1015     */
1016    LDKnativeChannelTransactionParameters *inner;
1017    /**
1018     * Indicates that this is the only struct which contains the same pointer.
1019     * Rust functions which take ownership of an object provided via an argument require
1020     * this to be true and invalidate the object pointed to by inner.
1021     */
1022    bool is_owned;
1023 } LDKChannelTransactionParameters;
1024
1025 /**
1026  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1027  */
1028 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
1029    /**
1030     * A pointer to the contents in the success state.
1031     * Reading from this pointer when `result_ok` is not set is undefined.
1032     */
1033    struct LDKChannelTransactionParameters *result;
1034    /**
1035     * A pointer to the contents in the error state.
1036     * Reading from this pointer when `result_ok` is set is undefined.
1037     */
1038    struct LDKDecodeError *err;
1039 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
1040
1041 /**
1042  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1043  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1044  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1045  */
1046 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1047    /**
1048     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1049     * `err` or `result` depending on the state of `result_ok`.
1050     */
1051    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1052    /**
1053     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1054     */
1055    bool result_ok;
1056 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1057
1058 /**
1059  * Represents a secp256k1 signature serialized as two 32-byte numbers
1060  */
1061 typedef struct LDKSignature {
1062    /**
1063     * The bytes of the signature in "compact" form
1064     */
1065    uint8_t compact_form[64];
1066 } LDKSignature;
1067
1068 /**
1069  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1070  * This corresponds to std::vector in C++
1071  */
1072 typedef struct LDKCVec_SignatureZ {
1073    /**
1074     * The elements in the array.
1075     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1076     */
1077    struct LDKSignature *data;
1078    /**
1079     * The number of elements pointed to by `data`.
1080     */
1081    uintptr_t datalen;
1082 } LDKCVec_SignatureZ;
1083
1084
1085
1086 /**
1087  * Information needed to build and sign a holder's commitment transaction.
1088  *
1089  * The transaction is only signed once we are ready to broadcast.
1090  */
1091 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1092    /**
1093     * A pointer to the opaque Rust object.
1094     * Nearly everywhere, inner must be non-null, however in places where
1095     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1096     */
1097    LDKnativeHolderCommitmentTransaction *inner;
1098    /**
1099     * Indicates that this is the only struct which contains the same pointer.
1100     * Rust functions which take ownership of an object provided via an argument require
1101     * this to be true and invalidate the object pointed to by inner.
1102     */
1103    bool is_owned;
1104 } LDKHolderCommitmentTransaction;
1105
1106 /**
1107  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1108  */
1109 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1110    /**
1111     * A pointer to the contents in the success state.
1112     * Reading from this pointer when `result_ok` is not set is undefined.
1113     */
1114    struct LDKHolderCommitmentTransaction *result;
1115    /**
1116     * A pointer to the contents in the error state.
1117     * Reading from this pointer when `result_ok` is set is undefined.
1118     */
1119    struct LDKDecodeError *err;
1120 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1121
1122 /**
1123  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1124  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1125  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1126  */
1127 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1128    /**
1129     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1130     * `err` or `result` depending on the state of `result_ok`.
1131     */
1132    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1133    /**
1134     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1135     */
1136    bool result_ok;
1137 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1138
1139
1140
1141 /**
1142  * A pre-built Bitcoin commitment transaction and its txid.
1143  */
1144 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1145    /**
1146     * A pointer to the opaque Rust object.
1147     * Nearly everywhere, inner must be non-null, however in places where
1148     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1149     */
1150    LDKnativeBuiltCommitmentTransaction *inner;
1151    /**
1152     * Indicates that this is the only struct which contains the same pointer.
1153     * Rust functions which take ownership of an object provided via an argument require
1154     * this to be true and invalidate the object pointed to by inner.
1155     */
1156    bool is_owned;
1157 } LDKBuiltCommitmentTransaction;
1158
1159 /**
1160  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1161  */
1162 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1163    /**
1164     * A pointer to the contents in the success state.
1165     * Reading from this pointer when `result_ok` is not set is undefined.
1166     */
1167    struct LDKBuiltCommitmentTransaction *result;
1168    /**
1169     * A pointer to the contents in the error state.
1170     * Reading from this pointer when `result_ok` is set is undefined.
1171     */
1172    struct LDKDecodeError *err;
1173 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1174
1175 /**
1176  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1177  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1178  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1179  */
1180 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1181    /**
1182     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1183     * `err` or `result` depending on the state of `result_ok`.
1184     */
1185    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1186    /**
1187     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1188     */
1189    bool result_ok;
1190 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1191
1192
1193
1194 /**
1195  * A wrapper on ClosingTransaction indicating that the built bitcoin
1196  * transaction is trusted.
1197  *
1198  * See trust() and verify() functions on CommitmentTransaction.
1199  *
1200  * This structure implements Deref.
1201  */
1202 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1203    /**
1204     * A pointer to the opaque Rust object.
1205     * Nearly everywhere, inner must be non-null, however in places where
1206     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1207     */
1208    LDKnativeTrustedClosingTransaction *inner;
1209    /**
1210     * Indicates that this is the only struct which contains the same pointer.
1211     * Rust functions which take ownership of an object provided via an argument require
1212     * this to be true and invalidate the object pointed to by inner.
1213     */
1214    bool is_owned;
1215 } LDKTrustedClosingTransaction;
1216
1217 /**
1218  * The contents of CResult_TrustedClosingTransactionNoneZ
1219  */
1220 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1221    /**
1222     * A pointer to the contents in the success state.
1223     * Reading from this pointer when `result_ok` is not set is undefined.
1224     */
1225    struct LDKTrustedClosingTransaction *result;
1226    /**
1227     * Note that this value is always NULL, as there are no contents in the Err variant
1228     */
1229    void *err;
1230 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1231
1232 /**
1233  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1234  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1235  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1236  */
1237 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1238    /**
1239     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1240     * `err` or `result` depending on the state of `result_ok`.
1241     */
1242    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1243    /**
1244     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1245     */
1246    bool result_ok;
1247 } LDKCResult_TrustedClosingTransactionNoneZ;
1248
1249
1250
1251 /**
1252  * This class tracks the per-transaction information needed to build a commitment transaction and will
1253  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1254  * and for transactions we sign for the counterparty.
1255  *
1256  * This class can be used inside a signer implementation to generate a signature given the relevant
1257  * secret key.
1258  */
1259 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1260    /**
1261     * A pointer to the opaque Rust object.
1262     * Nearly everywhere, inner must be non-null, however in places where
1263     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1264     */
1265    LDKnativeCommitmentTransaction *inner;
1266    /**
1267     * Indicates that this is the only struct which contains the same pointer.
1268     * Rust functions which take ownership of an object provided via an argument require
1269     * this to be true and invalidate the object pointed to by inner.
1270     */
1271    bool is_owned;
1272 } LDKCommitmentTransaction;
1273
1274 /**
1275  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1276  */
1277 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1278    /**
1279     * A pointer to the contents in the success state.
1280     * Reading from this pointer when `result_ok` is not set is undefined.
1281     */
1282    struct LDKCommitmentTransaction *result;
1283    /**
1284     * A pointer to the contents in the error state.
1285     * Reading from this pointer when `result_ok` is set is undefined.
1286     */
1287    struct LDKDecodeError *err;
1288 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1289
1290 /**
1291  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1292  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1293  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1294  */
1295 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1296    /**
1297     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1298     * `err` or `result` depending on the state of `result_ok`.
1299     */
1300    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1301    /**
1302     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1303     */
1304    bool result_ok;
1305 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1306
1307
1308
1309 /**
1310  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1311  * transaction and the transaction creation keys) are trusted.
1312  *
1313  * See trust() and verify() functions on CommitmentTransaction.
1314  *
1315  * This structure implements Deref.
1316  */
1317 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1318    /**
1319     * A pointer to the opaque Rust object.
1320     * Nearly everywhere, inner must be non-null, however in places where
1321     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1322     */
1323    LDKnativeTrustedCommitmentTransaction *inner;
1324    /**
1325     * Indicates that this is the only struct which contains the same pointer.
1326     * Rust functions which take ownership of an object provided via an argument require
1327     * this to be true and invalidate the object pointed to by inner.
1328     */
1329    bool is_owned;
1330 } LDKTrustedCommitmentTransaction;
1331
1332 /**
1333  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1334  */
1335 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1336    /**
1337     * A pointer to the contents in the success state.
1338     * Reading from this pointer when `result_ok` is not set is undefined.
1339     */
1340    struct LDKTrustedCommitmentTransaction *result;
1341    /**
1342     * Note that this value is always NULL, as there are no contents in the Err variant
1343     */
1344    void *err;
1345 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1346
1347 /**
1348  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1349  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1350  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1351  */
1352 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1353    /**
1354     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1355     * `err` or `result` depending on the state of `result_ok`.
1356     */
1357    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1358    /**
1359     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1360     */
1361    bool result_ok;
1362 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1363
1364 /**
1365  * The contents of CResult_CVec_SignatureZNoneZ
1366  */
1367 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1368    /**
1369     * A pointer to the contents in the success state.
1370     * Reading from this pointer when `result_ok` is not set is undefined.
1371     */
1372    struct LDKCVec_SignatureZ *result;
1373    /**
1374     * Note that this value is always NULL, as there are no contents in the Err variant
1375     */
1376    void *err;
1377 } LDKCResult_CVec_SignatureZNoneZPtr;
1378
1379 /**
1380  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1381  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1382  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1383  */
1384 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1385    /**
1386     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1387     * `err` or `result` depending on the state of `result_ok`.
1388     */
1389    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1390    /**
1391     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1392     */
1393    bool result_ok;
1394 } LDKCResult_CVec_SignatureZNoneZ;
1395
1396
1397
1398 /**
1399  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1400  *
1401  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
1402  */
1403 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1404    /**
1405     * A pointer to the opaque Rust object.
1406     * Nearly everywhere, inner must be non-null, however in places where
1407     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1408     */
1409    LDKnativeShutdownScript *inner;
1410    /**
1411     * Indicates that this is the only struct which contains the same pointer.
1412     * Rust functions which take ownership of an object provided via an argument require
1413     * this to be true and invalidate the object pointed to by inner.
1414     */
1415    bool is_owned;
1416 } LDKShutdownScript;
1417
1418 /**
1419  * The contents of CResult_ShutdownScriptDecodeErrorZ
1420  */
1421 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1422    /**
1423     * A pointer to the contents in the success state.
1424     * Reading from this pointer when `result_ok` is not set is undefined.
1425     */
1426    struct LDKShutdownScript *result;
1427    /**
1428     * A pointer to the contents in the error state.
1429     * Reading from this pointer when `result_ok` is set is undefined.
1430     */
1431    struct LDKDecodeError *err;
1432 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1433
1434 /**
1435  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1436  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1437  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1438  */
1439 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1440    /**
1441     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1442     * `err` or `result` depending on the state of `result_ok`.
1443     */
1444    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1445    /**
1446     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1447     */
1448    bool result_ok;
1449 } LDKCResult_ShutdownScriptDecodeErrorZ;
1450
1451
1452
1453 /**
1454  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1455  */
1456 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1457    /**
1458     * A pointer to the opaque Rust object.
1459     * Nearly everywhere, inner must be non-null, however in places where
1460     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1461     */
1462    LDKnativeInvalidShutdownScript *inner;
1463    /**
1464     * Indicates that this is the only struct which contains the same pointer.
1465     * Rust functions which take ownership of an object provided via an argument require
1466     * this to be true and invalidate the object pointed to by inner.
1467     */
1468    bool is_owned;
1469 } LDKInvalidShutdownScript;
1470
1471 /**
1472  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1473  */
1474 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1475    /**
1476     * A pointer to the contents in the success state.
1477     * Reading from this pointer when `result_ok` is not set is undefined.
1478     */
1479    struct LDKShutdownScript *result;
1480    /**
1481     * A pointer to the contents in the error state.
1482     * Reading from this pointer when `result_ok` is set is undefined.
1483     */
1484    struct LDKInvalidShutdownScript *err;
1485 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1486
1487 /**
1488  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1489  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1490  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1491  */
1492 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1493    /**
1494     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1495     * `err` or `result` depending on the state of `result_ok`.
1496     */
1497    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1498    /**
1499     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1500     */
1501    bool result_ok;
1502 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1503
1504 /**
1505  * The contents of CResult_NoneErrorZ
1506  */
1507 typedef union LDKCResult_NoneErrorZPtr {
1508    /**
1509     * Note that this value is always NULL, as there are no contents in the OK variant
1510     */
1511    void *result;
1512    /**
1513     * A pointer to the contents in the error state.
1514     * Reading from this pointer when `result_ok` is set is undefined.
1515     */
1516    enum LDKIOError *err;
1517 } LDKCResult_NoneErrorZPtr;
1518
1519 /**
1520  * A CResult_NoneErrorZ represents the result of a fallible operation,
1521  * containing a () on success and a crate::c_types::IOError on failure.
1522  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1523  */
1524 typedef struct LDKCResult_NoneErrorZ {
1525    /**
1526     * The contents of this CResult_NoneErrorZ, accessible via either
1527     * `err` or `result` depending on the state of `result_ok`.
1528     */
1529    union LDKCResult_NoneErrorZPtr contents;
1530    /**
1531     * Whether this CResult_NoneErrorZ represents a success state.
1532     */
1533    bool result_ok;
1534 } LDKCResult_NoneErrorZ;
1535
1536
1537
1538 /**
1539  * A hop in a route
1540  */
1541 typedef struct MUST_USE_STRUCT LDKRouteHop {
1542    /**
1543     * A pointer to the opaque Rust object.
1544     * Nearly everywhere, inner must be non-null, however in places where
1545     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1546     */
1547    LDKnativeRouteHop *inner;
1548    /**
1549     * Indicates that this is the only struct which contains the same pointer.
1550     * Rust functions which take ownership of an object provided via an argument require
1551     * this to be true and invalidate the object pointed to by inner.
1552     */
1553    bool is_owned;
1554 } LDKRouteHop;
1555
1556 /**
1557  * The contents of CResult_RouteHopDecodeErrorZ
1558  */
1559 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1560    /**
1561     * A pointer to the contents in the success state.
1562     * Reading from this pointer when `result_ok` is not set is undefined.
1563     */
1564    struct LDKRouteHop *result;
1565    /**
1566     * A pointer to the contents in the error state.
1567     * Reading from this pointer when `result_ok` is set is undefined.
1568     */
1569    struct LDKDecodeError *err;
1570 } LDKCResult_RouteHopDecodeErrorZPtr;
1571
1572 /**
1573  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1574  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1575  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1576  */
1577 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1578    /**
1579     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1580     * `err` or `result` depending on the state of `result_ok`.
1581     */
1582    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1583    /**
1584     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1585     */
1586    bool result_ok;
1587 } LDKCResult_RouteHopDecodeErrorZ;
1588
1589 /**
1590  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1591  * This corresponds to std::vector in C++
1592  */
1593 typedef struct LDKCVec_RouteHopZ {
1594    /**
1595     * The elements in the array.
1596     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1597     */
1598    struct LDKRouteHop *data;
1599    /**
1600     * The number of elements pointed to by `data`.
1601     */
1602    uintptr_t datalen;
1603 } LDKCVec_RouteHopZ;
1604
1605 /**
1606  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1607  * This corresponds to std::vector in C++
1608  */
1609 typedef struct LDKCVec_CVec_RouteHopZZ {
1610    /**
1611     * The elements in the array.
1612     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1613     */
1614    struct LDKCVec_RouteHopZ *data;
1615    /**
1616     * The number of elements pointed to by `data`.
1617     */
1618    uintptr_t datalen;
1619 } LDKCVec_CVec_RouteHopZZ;
1620
1621
1622
1623 /**
1624  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1625  * it can take multiple paths. Each path is composed of one or more hops through the network.
1626  */
1627 typedef struct MUST_USE_STRUCT LDKRoute {
1628    /**
1629     * A pointer to the opaque Rust object.
1630     * Nearly everywhere, inner must be non-null, however in places where
1631     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1632     */
1633    LDKnativeRoute *inner;
1634    /**
1635     * Indicates that this is the only struct which contains the same pointer.
1636     * Rust functions which take ownership of an object provided via an argument require
1637     * this to be true and invalidate the object pointed to by inner.
1638     */
1639    bool is_owned;
1640 } LDKRoute;
1641
1642 /**
1643  * The contents of CResult_RouteDecodeErrorZ
1644  */
1645 typedef union LDKCResult_RouteDecodeErrorZPtr {
1646    /**
1647     * A pointer to the contents in the success state.
1648     * Reading from this pointer when `result_ok` is not set is undefined.
1649     */
1650    struct LDKRoute *result;
1651    /**
1652     * A pointer to the contents in the error state.
1653     * Reading from this pointer when `result_ok` is set is undefined.
1654     */
1655    struct LDKDecodeError *err;
1656 } LDKCResult_RouteDecodeErrorZPtr;
1657
1658 /**
1659  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1660  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1661  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1662  */
1663 typedef struct LDKCResult_RouteDecodeErrorZ {
1664    /**
1665     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1666     * `err` or `result` depending on the state of `result_ok`.
1667     */
1668    union LDKCResult_RouteDecodeErrorZPtr contents;
1669    /**
1670     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1671     */
1672    bool result_ok;
1673 } LDKCResult_RouteDecodeErrorZ;
1674
1675
1676
1677 /**
1678  * Parameters needed to find a [`Route`].
1679  *
1680  * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
1681  * payment path.
1682  *
1683  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
1684  */
1685 typedef struct MUST_USE_STRUCT LDKRouteParameters {
1686    /**
1687     * A pointer to the opaque Rust object.
1688     * Nearly everywhere, inner must be non-null, however in places where
1689     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1690     */
1691    LDKnativeRouteParameters *inner;
1692    /**
1693     * Indicates that this is the only struct which contains the same pointer.
1694     * Rust functions which take ownership of an object provided via an argument require
1695     * this to be true and invalidate the object pointed to by inner.
1696     */
1697    bool is_owned;
1698 } LDKRouteParameters;
1699
1700 /**
1701  * The contents of CResult_RouteParametersDecodeErrorZ
1702  */
1703 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
1704    /**
1705     * A pointer to the contents in the success state.
1706     * Reading from this pointer when `result_ok` is not set is undefined.
1707     */
1708    struct LDKRouteParameters *result;
1709    /**
1710     * A pointer to the contents in the error state.
1711     * Reading from this pointer when `result_ok` is set is undefined.
1712     */
1713    struct LDKDecodeError *err;
1714 } LDKCResult_RouteParametersDecodeErrorZPtr;
1715
1716 /**
1717  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1718  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1719  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1720  */
1721 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
1722    /**
1723     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1724     * `err` or `result` depending on the state of `result_ok`.
1725     */
1726    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
1727    /**
1728     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1729     */
1730    bool result_ok;
1731 } LDKCResult_RouteParametersDecodeErrorZ;
1732
1733
1734
1735 /**
1736  * A list of hops along a payment path terminating with a channel to the recipient.
1737  */
1738 typedef struct MUST_USE_STRUCT LDKRouteHint {
1739    /**
1740     * A pointer to the opaque Rust object.
1741     * Nearly everywhere, inner must be non-null, however in places where
1742     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1743     */
1744    LDKnativeRouteHint *inner;
1745    /**
1746     * Indicates that this is the only struct which contains the same pointer.
1747     * Rust functions which take ownership of an object provided via an argument require
1748     * this to be true and invalidate the object pointed to by inner.
1749     */
1750    bool is_owned;
1751 } LDKRouteHint;
1752
1753 /**
1754  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1755  * This corresponds to std::vector in C++
1756  */
1757 typedef struct LDKCVec_RouteHintZ {
1758    /**
1759     * The elements in the array.
1760     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1761     */
1762    struct LDKRouteHint *data;
1763    /**
1764     * The number of elements pointed to by `data`.
1765     */
1766    uintptr_t datalen;
1767 } LDKCVec_RouteHintZ;
1768
1769 /**
1770  * An enum which can either contain a u64 or not
1771  */
1772 typedef enum LDKCOption_u64Z_Tag {
1773    /**
1774     * When we're in this state, this COption_u64Z contains a u64
1775     */
1776    LDKCOption_u64Z_Some,
1777    /**
1778     * When we're in this state, this COption_u64Z contains nothing
1779     */
1780    LDKCOption_u64Z_None,
1781    /**
1782     * Must be last for serialization purposes
1783     */
1784    LDKCOption_u64Z_Sentinel,
1785 } LDKCOption_u64Z_Tag;
1786
1787 typedef struct LDKCOption_u64Z {
1788    LDKCOption_u64Z_Tag tag;
1789    union {
1790       struct {
1791          uint64_t some;
1792       };
1793    };
1794 } LDKCOption_u64Z;
1795
1796
1797
1798 /**
1799  * The recipient of a payment.
1800  */
1801 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
1802    /**
1803     * A pointer to the opaque Rust object.
1804     * Nearly everywhere, inner must be non-null, however in places where
1805     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1806     */
1807    LDKnativePaymentParameters *inner;
1808    /**
1809     * Indicates that this is the only struct which contains the same pointer.
1810     * Rust functions which take ownership of an object provided via an argument require
1811     * this to be true and invalidate the object pointed to by inner.
1812     */
1813    bool is_owned;
1814 } LDKPaymentParameters;
1815
1816 /**
1817  * The contents of CResult_PaymentParametersDecodeErrorZ
1818  */
1819 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
1820    /**
1821     * A pointer to the contents in the success state.
1822     * Reading from this pointer when `result_ok` is not set is undefined.
1823     */
1824    struct LDKPaymentParameters *result;
1825    /**
1826     * A pointer to the contents in the error state.
1827     * Reading from this pointer when `result_ok` is set is undefined.
1828     */
1829    struct LDKDecodeError *err;
1830 } LDKCResult_PaymentParametersDecodeErrorZPtr;
1831
1832 /**
1833  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
1834  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1835  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1836  */
1837 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
1838    /**
1839     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
1840     * `err` or `result` depending on the state of `result_ok`.
1841     */
1842    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
1843    /**
1844     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
1845     */
1846    bool result_ok;
1847 } LDKCResult_PaymentParametersDecodeErrorZ;
1848
1849
1850
1851 /**
1852  * A channel descriptor for a hop along a payment path.
1853  */
1854 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1855    /**
1856     * A pointer to the opaque Rust object.
1857     * Nearly everywhere, inner must be non-null, however in places where
1858     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1859     */
1860    LDKnativeRouteHintHop *inner;
1861    /**
1862     * Indicates that this is the only struct which contains the same pointer.
1863     * Rust functions which take ownership of an object provided via an argument require
1864     * this to be true and invalidate the object pointed to by inner.
1865     */
1866    bool is_owned;
1867 } LDKRouteHintHop;
1868
1869 /**
1870  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1871  * This corresponds to std::vector in C++
1872  */
1873 typedef struct LDKCVec_RouteHintHopZ {
1874    /**
1875     * The elements in the array.
1876     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1877     */
1878    struct LDKRouteHintHop *data;
1879    /**
1880     * The number of elements pointed to by `data`.
1881     */
1882    uintptr_t datalen;
1883 } LDKCVec_RouteHintHopZ;
1884
1885 /**
1886  * The contents of CResult_RouteHintDecodeErrorZ
1887  */
1888 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
1889    /**
1890     * A pointer to the contents in the success state.
1891     * Reading from this pointer when `result_ok` is not set is undefined.
1892     */
1893    struct LDKRouteHint *result;
1894    /**
1895     * A pointer to the contents in the error state.
1896     * Reading from this pointer when `result_ok` is set is undefined.
1897     */
1898    struct LDKDecodeError *err;
1899 } LDKCResult_RouteHintDecodeErrorZPtr;
1900
1901 /**
1902  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
1903  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
1904  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1905  */
1906 typedef struct LDKCResult_RouteHintDecodeErrorZ {
1907    /**
1908     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
1909     * `err` or `result` depending on the state of `result_ok`.
1910     */
1911    union LDKCResult_RouteHintDecodeErrorZPtr contents;
1912    /**
1913     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
1914     */
1915    bool result_ok;
1916 } LDKCResult_RouteHintDecodeErrorZ;
1917
1918 /**
1919  * The contents of CResult_RouteHintHopDecodeErrorZ
1920  */
1921 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
1922    /**
1923     * A pointer to the contents in the success state.
1924     * Reading from this pointer when `result_ok` is not set is undefined.
1925     */
1926    struct LDKRouteHintHop *result;
1927    /**
1928     * A pointer to the contents in the error state.
1929     * Reading from this pointer when `result_ok` is set is undefined.
1930     */
1931    struct LDKDecodeError *err;
1932 } LDKCResult_RouteHintHopDecodeErrorZPtr;
1933
1934 /**
1935  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
1936  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1937  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1938  */
1939 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
1940    /**
1941     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
1942     * `err` or `result` depending on the state of `result_ok`.
1943     */
1944    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
1945    /**
1946     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
1947     */
1948    bool result_ok;
1949 } LDKCResult_RouteHintHopDecodeErrorZ;
1950
1951
1952
1953 /**
1954  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
1955  */
1956 typedef struct MUST_USE_STRUCT LDKChannelDetails {
1957    /**
1958     * A pointer to the opaque Rust object.
1959     * Nearly everywhere, inner must be non-null, however in places where
1960     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1961     */
1962    LDKnativeChannelDetails *inner;
1963    /**
1964     * Indicates that this is the only struct which contains the same pointer.
1965     * Rust functions which take ownership of an object provided via an argument require
1966     * this to be true and invalidate the object pointed to by inner.
1967     */
1968    bool is_owned;
1969 } LDKChannelDetails;
1970
1971 /**
1972  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
1973  * This corresponds to std::vector in C++
1974  */
1975 typedef struct LDKCVec_ChannelDetailsZ {
1976    /**
1977     * The elements in the array.
1978     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1979     */
1980    struct LDKChannelDetails *data;
1981    /**
1982     * The number of elements pointed to by `data`.
1983     */
1984    uintptr_t datalen;
1985 } LDKCVec_ChannelDetailsZ;
1986
1987
1988
1989 /**
1990  * An Err type for failure to process messages.
1991  */
1992 typedef struct MUST_USE_STRUCT LDKLightningError {
1993    /**
1994     * A pointer to the opaque Rust object.
1995     * Nearly everywhere, inner must be non-null, however in places where
1996     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1997     */
1998    LDKnativeLightningError *inner;
1999    /**
2000     * Indicates that this is the only struct which contains the same pointer.
2001     * Rust functions which take ownership of an object provided via an argument require
2002     * this to be true and invalidate the object pointed to by inner.
2003     */
2004    bool is_owned;
2005 } LDKLightningError;
2006
2007 /**
2008  * The contents of CResult_RouteLightningErrorZ
2009  */
2010 typedef union LDKCResult_RouteLightningErrorZPtr {
2011    /**
2012     * A pointer to the contents in the success state.
2013     * Reading from this pointer when `result_ok` is not set is undefined.
2014     */
2015    struct LDKRoute *result;
2016    /**
2017     * A pointer to the contents in the error state.
2018     * Reading from this pointer when `result_ok` is set is undefined.
2019     */
2020    struct LDKLightningError *err;
2021 } LDKCResult_RouteLightningErrorZPtr;
2022
2023 /**
2024  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2025  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2026  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2027  */
2028 typedef struct LDKCResult_RouteLightningErrorZ {
2029    /**
2030     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2031     * `err` or `result` depending on the state of `result_ok`.
2032     */
2033    union LDKCResult_RouteLightningErrorZPtr contents;
2034    /**
2035     * Whether this CResult_RouteLightningErrorZ represents a success state.
2036     */
2037    bool result_ok;
2038 } LDKCResult_RouteLightningErrorZ;
2039
2040 /**
2041  * The contents of CResult_TxOutAccessErrorZ
2042  */
2043 typedef union LDKCResult_TxOutAccessErrorZPtr {
2044    /**
2045     * A pointer to the contents in the success state.
2046     * Reading from this pointer when `result_ok` is not set is undefined.
2047     */
2048    struct LDKTxOut *result;
2049    /**
2050     * A pointer to the contents in the error state.
2051     * Reading from this pointer when `result_ok` is set is undefined.
2052     */
2053    enum LDKAccessError *err;
2054 } LDKCResult_TxOutAccessErrorZPtr;
2055
2056 /**
2057  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2058  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2059  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2060  */
2061 typedef struct LDKCResult_TxOutAccessErrorZ {
2062    /**
2063     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
2064     * `err` or `result` depending on the state of `result_ok`.
2065     */
2066    union LDKCResult_TxOutAccessErrorZPtr contents;
2067    /**
2068     * Whether this CResult_TxOutAccessErrorZ represents a success state.
2069     */
2070    bool result_ok;
2071 } LDKCResult_TxOutAccessErrorZ;
2072
2073 /**
2074  * A tuple of 2 elements. See the individual fields for the types contained.
2075  */
2076 typedef struct LDKC2Tuple_usizeTransactionZ {
2077    /**
2078     * The element at position 0
2079     */
2080    uintptr_t a;
2081    /**
2082     * The element at position 1
2083     */
2084    struct LDKTransaction b;
2085 } LDKC2Tuple_usizeTransactionZ;
2086
2087 /**
2088  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2089  * This corresponds to std::vector in C++
2090  */
2091 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
2092    /**
2093     * The elements in the array.
2094     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2095     */
2096    struct LDKC2Tuple_usizeTransactionZ *data;
2097    /**
2098     * The number of elements pointed to by `data`.
2099     */
2100    uintptr_t datalen;
2101 } LDKCVec_C2Tuple_usizeTransactionZZ;
2102
2103 /**
2104  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
2105  * look up the corresponding function in rust-lightning's docs.
2106  */
2107 typedef struct LDKThirtyTwoBytes {
2108    /**
2109     * The thirty-two bytes
2110     */
2111    uint8_t data[32];
2112 } LDKThirtyTwoBytes;
2113
2114 /**
2115  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2116  * This corresponds to std::vector in C++
2117  */
2118 typedef struct LDKCVec_TxidZ {
2119    /**
2120     * The elements in the array.
2121     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2122     */
2123    struct LDKThirtyTwoBytes *data;
2124    /**
2125     * The number of elements pointed to by `data`.
2126     */
2127    uintptr_t datalen;
2128 } LDKCVec_TxidZ;
2129
2130 /**
2131  * The contents of CResult_NoneChannelMonitorUpdateErrZ
2132  */
2133 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
2134    /**
2135     * Note that this value is always NULL, as there are no contents in the OK variant
2136     */
2137    void *result;
2138    /**
2139     * A pointer to the contents in the error state.
2140     * Reading from this pointer when `result_ok` is set is undefined.
2141     */
2142    enum LDKChannelMonitorUpdateErr *err;
2143 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2144
2145 /**
2146  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2147  * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2148  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2149  */
2150 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2151    /**
2152     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2153     * `err` or `result` depending on the state of `result_ok`.
2154     */
2155    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2156    /**
2157     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2158     */
2159    bool result_ok;
2160 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2161
2162
2163
2164 /**
2165  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2166  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2167  * preimage claim backward will lead to loss of funds.
2168  */
2169 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2170    /**
2171     * A pointer to the opaque Rust object.
2172     * Nearly everywhere, inner must be non-null, however in places where
2173     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2174     */
2175    LDKnativeHTLCUpdate *inner;
2176    /**
2177     * Indicates that this is the only struct which contains the same pointer.
2178     * Rust functions which take ownership of an object provided via an argument require
2179     * this to be true and invalidate the object pointed to by inner.
2180     */
2181    bool is_owned;
2182 } LDKHTLCUpdate;
2183
2184
2185
2186 /**
2187  * A reference to a transaction output.
2188  *
2189  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2190  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2191  */
2192 typedef struct MUST_USE_STRUCT LDKOutPoint {
2193    /**
2194     * A pointer to the opaque Rust object.
2195     * Nearly everywhere, inner must be non-null, however in places where
2196     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2197     */
2198    LDKnativeOutPoint *inner;
2199    /**
2200     * Indicates that this is the only struct which contains the same pointer.
2201     * Rust functions which take ownership of an object provided via an argument require
2202     * this to be true and invalidate the object pointed to by inner.
2203     */
2204    bool is_owned;
2205 } LDKOutPoint;
2206
2207 /**
2208  * An event to be processed by the ChannelManager.
2209  */
2210 typedef enum LDKMonitorEvent_Tag {
2211    /**
2212     * A monitor event containing an HTLCUpdate.
2213     */
2214    LDKMonitorEvent_HTLCEvent,
2215    /**
2216     * A monitor event that the Channel's commitment transaction was confirmed.
2217     */
2218    LDKMonitorEvent_CommitmentTxConfirmed,
2219    /**
2220     * Indicates a [`ChannelMonitor`] update has completed. See
2221     * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
2222     *
2223     * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
2224     */
2225    LDKMonitorEvent_UpdateCompleted,
2226    /**
2227     * Indicates a [`ChannelMonitor`] update has failed. See
2228     * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
2229     *
2230     * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
2231     */
2232    LDKMonitorEvent_UpdateFailed,
2233    /**
2234     * Must be last for serialization purposes
2235     */
2236    LDKMonitorEvent_Sentinel,
2237 } LDKMonitorEvent_Tag;
2238
2239 typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
2240    /**
2241     * The funding outpoint of the [`ChannelMonitor`] that was updated
2242     */
2243    struct LDKOutPoint funding_txo;
2244    /**
2245     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
2246     * [`ChannelMonitor::get_latest_update_id`].
2247     *
2248     * Note that this should only be set to a given update's ID if all previous updates for the
2249     * same [`ChannelMonitor`] have been applied and persisted.
2250     */
2251    uint64_t monitor_update_id;
2252 } LDKMonitorEvent_LDKUpdateCompleted_Body;
2253
2254 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
2255    LDKMonitorEvent_Tag tag;
2256    union {
2257       struct {
2258          struct LDKHTLCUpdate htlc_event;
2259       };
2260       struct {
2261          struct LDKOutPoint commitment_tx_confirmed;
2262       };
2263       LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
2264       struct {
2265          struct LDKOutPoint update_failed;
2266       };
2267    };
2268 } LDKMonitorEvent;
2269
2270 /**
2271  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2272  * This corresponds to std::vector in C++
2273  */
2274 typedef struct LDKCVec_MonitorEventZ {
2275    /**
2276     * The elements in the array.
2277     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2278     */
2279    struct LDKMonitorEvent *data;
2280    /**
2281     * The number of elements pointed to by `data`.
2282     */
2283    uintptr_t datalen;
2284 } LDKCVec_MonitorEventZ;
2285
2286 /**
2287  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2288  */
2289 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
2290    /**
2291     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2292     */
2293    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
2294    /**
2295     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2296     */
2297    LDKCOption_C2Tuple_usizeTransactionZZ_None,
2298    /**
2299     * Must be last for serialization purposes
2300     */
2301    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
2302 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
2303
2304 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
2305    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
2306    union {
2307       struct {
2308          struct LDKC2Tuple_usizeTransactionZ some;
2309       };
2310    };
2311 } LDKCOption_C2Tuple_usizeTransactionZZ;
2312
2313 /**
2314  * The reason the channel was closed. See individual variants more details.
2315  */
2316 typedef enum LDKClosureReason_Tag {
2317    /**
2318     * Closure generated from receiving a peer error message.
2319     *
2320     * Our counterparty may have broadcasted their latest commitment state, and we have
2321     * as well.
2322     */
2323    LDKClosureReason_CounterpartyForceClosed,
2324    /**
2325     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2326     *
2327     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2328     */
2329    LDKClosureReason_HolderForceClosed,
2330    /**
2331     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2332     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2333     */
2334    LDKClosureReason_CooperativeClosure,
2335    /**
2336     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2337     * commitment transaction came from our counterparty, but it may also have come from
2338     * a copy of our own `ChannelMonitor`.
2339     */
2340    LDKClosureReason_CommitmentTxConfirmed,
2341    /**
2342     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2343     */
2344    LDKClosureReason_FundingTimedOut,
2345    /**
2346     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2347     */
2348    LDKClosureReason_ProcessingError,
2349    /**
2350     * The `PeerManager` informed us that we've disconnected from the peer. We close channels
2351     * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
2352     * peer again in the future or if the peer disconnected before we finished negotiating
2353     * the channel open. The first case may be caused by incompatible features which our
2354     * counterparty, or we, require.
2355     */
2356    LDKClosureReason_DisconnectedPeer,
2357    /**
2358     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
2359     * the ChannelManager deserialized.
2360     */
2361    LDKClosureReason_OutdatedChannelManager,
2362    /**
2363     * Must be last for serialization purposes
2364     */
2365    LDKClosureReason_Sentinel,
2366 } LDKClosureReason_Tag;
2367
2368 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2369    /**
2370     * The error which the peer sent us.
2371     *
2372     * The string should be sanitized before it is used (e.g emitted to logs
2373     * or printed to stdout). Otherwise, a well crafted error message may exploit
2374     * a security vulnerability in the terminal emulator or the logging subsystem.
2375     */
2376    struct LDKStr peer_msg;
2377 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2378
2379 typedef struct LDKClosureReason_LDKProcessingError_Body {
2380    /**
2381     * A developer-readable error message which we generated.
2382     */
2383    struct LDKStr err;
2384 } LDKClosureReason_LDKProcessingError_Body;
2385
2386 typedef struct MUST_USE_STRUCT LDKClosureReason {
2387    LDKClosureReason_Tag tag;
2388    union {
2389       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2390       LDKClosureReason_LDKProcessingError_Body processing_error;
2391    };
2392 } LDKClosureReason;
2393
2394 /**
2395  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2396  */
2397 typedef enum LDKCOption_ClosureReasonZ_Tag {
2398    /**
2399     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2400     */
2401    LDKCOption_ClosureReasonZ_Some,
2402    /**
2403     * When we're in this state, this COption_ClosureReasonZ contains nothing
2404     */
2405    LDKCOption_ClosureReasonZ_None,
2406    /**
2407     * Must be last for serialization purposes
2408     */
2409    LDKCOption_ClosureReasonZ_Sentinel,
2410 } LDKCOption_ClosureReasonZ_Tag;
2411
2412 typedef struct LDKCOption_ClosureReasonZ {
2413    LDKCOption_ClosureReasonZ_Tag tag;
2414    union {
2415       struct {
2416          struct LDKClosureReason some;
2417       };
2418    };
2419 } LDKCOption_ClosureReasonZ;
2420
2421 /**
2422  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2423  */
2424 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2425    /**
2426     * A pointer to the contents in the success state.
2427     * Reading from this pointer when `result_ok` is not set is undefined.
2428     */
2429    struct LDKCOption_ClosureReasonZ *result;
2430    /**
2431     * A pointer to the contents in the error state.
2432     * Reading from this pointer when `result_ok` is set is undefined.
2433     */
2434    struct LDKDecodeError *err;
2435 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2436
2437 /**
2438  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2439  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2440  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2441  */
2442 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2443    /**
2444     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2445     * `err` or `result` depending on the state of `result_ok`.
2446     */
2447    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2448    /**
2449     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2450     */
2451    bool result_ok;
2452 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2453
2454
2455
2456 /**
2457  * A channel_update message to be sent or received from a peer
2458  */
2459 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2460    /**
2461     * A pointer to the opaque Rust object.
2462     * Nearly everywhere, inner must be non-null, however in places where
2463     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2464     */
2465    LDKnativeChannelUpdate *inner;
2466    /**
2467     * Indicates that this is the only struct which contains the same pointer.
2468     * Rust functions which take ownership of an object provided via an argument require
2469     * this to be true and invalidate the object pointed to by inner.
2470     */
2471    bool is_owned;
2472 } LDKChannelUpdate;
2473
2474 /**
2475  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2476  * return packet by a node along the route. See [BOLT #4] for details.
2477  *
2478  * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
2479  */
2480 typedef enum LDKNetworkUpdate_Tag {
2481    /**
2482     * An error indicating a `channel_update` messages should be applied via
2483     * [`NetworkGraph::update_channel`].
2484     */
2485    LDKNetworkUpdate_ChannelUpdateMessage,
2486    /**
2487     * An error indicating only that a channel has been closed, which should be applied via
2488     * [`NetworkGraph::close_channel_from_update`].
2489     */
2490    LDKNetworkUpdate_ChannelClosed,
2491    /**
2492     * An error indicating only that a node has failed, which should be applied via
2493     * [`NetworkGraph::fail_node`].
2494     */
2495    LDKNetworkUpdate_NodeFailure,
2496    /**
2497     * Must be last for serialization purposes
2498     */
2499    LDKNetworkUpdate_Sentinel,
2500 } LDKNetworkUpdate_Tag;
2501
2502 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2503    /**
2504     * The update to apply via [`NetworkGraph::update_channel`].
2505     */
2506    struct LDKChannelUpdate msg;
2507 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2508
2509 typedef struct LDKNetworkUpdate_LDKChannelClosed_Body {
2510    /**
2511     * The short channel id of the closed channel.
2512     */
2513    uint64_t short_channel_id;
2514    /**
2515     * Whether the channel should be permanently removed or temporarily disabled until a new
2516     * `channel_update` message is received.
2517     */
2518    bool is_permanent;
2519 } LDKNetworkUpdate_LDKChannelClosed_Body;
2520
2521 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2522    /**
2523     * The node id of the failed node.
2524     */
2525    struct LDKPublicKey node_id;
2526    /**
2527     * Whether the node should be permanently removed from consideration or can be restored
2528     * when a new `channel_update` message is received.
2529     */
2530    bool is_permanent;
2531 } LDKNetworkUpdate_LDKNodeFailure_Body;
2532
2533 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2534    LDKNetworkUpdate_Tag tag;
2535    union {
2536       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2537       LDKNetworkUpdate_LDKChannelClosed_Body channel_closed;
2538       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2539    };
2540 } LDKNetworkUpdate;
2541
2542 /**
2543  * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2544  */
2545 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2546    /**
2547     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2548     */
2549    LDKCOption_NetworkUpdateZ_Some,
2550    /**
2551     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2552     */
2553    LDKCOption_NetworkUpdateZ_None,
2554    /**
2555     * Must be last for serialization purposes
2556     */
2557    LDKCOption_NetworkUpdateZ_Sentinel,
2558 } LDKCOption_NetworkUpdateZ_Tag;
2559
2560 typedef struct LDKCOption_NetworkUpdateZ {
2561    LDKCOption_NetworkUpdateZ_Tag tag;
2562    union {
2563       struct {
2564          struct LDKNetworkUpdate some;
2565       };
2566    };
2567 } LDKCOption_NetworkUpdateZ;
2568
2569
2570
2571 /**
2572  * Information about a spendable output to a P2WSH script. See
2573  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2574  */
2575 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2576    /**
2577     * A pointer to the opaque Rust object.
2578     * Nearly everywhere, inner must be non-null, however in places where
2579     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2580     */
2581    LDKnativeDelayedPaymentOutputDescriptor *inner;
2582    /**
2583     * Indicates that this is the only struct which contains the same pointer.
2584     * Rust functions which take ownership of an object provided via an argument require
2585     * this to be true and invalidate the object pointed to by inner.
2586     */
2587    bool is_owned;
2588 } LDKDelayedPaymentOutputDescriptor;
2589
2590
2591
2592 /**
2593  * Information about a spendable output to our \"payment key\". See
2594  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2595  */
2596 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2597    /**
2598     * A pointer to the opaque Rust object.
2599     * Nearly everywhere, inner must be non-null, however in places where
2600     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2601     */
2602    LDKnativeStaticPaymentOutputDescriptor *inner;
2603    /**
2604     * Indicates that this is the only struct which contains the same pointer.
2605     * Rust functions which take ownership of an object provided via an argument require
2606     * this to be true and invalidate the object pointed to by inner.
2607     */
2608    bool is_owned;
2609 } LDKStaticPaymentOutputDescriptor;
2610
2611 /**
2612  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2613  * claim at any point in the future) an event is generated which you must track and be able to
2614  * spend on-chain. The information needed to do this is provided in this enum, including the
2615  * outpoint describing which txid and output index is available, the full output which exists at
2616  * that txid/index, and any keys or other information required to sign.
2617  */
2618 typedef enum LDKSpendableOutputDescriptor_Tag {
2619    /**
2620     * An output to a script which was provided via KeysInterface directly, either from
2621     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2622     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2623     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2624     * on-chain using the payment preimage or after it has timed out.
2625     */
2626    LDKSpendableOutputDescriptor_StaticOutput,
2627    /**
2628     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2629     *
2630     * The witness in the spending input should be:
2631     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2632     *
2633     * Note that the nSequence field in the spending input must be set to to_self_delay
2634     * (which means the transaction is not broadcastable until at least to_self_delay
2635     * blocks after the outpoint confirms).
2636     *
2637     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2638     * it is an output from an old state which we broadcast (which should never happen).
2639     *
2640     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2641     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2642     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2643     * chan_utils::derive_private_key. The public key can be generated without the secret key
2644     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2645     * Sign::pubkeys().
2646     *
2647     * To derive the revocation_pubkey provided here (which is used in the witness
2648     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2649     * call to Sign::ready_channel) and the provided per_commitment point
2650     * to chan_utils::derive_public_revocation_key.
2651     *
2652     * The witness script which is hashed and included in the output script_pubkey may be
2653     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2654     * (derived as above), and the to_self_delay contained here to
2655     * chan_utils::get_revokeable_redeemscript.
2656     */
2657    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2658    /**
2659     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2660     * corresponds to the public key in Sign::pubkeys().payment_point).
2661     * The witness in the spending input, is, thus, simply:
2662     * <BIP 143 signature> <payment key>
2663     *
2664     * These are generally the result of our counterparty having broadcast the current state,
2665     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2666     */
2667    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2668    /**
2669     * Must be last for serialization purposes
2670     */
2671    LDKSpendableOutputDescriptor_Sentinel,
2672 } LDKSpendableOutputDescriptor_Tag;
2673
2674 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2675    /**
2676     * The outpoint which is spendable
2677     */
2678    struct LDKOutPoint outpoint;
2679    /**
2680     * The output which is referenced by the given outpoint.
2681     */
2682    struct LDKTxOut output;
2683 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2684
2685 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2686    LDKSpendableOutputDescriptor_Tag tag;
2687    union {
2688       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2689       struct {
2690          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2691       };
2692       struct {
2693          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2694       };
2695    };
2696 } LDKSpendableOutputDescriptor;
2697
2698 /**
2699  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2700  * This corresponds to std::vector in C++
2701  */
2702 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2703    /**
2704     * The elements in the array.
2705     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2706     */
2707    struct LDKSpendableOutputDescriptor *data;
2708    /**
2709     * The number of elements pointed to by `data`.
2710     */
2711    uintptr_t datalen;
2712 } LDKCVec_SpendableOutputDescriptorZ;
2713
2714 /**
2715  * Some information provided on receipt of payment depends on whether the payment received is a
2716  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2717  */
2718 typedef enum LDKPaymentPurpose_Tag {
2719    /**
2720     * Information for receiving a payment that we generated an invoice for.
2721     */
2722    LDKPaymentPurpose_InvoicePayment,
2723    /**
2724     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2725     * (the payee) providing a preimage.
2726     */
2727    LDKPaymentPurpose_SpontaneousPayment,
2728    /**
2729     * Must be last for serialization purposes
2730     */
2731    LDKPaymentPurpose_Sentinel,
2732 } LDKPaymentPurpose_Tag;
2733
2734 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2735    /**
2736     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2737     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2738     * [`ChannelManager::claim_funds`].
2739     *
2740     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2741     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2742     *
2743     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2744     */
2745    struct LDKThirtyTwoBytes payment_preimage;
2746    /**
2747     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2748     * number of deanonymization attacks during the routing process.
2749     * It is provided here for your reference, however its accuracy is enforced directly by
2750     * [`ChannelManager`] using the values you previously provided to
2751     * [`ChannelManager::create_inbound_payment`] or
2752     * [`ChannelManager::create_inbound_payment_for_hash`].
2753     *
2754     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2755     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2756     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2757     */
2758    struct LDKThirtyTwoBytes payment_secret;
2759 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2760
2761 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2762    LDKPaymentPurpose_Tag tag;
2763    union {
2764       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2765       struct {
2766          struct LDKThirtyTwoBytes spontaneous_payment;
2767       };
2768    };
2769 } LDKPaymentPurpose;
2770
2771 /**
2772  * An Event which you should probably take some action in response to.
2773  *
2774  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2775  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2776  * written as it makes no sense to respond to it after reconnecting to peers).
2777  */
2778 typedef enum LDKEvent_Tag {
2779    /**
2780     * Used to indicate that the client should generate a funding transaction with the given
2781     * parameters and then call [`ChannelManager::funding_transaction_generated`].
2782     * Generated in [`ChannelManager`] message handling.
2783     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2784     * counterparty can steal your funds!
2785     *
2786     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2787     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2788     */
2789    LDKEvent_FundingGenerationReady,
2790    /**
2791     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2792     * [`ChannelManager::claim_funds`] to get it....
2793     * Note that if the preimage is not known, you should call
2794     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
2795     * network congestion.
2796     * If you fail to call either [`ChannelManager::claim_funds`] or
2797     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
2798     * automatically failed.
2799     *
2800     * # Note
2801     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2802     * `PaymentReceived` events may be generated for the same payment.
2803     *
2804     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2805     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
2806     */
2807    LDKEvent_PaymentReceived,
2808    /**
2809     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
2810     * and we got back the payment preimage for it).
2811     *
2812     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
2813     * event. In this situation, you SHOULD treat this payment as having succeeded.
2814     */
2815    LDKEvent_PaymentSent,
2816    /**
2817     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
2818     * something. You may wish to retry with a different route.
2819     *
2820     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
2821     * [`Event::PaymentFailed`] and [`all_paths_failed`].
2822     *
2823     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
2824     */
2825    LDKEvent_PaymentPathFailed,
2826    /**
2827     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
2828     * provide failure information for each MPP part in the payment.
2829     *
2830     * This event is provided once there are no further pending HTLCs for the payment and the
2831     * payment is no longer retryable, either due to a several-block timeout or because
2832     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
2833     *
2834     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2835     */
2836    LDKEvent_PaymentFailed,
2837    /**
2838     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
2839     * a time in the future.
2840     *
2841     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
2842     */
2843    LDKEvent_PendingHTLCsForwardable,
2844    /**
2845     * Used to indicate that an output which you should know how to spend was confirmed on chain
2846     * and is now spendable.
2847     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2848     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2849     * somewhere and spend them when you create on-chain transactions.
2850     */
2851    LDKEvent_SpendableOutputs,
2852    /**
2853     * This event is generated when a payment has been successfully forwarded through us and a
2854     * forwarding fee earned.
2855     */
2856    LDKEvent_PaymentForwarded,
2857    /**
2858     * Used to indicate that a channel with the given `channel_id` is in the process of closure.
2859     */
2860    LDKEvent_ChannelClosed,
2861    /**
2862     * Used to indicate to the user that they can abandon the funding transaction and recycle the
2863     * inputs for another purpose.
2864     */
2865    LDKEvent_DiscardFunding,
2866    /**
2867     * Indicates that a path for an outbound payment was successful.
2868     *
2869     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
2870     * [`Event::PaymentSent`] for obtaining the payment preimage.
2871     */
2872    LDKEvent_PaymentPathSuccessful,
2873    /**
2874     * Indicates a request to open a new channel by a peer.
2875     *
2876     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
2877     * request, call [`ChannelManager::force_close_channel`].
2878     *
2879     * The event is only triggered when a new open channel request is received and the
2880     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
2881     *
2882     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
2883     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
2884     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
2885     */
2886    LDKEvent_OpenChannelRequest,
2887    /**
2888     * Must be last for serialization purposes
2889     */
2890    LDKEvent_Sentinel,
2891 } LDKEvent_Tag;
2892
2893 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2894    /**
2895     * The random channel_id we picked which you'll need to pass into
2896     * ChannelManager::funding_transaction_generated.
2897     */
2898    struct LDKThirtyTwoBytes temporary_channel_id;
2899    /**
2900     * The value, in satoshis, that the output should have.
2901     */
2902    uint64_t channel_value_satoshis;
2903    /**
2904     * The script which should be used in the transaction output.
2905     */
2906    struct LDKCVec_u8Z output_script;
2907    /**
2908     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2909     * an inbound channel.
2910     *
2911     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2912     */
2913    uint64_t user_channel_id;
2914 } LDKEvent_LDKFundingGenerationReady_Body;
2915
2916 typedef struct LDKEvent_LDKPaymentReceived_Body {
2917    /**
2918     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
2919     * not stop you from registering duplicate payment hashes for inbound payments.
2920     */
2921    struct LDKThirtyTwoBytes payment_hash;
2922    /**
2923     * The value, in thousandths of a satoshi, that this payment is for.
2924     */
2925    uint64_t amt;
2926    /**
2927     * Information for claiming this received payment, based on whether the purpose of the
2928     * payment is to pay an invoice or to send a spontaneous payment.
2929     */
2930    struct LDKPaymentPurpose purpose;
2931 } LDKEvent_LDKPaymentReceived_Body;
2932
2933 typedef struct LDKEvent_LDKPaymentSent_Body {
2934    /**
2935     * The id returned by [`ChannelManager::send_payment`] and used with
2936     * [`ChannelManager::retry_payment`].
2937     *
2938     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2939     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2940     *
2941     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2942     */
2943    struct LDKThirtyTwoBytes payment_id;
2944    /**
2945     * The preimage to the hash given to ChannelManager::send_payment.
2946     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2947     * store it somehow!
2948     */
2949    struct LDKThirtyTwoBytes payment_preimage;
2950    /**
2951     * The hash that was given to [`ChannelManager::send_payment`].
2952     *
2953     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2954     */
2955    struct LDKThirtyTwoBytes payment_hash;
2956    /**
2957     * The total fee which was spent at intermediate hops in this payment, across all paths.
2958     *
2959     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
2960     * overpayment to the recipient node.
2961     *
2962     * If the recipient or an intermediate node misbehaves and gives us free money, this may
2963     * overstate the amount paid, though this is unlikely.
2964     *
2965     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
2966     */
2967    struct LDKCOption_u64Z fee_paid_msat;
2968 } LDKEvent_LDKPaymentSent_Body;
2969
2970 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
2971    /**
2972     * The id returned by [`ChannelManager::send_payment`] and used with
2973     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
2974     *
2975     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2976     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2977     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2978     *
2979     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2980     */
2981    struct LDKThirtyTwoBytes payment_id;
2982    /**
2983     * The hash that was given to [`ChannelManager::send_payment`].
2984     *
2985     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2986     */
2987    struct LDKThirtyTwoBytes payment_hash;
2988    /**
2989     * Indicates the payment was rejected for some reason by the recipient. This implies that
2990     * the payment has failed, not just the route in question. If this is not set, you may
2991     * retry the payment via a different route.
2992     */
2993    bool rejected_by_dest;
2994    /**
2995     * Any failure information conveyed via the Onion return packet by a node along the failed
2996     * payment route.
2997     *
2998     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
2999     * account the update. [`NetGraphMsgHandler`] is capable of doing this.
3000     *
3001     * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
3002     * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
3003     */
3004    struct LDKCOption_NetworkUpdateZ network_update;
3005    /**
3006     * For both single-path and multi-path payments, this is set if all paths of the payment have
3007     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
3008     * larger MPP payment were still in flight when this event was generated.
3009     *
3010     * Note that if you are retrying individual MPP parts, using this value to determine if a
3011     * payment has fully failed is race-y. Because multiple failures can happen prior to events
3012     * being processed, you may retry in response to a first failure, with a second failure
3013     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
3014     * you will see `all_paths_failed` set even though the retry of the first failure still
3015     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3016     *
3017     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3018     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3019     *
3020     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3021     *
3022     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3023     */
3024    bool all_paths_failed;
3025    /**
3026     * The payment path that failed.
3027     */
3028    struct LDKCVec_RouteHopZ path;
3029    /**
3030     * The channel responsible for the failed payment path.
3031     *
3032     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3033     * retried. May be `None` for older [`Event`] serializations.
3034     */
3035    struct LDKCOption_u64Z short_channel_id;
3036    /**
3037     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3038     *
3039     * See [`find_route`] for details.
3040     *
3041     * [`Route`]: crate::routing::router::Route
3042     * [`find_route`]: crate::routing::router::find_route
3043     *
3044     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3045     */
3046    struct LDKRouteParameters retry;
3047 } LDKEvent_LDKPaymentPathFailed_Body;
3048
3049 typedef struct LDKEvent_LDKPaymentFailed_Body {
3050    /**
3051     * The id returned by [`ChannelManager::send_payment`] and used with
3052     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3053     *
3054     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3055     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3056     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3057     */
3058    struct LDKThirtyTwoBytes payment_id;
3059    /**
3060     * The hash that was given to [`ChannelManager::send_payment`].
3061     *
3062     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3063     */
3064    struct LDKThirtyTwoBytes payment_hash;
3065 } LDKEvent_LDKPaymentFailed_Body;
3066
3067 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3068    /**
3069     * The minimum amount of time that should be waited prior to calling
3070     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3071     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3072     * now + 5*time_forwardable).
3073     */
3074    uint64_t time_forwardable;
3075 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3076
3077 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3078    /**
3079     * The outputs which you should store as spendable by you.
3080     */
3081    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3082 } LDKEvent_LDKSpendableOutputs_Body;
3083
3084 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3085    /**
3086     * The fee, in milli-satoshis, which was earned as a result of the payment.
3087     *
3088     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3089     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3090     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3091     * claimed the full value in millisatoshis from the source. In this case,
3092     * `claim_from_onchain_tx` will be set.
3093     *
3094     * If the channel which sent us the payment has been force-closed, we will claim the funds
3095     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3096     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3097     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3098     * `None`.
3099     */
3100    struct LDKCOption_u64Z fee_earned_msat;
3101    /**
3102     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3103     * transaction.
3104     */
3105    bool claim_from_onchain_tx;
3106 } LDKEvent_LDKPaymentForwarded_Body;
3107
3108 typedef struct LDKEvent_LDKChannelClosed_Body {
3109    /**
3110     * The channel_id of the channel which has been closed. Note that on-chain transactions
3111     * resolving the channel are likely still awaiting confirmation.
3112     */
3113    struct LDKThirtyTwoBytes channel_id;
3114    /**
3115     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
3116     * an inbound channel. This will always be zero for objects serialized with LDK versions
3117     * prior to 0.0.102.
3118     *
3119     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3120     */
3121    uint64_t user_channel_id;
3122    /**
3123     * The reason the channel was closed.
3124     */
3125    struct LDKClosureReason reason;
3126 } LDKEvent_LDKChannelClosed_Body;
3127
3128 typedef struct LDKEvent_LDKDiscardFunding_Body {
3129    /**
3130     * The channel_id of the channel which has been closed.
3131     */
3132    struct LDKThirtyTwoBytes channel_id;
3133    /**
3134     * The full transaction received from the user
3135     */
3136    struct LDKTransaction transaction;
3137 } LDKEvent_LDKDiscardFunding_Body;
3138
3139 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3140    /**
3141     * The id returned by [`ChannelManager::send_payment`] and used with
3142     * [`ChannelManager::retry_payment`].
3143     *
3144     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3145     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3146     */
3147    struct LDKThirtyTwoBytes payment_id;
3148    /**
3149     * The hash that was given to [`ChannelManager::send_payment`].
3150     *
3151     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3152     *
3153     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3154     */
3155    struct LDKThirtyTwoBytes payment_hash;
3156    /**
3157     * The payment path that was successful.
3158     *
3159     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
3160     */
3161    struct LDKCVec_RouteHopZ path;
3162 } LDKEvent_LDKPaymentPathSuccessful_Body;
3163
3164 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3165    /**
3166     * The temporary channel ID of the channel requested to be opened.
3167     *
3168     * When responding to the request, the `temporary_channel_id` should be passed
3169     * back to the ChannelManager with [`ChannelManager::accept_inbound_channel`] to accept,
3170     * or to [`ChannelManager::force_close_channel`] to reject.
3171     *
3172     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3173     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
3174     */
3175    struct LDKThirtyTwoBytes temporary_channel_id;
3176    /**
3177     * The node_id of the counterparty requesting to open the channel.
3178     */
3179    struct LDKPublicKey counterparty_node_id;
3180    /**
3181     * The channel value of the requested channel.
3182     */
3183    uint64_t funding_satoshis;
3184    /**
3185     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3186     */
3187    uint64_t push_msat;
3188 } LDKEvent_LDKOpenChannelRequest_Body;
3189
3190 typedef struct MUST_USE_STRUCT LDKEvent {
3191    LDKEvent_Tag tag;
3192    union {
3193       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3194       LDKEvent_LDKPaymentReceived_Body payment_received;
3195       LDKEvent_LDKPaymentSent_Body payment_sent;
3196       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3197       LDKEvent_LDKPaymentFailed_Body payment_failed;
3198       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3199       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3200       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3201       LDKEvent_LDKChannelClosed_Body channel_closed;
3202       LDKEvent_LDKDiscardFunding_Body discard_funding;
3203       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3204       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
3205    };
3206 } LDKEvent;
3207
3208 /**
3209  * An enum which can either contain a crate::lightning::util::events::Event or not
3210  */
3211 typedef enum LDKCOption_EventZ_Tag {
3212    /**
3213     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3214     */
3215    LDKCOption_EventZ_Some,
3216    /**
3217     * When we're in this state, this COption_EventZ contains nothing
3218     */
3219    LDKCOption_EventZ_None,
3220    /**
3221     * Must be last for serialization purposes
3222     */
3223    LDKCOption_EventZ_Sentinel,
3224 } LDKCOption_EventZ_Tag;
3225
3226 typedef struct LDKCOption_EventZ {
3227    LDKCOption_EventZ_Tag tag;
3228    union {
3229       struct {
3230          struct LDKEvent some;
3231       };
3232    };
3233 } LDKCOption_EventZ;
3234
3235 /**
3236  * The contents of CResult_COption_EventZDecodeErrorZ
3237  */
3238 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
3239    /**
3240     * A pointer to the contents in the success state.
3241     * Reading from this pointer when `result_ok` is not set is undefined.
3242     */
3243    struct LDKCOption_EventZ *result;
3244    /**
3245     * A pointer to the contents in the error state.
3246     * Reading from this pointer when `result_ok` is set is undefined.
3247     */
3248    struct LDKDecodeError *err;
3249 } LDKCResult_COption_EventZDecodeErrorZPtr;
3250
3251 /**
3252  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3253  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3254  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3255  */
3256 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3257    /**
3258     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3259     * `err` or `result` depending on the state of `result_ok`.
3260     */
3261    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3262    /**
3263     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3264     */
3265    bool result_ok;
3266 } LDKCResult_COption_EventZDecodeErrorZ;
3267
3268
3269
3270 /**
3271  * An accept_channel message to be sent or received from a peer
3272  */
3273 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3274    /**
3275     * A pointer to the opaque Rust object.
3276     * Nearly everywhere, inner must be non-null, however in places where
3277     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3278     */
3279    LDKnativeAcceptChannel *inner;
3280    /**
3281     * Indicates that this is the only struct which contains the same pointer.
3282     * Rust functions which take ownership of an object provided via an argument require
3283     * this to be true and invalidate the object pointed to by inner.
3284     */
3285    bool is_owned;
3286 } LDKAcceptChannel;
3287
3288
3289
3290 /**
3291  * An open_channel message to be sent or received from a peer
3292  */
3293 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3294    /**
3295     * A pointer to the opaque Rust object.
3296     * Nearly everywhere, inner must be non-null, however in places where
3297     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3298     */
3299    LDKnativeOpenChannel *inner;
3300    /**
3301     * Indicates that this is the only struct which contains the same pointer.
3302     * Rust functions which take ownership of an object provided via an argument require
3303     * this to be true and invalidate the object pointed to by inner.
3304     */
3305    bool is_owned;
3306 } LDKOpenChannel;
3307
3308
3309
3310 /**
3311  * A funding_created message to be sent or received from a peer
3312  */
3313 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3314    /**
3315     * A pointer to the opaque Rust object.
3316     * Nearly everywhere, inner must be non-null, however in places where
3317     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3318     */
3319    LDKnativeFundingCreated *inner;
3320    /**
3321     * Indicates that this is the only struct which contains the same pointer.
3322     * Rust functions which take ownership of an object provided via an argument require
3323     * this to be true and invalidate the object pointed to by inner.
3324     */
3325    bool is_owned;
3326 } LDKFundingCreated;
3327
3328
3329
3330 /**
3331  * A funding_signed message to be sent or received from a peer
3332  */
3333 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3334    /**
3335     * A pointer to the opaque Rust object.
3336     * Nearly everywhere, inner must be non-null, however in places where
3337     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3338     */
3339    LDKnativeFundingSigned *inner;
3340    /**
3341     * Indicates that this is the only struct which contains the same pointer.
3342     * Rust functions which take ownership of an object provided via an argument require
3343     * this to be true and invalidate the object pointed to by inner.
3344     */
3345    bool is_owned;
3346 } LDKFundingSigned;
3347
3348
3349
3350 /**
3351  * A funding_locked message to be sent or received from a peer
3352  */
3353 typedef struct MUST_USE_STRUCT LDKFundingLocked {
3354    /**
3355     * A pointer to the opaque Rust object.
3356     * Nearly everywhere, inner must be non-null, however in places where
3357     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3358     */
3359    LDKnativeFundingLocked *inner;
3360    /**
3361     * Indicates that this is the only struct which contains the same pointer.
3362     * Rust functions which take ownership of an object provided via an argument require
3363     * this to be true and invalidate the object pointed to by inner.
3364     */
3365    bool is_owned;
3366 } LDKFundingLocked;
3367
3368
3369
3370 /**
3371  * An announcement_signatures message to be sent or received from a peer
3372  */
3373 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3374    /**
3375     * A pointer to the opaque Rust object.
3376     * Nearly everywhere, inner must be non-null, however in places where
3377     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3378     */
3379    LDKnativeAnnouncementSignatures *inner;
3380    /**
3381     * Indicates that this is the only struct which contains the same pointer.
3382     * Rust functions which take ownership of an object provided via an argument require
3383     * this to be true and invalidate the object pointed to by inner.
3384     */
3385    bool is_owned;
3386 } LDKAnnouncementSignatures;
3387
3388
3389
3390 /**
3391  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3392  * transaction updates if they were pending.
3393  */
3394 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3395    /**
3396     * A pointer to the opaque Rust object.
3397     * Nearly everywhere, inner must be non-null, however in places where
3398     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3399     */
3400    LDKnativeCommitmentUpdate *inner;
3401    /**
3402     * Indicates that this is the only struct which contains the same pointer.
3403     * Rust functions which take ownership of an object provided via an argument require
3404     * this to be true and invalidate the object pointed to by inner.
3405     */
3406    bool is_owned;
3407 } LDKCommitmentUpdate;
3408
3409
3410
3411 /**
3412  * A revoke_and_ack message to be sent or received from a peer
3413  */
3414 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3415    /**
3416     * A pointer to the opaque Rust object.
3417     * Nearly everywhere, inner must be non-null, however in places where
3418     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3419     */
3420    LDKnativeRevokeAndACK *inner;
3421    /**
3422     * Indicates that this is the only struct which contains the same pointer.
3423     * Rust functions which take ownership of an object provided via an argument require
3424     * this to be true and invalidate the object pointed to by inner.
3425     */
3426    bool is_owned;
3427 } LDKRevokeAndACK;
3428
3429
3430
3431 /**
3432  * A closing_signed message to be sent or received from a peer
3433  */
3434 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3435    /**
3436     * A pointer to the opaque Rust object.
3437     * Nearly everywhere, inner must be non-null, however in places where
3438     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3439     */
3440    LDKnativeClosingSigned *inner;
3441    /**
3442     * Indicates that this is the only struct which contains the same pointer.
3443     * Rust functions which take ownership of an object provided via an argument require
3444     * this to be true and invalidate the object pointed to by inner.
3445     */
3446    bool is_owned;
3447 } LDKClosingSigned;
3448
3449
3450
3451 /**
3452  * A shutdown message to be sent or received from a peer
3453  */
3454 typedef struct MUST_USE_STRUCT LDKShutdown {
3455    /**
3456     * A pointer to the opaque Rust object.
3457     * Nearly everywhere, inner must be non-null, however in places where
3458     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3459     */
3460    LDKnativeShutdown *inner;
3461    /**
3462     * Indicates that this is the only struct which contains the same pointer.
3463     * Rust functions which take ownership of an object provided via an argument require
3464     * this to be true and invalidate the object pointed to by inner.
3465     */
3466    bool is_owned;
3467 } LDKShutdown;
3468
3469
3470
3471 /**
3472  * A channel_reestablish message to be sent or received from a peer
3473  */
3474 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3475    /**
3476     * A pointer to the opaque Rust object.
3477     * Nearly everywhere, inner must be non-null, however in places where
3478     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3479     */
3480    LDKnativeChannelReestablish *inner;
3481    /**
3482     * Indicates that this is the only struct which contains the same pointer.
3483     * Rust functions which take ownership of an object provided via an argument require
3484     * this to be true and invalidate the object pointed to by inner.
3485     */
3486    bool is_owned;
3487 } LDKChannelReestablish;
3488
3489
3490
3491 /**
3492  * A channel_announcement message to be sent or received from a peer
3493  */
3494 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3495    /**
3496     * A pointer to the opaque Rust object.
3497     * Nearly everywhere, inner must be non-null, however in places where
3498     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3499     */
3500    LDKnativeChannelAnnouncement *inner;
3501    /**
3502     * Indicates that this is the only struct which contains the same pointer.
3503     * Rust functions which take ownership of an object provided via an argument require
3504     * this to be true and invalidate the object pointed to by inner.
3505     */
3506    bool is_owned;
3507 } LDKChannelAnnouncement;
3508
3509
3510
3511 /**
3512  * A node_announcement message to be sent or received from a peer
3513  */
3514 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3515    /**
3516     * A pointer to the opaque Rust object.
3517     * Nearly everywhere, inner must be non-null, however in places where
3518     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3519     */
3520    LDKnativeNodeAnnouncement *inner;
3521    /**
3522     * Indicates that this is the only struct which contains the same pointer.
3523     * Rust functions which take ownership of an object provided via an argument require
3524     * this to be true and invalidate the object pointed to by inner.
3525     */
3526    bool is_owned;
3527 } LDKNodeAnnouncement;
3528
3529
3530
3531 /**
3532  * An error message to be sent or received from a peer
3533  */
3534 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3535    /**
3536     * A pointer to the opaque Rust object.
3537     * Nearly everywhere, inner must be non-null, however in places where
3538     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3539     */
3540    LDKnativeErrorMessage *inner;
3541    /**
3542     * Indicates that this is the only struct which contains the same pointer.
3543     * Rust functions which take ownership of an object provided via an argument require
3544     * this to be true and invalidate the object pointed to by inner.
3545     */
3546    bool is_owned;
3547 } LDKErrorMessage;
3548
3549
3550
3551 /**
3552  * A warning message to be sent or received from a peer
3553  */
3554 typedef struct MUST_USE_STRUCT LDKWarningMessage {
3555    /**
3556     * A pointer to the opaque Rust object.
3557     * Nearly everywhere, inner must be non-null, however in places where
3558     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3559     */
3560    LDKnativeWarningMessage *inner;
3561    /**
3562     * Indicates that this is the only struct which contains the same pointer.
3563     * Rust functions which take ownership of an object provided via an argument require
3564     * this to be true and invalidate the object pointed to by inner.
3565     */
3566    bool is_owned;
3567 } LDKWarningMessage;
3568
3569 /**
3570  * Used to put an error message in a LightningError
3571  */
3572 typedef enum LDKErrorAction_Tag {
3573    /**
3574     * The peer took some action which made us think they were useless. Disconnect them.
3575     */
3576    LDKErrorAction_DisconnectPeer,
3577    /**
3578     * The peer did something harmless that we weren't able to process, just log and ignore
3579     */
3580    LDKErrorAction_IgnoreError,
3581    /**
3582     * The peer did something harmless that we weren't able to meaningfully process.
3583     * If the error is logged, log it at the given level.
3584     */
3585    LDKErrorAction_IgnoreAndLog,
3586    /**
3587     * The peer provided us with a gossip message which we'd already seen. In most cases this
3588     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
3589     * our own channel announcements.
3590     */
3591    LDKErrorAction_IgnoreDuplicateGossip,
3592    /**
3593     * The peer did something incorrect. Tell them.
3594     */
3595    LDKErrorAction_SendErrorMessage,
3596    /**
3597     * The peer did something incorrect. Tell them without closing any channels.
3598     */
3599    LDKErrorAction_SendWarningMessage,
3600    /**
3601     * Must be last for serialization purposes
3602     */
3603    LDKErrorAction_Sentinel,
3604 } LDKErrorAction_Tag;
3605
3606 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3607    /**
3608     * An error message which we should make an effort to send before we disconnect.
3609     *
3610     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3611     */
3612    struct LDKErrorMessage msg;
3613 } LDKErrorAction_LDKDisconnectPeer_Body;
3614
3615 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3616    /**
3617     * The message to send.
3618     */
3619    struct LDKErrorMessage msg;
3620 } LDKErrorAction_LDKSendErrorMessage_Body;
3621
3622 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
3623    /**
3624     * The message to send.
3625     */
3626    struct LDKWarningMessage msg;
3627    /**
3628     * The peer may have done something harmless that we weren't able to meaningfully process,
3629     * though we should still tell them about it.
3630     * If this event is logged, log it at the given level.
3631     */
3632    enum LDKLevel log_level;
3633 } LDKErrorAction_LDKSendWarningMessage_Body;
3634
3635 typedef struct MUST_USE_STRUCT LDKErrorAction {
3636    LDKErrorAction_Tag tag;
3637    union {
3638       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3639       struct {
3640          enum LDKLevel ignore_and_log;
3641       };
3642       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3643       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
3644    };
3645 } LDKErrorAction;
3646
3647
3648
3649 /**
3650  * A query_channel_range message is used to query a peer for channel
3651  * UTXOs in a range of blocks. The recipient of a query makes a best
3652  * effort to reply to the query using one or more reply_channel_range
3653  * messages.
3654  */
3655 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3656    /**
3657     * A pointer to the opaque Rust object.
3658     * Nearly everywhere, inner must be non-null, however in places where
3659     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3660     */
3661    LDKnativeQueryChannelRange *inner;
3662    /**
3663     * Indicates that this is the only struct which contains the same pointer.
3664     * Rust functions which take ownership of an object provided via an argument require
3665     * this to be true and invalidate the object pointed to by inner.
3666     */
3667    bool is_owned;
3668 } LDKQueryChannelRange;
3669
3670
3671
3672 /**
3673  * A query_short_channel_ids message is used to query a peer for
3674  * routing gossip messages related to one or more short_channel_ids.
3675  * The query recipient will reply with the latest, if available,
3676  * channel_announcement, channel_update and node_announcement messages
3677  * it maintains for the requested short_channel_ids followed by a
3678  * reply_short_channel_ids_end message. The short_channel_ids sent in
3679  * this query are encoded. We only support encoding_type=0 uncompressed
3680  * serialization and do not support encoding_type=1 zlib serialization.
3681  */
3682 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3683    /**
3684     * A pointer to the opaque Rust object.
3685     * Nearly everywhere, inner must be non-null, however in places where
3686     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3687     */
3688    LDKnativeQueryShortChannelIds *inner;
3689    /**
3690     * Indicates that this is the only struct which contains the same pointer.
3691     * Rust functions which take ownership of an object provided via an argument require
3692     * this to be true and invalidate the object pointed to by inner.
3693     */
3694    bool is_owned;
3695 } LDKQueryShortChannelIds;
3696
3697
3698
3699 /**
3700  * A reply_channel_range message is a reply to a query_channel_range
3701  * message. Multiple reply_channel_range messages can be sent in reply
3702  * to a single query_channel_range message. The query recipient makes a
3703  * best effort to respond based on their local network view which may
3704  * not be a perfect view of the network. The short_channel_ids in the
3705  * reply are encoded. We only support encoding_type=0 uncompressed
3706  * serialization and do not support encoding_type=1 zlib serialization.
3707  */
3708 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3709    /**
3710     * A pointer to the opaque Rust object.
3711     * Nearly everywhere, inner must be non-null, however in places where
3712     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3713     */
3714    LDKnativeReplyChannelRange *inner;
3715    /**
3716     * Indicates that this is the only struct which contains the same pointer.
3717     * Rust functions which take ownership of an object provided via an argument require
3718     * this to be true and invalidate the object pointed to by inner.
3719     */
3720    bool is_owned;
3721 } LDKReplyChannelRange;
3722
3723 /**
3724  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3725  * broadcast to most peers).
3726  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3727  */
3728 typedef enum LDKMessageSendEvent_Tag {
3729    /**
3730     * Used to indicate that we've accepted a channel open and should send the accept_channel
3731     * message provided to the given peer.
3732     */
3733    LDKMessageSendEvent_SendAcceptChannel,
3734    /**
3735     * Used to indicate that we've initiated a channel open and should send the open_channel
3736     * message provided to the given peer.
3737     */
3738    LDKMessageSendEvent_SendOpenChannel,
3739    /**
3740     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3741     */
3742    LDKMessageSendEvent_SendFundingCreated,
3743    /**
3744     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3745     */
3746    LDKMessageSendEvent_SendFundingSigned,
3747    /**
3748     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3749     */
3750    LDKMessageSendEvent_SendFundingLocked,
3751    /**
3752     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3753     */
3754    LDKMessageSendEvent_SendAnnouncementSignatures,
3755    /**
3756     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3757     * message should be sent to the peer with the given node_id.
3758     */
3759    LDKMessageSendEvent_UpdateHTLCs,
3760    /**
3761     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3762     */
3763    LDKMessageSendEvent_SendRevokeAndACK,
3764    /**
3765     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3766     */
3767    LDKMessageSendEvent_SendClosingSigned,
3768    /**
3769     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3770     */
3771    LDKMessageSendEvent_SendShutdown,
3772    /**
3773     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3774     */
3775    LDKMessageSendEvent_SendChannelReestablish,
3776    /**
3777     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3778     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3779     *
3780     * Note that after doing so, you very likely (unless you did so very recently) want to call
3781     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3782     * This ensures that any nodes which see our channel_announcement also have a relevant
3783     * node_announcement, including relevant feature flags which may be important for routing
3784     * through or to us.
3785     */
3786    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3787    /**
3788     * Used to indicate that a node_announcement should be broadcast to all peers.
3789     */
3790    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3791    /**
3792     * Used to indicate that a channel_update should be broadcast to all peers.
3793     */
3794    LDKMessageSendEvent_BroadcastChannelUpdate,
3795    /**
3796     * Used to indicate that a channel_update should be sent to a single peer.
3797     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
3798     * private channel and we shouldn't be informing all of our peers of channel parameters.
3799     */
3800    LDKMessageSendEvent_SendChannelUpdate,
3801    /**
3802     * Broadcast an error downstream to be handled
3803     */
3804    LDKMessageSendEvent_HandleError,
3805    /**
3806     * Query a peer for channels with funding transaction UTXOs in a block range.
3807     */
3808    LDKMessageSendEvent_SendChannelRangeQuery,
3809    /**
3810     * Request routing gossip messages from a peer for a list of channels identified by
3811     * their short_channel_ids.
3812     */
3813    LDKMessageSendEvent_SendShortIdsQuery,
3814    /**
3815     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3816     * emitted during processing of the query.
3817     */
3818    LDKMessageSendEvent_SendReplyChannelRange,
3819    /**
3820     * Must be last for serialization purposes
3821     */
3822    LDKMessageSendEvent_Sentinel,
3823 } LDKMessageSendEvent_Tag;
3824
3825 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3826    /**
3827     * The node_id of the node which should receive this message
3828     */
3829    struct LDKPublicKey node_id;
3830    /**
3831     * The message which should be sent.
3832     */
3833    struct LDKAcceptChannel msg;
3834 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3835
3836 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3837    /**
3838     * The node_id of the node which should receive this message
3839     */
3840    struct LDKPublicKey node_id;
3841    /**
3842     * The message which should be sent.
3843     */
3844    struct LDKOpenChannel msg;
3845 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3846
3847 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3848    /**
3849     * The node_id of the node which should receive this message
3850     */
3851    struct LDKPublicKey node_id;
3852    /**
3853     * The message which should be sent.
3854     */
3855    struct LDKFundingCreated msg;
3856 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3857
3858 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3859    /**
3860     * The node_id of the node which should receive this message
3861     */
3862    struct LDKPublicKey node_id;
3863    /**
3864     * The message which should be sent.
3865     */
3866    struct LDKFundingSigned msg;
3867 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3868
3869 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3870    /**
3871     * The node_id of the node which should receive these message(s)
3872     */
3873    struct LDKPublicKey node_id;
3874    /**
3875     * The funding_locked message which should be sent.
3876     */
3877    struct LDKFundingLocked msg;
3878 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
3879
3880 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3881    /**
3882     * The node_id of the node which should receive these message(s)
3883     */
3884    struct LDKPublicKey node_id;
3885    /**
3886     * The announcement_signatures message which should be sent.
3887     */
3888    struct LDKAnnouncementSignatures msg;
3889 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3890
3891 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3892    /**
3893     * The node_id of the node which should receive these message(s)
3894     */
3895    struct LDKPublicKey node_id;
3896    /**
3897     * The update messages which should be sent. ALL messages in the struct should be sent!
3898     */
3899    struct LDKCommitmentUpdate updates;
3900 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3901
3902 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3903    /**
3904     * The node_id of the node which should receive this message
3905     */
3906    struct LDKPublicKey node_id;
3907    /**
3908     * The message which should be sent.
3909     */
3910    struct LDKRevokeAndACK msg;
3911 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3912
3913 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3914    /**
3915     * The node_id of the node which should receive this message
3916     */
3917    struct LDKPublicKey node_id;
3918    /**
3919     * The message which should be sent.
3920     */
3921    struct LDKClosingSigned msg;
3922 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3923
3924 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3925    /**
3926     * The node_id of the node which should receive this message
3927     */
3928    struct LDKPublicKey node_id;
3929    /**
3930     * The message which should be sent.
3931     */
3932    struct LDKShutdown msg;
3933 } LDKMessageSendEvent_LDKSendShutdown_Body;
3934
3935 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
3936    /**
3937     * The node_id of the node which should receive this message
3938     */
3939    struct LDKPublicKey node_id;
3940    /**
3941     * The message which should be sent.
3942     */
3943    struct LDKChannelReestablish msg;
3944 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
3945
3946 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
3947    /**
3948     * The channel_announcement which should be sent.
3949     */
3950    struct LDKChannelAnnouncement msg;
3951    /**
3952     * The followup channel_update which should be sent.
3953     */
3954    struct LDKChannelUpdate update_msg;
3955 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
3956
3957 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
3958    /**
3959     * The node_announcement which should be sent.
3960     */
3961    struct LDKNodeAnnouncement msg;
3962 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
3963
3964 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
3965    /**
3966     * The channel_update which should be sent.
3967     */
3968    struct LDKChannelUpdate msg;
3969 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
3970
3971 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
3972    /**
3973     * The node_id of the node which should receive this message
3974     */
3975    struct LDKPublicKey node_id;
3976    /**
3977     * The channel_update which should be sent.
3978     */
3979    struct LDKChannelUpdate msg;
3980 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
3981
3982 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
3983    /**
3984     * The node_id of the node which should receive this message
3985     */
3986    struct LDKPublicKey node_id;
3987    /**
3988     * The action which should be taken.
3989     */
3990    struct LDKErrorAction action;
3991 } LDKMessageSendEvent_LDKHandleError_Body;
3992
3993 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
3994    /**
3995     * The node_id of this message recipient
3996     */
3997    struct LDKPublicKey node_id;
3998    /**
3999     * The query_channel_range which should be sent.
4000     */
4001    struct LDKQueryChannelRange msg;
4002 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4003
4004 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4005    /**
4006     * The node_id of this message recipient
4007     */
4008    struct LDKPublicKey node_id;
4009    /**
4010     * The query_short_channel_ids which should be sent.
4011     */
4012    struct LDKQueryShortChannelIds msg;
4013 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4014
4015 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4016    /**
4017     * The node_id of this message recipient
4018     */
4019    struct LDKPublicKey node_id;
4020    /**
4021     * The reply_channel_range which should be sent.
4022     */
4023    struct LDKReplyChannelRange msg;
4024 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4025
4026 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4027    LDKMessageSendEvent_Tag tag;
4028    union {
4029       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4030       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4031       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4032       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4033       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
4034       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4035       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4036       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4037       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4038       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4039       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4040       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4041       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4042       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4043       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4044       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4045       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4046       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4047       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4048    };
4049 } LDKMessageSendEvent;
4050
4051 /**
4052  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4053  * This corresponds to std::vector in C++
4054  */
4055 typedef struct LDKCVec_MessageSendEventZ {
4056    /**
4057     * The elements in the array.
4058     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4059     */
4060    struct LDKMessageSendEvent *data;
4061    /**
4062     * The number of elements pointed to by `data`.
4063     */
4064    uintptr_t datalen;
4065 } LDKCVec_MessageSendEventZ;
4066
4067
4068
4069 /**
4070  * [`Score`] implementation that uses a fixed penalty.
4071  */
4072 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
4073    /**
4074     * A pointer to the opaque Rust object.
4075     * Nearly everywhere, inner must be non-null, however in places where
4076     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4077     */
4078    LDKnativeFixedPenaltyScorer *inner;
4079    /**
4080     * Indicates that this is the only struct which contains the same pointer.
4081     * Rust functions which take ownership of an object provided via an argument require
4082     * this to be true and invalidate the object pointed to by inner.
4083     */
4084    bool is_owned;
4085 } LDKFixedPenaltyScorer;
4086
4087 /**
4088  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4089  */
4090 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
4091    /**
4092     * A pointer to the contents in the success state.
4093     * Reading from this pointer when `result_ok` is not set is undefined.
4094     */
4095    struct LDKFixedPenaltyScorer *result;
4096    /**
4097     * A pointer to the contents in the error state.
4098     * Reading from this pointer when `result_ok` is set is undefined.
4099     */
4100    struct LDKDecodeError *err;
4101 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
4102
4103 /**
4104  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4105  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4106  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4107  */
4108 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
4109    /**
4110     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4111     * `err` or `result` depending on the state of `result_ok`.
4112     */
4113    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
4114    /**
4115     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4116     */
4117    bool result_ok;
4118 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
4119
4120
4121
4122 /**
4123  * Parameters for configuring [`Scorer`].
4124  */
4125 typedef struct MUST_USE_STRUCT LDKScoringParameters {
4126    /**
4127     * A pointer to the opaque Rust object.
4128     * Nearly everywhere, inner must be non-null, however in places where
4129     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4130     */
4131    LDKnativeScoringParameters *inner;
4132    /**
4133     * Indicates that this is the only struct which contains the same pointer.
4134     * Rust functions which take ownership of an object provided via an argument require
4135     * this to be true and invalidate the object pointed to by inner.
4136     */
4137    bool is_owned;
4138 } LDKScoringParameters;
4139
4140 /**
4141  * The contents of CResult_ScoringParametersDecodeErrorZ
4142  */
4143 typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
4144    /**
4145     * A pointer to the contents in the success state.
4146     * Reading from this pointer when `result_ok` is not set is undefined.
4147     */
4148    struct LDKScoringParameters *result;
4149    /**
4150     * A pointer to the contents in the error state.
4151     * Reading from this pointer when `result_ok` is set is undefined.
4152     */
4153    struct LDKDecodeError *err;
4154 } LDKCResult_ScoringParametersDecodeErrorZPtr;
4155
4156 /**
4157  * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
4158  * containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4159  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4160  */
4161 typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
4162    /**
4163     * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
4164     * `err` or `result` depending on the state of `result_ok`.
4165     */
4166    union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
4167    /**
4168     * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
4169     */
4170    bool result_ok;
4171 } LDKCResult_ScoringParametersDecodeErrorZ;
4172
4173
4174
4175 /**
4176  * [`Score`] implementation that provides reasonable default behavior.
4177  *
4178  * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
4179  * slightly higher fees are available. Will further penalize channels that fail to relay payments.
4180  *
4181  * See [module-level documentation] for usage and [`ScoringParameters`] for customization.
4182  *
4183  * # Note
4184  *
4185  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4186  * behavior.
4187  *
4188  * [module-level documentation]: crate::routing::scoring
4189  */
4190 typedef struct MUST_USE_STRUCT LDKScorer {
4191    /**
4192     * A pointer to the opaque Rust object.
4193     * Nearly everywhere, inner must be non-null, however in places where
4194     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4195     */
4196    LDKnativeScorer *inner;
4197    /**
4198     * Indicates that this is the only struct which contains the same pointer.
4199     * Rust functions which take ownership of an object provided via an argument require
4200     * this to be true and invalidate the object pointed to by inner.
4201     */
4202    bool is_owned;
4203 } LDKScorer;
4204
4205 /**
4206  * The contents of CResult_ScorerDecodeErrorZ
4207  */
4208 typedef union LDKCResult_ScorerDecodeErrorZPtr {
4209    /**
4210     * A pointer to the contents in the success state.
4211     * Reading from this pointer when `result_ok` is not set is undefined.
4212     */
4213    struct LDKScorer *result;
4214    /**
4215     * A pointer to the contents in the error state.
4216     * Reading from this pointer when `result_ok` is set is undefined.
4217     */
4218    struct LDKDecodeError *err;
4219 } LDKCResult_ScorerDecodeErrorZPtr;
4220
4221 /**
4222  * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
4223  * containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4224  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4225  */
4226 typedef struct LDKCResult_ScorerDecodeErrorZ {
4227    /**
4228     * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
4229     * `err` or `result` depending on the state of `result_ok`.
4230     */
4231    union LDKCResult_ScorerDecodeErrorZPtr contents;
4232    /**
4233     * Whether this CResult_ScorerDecodeErrorZ represents a success state.
4234     */
4235    bool result_ok;
4236 } LDKCResult_ScorerDecodeErrorZ;
4237
4238
4239
4240 /**
4241  * Parameters for configuring [`ProbabilisticScorer`].
4242  */
4243 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
4244    /**
4245     * A pointer to the opaque Rust object.
4246     * Nearly everywhere, inner must be non-null, however in places where
4247     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4248     */
4249    LDKnativeProbabilisticScoringParameters *inner;
4250    /**
4251     * Indicates that this is the only struct which contains the same pointer.
4252     * Rust functions which take ownership of an object provided via an argument require
4253     * this to be true and invalidate the object pointed to by inner.
4254     */
4255    bool is_owned;
4256 } LDKProbabilisticScoringParameters;
4257
4258 /**
4259  * The contents of CResult_ProbabilisticScoringParametersDecodeErrorZ
4260  */
4261 typedef union LDKCResult_ProbabilisticScoringParametersDecodeErrorZPtr {
4262    /**
4263     * A pointer to the contents in the success state.
4264     * Reading from this pointer when `result_ok` is not set is undefined.
4265     */
4266    struct LDKProbabilisticScoringParameters *result;
4267    /**
4268     * A pointer to the contents in the error state.
4269     * Reading from this pointer when `result_ok` is set is undefined.
4270     */
4271    struct LDKDecodeError *err;
4272 } LDKCResult_ProbabilisticScoringParametersDecodeErrorZPtr;
4273
4274 /**
4275  * A CResult_ProbabilisticScoringParametersDecodeErrorZ represents the result of a fallible operation,
4276  * containing a crate::lightning::routing::scoring::ProbabilisticScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4277  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4278  */
4279 typedef struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ {
4280    /**
4281     * The contents of this CResult_ProbabilisticScoringParametersDecodeErrorZ, accessible via either
4282     * `err` or `result` depending on the state of `result_ok`.
4283     */
4284    union LDKCResult_ProbabilisticScoringParametersDecodeErrorZPtr contents;
4285    /**
4286     * Whether this CResult_ProbabilisticScoringParametersDecodeErrorZ represents a success state.
4287     */
4288    bool result_ok;
4289 } LDKCResult_ProbabilisticScoringParametersDecodeErrorZ;
4290
4291
4292
4293 /**
4294  * Features used within an `init` message.
4295  */
4296 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4297    /**
4298     * A pointer to the opaque Rust object.
4299     * Nearly everywhere, inner must be non-null, however in places where
4300     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4301     */
4302    LDKnativeInitFeatures *inner;
4303    /**
4304     * Indicates that this is the only struct which contains the same pointer.
4305     * Rust functions which take ownership of an object provided via an argument require
4306     * this to be true and invalidate the object pointed to by inner.
4307     */
4308    bool is_owned;
4309 } LDKInitFeatures;
4310
4311 /**
4312  * The contents of CResult_InitFeaturesDecodeErrorZ
4313  */
4314 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4315    /**
4316     * A pointer to the contents in the success state.
4317     * Reading from this pointer when `result_ok` is not set is undefined.
4318     */
4319    struct LDKInitFeatures *result;
4320    /**
4321     * A pointer to the contents in the error state.
4322     * Reading from this pointer when `result_ok` is set is undefined.
4323     */
4324    struct LDKDecodeError *err;
4325 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4326
4327 /**
4328  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4329  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4330  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4331  */
4332 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4333    /**
4334     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4335     * `err` or `result` depending on the state of `result_ok`.
4336     */
4337    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4338    /**
4339     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4340     */
4341    bool result_ok;
4342 } LDKCResult_InitFeaturesDecodeErrorZ;
4343
4344
4345
4346 /**
4347  * Features used within a `channel_announcement` message.
4348  */
4349 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4350    /**
4351     * A pointer to the opaque Rust object.
4352     * Nearly everywhere, inner must be non-null, however in places where
4353     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4354     */
4355    LDKnativeChannelFeatures *inner;
4356    /**
4357     * Indicates that this is the only struct which contains the same pointer.
4358     * Rust functions which take ownership of an object provided via an argument require
4359     * this to be true and invalidate the object pointed to by inner.
4360     */
4361    bool is_owned;
4362 } LDKChannelFeatures;
4363
4364 /**
4365  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4366  */
4367 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4368    /**
4369     * A pointer to the contents in the success state.
4370     * Reading from this pointer when `result_ok` is not set is undefined.
4371     */
4372    struct LDKChannelFeatures *result;
4373    /**
4374     * A pointer to the contents in the error state.
4375     * Reading from this pointer when `result_ok` is set is undefined.
4376     */
4377    struct LDKDecodeError *err;
4378 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4379
4380 /**
4381  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4382  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4383  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4384  */
4385 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4386    /**
4387     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4388     * `err` or `result` depending on the state of `result_ok`.
4389     */
4390    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4391    /**
4392     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4393     */
4394    bool result_ok;
4395 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4396
4397
4398
4399 /**
4400  * Features used within a `node_announcement` message.
4401  */
4402 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4403    /**
4404     * A pointer to the opaque Rust object.
4405     * Nearly everywhere, inner must be non-null, however in places where
4406     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4407     */
4408    LDKnativeNodeFeatures *inner;
4409    /**
4410     * Indicates that this is the only struct which contains the same pointer.
4411     * Rust functions which take ownership of an object provided via an argument require
4412     * this to be true and invalidate the object pointed to by inner.
4413     */
4414    bool is_owned;
4415 } LDKNodeFeatures;
4416
4417 /**
4418  * The contents of CResult_NodeFeaturesDecodeErrorZ
4419  */
4420 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4421    /**
4422     * A pointer to the contents in the success state.
4423     * Reading from this pointer when `result_ok` is not set is undefined.
4424     */
4425    struct LDKNodeFeatures *result;
4426    /**
4427     * A pointer to the contents in the error state.
4428     * Reading from this pointer when `result_ok` is set is undefined.
4429     */
4430    struct LDKDecodeError *err;
4431 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4432
4433 /**
4434  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4435  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4436  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4437  */
4438 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4439    /**
4440     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4441     * `err` or `result` depending on the state of `result_ok`.
4442     */
4443    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4444    /**
4445     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4446     */
4447    bool result_ok;
4448 } LDKCResult_NodeFeaturesDecodeErrorZ;
4449
4450
4451
4452 /**
4453  * Features used within an invoice.
4454  */
4455 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4456    /**
4457     * A pointer to the opaque Rust object.
4458     * Nearly everywhere, inner must be non-null, however in places where
4459     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4460     */
4461    LDKnativeInvoiceFeatures *inner;
4462    /**
4463     * Indicates that this is the only struct which contains the same pointer.
4464     * Rust functions which take ownership of an object provided via an argument require
4465     * this to be true and invalidate the object pointed to by inner.
4466     */
4467    bool is_owned;
4468 } LDKInvoiceFeatures;
4469
4470 /**
4471  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4472  */
4473 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4474    /**
4475     * A pointer to the contents in the success state.
4476     * Reading from this pointer when `result_ok` is not set is undefined.
4477     */
4478    struct LDKInvoiceFeatures *result;
4479    /**
4480     * A pointer to the contents in the error state.
4481     * Reading from this pointer when `result_ok` is set is undefined.
4482     */
4483    struct LDKDecodeError *err;
4484 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4485
4486 /**
4487  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4488  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4489  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4490  */
4491 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4492    /**
4493     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4494     * `err` or `result` depending on the state of `result_ok`.
4495     */
4496    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4497    /**
4498     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4499     */
4500    bool result_ok;
4501 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4502
4503
4504
4505 /**
4506  * Features used within the channel_type field in an OpenChannel message.
4507  *
4508  * A channel is always of some known \"type\", describing the transaction formats used and the exact
4509  * semantics of our interaction with our peer.
4510  *
4511  * Note that because a channel is a specific type which is proposed by the opener and accepted by
4512  * the counterparty, only required features are allowed here.
4513  *
4514  * This is serialized differently from other feature types - it is not prefixed by a length, and
4515  * thus must only appear inside a TLV where its length is known in advance.
4516  */
4517 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
4518    /**
4519     * A pointer to the opaque Rust object.
4520     * Nearly everywhere, inner must be non-null, however in places where
4521     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4522     */
4523    LDKnativeChannelTypeFeatures *inner;
4524    /**
4525     * Indicates that this is the only struct which contains the same pointer.
4526     * Rust functions which take ownership of an object provided via an argument require
4527     * this to be true and invalidate the object pointed to by inner.
4528     */
4529    bool is_owned;
4530 } LDKChannelTypeFeatures;
4531
4532 /**
4533  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4534  */
4535 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
4536    /**
4537     * A pointer to the contents in the success state.
4538     * Reading from this pointer when `result_ok` is not set is undefined.
4539     */
4540    struct LDKChannelTypeFeatures *result;
4541    /**
4542     * A pointer to the contents in the error state.
4543     * Reading from this pointer when `result_ok` is set is undefined.
4544     */
4545    struct LDKDecodeError *err;
4546 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
4547
4548 /**
4549  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4550  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4551  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4552  */
4553 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
4554    /**
4555     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4556     * `err` or `result` depending on the state of `result_ok`.
4557     */
4558    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
4559    /**
4560     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4561     */
4562    bool result_ok;
4563 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
4564
4565 /**
4566  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4567  */
4568 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4569    /**
4570     * A pointer to the contents in the success state.
4571     * Reading from this pointer when `result_ok` is not set is undefined.
4572     */
4573    struct LDKDelayedPaymentOutputDescriptor *result;
4574    /**
4575     * A pointer to the contents in the error state.
4576     * Reading from this pointer when `result_ok` is set is undefined.
4577     */
4578    struct LDKDecodeError *err;
4579 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
4580
4581 /**
4582  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4583  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4584  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4585  */
4586 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4587    /**
4588     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4589     * `err` or `result` depending on the state of `result_ok`.
4590     */
4591    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
4592    /**
4593     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4594     */
4595    bool result_ok;
4596 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
4597
4598 /**
4599  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4600  */
4601 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4602    /**
4603     * A pointer to the contents in the success state.
4604     * Reading from this pointer when `result_ok` is not set is undefined.
4605     */
4606    struct LDKStaticPaymentOutputDescriptor *result;
4607    /**
4608     * A pointer to the contents in the error state.
4609     * Reading from this pointer when `result_ok` is set is undefined.
4610     */
4611    struct LDKDecodeError *err;
4612 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
4613
4614 /**
4615  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4616  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4617  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4618  */
4619 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4620    /**
4621     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4622     * `err` or `result` depending on the state of `result_ok`.
4623     */
4624    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
4625    /**
4626     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4627     */
4628    bool result_ok;
4629 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
4630
4631 /**
4632  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4633  */
4634 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
4635    /**
4636     * A pointer to the contents in the success state.
4637     * Reading from this pointer when `result_ok` is not set is undefined.
4638     */
4639    struct LDKSpendableOutputDescriptor *result;
4640    /**
4641     * A pointer to the contents in the error state.
4642     * Reading from this pointer when `result_ok` is set is undefined.
4643     */
4644    struct LDKDecodeError *err;
4645 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
4646
4647 /**
4648  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4649  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4650  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4651  */
4652 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
4653    /**
4654     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4655     * `err` or `result` depending on the state of `result_ok`.
4656     */
4657    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
4658    /**
4659     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4660     */
4661    bool result_ok;
4662 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
4663
4664 /**
4665  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4666  * This corresponds to std::vector in C++
4667  */
4668 typedef struct LDKCVec_PaymentPreimageZ {
4669    /**
4670     * The elements in the array.
4671     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4672     */
4673    struct LDKThirtyTwoBytes *data;
4674    /**
4675     * The number of elements pointed to by `data`.
4676     */
4677    uintptr_t datalen;
4678 } LDKCVec_PaymentPreimageZ;
4679
4680 /**
4681  * A tuple of 2 elements. See the individual fields for the types contained.
4682  */
4683 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
4684    /**
4685     * The element at position 0
4686     */
4687    struct LDKSignature a;
4688    /**
4689     * The element at position 1
4690     */
4691    struct LDKCVec_SignatureZ b;
4692 } LDKC2Tuple_SignatureCVec_SignatureZZ;
4693
4694 /**
4695  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4696  */
4697 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
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 LDKC2Tuple_SignatureCVec_SignatureZZ *result;
4703    /**
4704     * Note that this value is always NULL, as there are no contents in the Err variant
4705     */
4706    void *err;
4707 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
4708
4709 /**
4710  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4711  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4712  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4713  */
4714 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4715    /**
4716     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4717     * `err` or `result` depending on the state of `result_ok`.
4718     */
4719    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
4720    /**
4721     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4722     */
4723    bool result_ok;
4724 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
4725
4726 /**
4727  * The contents of CResult_SignatureNoneZ
4728  */
4729 typedef union LDKCResult_SignatureNoneZPtr {
4730    /**
4731     * A pointer to the contents in the success state.
4732     * Reading from this pointer when `result_ok` is not set is undefined.
4733     */
4734    struct LDKSignature *result;
4735    /**
4736     * Note that this value is always NULL, as there are no contents in the Err variant
4737     */
4738    void *err;
4739 } LDKCResult_SignatureNoneZPtr;
4740
4741 /**
4742  * A CResult_SignatureNoneZ represents the result of a fallible operation,
4743  * containing a crate::c_types::Signature on success and a () on failure.
4744  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4745  */
4746 typedef struct LDKCResult_SignatureNoneZ {
4747    /**
4748     * The contents of this CResult_SignatureNoneZ, accessible via either
4749     * `err` or `result` depending on the state of `result_ok`.
4750     */
4751    union LDKCResult_SignatureNoneZPtr contents;
4752    /**
4753     * Whether this CResult_SignatureNoneZ represents a success state.
4754     */
4755    bool result_ok;
4756 } LDKCResult_SignatureNoneZ;
4757
4758 /**
4759  * A tuple of 2 elements. See the individual fields for the types contained.
4760  */
4761 typedef struct LDKC2Tuple_SignatureSignatureZ {
4762    /**
4763     * The element at position 0
4764     */
4765    struct LDKSignature a;
4766    /**
4767     * The element at position 1
4768     */
4769    struct LDKSignature b;
4770 } LDKC2Tuple_SignatureSignatureZ;
4771
4772 /**
4773  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
4774  */
4775 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
4776    /**
4777     * A pointer to the contents in the success state.
4778     * Reading from this pointer when `result_ok` is not set is undefined.
4779     */
4780    struct LDKC2Tuple_SignatureSignatureZ *result;
4781    /**
4782     * Note that this value is always NULL, as there are no contents in the Err variant
4783     */
4784    void *err;
4785 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
4786
4787 /**
4788  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
4789  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
4790  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4791  */
4792 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
4793    /**
4794     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
4795     * `err` or `result` depending on the state of `result_ok`.
4796     */
4797    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
4798    /**
4799     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
4800     */
4801    bool result_ok;
4802 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
4803
4804 /**
4805  * The contents of CResult_SecretKeyNoneZ
4806  */
4807 typedef union LDKCResult_SecretKeyNoneZPtr {
4808    /**
4809     * A pointer to the contents in the success state.
4810     * Reading from this pointer when `result_ok` is not set is undefined.
4811     */
4812    struct LDKSecretKey *result;
4813    /**
4814     * Note that this value is always NULL, as there are no contents in the Err variant
4815     */
4816    void *err;
4817 } LDKCResult_SecretKeyNoneZPtr;
4818
4819 /**
4820  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
4821  * containing a crate::c_types::SecretKey on success and a () on failure.
4822  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4823  */
4824 typedef struct LDKCResult_SecretKeyNoneZ {
4825    /**
4826     * The contents of this CResult_SecretKeyNoneZ, accessible via either
4827     * `err` or `result` depending on the state of `result_ok`.
4828     */
4829    union LDKCResult_SecretKeyNoneZPtr contents;
4830    /**
4831     * Whether this CResult_SecretKeyNoneZ represents a success state.
4832     */
4833    bool result_ok;
4834 } LDKCResult_SecretKeyNoneZ;
4835
4836
4837
4838 /**
4839  * This class tracks the per-transaction information needed to build a closing transaction and will
4840  * actually build it and sign.
4841  *
4842  * This class can be used inside a signer implementation to generate a signature given the relevant
4843  * secret key.
4844  */
4845 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
4846    /**
4847     * A pointer to the opaque Rust object.
4848     * Nearly everywhere, inner must be non-null, however in places where
4849     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4850     */
4851    LDKnativeClosingTransaction *inner;
4852    /**
4853     * Indicates that this is the only struct which contains the same pointer.
4854     * Rust functions which take ownership of an object provided via an argument require
4855     * this to be true and invalidate the object pointed to by inner.
4856     */
4857    bool is_owned;
4858 } LDKClosingTransaction;
4859
4860
4861
4862 /**
4863  * The unsigned part of a channel_announcement
4864  */
4865 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
4866    /**
4867     * A pointer to the opaque Rust object.
4868     * Nearly everywhere, inner must be non-null, however in places where
4869     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4870     */
4871    LDKnativeUnsignedChannelAnnouncement *inner;
4872    /**
4873     * Indicates that this is the only struct which contains the same pointer.
4874     * Rust functions which take ownership of an object provided via an argument require
4875     * this to be true and invalidate the object pointed to by inner.
4876     */
4877    bool is_owned;
4878 } LDKUnsignedChannelAnnouncement;
4879
4880 /**
4881  * A trait to sign lightning channel transactions as described in BOLT 3.
4882  *
4883  * Signing services could be implemented on a hardware wallet. In this case,
4884  * the current Sign would be a front-end on top of a communication
4885  * channel connected to your secure device and lightning key material wouldn't
4886  * reside on a hot server. Nevertheless, a this deployment would still need
4887  * to trust the ChannelManager to avoid loss of funds as this latest component
4888  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
4889  *
4890  * A more secure iteration would be to use hashlock (or payment points) to pair
4891  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
4892  * at the price of more state and computation on the hardware wallet side. In the future,
4893  * we are looking forward to design such interface.
4894  *
4895  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
4896  * to act, as liveness and breach reply correctness are always going to be hard requirements
4897  * of LN security model, orthogonal of key management issues.
4898  */
4899 typedef struct LDKBaseSign {
4900    /**
4901     * An opaque pointer which is passed to your function implementations as an argument.
4902     * This has no meaning in the LDK, and can be NULL or any other value.
4903     */
4904    void *this_arg;
4905    /**
4906     * Gets the per-commitment point for a specific commitment number
4907     *
4908     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
4909     */
4910    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
4911    /**
4912     * Gets the commitment secret for a specific commitment number as part of the revocation process
4913     *
4914     * An external signer implementation should error here if the commitment was already signed
4915     * and should refuse to sign it in the future.
4916     *
4917     * May be called more than once for the same index.
4918     *
4919     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
4920     */
4921    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
4922    /**
4923     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
4924     *
4925     * This is required in order for the signer to make sure that releasing a commitment
4926     * secret won't leave us without a broadcastable holder transaction.
4927     * Policy checks should be implemented in this function, including checking the amount
4928     * sent to us and checking the HTLCs.
4929     *
4930     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
4931     * A validating signer should ensure that an HTLC output is removed only when the matching
4932     * preimage is provided, or when the value to holder is restored.
4933     *
4934     * NOTE: all the relevant preimages will be provided, but there may also be additional
4935     * irrelevant or duplicate preimages.
4936     */
4937    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
4938    /**
4939     * Gets the holder's channel public keys and basepoints
4940     */
4941    struct LDKChannelPublicKeys pubkeys;
4942    /**
4943     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
4944     * Note that this takes a pointer to this object, not the this_ptr like other methods do
4945     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
4946     */
4947    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
4948    /**
4949     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
4950     * some SpendableOutputDescriptor types. This should be sufficient to identify this
4951     * Sign object uniquely and lookup or re-derive its keys.
4952     */
4953    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
4954    /**
4955     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
4956     *
4957     * Note that if signing fails or is rejected, the channel will be force-closed.
4958     *
4959     * Policy checks should be implemented in this function, including checking the amount
4960     * sent to us and checking the HTLCs.
4961     *
4962     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
4963     * A validating signer should ensure that an HTLC output is removed only when the matching
4964     * preimage is provided, or when the value to holder is restored.
4965     *
4966     * NOTE: all the relevant preimages will be provided, but there may also be additional
4967     * irrelevant or duplicate preimages.
4968     */
4969    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
4970    /**
4971     * Validate the counterparty's revocation.
4972     *
4973     * This is required in order for the signer to make sure that the state has moved
4974     * forward and it is safe to sign the next counterparty commitment.
4975     */
4976    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
4977    /**
4978     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
4979     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
4980     * latest commitment_tx when we initiate a force-close.
4981     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
4982     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
4983     * the latest.
4984     * This may be called multiple times for the same transaction.
4985     *
4986     * An external signer implementation should check that the commitment has not been revoked.
4987     *
4988     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
4989     */
4990    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
4991    /**
4992     * Create a signature for the given input in a transaction spending an HTLC transaction output
4993     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
4994     *
4995     * A justice transaction may claim multiple outputs at the same time if timelocks are
4996     * similar, but only a signature for the input at index `input` should be signed for here.
4997     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
4998     * to an upcoming timelock expiration.
4999     *
5000     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5001     *
5002     * per_commitment_key is revocation secret which was provided by our counterparty when they
5003     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
5004     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
5005     * so).
5006     */
5007    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]);
5008    /**
5009     * Create a signature for the given input in a transaction spending a commitment transaction
5010     * HTLC output when our counterparty broadcasts an old state.
5011     *
5012     * A justice transaction may claim multiple outputs at the same time if timelocks are
5013     * similar, but only a signature for the input at index `input` should be signed for here.
5014     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
5015     * to an upcoming timelock expiration.
5016     *
5017     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5018     *
5019     * per_commitment_key is revocation secret which was provided by our counterparty when they
5020     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
5021     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
5022     * so).
5023     *
5024     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
5025     * (which is committed to in the BIP 143 signatures).
5026     */
5027    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);
5028    /**
5029     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
5030     * transaction, either offered or received.
5031     *
5032     * Such a transaction may claim multiples offered outputs at same time if we know the
5033     * preimage for each when we create it, but only the input at index `input` should be
5034     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
5035     * needed with regards to an upcoming timelock expiration.
5036     *
5037     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
5038     * outputs.
5039     *
5040     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5041     *
5042     * Per_commitment_point is the dynamic point corresponding to the channel state
5043     * detected onchain. It has been generated by our counterparty and is used to derive
5044     * channel state keys, which are then included in the witness script and committed to in the
5045     * BIP 143 signature.
5046     */
5047    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);
5048    /**
5049     * Create a signature for a (proposed) closing transaction.
5050     *
5051     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
5052     * chosen to forgo their output as dust.
5053     */
5054    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
5055    /**
5056     * Signs a channel announcement message with our funding key and our node secret key (aka
5057     * node_id or network_key), proving it comes from one of the channel participants.
5058     *
5059     * The first returned signature should be from our node secret key, the second from our
5060     * funding key.
5061     *
5062     * Note that if this fails or is rejected, the channel will not be publicly announced and
5063     * our counterparty may (though likely will not) close the channel on us for violating the
5064     * protocol.
5065     */
5066    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
5067    /**
5068     * Set the counterparty static channel data, including basepoints,
5069     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
5070     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
5071     * they MUST NOT be allowed to change to different values once set.
5072     *
5073     * channel_parameters.is_populated() MUST be true.
5074     *
5075     * We bind holder_selected_contest_delay late here for API convenience.
5076     *
5077     * Will be called before any signatures are applied.
5078     */
5079    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
5080    /**
5081     * Frees any resources associated with this object given its this_arg pointer.
5082     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5083     */
5084    void (*free)(void *this_arg);
5085 } LDKBaseSign;
5086
5087 /**
5088  * A cloneable signer.
5089  *
5090  * Although we require signers to be cloneable, it may be useful for developers to be able to use
5091  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
5092  * which implies Sized, into this derived trait.
5093  */
5094 typedef struct LDKSign {
5095    /**
5096     * An opaque pointer which is passed to your function implementations as an argument.
5097     * This has no meaning in the LDK, and can be NULL or any other value.
5098     */
5099    void *this_arg;
5100    /**
5101     * Implementation of BaseSign for this object.
5102     */
5103    struct LDKBaseSign BaseSign;
5104    /**
5105     * Serialize the object into a byte array
5106     */
5107    struct LDKCVec_u8Z (*write)(const void *this_arg);
5108    /**
5109     * Called, if set, after this Sign has been cloned into a duplicate object.
5110     * The new Sign is provided, and should be mutated as needed to perform a
5111     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
5112     */
5113    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
5114    /**
5115     * Frees any resources associated with this object given its this_arg pointer.
5116     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5117     */
5118    void (*free)(void *this_arg);
5119 } LDKSign;
5120
5121 /**
5122  * The contents of CResult_SignDecodeErrorZ
5123  */
5124 typedef union LDKCResult_SignDecodeErrorZPtr {
5125    /**
5126     * A pointer to the contents in the success state.
5127     * Reading from this pointer when `result_ok` is not set is undefined.
5128     */
5129    struct LDKSign *result;
5130    /**
5131     * A pointer to the contents in the error state.
5132     * Reading from this pointer when `result_ok` is set is undefined.
5133     */
5134    struct LDKDecodeError *err;
5135 } LDKCResult_SignDecodeErrorZPtr;
5136
5137 /**
5138  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5139  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5140  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5141  */
5142 typedef struct LDKCResult_SignDecodeErrorZ {
5143    /**
5144     * The contents of this CResult_SignDecodeErrorZ, accessible via either
5145     * `err` or `result` depending on the state of `result_ok`.
5146     */
5147    union LDKCResult_SignDecodeErrorZPtr contents;
5148    /**
5149     * Whether this CResult_SignDecodeErrorZ represents a success state.
5150     */
5151    bool result_ok;
5152 } LDKCResult_SignDecodeErrorZ;
5153
5154 /**
5155  * Integer in the range `0..32`
5156  */
5157 typedef struct LDKu5 {
5158    uint8_t _0;
5159 } LDKu5;
5160
5161 /**
5162  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5163  * This corresponds to std::vector in C++
5164  */
5165 typedef struct LDKCVec_u5Z {
5166    /**
5167     * The elements in the array.
5168     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5169     */
5170    struct LDKu5 *data;
5171    /**
5172     * The number of elements pointed to by `data`.
5173     */
5174    uintptr_t datalen;
5175 } LDKCVec_u5Z;
5176
5177 /**
5178  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
5179  * allows recovering the exact public key which created the signature given the message.
5180  */
5181 typedef struct LDKRecoverableSignature {
5182    /**
5183     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
5184     * recovery.
5185     */
5186    uint8_t serialized_form[68];
5187 } LDKRecoverableSignature;
5188
5189 /**
5190  * The contents of CResult_RecoverableSignatureNoneZ
5191  */
5192 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
5193    /**
5194     * A pointer to the contents in the success state.
5195     * Reading from this pointer when `result_ok` is not set is undefined.
5196     */
5197    struct LDKRecoverableSignature *result;
5198    /**
5199     * Note that this value is always NULL, as there are no contents in the Err variant
5200     */
5201    void *err;
5202 } LDKCResult_RecoverableSignatureNoneZPtr;
5203
5204 /**
5205  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5206  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
5207  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5208  */
5209 typedef struct LDKCResult_RecoverableSignatureNoneZ {
5210    /**
5211     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5212     * `err` or `result` depending on the state of `result_ok`.
5213     */
5214    union LDKCResult_RecoverableSignatureNoneZPtr contents;
5215    /**
5216     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5217     */
5218    bool result_ok;
5219 } LDKCResult_RecoverableSignatureNoneZ;
5220
5221 /**
5222  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5223  * This corresponds to std::vector in C++
5224  */
5225 typedef struct LDKCVec_CVec_u8ZZ {
5226    /**
5227     * The elements in the array.
5228     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5229     */
5230    struct LDKCVec_u8Z *data;
5231    /**
5232     * The number of elements pointed to by `data`.
5233     */
5234    uintptr_t datalen;
5235 } LDKCVec_CVec_u8ZZ;
5236
5237 /**
5238  * The contents of CResult_CVec_CVec_u8ZZNoneZ
5239  */
5240 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
5241    /**
5242     * A pointer to the contents in the success state.
5243     * Reading from this pointer when `result_ok` is not set is undefined.
5244     */
5245    struct LDKCVec_CVec_u8ZZ *result;
5246    /**
5247     * Note that this value is always NULL, as there are no contents in the Err variant
5248     */
5249    void *err;
5250 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
5251
5252 /**
5253  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5254  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5255  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5256  */
5257 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
5258    /**
5259     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5260     * `err` or `result` depending on the state of `result_ok`.
5261     */
5262    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
5263    /**
5264     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5265     */
5266    bool result_ok;
5267 } LDKCResult_CVec_CVec_u8ZZNoneZ;
5268
5269
5270
5271 /**
5272  * A simple implementation of Sign that just keeps the private keys in memory.
5273  *
5274  * This implementation performs no policy checks and is insufficient by itself as
5275  * a secure external signer.
5276  */
5277 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
5278    /**
5279     * A pointer to the opaque Rust object.
5280     * Nearly everywhere, inner must be non-null, however in places where
5281     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5282     */
5283    LDKnativeInMemorySigner *inner;
5284    /**
5285     * Indicates that this is the only struct which contains the same pointer.
5286     * Rust functions which take ownership of an object provided via an argument require
5287     * this to be true and invalidate the object pointed to by inner.
5288     */
5289    bool is_owned;
5290 } LDKInMemorySigner;
5291
5292 /**
5293  * The contents of CResult_InMemorySignerDecodeErrorZ
5294  */
5295 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
5296    /**
5297     * A pointer to the contents in the success state.
5298     * Reading from this pointer when `result_ok` is not set is undefined.
5299     */
5300    struct LDKInMemorySigner *result;
5301    /**
5302     * A pointer to the contents in the error state.
5303     * Reading from this pointer when `result_ok` is set is undefined.
5304     */
5305    struct LDKDecodeError *err;
5306 } LDKCResult_InMemorySignerDecodeErrorZPtr;
5307
5308 /**
5309  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5310  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5311  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5312  */
5313 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
5314    /**
5315     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5316     * `err` or `result` depending on the state of `result_ok`.
5317     */
5318    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
5319    /**
5320     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5321     */
5322    bool result_ok;
5323 } LDKCResult_InMemorySignerDecodeErrorZ;
5324
5325 /**
5326  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5327  * This corresponds to std::vector in C++
5328  */
5329 typedef struct LDKCVec_TxOutZ {
5330    /**
5331     * The elements in the array.
5332     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5333     */
5334    struct LDKTxOut *data;
5335    /**
5336     * The number of elements pointed to by `data`.
5337     */
5338    uintptr_t datalen;
5339 } LDKCVec_TxOutZ;
5340
5341 /**
5342  * The contents of CResult_TransactionNoneZ
5343  */
5344 typedef union LDKCResult_TransactionNoneZPtr {
5345    /**
5346     * A pointer to the contents in the success state.
5347     * Reading from this pointer when `result_ok` is not set is undefined.
5348     */
5349    struct LDKTransaction *result;
5350    /**
5351     * Note that this value is always NULL, as there are no contents in the Err variant
5352     */
5353    void *err;
5354 } LDKCResult_TransactionNoneZPtr;
5355
5356 /**
5357  * A CResult_TransactionNoneZ represents the result of a fallible operation,
5358  * containing a crate::c_types::Transaction on success and a () on failure.
5359  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5360  */
5361 typedef struct LDKCResult_TransactionNoneZ {
5362    /**
5363     * The contents of this CResult_TransactionNoneZ, accessible via either
5364     * `err` or `result` depending on the state of `result_ok`.
5365     */
5366    union LDKCResult_TransactionNoneZPtr contents;
5367    /**
5368     * Whether this CResult_TransactionNoneZ represents a success state.
5369     */
5370    bool result_ok;
5371 } LDKCResult_TransactionNoneZ;
5372
5373
5374
5375 /**
5376  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
5377  * on-chain transactions to ensure no loss of funds occurs.
5378  *
5379  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
5380  * information and are actively monitoring the chain.
5381  *
5382  * Pending Events or updated HTLCs which have not yet been read out by
5383  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
5384  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
5385  * gotten are fully handled before re-serializing the new state.
5386  *
5387  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
5388  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
5389  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
5390  * returned block hash and the the current chain and then reconnecting blocks to get to the
5391  * best chain) upon deserializing the object!
5392  */
5393 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
5394    /**
5395     * A pointer to the opaque Rust object.
5396     * Nearly everywhere, inner must be non-null, however in places where
5397     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5398     */
5399    LDKnativeChannelMonitor *inner;
5400    /**
5401     * Indicates that this is the only struct which contains the same pointer.
5402     * Rust functions which take ownership of an object provided via an argument require
5403     * this to be true and invalidate the object pointed to by inner.
5404     */
5405    bool is_owned;
5406 } LDKChannelMonitor;
5407
5408 /**
5409  * A tuple of 2 elements. See the individual fields for the types contained.
5410  */
5411 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
5412    /**
5413     * The element at position 0
5414     */
5415    struct LDKThirtyTwoBytes a;
5416    /**
5417     * The element at position 1
5418     */
5419    struct LDKChannelMonitor b;
5420 } LDKC2Tuple_BlockHashChannelMonitorZ;
5421
5422 /**
5423  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5424  * This corresponds to std::vector in C++
5425  */
5426 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
5427    /**
5428     * The elements in the array.
5429     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5430     */
5431    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
5432    /**
5433     * The number of elements pointed to by `data`.
5434     */
5435    uintptr_t datalen;
5436 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
5437
5438 /**
5439  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5440  */
5441 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5442    /**
5443     * A pointer to the contents in the success state.
5444     * Reading from this pointer when `result_ok` is not set is undefined.
5445     */
5446    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
5447    /**
5448     * A pointer to the contents in the error state.
5449     * Reading from this pointer when `result_ok` is set is undefined.
5450     */
5451    enum LDKIOError *err;
5452 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
5453
5454 /**
5455  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5456  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5457  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5458  */
5459 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5460    /**
5461     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5462     * `err` or `result` depending on the state of `result_ok`.
5463     */
5464    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
5465    /**
5466     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5467     */
5468    bool result_ok;
5469 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
5470
5471 /**
5472  * An enum which can either contain a u16 or not
5473  */
5474 typedef enum LDKCOption_u16Z_Tag {
5475    /**
5476     * When we're in this state, this COption_u16Z contains a u16
5477     */
5478    LDKCOption_u16Z_Some,
5479    /**
5480     * When we're in this state, this COption_u16Z contains nothing
5481     */
5482    LDKCOption_u16Z_None,
5483    /**
5484     * Must be last for serialization purposes
5485     */
5486    LDKCOption_u16Z_Sentinel,
5487 } LDKCOption_u16Z_Tag;
5488
5489 typedef struct LDKCOption_u16Z {
5490    LDKCOption_u16Z_Tag tag;
5491    union {
5492       struct {
5493          uint16_t some;
5494       };
5495    };
5496 } LDKCOption_u16Z;
5497
5498 /**
5499  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
5500  * too-high values)
5501  */
5502 typedef enum LDKAPIError_Tag {
5503    /**
5504     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
5505     * are documented, but generally indicates some precondition of a function was violated.
5506     */
5507    LDKAPIError_APIMisuseError,
5508    /**
5509     * Due to a high feerate, we were unable to complete the request.
5510     * For example, this may be returned if the feerate implies we cannot open a channel at the
5511     * requested value, but opening a larger channel would succeed.
5512     */
5513    LDKAPIError_FeeRateTooHigh,
5514    /**
5515     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
5516     * too-many-hops, etc).
5517     */
5518    LDKAPIError_RouteError,
5519    /**
5520     * We were unable to complete the request as the Channel required to do so is unable to
5521     * complete the request (or was not found). This can take many forms, including disconnected
5522     * peer, channel at capacity, channel shutting down, etc.
5523     */
5524    LDKAPIError_ChannelUnavailable,
5525    /**
5526     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
5527     * attempted action to fail.
5528     */
5529    LDKAPIError_MonitorUpdateFailed,
5530    /**
5531     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
5532     * with the channel counterparty as negotiated in [`InitFeatures`].
5533     *
5534     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
5535     * a channel or cooperatively close one with this peer (and will have to force-close instead).
5536     *
5537     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
5538     * [`InitFeatures`]: crate::ln::features::InitFeatures
5539     */
5540    LDKAPIError_IncompatibleShutdownScript,
5541    /**
5542     * Must be last for serialization purposes
5543     */
5544    LDKAPIError_Sentinel,
5545 } LDKAPIError_Tag;
5546
5547 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
5548    /**
5549     * A human-readable error message
5550     */
5551    struct LDKStr err;
5552 } LDKAPIError_LDKAPIMisuseError_Body;
5553
5554 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
5555    /**
5556     * A human-readable error message
5557     */
5558    struct LDKStr err;
5559    /**
5560     * The feerate which was too high.
5561     */
5562    uint32_t feerate;
5563 } LDKAPIError_LDKFeeRateTooHigh_Body;
5564
5565 typedef struct LDKAPIError_LDKRouteError_Body {
5566    /**
5567     * A human-readable error message
5568     */
5569    struct LDKStr err;
5570 } LDKAPIError_LDKRouteError_Body;
5571
5572 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
5573    /**
5574     * A human-readable error message
5575     */
5576    struct LDKStr err;
5577 } LDKAPIError_LDKChannelUnavailable_Body;
5578
5579 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
5580    /**
5581     * The incompatible shutdown script.
5582     */
5583    struct LDKShutdownScript script;
5584 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
5585
5586 typedef struct MUST_USE_STRUCT LDKAPIError {
5587    LDKAPIError_Tag tag;
5588    union {
5589       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
5590       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
5591       LDKAPIError_LDKRouteError_Body route_error;
5592       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
5593       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
5594    };
5595 } LDKAPIError;
5596
5597 /**
5598  * The contents of CResult_NoneAPIErrorZ
5599  */
5600 typedef union LDKCResult_NoneAPIErrorZPtr {
5601    /**
5602     * Note that this value is always NULL, as there are no contents in the OK variant
5603     */
5604    void *result;
5605    /**
5606     * A pointer to the contents in the error state.
5607     * Reading from this pointer when `result_ok` is set is undefined.
5608     */
5609    struct LDKAPIError *err;
5610 } LDKCResult_NoneAPIErrorZPtr;
5611
5612 /**
5613  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5614  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
5615  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5616  */
5617 typedef struct LDKCResult_NoneAPIErrorZ {
5618    /**
5619     * The contents of this CResult_NoneAPIErrorZ, accessible via either
5620     * `err` or `result` depending on the state of `result_ok`.
5621     */
5622    union LDKCResult_NoneAPIErrorZPtr contents;
5623    /**
5624     * Whether this CResult_NoneAPIErrorZ represents a success state.
5625     */
5626    bool result_ok;
5627 } LDKCResult_NoneAPIErrorZ;
5628
5629 /**
5630  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5631  * This corresponds to std::vector in C++
5632  */
5633 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
5634    /**
5635     * The elements in the array.
5636     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5637     */
5638    struct LDKCResult_NoneAPIErrorZ *data;
5639    /**
5640     * The number of elements pointed to by `data`.
5641     */
5642    uintptr_t datalen;
5643 } LDKCVec_CResult_NoneAPIErrorZZ;
5644
5645 /**
5646  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5647  * This corresponds to std::vector in C++
5648  */
5649 typedef struct LDKCVec_APIErrorZ {
5650    /**
5651     * The elements in the array.
5652     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5653     */
5654    struct LDKAPIError *data;
5655    /**
5656     * The number of elements pointed to by `data`.
5657     */
5658    uintptr_t datalen;
5659 } LDKCVec_APIErrorZ;
5660
5661 /**
5662  * The contents of CResult__u832APIErrorZ
5663  */
5664 typedef union LDKCResult__u832APIErrorZPtr {
5665    /**
5666     * A pointer to the contents in the success state.
5667     * Reading from this pointer when `result_ok` is not set is undefined.
5668     */
5669    struct LDKThirtyTwoBytes *result;
5670    /**
5671     * A pointer to the contents in the error state.
5672     * Reading from this pointer when `result_ok` is set is undefined.
5673     */
5674    struct LDKAPIError *err;
5675 } LDKCResult__u832APIErrorZPtr;
5676
5677 /**
5678  * A CResult__u832APIErrorZ represents the result of a fallible operation,
5679  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5680  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5681  */
5682 typedef struct LDKCResult__u832APIErrorZ {
5683    /**
5684     * The contents of this CResult__u832APIErrorZ, accessible via either
5685     * `err` or `result` depending on the state of `result_ok`.
5686     */
5687    union LDKCResult__u832APIErrorZPtr contents;
5688    /**
5689     * Whether this CResult__u832APIErrorZ represents a success state.
5690     */
5691    bool result_ok;
5692 } LDKCResult__u832APIErrorZ;
5693
5694 /**
5695  * If a payment fails to send, it can be in one of several states. This enum is returned as the
5696  * Err() type describing which state the payment is in, see the description of individual enum
5697  * states for more.
5698  */
5699 typedef enum LDKPaymentSendFailure_Tag {
5700    /**
5701     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
5702     * send the payment at all. No channel state has been changed or messages sent to peers, and
5703     * once you've changed the parameter at error, you can freely retry the payment in full.
5704     */
5705    LDKPaymentSendFailure_ParameterError,
5706    /**
5707     * A parameter in a single path which was passed to send_payment was invalid, preventing us
5708     * from attempting to send the payment at all. No channel state has been changed or messages
5709     * sent to peers, and once you've changed the parameter at error, you can freely retry the
5710     * payment in full.
5711     *
5712     * The results here are ordered the same as the paths in the route object which was passed to
5713     * send_payment.
5714     */
5715    LDKPaymentSendFailure_PathParameterError,
5716    /**
5717     * All paths which were attempted failed to send, with no channel state change taking place.
5718     * You can freely retry the payment in full (though you probably want to do so over different
5719     * paths than the ones selected).
5720     */
5721    LDKPaymentSendFailure_AllFailedRetrySafe,
5722    /**
5723     * Some paths which were attempted failed to send, though possibly not all. At least some
5724     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
5725     * in over-/re-payment.
5726     *
5727     * The results here are ordered the same as the paths in the route object which was passed to
5728     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
5729     * retried (though there is currently no API with which to do so).
5730     *
5731     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
5732     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
5733     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
5734     * with the latest update_id.
5735     */
5736    LDKPaymentSendFailure_PartialFailure,
5737    /**
5738     * Must be last for serialization purposes
5739     */
5740    LDKPaymentSendFailure_Sentinel,
5741 } LDKPaymentSendFailure_Tag;
5742
5743 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
5744    /**
5745     * The errors themselves, in the same order as the route hops.
5746     */
5747    struct LDKCVec_CResult_NoneAPIErrorZZ results;
5748    /**
5749     * If some paths failed without irrevocably committing to the new HTLC(s), this will
5750     * contain a [`RouteParameters`] object which can be used to calculate a new route that
5751     * will pay all remaining unpaid balance.
5752     *
5753     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5754     */
5755    struct LDKRouteParameters failed_paths_retry;
5756    /**
5757     * The payment id for the payment, which is now at least partially pending.
5758     */
5759    struct LDKThirtyTwoBytes payment_id;
5760 } LDKPaymentSendFailure_LDKPartialFailure_Body;
5761
5762 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
5763    LDKPaymentSendFailure_Tag tag;
5764    union {
5765       struct {
5766          struct LDKAPIError parameter_error;
5767       };
5768       struct {
5769          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
5770       };
5771       struct {
5772          struct LDKCVec_APIErrorZ all_failed_retry_safe;
5773       };
5774       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
5775    };
5776 } LDKPaymentSendFailure;
5777
5778 /**
5779  * The contents of CResult_PaymentIdPaymentSendFailureZ
5780  */
5781 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
5782    /**
5783     * A pointer to the contents in the success state.
5784     * Reading from this pointer when `result_ok` is not set is undefined.
5785     */
5786    struct LDKThirtyTwoBytes *result;
5787    /**
5788     * A pointer to the contents in the error state.
5789     * Reading from this pointer when `result_ok` is set is undefined.
5790     */
5791    struct LDKPaymentSendFailure *err;
5792 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
5793
5794 /**
5795  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5796  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5797  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5798  */
5799 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
5800    /**
5801     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5802     * `err` or `result` depending on the state of `result_ok`.
5803     */
5804    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
5805    /**
5806     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5807     */
5808    bool result_ok;
5809 } LDKCResult_PaymentIdPaymentSendFailureZ;
5810
5811 /**
5812  * The contents of CResult_NonePaymentSendFailureZ
5813  */
5814 typedef union LDKCResult_NonePaymentSendFailureZPtr {
5815    /**
5816     * Note that this value is always NULL, as there are no contents in the OK variant
5817     */
5818    void *result;
5819    /**
5820     * A pointer to the contents in the error state.
5821     * Reading from this pointer when `result_ok` is set is undefined.
5822     */
5823    struct LDKPaymentSendFailure *err;
5824 } LDKCResult_NonePaymentSendFailureZPtr;
5825
5826 /**
5827  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5828  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5829  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5830  */
5831 typedef struct LDKCResult_NonePaymentSendFailureZ {
5832    /**
5833     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5834     * `err` or `result` depending on the state of `result_ok`.
5835     */
5836    union LDKCResult_NonePaymentSendFailureZPtr contents;
5837    /**
5838     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
5839     */
5840    bool result_ok;
5841 } LDKCResult_NonePaymentSendFailureZ;
5842
5843 /**
5844  * A tuple of 2 elements. See the individual fields for the types contained.
5845  */
5846 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
5847    /**
5848     * The element at position 0
5849     */
5850    struct LDKThirtyTwoBytes a;
5851    /**
5852     * The element at position 1
5853     */
5854    struct LDKThirtyTwoBytes b;
5855 } LDKC2Tuple_PaymentHashPaymentIdZ;
5856
5857 /**
5858  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
5859  */
5860 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
5861    /**
5862     * A pointer to the contents in the success state.
5863     * Reading from this pointer when `result_ok` is not set is undefined.
5864     */
5865    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
5866    /**
5867     * A pointer to the contents in the error state.
5868     * Reading from this pointer when `result_ok` is set is undefined.
5869     */
5870    struct LDKPaymentSendFailure *err;
5871 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
5872
5873 /**
5874  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
5875  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5876  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5877  */
5878 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
5879    /**
5880     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
5881     * `err` or `result` depending on the state of `result_ok`.
5882     */
5883    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
5884    /**
5885     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
5886     */
5887    bool result_ok;
5888 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
5889
5890 /**
5891  * A 4-byte byte array.
5892  */
5893 typedef struct LDKFourBytes {
5894    /**
5895     * The four bytes
5896     */
5897    uint8_t data[4];
5898 } LDKFourBytes;
5899
5900 /**
5901  * A 16-byte byte array.
5902  */
5903 typedef struct LDKSixteenBytes {
5904    /**
5905     * The sixteen bytes
5906     */
5907    uint8_t data[16];
5908 } LDKSixteenBytes;
5909
5910 /**
5911  * A 12-byte byte array.
5912  */
5913 typedef struct LDKTwelveBytes {
5914    /**
5915     * The twelve bytes
5916     */
5917    uint8_t data[12];
5918 } LDKTwelveBytes;
5919
5920 /**
5921  * An address which can be used to connect to a remote peer
5922  */
5923 typedef enum LDKNetAddress_Tag {
5924    /**
5925     * An IPv4 address/port on which the peer is listening.
5926     */
5927    LDKNetAddress_IPv4,
5928    /**
5929     * An IPv6 address/port on which the peer is listening.
5930     */
5931    LDKNetAddress_IPv6,
5932    /**
5933     * An old-style Tor onion address/port on which the peer is listening.
5934     *
5935     * This field is deprecated and the Tor network generally no longer supports V2 Onion
5936     * addresses. Thus, the details are not parsed here.
5937     */
5938    LDKNetAddress_OnionV2,
5939    /**
5940     * A new-style Tor onion address/port on which the peer is listening.
5941     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
5942     * wrap as base32 and append \".onion\".
5943     */
5944    LDKNetAddress_OnionV3,
5945    /**
5946     * Must be last for serialization purposes
5947     */
5948    LDKNetAddress_Sentinel,
5949 } LDKNetAddress_Tag;
5950
5951 typedef struct LDKNetAddress_LDKIPv4_Body {
5952    /**
5953     * The 4-byte IPv4 address
5954     */
5955    struct LDKFourBytes addr;
5956    /**
5957     * The port on which the node is listening
5958     */
5959    uint16_t port;
5960 } LDKNetAddress_LDKIPv4_Body;
5961
5962 typedef struct LDKNetAddress_LDKIPv6_Body {
5963    /**
5964     * The 16-byte IPv6 address
5965     */
5966    struct LDKSixteenBytes addr;
5967    /**
5968     * The port on which the node is listening
5969     */
5970    uint16_t port;
5971 } LDKNetAddress_LDKIPv6_Body;
5972
5973 typedef struct LDKNetAddress_LDKOnionV3_Body {
5974    /**
5975     * The ed25519 long-term public key of the peer
5976     */
5977    struct LDKThirtyTwoBytes ed25519_pubkey;
5978    /**
5979     * The checksum of the pubkey and version, as included in the onion address
5980     */
5981    uint16_t checksum;
5982    /**
5983     * The version byte, as defined by the Tor Onion v3 spec.
5984     */
5985    uint8_t version;
5986    /**
5987     * The port on which the node is listening
5988     */
5989    uint16_t port;
5990 } LDKNetAddress_LDKOnionV3_Body;
5991
5992 typedef struct MUST_USE_STRUCT LDKNetAddress {
5993    LDKNetAddress_Tag tag;
5994    union {
5995       LDKNetAddress_LDKIPv4_Body i_pv4;
5996       LDKNetAddress_LDKIPv6_Body i_pv6;
5997       struct {
5998          struct LDKTwelveBytes onion_v2;
5999       };
6000       LDKNetAddress_LDKOnionV3_Body onion_v3;
6001    };
6002 } LDKNetAddress;
6003
6004 /**
6005  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6006  * This corresponds to std::vector in C++
6007  */
6008 typedef struct LDKCVec_NetAddressZ {
6009    /**
6010     * The elements in the array.
6011     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6012     */
6013    struct LDKNetAddress *data;
6014    /**
6015     * The number of elements pointed to by `data`.
6016     */
6017    uintptr_t datalen;
6018 } LDKCVec_NetAddressZ;
6019
6020 /**
6021  * A tuple of 2 elements. See the individual fields for the types contained.
6022  */
6023 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
6024    /**
6025     * The element at position 0
6026     */
6027    struct LDKThirtyTwoBytes a;
6028    /**
6029     * The element at position 1
6030     */
6031    struct LDKThirtyTwoBytes b;
6032 } LDKC2Tuple_PaymentHashPaymentSecretZ;
6033
6034 /**
6035  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6036  */
6037 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6038    /**
6039     * A pointer to the contents in the success state.
6040     * Reading from this pointer when `result_ok` is not set is undefined.
6041     */
6042    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
6043    /**
6044     * Note that this value is always NULL, as there are no contents in the Err variant
6045     */
6046    void *err;
6047 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
6048
6049 /**
6050  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6051  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6052  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6053  */
6054 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6055    /**
6056     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6057     * `err` or `result` depending on the state of `result_ok`.
6058     */
6059    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
6060    /**
6061     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6062     */
6063    bool result_ok;
6064 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
6065
6066 /**
6067  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6068  */
6069 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6070    /**
6071     * A pointer to the contents in the success state.
6072     * Reading from this pointer when `result_ok` is not set is undefined.
6073     */
6074    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
6075    /**
6076     * A pointer to the contents in the error state.
6077     * Reading from this pointer when `result_ok` is set is undefined.
6078     */
6079    struct LDKAPIError *err;
6080 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
6081
6082 /**
6083  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6084  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6085  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6086  */
6087 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6088    /**
6089     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6090     * `err` or `result` depending on the state of `result_ok`.
6091     */
6092    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
6093    /**
6094     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6095     */
6096    bool result_ok;
6097 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
6098
6099 /**
6100  * The contents of CResult_PaymentSecretNoneZ
6101  */
6102 typedef union LDKCResult_PaymentSecretNoneZPtr {
6103    /**
6104     * A pointer to the contents in the success state.
6105     * Reading from this pointer when `result_ok` is not set is undefined.
6106     */
6107    struct LDKThirtyTwoBytes *result;
6108    /**
6109     * Note that this value is always NULL, as there are no contents in the Err variant
6110     */
6111    void *err;
6112 } LDKCResult_PaymentSecretNoneZPtr;
6113
6114 /**
6115  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6116  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6117  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6118  */
6119 typedef struct LDKCResult_PaymentSecretNoneZ {
6120    /**
6121     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
6122     * `err` or `result` depending on the state of `result_ok`.
6123     */
6124    union LDKCResult_PaymentSecretNoneZPtr contents;
6125    /**
6126     * Whether this CResult_PaymentSecretNoneZ represents a success state.
6127     */
6128    bool result_ok;
6129 } LDKCResult_PaymentSecretNoneZ;
6130
6131 /**
6132  * The contents of CResult_PaymentSecretAPIErrorZ
6133  */
6134 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
6135    /**
6136     * A pointer to the contents in the success state.
6137     * Reading from this pointer when `result_ok` is not set is undefined.
6138     */
6139    struct LDKThirtyTwoBytes *result;
6140    /**
6141     * A pointer to the contents in the error state.
6142     * Reading from this pointer when `result_ok` is set is undefined.
6143     */
6144    struct LDKAPIError *err;
6145 } LDKCResult_PaymentSecretAPIErrorZPtr;
6146
6147 /**
6148  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6149  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6150  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6151  */
6152 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
6153    /**
6154     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6155     * `err` or `result` depending on the state of `result_ok`.
6156     */
6157    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
6158    /**
6159     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6160     */
6161    bool result_ok;
6162 } LDKCResult_PaymentSecretAPIErrorZ;
6163
6164 /**
6165  * The contents of CResult_PaymentPreimageAPIErrorZ
6166  */
6167 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
6168    /**
6169     * A pointer to the contents in the success state.
6170     * Reading from this pointer when `result_ok` is not set is undefined.
6171     */
6172    struct LDKThirtyTwoBytes *result;
6173    /**
6174     * A pointer to the contents in the error state.
6175     * Reading from this pointer when `result_ok` is set is undefined.
6176     */
6177    struct LDKAPIError *err;
6178 } LDKCResult_PaymentPreimageAPIErrorZPtr;
6179
6180 /**
6181  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
6182  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6183  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6184  */
6185 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
6186    /**
6187     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
6188     * `err` or `result` depending on the state of `result_ok`.
6189     */
6190    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
6191    /**
6192     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
6193     */
6194    bool result_ok;
6195 } LDKCResult_PaymentPreimageAPIErrorZ;
6196
6197
6198
6199 /**
6200  * Information needed for constructing an invoice route hint for this channel.
6201  */
6202 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
6203    /**
6204     * A pointer to the opaque Rust object.
6205     * Nearly everywhere, inner must be non-null, however in places where
6206     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6207     */
6208    LDKnativeCounterpartyForwardingInfo *inner;
6209    /**
6210     * Indicates that this is the only struct which contains the same pointer.
6211     * Rust functions which take ownership of an object provided via an argument require
6212     * this to be true and invalidate the object pointed to by inner.
6213     */
6214    bool is_owned;
6215 } LDKCounterpartyForwardingInfo;
6216
6217 /**
6218  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
6219  */
6220 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
6221    /**
6222     * A pointer to the contents in the success state.
6223     * Reading from this pointer when `result_ok` is not set is undefined.
6224     */
6225    struct LDKCounterpartyForwardingInfo *result;
6226    /**
6227     * A pointer to the contents in the error state.
6228     * Reading from this pointer when `result_ok` is set is undefined.
6229     */
6230    struct LDKDecodeError *err;
6231 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
6232
6233 /**
6234  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
6235  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6236  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6237  */
6238 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
6239    /**
6240     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
6241     * `err` or `result` depending on the state of `result_ok`.
6242     */
6243    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
6244    /**
6245     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
6246     */
6247    bool result_ok;
6248 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
6249
6250
6251
6252 /**
6253  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
6254  * to better separate parameters.
6255  */
6256 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
6257    /**
6258     * A pointer to the opaque Rust object.
6259     * Nearly everywhere, inner must be non-null, however in places where
6260     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6261     */
6262    LDKnativeChannelCounterparty *inner;
6263    /**
6264     * Indicates that this is the only struct which contains the same pointer.
6265     * Rust functions which take ownership of an object provided via an argument require
6266     * this to be true and invalidate the object pointed to by inner.
6267     */
6268    bool is_owned;
6269 } LDKChannelCounterparty;
6270
6271 /**
6272  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
6273  */
6274 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
6275    /**
6276     * A pointer to the contents in the success state.
6277     * Reading from this pointer when `result_ok` is not set is undefined.
6278     */
6279    struct LDKChannelCounterparty *result;
6280    /**
6281     * A pointer to the contents in the error state.
6282     * Reading from this pointer when `result_ok` is set is undefined.
6283     */
6284    struct LDKDecodeError *err;
6285 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
6286
6287 /**
6288  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
6289  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
6290  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6291  */
6292 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
6293    /**
6294     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
6295     * `err` or `result` depending on the state of `result_ok`.
6296     */
6297    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
6298    /**
6299     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
6300     */
6301    bool result_ok;
6302 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
6303
6304 /**
6305  * The contents of CResult_ChannelDetailsDecodeErrorZ
6306  */
6307 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
6308    /**
6309     * A pointer to the contents in the success state.
6310     * Reading from this pointer when `result_ok` is not set is undefined.
6311     */
6312    struct LDKChannelDetails *result;
6313    /**
6314     * A pointer to the contents in the error state.
6315     * Reading from this pointer when `result_ok` is set is undefined.
6316     */
6317    struct LDKDecodeError *err;
6318 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
6319
6320 /**
6321  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
6322  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
6323  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6324  */
6325 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
6326    /**
6327     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
6328     * `err` or `result` depending on the state of `result_ok`.
6329     */
6330    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
6331    /**
6332     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
6333     */
6334    bool result_ok;
6335 } LDKCResult_ChannelDetailsDecodeErrorZ;
6336
6337
6338
6339 /**
6340  * Route hints used in constructing invoices for [phantom node payents].
6341  *
6342  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
6343  */
6344 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
6345    /**
6346     * A pointer to the opaque Rust object.
6347     * Nearly everywhere, inner must be non-null, however in places where
6348     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6349     */
6350    LDKnativePhantomRouteHints *inner;
6351    /**
6352     * Indicates that this is the only struct which contains the same pointer.
6353     * Rust functions which take ownership of an object provided via an argument require
6354     * this to be true and invalidate the object pointed to by inner.
6355     */
6356    bool is_owned;
6357 } LDKPhantomRouteHints;
6358
6359 /**
6360  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
6361  */
6362 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
6363    /**
6364     * A pointer to the contents in the success state.
6365     * Reading from this pointer when `result_ok` is not set is undefined.
6366     */
6367    struct LDKPhantomRouteHints *result;
6368    /**
6369     * A pointer to the contents in the error state.
6370     * Reading from this pointer when `result_ok` is set is undefined.
6371     */
6372    struct LDKDecodeError *err;
6373 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
6374
6375 /**
6376  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
6377  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
6378  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6379  */
6380 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
6381    /**
6382     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
6383     * `err` or `result` depending on the state of `result_ok`.
6384     */
6385    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
6386    /**
6387     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
6388     */
6389    bool result_ok;
6390 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
6391
6392 /**
6393  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6394  * This corresponds to std::vector in C++
6395  */
6396 typedef struct LDKCVec_ChannelMonitorZ {
6397    /**
6398     * The elements in the array.
6399     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6400     */
6401    struct LDKChannelMonitor *data;
6402    /**
6403     * The number of elements pointed to by `data`.
6404     */
6405    uintptr_t datalen;
6406 } LDKCVec_ChannelMonitorZ;
6407
6408
6409
6410 /**
6411  * An update generated by the underlying Channel itself which contains some new information the
6412  * ChannelMonitor should be made aware of.
6413  */
6414 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
6415    /**
6416     * A pointer to the opaque Rust object.
6417     * Nearly everywhere, inner must be non-null, however in places where
6418     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6419     */
6420    LDKnativeChannelMonitorUpdate *inner;
6421    /**
6422     * Indicates that this is the only struct which contains the same pointer.
6423     * Rust functions which take ownership of an object provided via an argument require
6424     * this to be true and invalidate the object pointed to by inner.
6425     */
6426    bool is_owned;
6427 } LDKChannelMonitorUpdate;
6428
6429 /**
6430  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
6431  * blocks are connected and disconnected.
6432  *
6433  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
6434  * responsible for maintaining a set of monitors such that they can be updated accordingly as
6435  * channel state changes and HTLCs are resolved. See method documentation for specific
6436  * requirements.
6437  *
6438  * Implementations **must** ensure that updates are successfully applied and persisted upon method
6439  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
6440  * without taking any further action such as persisting the current state.
6441  *
6442  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
6443  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
6444  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
6445  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
6446  * multiple instances.
6447  *
6448  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
6449  */
6450 typedef struct LDKWatch {
6451    /**
6452     * An opaque pointer which is passed to your function implementations as an argument.
6453     * This has no meaning in the LDK, and can be NULL or any other value.
6454     */
6455    void *this_arg;
6456    /**
6457     * Watches a channel identified by `funding_txo` using `monitor`.
6458     *
6459     * Implementations are responsible for watching the chain for the funding transaction along
6460     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
6461     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
6462     *
6463     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
6464     * the given `funding_txo` has previously been registered via `watch_channel`.
6465     *
6466     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
6467     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
6468     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
6469     */
6470    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
6471    /**
6472     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
6473     *
6474     * Implementations must call [`update_monitor`] with the given update. See
6475     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
6476     *
6477     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
6478     */
6479    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
6480    /**
6481     * Returns any monitor events since the last call. Subsequent calls must only return new
6482     * events.
6483     *
6484     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
6485     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
6486     * to disk.
6487     *
6488     * For details on asynchronous [`ChannelMonitor`] updating and returning
6489     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
6490     */
6491    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
6492    /**
6493     * Frees any resources associated with this object given its this_arg pointer.
6494     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6495     */
6496    void (*free)(void *this_arg);
6497 } LDKWatch;
6498
6499 /**
6500  * An interface to send a transaction to the Bitcoin network.
6501  */
6502 typedef struct LDKBroadcasterInterface {
6503    /**
6504     * An opaque pointer which is passed to your function implementations as an argument.
6505     * This has no meaning in the LDK, and can be NULL or any other value.
6506     */
6507    void *this_arg;
6508    /**
6509     * Sends a transaction out to (hopefully) be mined.
6510     */
6511    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
6512    /**
6513     * Frees any resources associated with this object given its this_arg pointer.
6514     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6515     */
6516    void (*free)(void *this_arg);
6517 } LDKBroadcasterInterface;
6518
6519 /**
6520  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
6521  * own the memory pointed to by data.
6522  */
6523 typedef struct LDKu8slice {
6524    /**
6525     * A pointer to the byte buffer
6526     */
6527    const uint8_t *data;
6528    /**
6529     * The number of bytes pointed to by `data`.
6530     */
6531    uintptr_t datalen;
6532 } LDKu8slice;
6533
6534 /**
6535  * A trait to describe an object which can get user secrets and key material.
6536  */
6537 typedef struct LDKKeysInterface {
6538    /**
6539     * An opaque pointer which is passed to your function implementations as an argument.
6540     * This has no meaning in the LDK, and can be NULL or any other value.
6541     */
6542    void *this_arg;
6543    /**
6544     * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`].
6545     *
6546     * This method must return the same value each time it is called with a given `Recipient`
6547     * parameter.
6548     */
6549    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
6550    /**
6551     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
6552     *
6553     * This method should return a different value each time it is called, to avoid linking
6554     * on-chain funds across channels as controlled to the same user.
6555     */
6556    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
6557    /**
6558     * Get a script pubkey which we will send funds to when closing a channel.
6559     *
6560     * This method should return a different value each time it is called, to avoid linking
6561     * on-chain funds across channels as controlled to the same user.
6562     */
6563    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
6564    /**
6565     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
6566     * restarted with some stale data!
6567     *
6568     * This method must return a different value each time it is called.
6569     */
6570    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
6571    /**
6572     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
6573     * onion packets and for temporary channel IDs. There is no requirement that these be
6574     * persisted anywhere, though they must be unique across restarts.
6575     *
6576     * This method must return a different value each time it is called.
6577     */
6578    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
6579    /**
6580     * Reads a `Signer` for this `KeysInterface` from the given input stream.
6581     * This is only called during deserialization of other objects which contain
6582     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
6583     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
6584     * contain no versioning scheme. You may wish to include your own version prefix and ensure
6585     * you've read all of the provided bytes to ensure no corruption occurred.
6586     */
6587    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
6588    /**
6589     * Sign an invoice.
6590     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
6591     * this trait to parse the invoice and make sure they're signing what they expect, rather than
6592     * blindly signing the hash.
6593     * The hrp is ascii bytes, while the invoice data is base32.
6594     *
6595     * The secret key used to sign the invoice is dependent on the [`Recipient`].
6596     */
6597    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
6598    /**
6599     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
6600     *
6601     * If the implementor of this trait supports [phantom node payments], then every node that is
6602     * intended to be included in the phantom invoice route hints must return the same value from
6603     * this method.
6604     *
6605     * This method must return the same value each time it is called.
6606     *
6607     * [phantom node payments]: PhantomKeysManager
6608     */
6609    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
6610    /**
6611     * Frees any resources associated with this object given its this_arg pointer.
6612     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6613     */
6614    void (*free)(void *this_arg);
6615 } LDKKeysInterface;
6616
6617 /**
6618  * A trait which should be implemented to provide feerate information on a number of time
6619  * horizons.
6620  *
6621  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
6622  * called from inside the library in response to chain events, P2P events, or timer events).
6623  */
6624 typedef struct LDKFeeEstimator {
6625    /**
6626     * An opaque pointer which is passed to your function implementations as an argument.
6627     * This has no meaning in the LDK, and can be NULL or any other value.
6628     */
6629    void *this_arg;
6630    /**
6631     * Gets estimated satoshis of fee required per 1000 Weight-Units.
6632     *
6633     * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
6634     * round-downs don't put us below 1 satoshi-per-byte).
6635     *
6636     * This method can be implemented with the following unit conversions:
6637     *  * max(satoshis-per-byte * 250, 253)
6638     *  * max(satoshis-per-kbyte / 4, 253)
6639     */
6640    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
6641    /**
6642     * Frees any resources associated with this object given its this_arg pointer.
6643     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6644     */
6645    void (*free)(void *this_arg);
6646 } LDKFeeEstimator;
6647
6648
6649
6650 /**
6651  * A Record, unit of logging output with Metadata to enable filtering
6652  * Module_path, file, line to inform on log's source
6653  */
6654 typedef struct MUST_USE_STRUCT LDKRecord {
6655    /**
6656     * A pointer to the opaque Rust object.
6657     * Nearly everywhere, inner must be non-null, however in places where
6658     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6659     */
6660    LDKnativeRecord *inner;
6661    /**
6662     * Indicates that this is the only struct which contains the same pointer.
6663     * Rust functions which take ownership of an object provided via an argument require
6664     * this to be true and invalidate the object pointed to by inner.
6665     */
6666    bool is_owned;
6667 } LDKRecord;
6668
6669 /**
6670  * A trait encapsulating the operations required of a logger
6671  */
6672 typedef struct LDKLogger {
6673    /**
6674     * An opaque pointer which is passed to your function implementations as an argument.
6675     * This has no meaning in the LDK, and can be NULL or any other value.
6676     */
6677    void *this_arg;
6678    /**
6679     * Logs the `Record`
6680     */
6681    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
6682    /**
6683     * Frees any resources associated with this object given its this_arg pointer.
6684     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6685     */
6686    void (*free)(void *this_arg);
6687 } LDKLogger;
6688
6689
6690
6691 /**
6692  * Manager which keeps track of a number of channels and sends messages to the appropriate
6693  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
6694  *
6695  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
6696  * to individual Channels.
6697  *
6698  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
6699  * all peers during write/read (though does not modify this instance, only the instance being
6700  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
6701  * called funding_transaction_generated for outbound channels).
6702  *
6703  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
6704  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
6705  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
6706  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
6707  * the serialization process). If the deserialized version is out-of-date compared to the
6708  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
6709  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
6710  *
6711  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
6712  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6713  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
6714  * block_connected() to step towards your best block) upon deserialization before using the
6715  * object!
6716  *
6717  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
6718  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
6719  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
6720  * offline for a full minute. In order to track this, you must call
6721  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
6722  *
6723  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
6724  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
6725  * essentially you should default to using a SimpleRefChannelManager, and use a
6726  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
6727  * you're using lightning-net-tokio.
6728  */
6729 typedef struct MUST_USE_STRUCT LDKChannelManager {
6730    /**
6731     * A pointer to the opaque Rust object.
6732     * Nearly everywhere, inner must be non-null, however in places where
6733     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6734     */
6735    LDKnativeChannelManager *inner;
6736    /**
6737     * Indicates that this is the only struct which contains the same pointer.
6738     * Rust functions which take ownership of an object provided via an argument require
6739     * this to be true and invalidate the object pointed to by inner.
6740     */
6741    bool is_owned;
6742 } LDKChannelManager;
6743
6744 /**
6745  * A tuple of 2 elements. See the individual fields for the types contained.
6746  */
6747 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
6748    /**
6749     * The element at position 0
6750     */
6751    struct LDKThirtyTwoBytes a;
6752    /**
6753     * The element at position 1
6754     */
6755    struct LDKChannelManager b;
6756 } LDKC2Tuple_BlockHashChannelManagerZ;
6757
6758 /**
6759  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6760  */
6761 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6762    /**
6763     * A pointer to the contents in the success state.
6764     * Reading from this pointer when `result_ok` is not set is undefined.
6765     */
6766    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
6767    /**
6768     * A pointer to the contents in the error state.
6769     * Reading from this pointer when `result_ok` is set is undefined.
6770     */
6771    struct LDKDecodeError *err;
6772 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
6773
6774 /**
6775  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6776  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6777  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6778  */
6779 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6780    /**
6781     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6782     * `err` or `result` depending on the state of `result_ok`.
6783     */
6784    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
6785    /**
6786     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6787     */
6788    bool result_ok;
6789 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
6790
6791
6792
6793 /**
6794  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
6795  * with our counterparty.
6796  */
6797 typedef struct MUST_USE_STRUCT LDKChannelConfig {
6798    /**
6799     * A pointer to the opaque Rust object.
6800     * Nearly everywhere, inner must be non-null, however in places where
6801     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6802     */
6803    LDKnativeChannelConfig *inner;
6804    /**
6805     * Indicates that this is the only struct which contains the same pointer.
6806     * Rust functions which take ownership of an object provided via an argument require
6807     * this to be true and invalidate the object pointed to by inner.
6808     */
6809    bool is_owned;
6810 } LDKChannelConfig;
6811
6812 /**
6813  * The contents of CResult_ChannelConfigDecodeErrorZ
6814  */
6815 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
6816    /**
6817     * A pointer to the contents in the success state.
6818     * Reading from this pointer when `result_ok` is not set is undefined.
6819     */
6820    struct LDKChannelConfig *result;
6821    /**
6822     * A pointer to the contents in the error state.
6823     * Reading from this pointer when `result_ok` is set is undefined.
6824     */
6825    struct LDKDecodeError *err;
6826 } LDKCResult_ChannelConfigDecodeErrorZPtr;
6827
6828 /**
6829  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6830  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6831  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6832  */
6833 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
6834    /**
6835     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6836     * `err` or `result` depending on the state of `result_ok`.
6837     */
6838    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
6839    /**
6840     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6841     */
6842    bool result_ok;
6843 } LDKCResult_ChannelConfigDecodeErrorZ;
6844
6845 /**
6846  * The contents of CResult_OutPointDecodeErrorZ
6847  */
6848 typedef union LDKCResult_OutPointDecodeErrorZPtr {
6849    /**
6850     * A pointer to the contents in the success state.
6851     * Reading from this pointer when `result_ok` is not set is undefined.
6852     */
6853    struct LDKOutPoint *result;
6854    /**
6855     * A pointer to the contents in the error state.
6856     * Reading from this pointer when `result_ok` is set is undefined.
6857     */
6858    struct LDKDecodeError *err;
6859 } LDKCResult_OutPointDecodeErrorZPtr;
6860
6861 /**
6862  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
6863  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
6864  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6865  */
6866 typedef struct LDKCResult_OutPointDecodeErrorZ {
6867    /**
6868     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
6869     * `err` or `result` depending on the state of `result_ok`.
6870     */
6871    union LDKCResult_OutPointDecodeErrorZPtr contents;
6872    /**
6873     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
6874     */
6875    bool result_ok;
6876 } LDKCResult_OutPointDecodeErrorZ;
6877
6878 /**
6879  * Defines a type identifier for sending messages over the wire.
6880  *
6881  * Messages implementing this trait specify a type and must be [`Writeable`].
6882  */
6883 typedef struct LDKType {
6884    /**
6885     * An opaque pointer which is passed to your function implementations as an argument.
6886     * This has no meaning in the LDK, and can be NULL or any other value.
6887     */
6888    void *this_arg;
6889    /**
6890     * Returns the type identifying the message payload.
6891     */
6892    uint16_t (*type_id)(const void *this_arg);
6893    /**
6894     * Return a human-readable "debug" string describing this object
6895     */
6896    struct LDKStr (*debug_str)(const void *this_arg);
6897    /**
6898     * Serialize the object into a byte array
6899     */
6900    struct LDKCVec_u8Z (*write)(const void *this_arg);
6901    /**
6902     * Frees any resources associated with this object given its this_arg pointer.
6903     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6904     */
6905    void (*free)(void *this_arg);
6906 } LDKType;
6907
6908 /**
6909  * An enum which can either contain a crate::lightning::ln::wire::Type or not
6910  */
6911 typedef enum LDKCOption_TypeZ_Tag {
6912    /**
6913     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
6914     */
6915    LDKCOption_TypeZ_Some,
6916    /**
6917     * When we're in this state, this COption_TypeZ contains nothing
6918     */
6919    LDKCOption_TypeZ_None,
6920    /**
6921     * Must be last for serialization purposes
6922     */
6923    LDKCOption_TypeZ_Sentinel,
6924 } LDKCOption_TypeZ_Tag;
6925
6926 typedef struct LDKCOption_TypeZ {
6927    LDKCOption_TypeZ_Tag tag;
6928    union {
6929       struct {
6930          struct LDKType some;
6931       };
6932    };
6933 } LDKCOption_TypeZ;
6934
6935 /**
6936  * The contents of CResult_COption_TypeZDecodeErrorZ
6937  */
6938 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
6939    /**
6940     * A pointer to the contents in the success state.
6941     * Reading from this pointer when `result_ok` is not set is undefined.
6942     */
6943    struct LDKCOption_TypeZ *result;
6944    /**
6945     * A pointer to the contents in the error state.
6946     * Reading from this pointer when `result_ok` is set is undefined.
6947     */
6948    struct LDKDecodeError *err;
6949 } LDKCResult_COption_TypeZDecodeErrorZPtr;
6950
6951 /**
6952  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
6953  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6954  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6955  */
6956 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
6957    /**
6958     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
6959     * `err` or `result` depending on the state of `result_ok`.
6960     */
6961    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
6962    /**
6963     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
6964     */
6965    bool result_ok;
6966 } LDKCResult_COption_TypeZDecodeErrorZ;
6967
6968 /**
6969  * An error that may occur when making a payment.
6970  */
6971 typedef enum LDKPaymentError_Tag {
6972    /**
6973     * An error resulting from the provided [`Invoice`] or payment hash.
6974     */
6975    LDKPaymentError_Invoice,
6976    /**
6977     * An error occurring when finding a route.
6978     */
6979    LDKPaymentError_Routing,
6980    /**
6981     * An error occurring when sending a payment.
6982     */
6983    LDKPaymentError_Sending,
6984    /**
6985     * Must be last for serialization purposes
6986     */
6987    LDKPaymentError_Sentinel,
6988 } LDKPaymentError_Tag;
6989
6990 typedef struct MUST_USE_STRUCT LDKPaymentError {
6991    LDKPaymentError_Tag tag;
6992    union {
6993       struct {
6994          struct LDKStr invoice;
6995       };
6996       struct {
6997          struct LDKLightningError routing;
6998       };
6999       struct {
7000          struct LDKPaymentSendFailure sending;
7001       };
7002    };
7003 } LDKPaymentError;
7004
7005 /**
7006  * The contents of CResult_PaymentIdPaymentErrorZ
7007  */
7008 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
7009    /**
7010     * A pointer to the contents in the success state.
7011     * Reading from this pointer when `result_ok` is not set is undefined.
7012     */
7013    struct LDKThirtyTwoBytes *result;
7014    /**
7015     * A pointer to the contents in the error state.
7016     * Reading from this pointer when `result_ok` is set is undefined.
7017     */
7018    struct LDKPaymentError *err;
7019 } LDKCResult_PaymentIdPaymentErrorZPtr;
7020
7021 /**
7022  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
7023  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7024  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7025  */
7026 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
7027    /**
7028     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7029     * `err` or `result` depending on the state of `result_ok`.
7030     */
7031    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
7032    /**
7033     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7034     */
7035    bool result_ok;
7036 } LDKCResult_PaymentIdPaymentErrorZ;
7037
7038 /**
7039  * The contents of CResult_SiPrefixNoneZ
7040  */
7041 typedef union LDKCResult_SiPrefixNoneZPtr {
7042    /**
7043     * A pointer to the contents in the success state.
7044     * Reading from this pointer when `result_ok` is not set is undefined.
7045     */
7046    enum LDKSiPrefix *result;
7047    /**
7048     * Note that this value is always NULL, as there are no contents in the Err variant
7049     */
7050    void *err;
7051 } LDKCResult_SiPrefixNoneZPtr;
7052
7053 /**
7054  * A CResult_SiPrefixNoneZ represents the result of a fallible operation,
7055  * containing a crate::lightning_invoice::SiPrefix on success and a () on failure.
7056  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7057  */
7058 typedef struct LDKCResult_SiPrefixNoneZ {
7059    /**
7060     * The contents of this CResult_SiPrefixNoneZ, accessible via either
7061     * `err` or `result` depending on the state of `result_ok`.
7062     */
7063    union LDKCResult_SiPrefixNoneZPtr contents;
7064    /**
7065     * Whether this CResult_SiPrefixNoneZ represents a success state.
7066     */
7067    bool result_ok;
7068 } LDKCResult_SiPrefixNoneZ;
7069
7070
7071
7072 /**
7073  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
7074  *
7075  * There are three ways to construct an `Invoice`:
7076  *  1. using `InvoiceBuilder`
7077  *  2. using `Invoice::from_signed(SignedRawInvoice)`
7078  *  3. using `str::parse::<Invoice>(&str)`
7079  */
7080 typedef struct MUST_USE_STRUCT LDKInvoice {
7081    /**
7082     * A pointer to the opaque Rust object.
7083     * Nearly everywhere, inner must be non-null, however in places where
7084     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7085     */
7086    LDKnativeInvoice *inner;
7087    /**
7088     * Indicates that this is the only struct which contains the same pointer.
7089     * Rust functions which take ownership of an object provided via an argument require
7090     * this to be true and invalidate the object pointed to by inner.
7091     */
7092    bool is_owned;
7093 } LDKInvoice;
7094
7095 /**
7096  * The contents of CResult_InvoiceNoneZ
7097  */
7098 typedef union LDKCResult_InvoiceNoneZPtr {
7099    /**
7100     * A pointer to the contents in the success state.
7101     * Reading from this pointer when `result_ok` is not set is undefined.
7102     */
7103    struct LDKInvoice *result;
7104    /**
7105     * Note that this value is always NULL, as there are no contents in the Err variant
7106     */
7107    void *err;
7108 } LDKCResult_InvoiceNoneZPtr;
7109
7110 /**
7111  * A CResult_InvoiceNoneZ represents the result of a fallible operation,
7112  * containing a crate::lightning_invoice::Invoice on success and a () on failure.
7113  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7114  */
7115 typedef struct LDKCResult_InvoiceNoneZ {
7116    /**
7117     * The contents of this CResult_InvoiceNoneZ, accessible via either
7118     * `err` or `result` depending on the state of `result_ok`.
7119     */
7120    union LDKCResult_InvoiceNoneZPtr contents;
7121    /**
7122     * Whether this CResult_InvoiceNoneZ represents a success state.
7123     */
7124    bool result_ok;
7125 } LDKCResult_InvoiceNoneZ;
7126
7127
7128
7129 /**
7130  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
7131  * invalid.
7132  *
7133  * # Invariants
7134  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
7135  */
7136 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
7137    /**
7138     * A pointer to the opaque Rust object.
7139     * Nearly everywhere, inner must be non-null, however in places where
7140     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7141     */
7142    LDKnativeSignedRawInvoice *inner;
7143    /**
7144     * Indicates that this is the only struct which contains the same pointer.
7145     * Rust functions which take ownership of an object provided via an argument require
7146     * this to be true and invalidate the object pointed to by inner.
7147     */
7148    bool is_owned;
7149 } LDKSignedRawInvoice;
7150
7151 /**
7152  * The contents of CResult_SignedRawInvoiceNoneZ
7153  */
7154 typedef union LDKCResult_SignedRawInvoiceNoneZPtr {
7155    /**
7156     * A pointer to the contents in the success state.
7157     * Reading from this pointer when `result_ok` is not set is undefined.
7158     */
7159    struct LDKSignedRawInvoice *result;
7160    /**
7161     * Note that this value is always NULL, as there are no contents in the Err variant
7162     */
7163    void *err;
7164 } LDKCResult_SignedRawInvoiceNoneZPtr;
7165
7166 /**
7167  * A CResult_SignedRawInvoiceNoneZ represents the result of a fallible operation,
7168  * containing a crate::lightning_invoice::SignedRawInvoice on success and a () on failure.
7169  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7170  */
7171 typedef struct LDKCResult_SignedRawInvoiceNoneZ {
7172    /**
7173     * The contents of this CResult_SignedRawInvoiceNoneZ, accessible via either
7174     * `err` or `result` depending on the state of `result_ok`.
7175     */
7176    union LDKCResult_SignedRawInvoiceNoneZPtr contents;
7177    /**
7178     * Whether this CResult_SignedRawInvoiceNoneZ represents a success state.
7179     */
7180    bool result_ok;
7181 } LDKCResult_SignedRawInvoiceNoneZ;
7182
7183
7184
7185 /**
7186  * Represents an syntactically correct Invoice for a payment on the lightning network,
7187  * but without the signature information.
7188  * De- and encoding should not lead to information loss but may lead to different hashes.
7189  *
7190  * For methods without docs see the corresponding methods in `Invoice`.
7191  */
7192 typedef struct MUST_USE_STRUCT LDKRawInvoice {
7193    /**
7194     * A pointer to the opaque Rust object.
7195     * Nearly everywhere, inner must be non-null, however in places where
7196     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7197     */
7198    LDKnativeRawInvoice *inner;
7199    /**
7200     * Indicates that this is the only struct which contains the same pointer.
7201     * Rust functions which take ownership of an object provided via an argument require
7202     * this to be true and invalidate the object pointed to by inner.
7203     */
7204    bool is_owned;
7205 } LDKRawInvoice;
7206
7207
7208
7209 /**
7210  * Recoverable signature
7211  */
7212 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
7213    /**
7214     * A pointer to the opaque Rust object.
7215     * Nearly everywhere, inner must be non-null, however in places where
7216     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7217     */
7218    LDKnativeInvoiceSignature *inner;
7219    /**
7220     * Indicates that this is the only struct which contains the same pointer.
7221     * Rust functions which take ownership of an object provided via an argument require
7222     * this to be true and invalidate the object pointed to by inner.
7223     */
7224    bool is_owned;
7225 } LDKInvoiceSignature;
7226
7227 /**
7228  * A tuple of 3 elements. See the individual fields for the types contained.
7229  */
7230 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
7231    /**
7232     * The element at position 0
7233     */
7234    struct LDKRawInvoice a;
7235    /**
7236     * The element at position 1
7237     */
7238    struct LDKThirtyTwoBytes b;
7239    /**
7240     * The element at position 2
7241     */
7242    struct LDKInvoiceSignature c;
7243 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
7244
7245
7246
7247 /**
7248  * Payee public key
7249  */
7250 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
7251    /**
7252     * A pointer to the opaque Rust object.
7253     * Nearly everywhere, inner must be non-null, however in places where
7254     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7255     */
7256    LDKnativePayeePubKey *inner;
7257    /**
7258     * Indicates that this is the only struct which contains the same pointer.
7259     * Rust functions which take ownership of an object provided via an argument require
7260     * this to be true and invalidate the object pointed to by inner.
7261     */
7262    bool is_owned;
7263 } LDKPayeePubKey;
7264
7265 /**
7266  * The contents of CResult_PayeePubKeyErrorZ
7267  */
7268 typedef union LDKCResult_PayeePubKeyErrorZPtr {
7269    /**
7270     * A pointer to the contents in the success state.
7271     * Reading from this pointer when `result_ok` is not set is undefined.
7272     */
7273    struct LDKPayeePubKey *result;
7274    /**
7275     * A pointer to the contents in the error state.
7276     * Reading from this pointer when `result_ok` is set is undefined.
7277     */
7278    enum LDKSecp256k1Error *err;
7279 } LDKCResult_PayeePubKeyErrorZPtr;
7280
7281 /**
7282  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
7283  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
7284  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7285  */
7286 typedef struct LDKCResult_PayeePubKeyErrorZ {
7287    /**
7288     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
7289     * `err` or `result` depending on the state of `result_ok`.
7290     */
7291    union LDKCResult_PayeePubKeyErrorZPtr contents;
7292    /**
7293     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
7294     */
7295    bool result_ok;
7296 } LDKCResult_PayeePubKeyErrorZ;
7297
7298
7299
7300 /**
7301  * Private routing information
7302  *
7303  * # Invariants
7304  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
7305  *
7306  */
7307 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
7308    /**
7309     * A pointer to the opaque Rust object.
7310     * Nearly everywhere, inner must be non-null, however in places where
7311     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7312     */
7313    LDKnativePrivateRoute *inner;
7314    /**
7315     * Indicates that this is the only struct which contains the same pointer.
7316     * Rust functions which take ownership of an object provided via an argument require
7317     * this to be true and invalidate the object pointed to by inner.
7318     */
7319    bool is_owned;
7320 } LDKPrivateRoute;
7321
7322 /**
7323  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
7324  * This corresponds to std::vector in C++
7325  */
7326 typedef struct LDKCVec_PrivateRouteZ {
7327    /**
7328     * The elements in the array.
7329     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7330     */
7331    struct LDKPrivateRoute *data;
7332    /**
7333     * The number of elements pointed to by `data`.
7334     */
7335    uintptr_t datalen;
7336 } LDKCVec_PrivateRouteZ;
7337
7338
7339
7340 /**
7341  * A timestamp that refers to a date after 1 January 1970.
7342  *
7343  * # Invariants
7344  *
7345  * The Unix timestamp representing the stored time has to be positive and no greater than
7346  * [`MAX_TIMESTAMP`].
7347  */
7348 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
7349    /**
7350     * A pointer to the opaque Rust object.
7351     * Nearly everywhere, inner must be non-null, however in places where
7352     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7353     */
7354    LDKnativePositiveTimestamp *inner;
7355    /**
7356     * Indicates that this is the only struct which contains the same pointer.
7357     * Rust functions which take ownership of an object provided via an argument require
7358     * this to be true and invalidate the object pointed to by inner.
7359     */
7360    bool is_owned;
7361 } LDKPositiveTimestamp;
7362
7363 /**
7364  * The contents of CResult_PositiveTimestampCreationErrorZ
7365  */
7366 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
7367    /**
7368     * A pointer to the contents in the success state.
7369     * Reading from this pointer when `result_ok` is not set is undefined.
7370     */
7371    struct LDKPositiveTimestamp *result;
7372    /**
7373     * A pointer to the contents in the error state.
7374     * Reading from this pointer when `result_ok` is set is undefined.
7375     */
7376    enum LDKCreationError *err;
7377 } LDKCResult_PositiveTimestampCreationErrorZPtr;
7378
7379 /**
7380  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
7381  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
7382  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7383  */
7384 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
7385    /**
7386     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
7387     * `err` or `result` depending on the state of `result_ok`.
7388     */
7389    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
7390    /**
7391     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
7392     */
7393    bool result_ok;
7394 } LDKCResult_PositiveTimestampCreationErrorZ;
7395
7396 /**
7397  * The contents of CResult_NoneSemanticErrorZ
7398  */
7399 typedef union LDKCResult_NoneSemanticErrorZPtr {
7400    /**
7401     * Note that this value is always NULL, as there are no contents in the OK variant
7402     */
7403    void *result;
7404    /**
7405     * A pointer to the contents in the error state.
7406     * Reading from this pointer when `result_ok` is set is undefined.
7407     */
7408    enum LDKSemanticError *err;
7409 } LDKCResult_NoneSemanticErrorZPtr;
7410
7411 /**
7412  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
7413  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
7414  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7415  */
7416 typedef struct LDKCResult_NoneSemanticErrorZ {
7417    /**
7418     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
7419     * `err` or `result` depending on the state of `result_ok`.
7420     */
7421    union LDKCResult_NoneSemanticErrorZPtr contents;
7422    /**
7423     * Whether this CResult_NoneSemanticErrorZ represents a success state.
7424     */
7425    bool result_ok;
7426 } LDKCResult_NoneSemanticErrorZ;
7427
7428 /**
7429  * The contents of CResult_InvoiceSemanticErrorZ
7430  */
7431 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
7432    /**
7433     * A pointer to the contents in the success state.
7434     * Reading from this pointer when `result_ok` is not set is undefined.
7435     */
7436    struct LDKInvoice *result;
7437    /**
7438     * A pointer to the contents in the error state.
7439     * Reading from this pointer when `result_ok` is set is undefined.
7440     */
7441    enum LDKSemanticError *err;
7442 } LDKCResult_InvoiceSemanticErrorZPtr;
7443
7444 /**
7445  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
7446  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
7447  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7448  */
7449 typedef struct LDKCResult_InvoiceSemanticErrorZ {
7450    /**
7451     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
7452     * `err` or `result` depending on the state of `result_ok`.
7453     */
7454    union LDKCResult_InvoiceSemanticErrorZPtr contents;
7455    /**
7456     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
7457     */
7458    bool result_ok;
7459 } LDKCResult_InvoiceSemanticErrorZ;
7460
7461
7462
7463 /**
7464  * Description string
7465  *
7466  * # Invariants
7467  * The description can be at most 639 __bytes__ long
7468  */
7469 typedef struct MUST_USE_STRUCT LDKDescription {
7470    /**
7471     * A pointer to the opaque Rust object.
7472     * Nearly everywhere, inner must be non-null, however in places where
7473     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7474     */
7475    LDKnativeDescription *inner;
7476    /**
7477     * Indicates that this is the only struct which contains the same pointer.
7478     * Rust functions which take ownership of an object provided via an argument require
7479     * this to be true and invalidate the object pointed to by inner.
7480     */
7481    bool is_owned;
7482 } LDKDescription;
7483
7484 /**
7485  * The contents of CResult_DescriptionCreationErrorZ
7486  */
7487 typedef union LDKCResult_DescriptionCreationErrorZPtr {
7488    /**
7489     * A pointer to the contents in the success state.
7490     * Reading from this pointer when `result_ok` is not set is undefined.
7491     */
7492    struct LDKDescription *result;
7493    /**
7494     * A pointer to the contents in the error state.
7495     * Reading from this pointer when `result_ok` is set is undefined.
7496     */
7497    enum LDKCreationError *err;
7498 } LDKCResult_DescriptionCreationErrorZPtr;
7499
7500 /**
7501  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
7502  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
7503  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7504  */
7505 typedef struct LDKCResult_DescriptionCreationErrorZ {
7506    /**
7507     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
7508     * `err` or `result` depending on the state of `result_ok`.
7509     */
7510    union LDKCResult_DescriptionCreationErrorZPtr contents;
7511    /**
7512     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
7513     */
7514    bool result_ok;
7515 } LDKCResult_DescriptionCreationErrorZ;
7516
7517 /**
7518  * The contents of CResult_PrivateRouteCreationErrorZ
7519  */
7520 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
7521    /**
7522     * A pointer to the contents in the success state.
7523     * Reading from this pointer when `result_ok` is not set is undefined.
7524     */
7525    struct LDKPrivateRoute *result;
7526    /**
7527     * A pointer to the contents in the error state.
7528     * Reading from this pointer when `result_ok` is set is undefined.
7529     */
7530    enum LDKCreationError *err;
7531 } LDKCResult_PrivateRouteCreationErrorZPtr;
7532
7533 /**
7534  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
7535  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
7536  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7537  */
7538 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
7539    /**
7540     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
7541     * `err` or `result` depending on the state of `result_ok`.
7542     */
7543    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
7544    /**
7545     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
7546     */
7547    bool result_ok;
7548 } LDKCResult_PrivateRouteCreationErrorZ;
7549
7550 /**
7551  * The contents of CResult_StringErrorZ
7552  */
7553 typedef union LDKCResult_StringErrorZPtr {
7554    /**
7555     * A pointer to the contents in the success state.
7556     * Reading from this pointer when `result_ok` is not set is undefined.
7557     */
7558    struct LDKStr *result;
7559    /**
7560     * A pointer to the contents in the error state.
7561     * Reading from this pointer when `result_ok` is set is undefined.
7562     */
7563    enum LDKSecp256k1Error *err;
7564 } LDKCResult_StringErrorZPtr;
7565
7566 /**
7567  * A CResult_StringErrorZ represents the result of a fallible operation,
7568  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
7569  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7570  */
7571 typedef struct LDKCResult_StringErrorZ {
7572    /**
7573     * The contents of this CResult_StringErrorZ, accessible via either
7574     * `err` or `result` depending on the state of `result_ok`.
7575     */
7576    union LDKCResult_StringErrorZPtr contents;
7577    /**
7578     * Whether this CResult_StringErrorZ represents a success state.
7579     */
7580    bool result_ok;
7581 } LDKCResult_StringErrorZ;
7582
7583 /**
7584  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
7585  */
7586 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
7587    /**
7588     * A pointer to the contents in the success state.
7589     * Reading from this pointer when `result_ok` is not set is undefined.
7590     */
7591    struct LDKChannelMonitorUpdate *result;
7592    /**
7593     * A pointer to the contents in the error state.
7594     * Reading from this pointer when `result_ok` is set is undefined.
7595     */
7596    struct LDKDecodeError *err;
7597 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
7598
7599 /**
7600  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
7601  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7602  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7603  */
7604 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
7605    /**
7606     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
7607     * `err` or `result` depending on the state of `result_ok`.
7608     */
7609    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
7610    /**
7611     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
7612     */
7613    bool result_ok;
7614 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
7615
7616 /**
7617  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
7618  */
7619 typedef enum LDKCOption_MonitorEventZ_Tag {
7620    /**
7621     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
7622     */
7623    LDKCOption_MonitorEventZ_Some,
7624    /**
7625     * When we're in this state, this COption_MonitorEventZ contains nothing
7626     */
7627    LDKCOption_MonitorEventZ_None,
7628    /**
7629     * Must be last for serialization purposes
7630     */
7631    LDKCOption_MonitorEventZ_Sentinel,
7632 } LDKCOption_MonitorEventZ_Tag;
7633
7634 typedef struct LDKCOption_MonitorEventZ {
7635    LDKCOption_MonitorEventZ_Tag tag;
7636    union {
7637       struct {
7638          struct LDKMonitorEvent some;
7639       };
7640    };
7641 } LDKCOption_MonitorEventZ;
7642
7643 /**
7644  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
7645  */
7646 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
7647    /**
7648     * A pointer to the contents in the success state.
7649     * Reading from this pointer when `result_ok` is not set is undefined.
7650     */
7651    struct LDKCOption_MonitorEventZ *result;
7652    /**
7653     * A pointer to the contents in the error state.
7654     * Reading from this pointer when `result_ok` is set is undefined.
7655     */
7656    struct LDKDecodeError *err;
7657 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
7658
7659 /**
7660  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
7661  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7662  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7663  */
7664 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
7665    /**
7666     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
7667     * `err` or `result` depending on the state of `result_ok`.
7668     */
7669    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
7670    /**
7671     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
7672     */
7673    bool result_ok;
7674 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
7675
7676 /**
7677  * The contents of CResult_HTLCUpdateDecodeErrorZ
7678  */
7679 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
7680    /**
7681     * A pointer to the contents in the success state.
7682     * Reading from this pointer when `result_ok` is not set is undefined.
7683     */
7684    struct LDKHTLCUpdate *result;
7685    /**
7686     * A pointer to the contents in the error state.
7687     * Reading from this pointer when `result_ok` is set is undefined.
7688     */
7689    struct LDKDecodeError *err;
7690 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
7691
7692 /**
7693  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7694  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7695  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7696  */
7697 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
7698    /**
7699     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7700     * `err` or `result` depending on the state of `result_ok`.
7701     */
7702    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
7703    /**
7704     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7705     */
7706    bool result_ok;
7707 } LDKCResult_HTLCUpdateDecodeErrorZ;
7708
7709 /**
7710  * A tuple of 2 elements. See the individual fields for the types contained.
7711  */
7712 typedef struct LDKC2Tuple_OutPointScriptZ {
7713    /**
7714     * The element at position 0
7715     */
7716    struct LDKOutPoint a;
7717    /**
7718     * The element at position 1
7719     */
7720    struct LDKCVec_u8Z b;
7721 } LDKC2Tuple_OutPointScriptZ;
7722
7723 /**
7724  * A tuple of 2 elements. See the individual fields for the types contained.
7725  */
7726 typedef struct LDKC2Tuple_u32ScriptZ {
7727    /**
7728     * The element at position 0
7729     */
7730    uint32_t a;
7731    /**
7732     * The element at position 1
7733     */
7734    struct LDKCVec_u8Z b;
7735 } LDKC2Tuple_u32ScriptZ;
7736
7737 /**
7738  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
7739  * This corresponds to std::vector in C++
7740  */
7741 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
7742    /**
7743     * The elements in the array.
7744     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7745     */
7746    struct LDKC2Tuple_u32ScriptZ *data;
7747    /**
7748     * The number of elements pointed to by `data`.
7749     */
7750    uintptr_t datalen;
7751 } LDKCVec_C2Tuple_u32ScriptZZ;
7752
7753 /**
7754  * A tuple of 2 elements. See the individual fields for the types contained.
7755  */
7756 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
7757    /**
7758     * The element at position 0
7759     */
7760    struct LDKThirtyTwoBytes a;
7761    /**
7762     * The element at position 1
7763     */
7764    struct LDKCVec_C2Tuple_u32ScriptZZ b;
7765 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
7766
7767 /**
7768  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
7769  * This corresponds to std::vector in C++
7770  */
7771 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
7772    /**
7773     * The elements in the array.
7774     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7775     */
7776    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
7777    /**
7778     * The number of elements pointed to by `data`.
7779     */
7780    uintptr_t datalen;
7781 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
7782
7783 /**
7784  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
7785  * This corresponds to std::vector in C++
7786  */
7787 typedef struct LDKCVec_EventZ {
7788    /**
7789     * The elements in the array.
7790     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7791     */
7792    struct LDKEvent *data;
7793    /**
7794     * The number of elements pointed to by `data`.
7795     */
7796    uintptr_t datalen;
7797 } LDKCVec_EventZ;
7798
7799 /**
7800  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
7801  * This corresponds to std::vector in C++
7802  */
7803 typedef struct LDKCVec_TransactionZ {
7804    /**
7805     * The elements in the array.
7806     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7807     */
7808    struct LDKTransaction *data;
7809    /**
7810     * The number of elements pointed to by `data`.
7811     */
7812    uintptr_t datalen;
7813 } LDKCVec_TransactionZ;
7814
7815 /**
7816  * A tuple of 2 elements. See the individual fields for the types contained.
7817  */
7818 typedef struct LDKC2Tuple_u32TxOutZ {
7819    /**
7820     * The element at position 0
7821     */
7822    uint32_t a;
7823    /**
7824     * The element at position 1
7825     */
7826    struct LDKTxOut b;
7827 } LDKC2Tuple_u32TxOutZ;
7828
7829 /**
7830  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
7831  * This corresponds to std::vector in C++
7832  */
7833 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
7834    /**
7835     * The elements in the array.
7836     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7837     */
7838    struct LDKC2Tuple_u32TxOutZ *data;
7839    /**
7840     * The number of elements pointed to by `data`.
7841     */
7842    uintptr_t datalen;
7843 } LDKCVec_C2Tuple_u32TxOutZZ;
7844
7845 /**
7846  * A tuple of 2 elements. See the individual fields for the types contained.
7847  */
7848 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
7849    /**
7850     * The element at position 0
7851     */
7852    struct LDKThirtyTwoBytes a;
7853    /**
7854     * The element at position 1
7855     */
7856    struct LDKCVec_C2Tuple_u32TxOutZZ b;
7857 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
7858
7859 /**
7860  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
7861  * This corresponds to std::vector in C++
7862  */
7863 typedef struct LDKCVec_TransactionOutputsZ {
7864    /**
7865     * The elements in the array.
7866     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7867     */
7868    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
7869    /**
7870     * The number of elements pointed to by `data`.
7871     */
7872    uintptr_t datalen;
7873 } LDKCVec_TransactionOutputsZ;
7874
7875 /**
7876  * Details about the balance(s) available for spending once the channel appears on chain.
7877  *
7878  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
7879  * be provided.
7880  */
7881 typedef enum LDKBalance_Tag {
7882    /**
7883     * The channel is not yet closed (or the commitment or closing transaction has not yet
7884     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
7885     * force-closed now.
7886     */
7887    LDKBalance_ClaimableOnChannelClose,
7888    /**
7889     * The channel has been closed, and the given balance is ours but awaiting confirmations until
7890     * we consider it spendable.
7891     */
7892    LDKBalance_ClaimableAwaitingConfirmations,
7893    /**
7894     * The channel has been closed, and the given balance should be ours but awaiting spending
7895     * transaction confirmation. If the spending transaction does not confirm in time, it is
7896     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
7897     *
7898     * Once the spending transaction confirms, before it has reached enough confirmations to be
7899     * considered safe from chain reorganizations, the balance will instead be provided via
7900     * [`Balance::ClaimableAwaitingConfirmations`].
7901     */
7902    LDKBalance_ContentiousClaimable,
7903    /**
7904     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
7905     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
7906     * likely to be claimed by our counterparty before we do.
7907     */
7908    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
7909    /**
7910     * Must be last for serialization purposes
7911     */
7912    LDKBalance_Sentinel,
7913 } LDKBalance_Tag;
7914
7915 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
7916    /**
7917     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
7918     * required to do so.
7919     */
7920    uint64_t claimable_amount_satoshis;
7921 } LDKBalance_LDKClaimableOnChannelClose_Body;
7922
7923 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
7924    /**
7925     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
7926     * were spent in broadcasting the transaction.
7927     */
7928    uint64_t claimable_amount_satoshis;
7929    /**
7930     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
7931     * amount.
7932     */
7933    uint32_t confirmation_height;
7934 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
7935
7936 typedef struct LDKBalance_LDKContentiousClaimable_Body {
7937    /**
7938     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
7939     * required to do so.
7940     */
7941    uint64_t claimable_amount_satoshis;
7942    /**
7943     * The height at which the counterparty may be able to claim the balance if we have not
7944     * done so.
7945     */
7946    uint32_t timeout_height;
7947 } LDKBalance_LDKContentiousClaimable_Body;
7948
7949 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
7950    /**
7951     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
7952     * required to do so.
7953     */
7954    uint64_t claimable_amount_satoshis;
7955    /**
7956     * The height at which we will be able to claim the balance if our counterparty has not
7957     * done so.
7958     */
7959    uint32_t claimable_height;
7960 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
7961
7962 typedef struct MUST_USE_STRUCT LDKBalance {
7963    LDKBalance_Tag tag;
7964    union {
7965       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
7966       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
7967       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
7968       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
7969    };
7970 } LDKBalance;
7971
7972 /**
7973  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
7974  * This corresponds to std::vector in C++
7975  */
7976 typedef struct LDKCVec_BalanceZ {
7977    /**
7978     * The elements in the array.
7979     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7980     */
7981    struct LDKBalance *data;
7982    /**
7983     * The number of elements pointed to by `data`.
7984     */
7985    uintptr_t datalen;
7986 } LDKCVec_BalanceZ;
7987
7988 /**
7989  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
7990  */
7991 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
7992    /**
7993     * A pointer to the contents in the success state.
7994     * Reading from this pointer when `result_ok` is not set is undefined.
7995     */
7996    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
7997    /**
7998     * A pointer to the contents in the error state.
7999     * Reading from this pointer when `result_ok` is set is undefined.
8000     */
8001    struct LDKDecodeError *err;
8002 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
8003
8004 /**
8005  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
8006  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8007  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8008  */
8009 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8010    /**
8011     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
8012     * `err` or `result` depending on the state of `result_ok`.
8013     */
8014    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
8015    /**
8016     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
8017     */
8018    bool result_ok;
8019 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
8020
8021 /**
8022  * The contents of CResult_NoneLightningErrorZ
8023  */
8024 typedef union LDKCResult_NoneLightningErrorZPtr {
8025    /**
8026     * Note that this value is always NULL, as there are no contents in the OK variant
8027     */
8028    void *result;
8029    /**
8030     * A pointer to the contents in the error state.
8031     * Reading from this pointer when `result_ok` is set is undefined.
8032     */
8033    struct LDKLightningError *err;
8034 } LDKCResult_NoneLightningErrorZPtr;
8035
8036 /**
8037  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
8038  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
8039  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8040  */
8041 typedef struct LDKCResult_NoneLightningErrorZ {
8042    /**
8043     * The contents of this CResult_NoneLightningErrorZ, accessible via either
8044     * `err` or `result` depending on the state of `result_ok`.
8045     */
8046    union LDKCResult_NoneLightningErrorZPtr contents;
8047    /**
8048     * Whether this CResult_NoneLightningErrorZ represents a success state.
8049     */
8050    bool result_ok;
8051 } LDKCResult_NoneLightningErrorZ;
8052
8053 /**
8054  * A tuple of 2 elements. See the individual fields for the types contained.
8055  */
8056 typedef struct LDKC2Tuple_PublicKeyTypeZ {
8057    /**
8058     * The element at position 0
8059     */
8060    struct LDKPublicKey a;
8061    /**
8062     * The element at position 1
8063     */
8064    struct LDKType b;
8065 } LDKC2Tuple_PublicKeyTypeZ;
8066
8067 /**
8068  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
8069  * This corresponds to std::vector in C++
8070  */
8071 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
8072    /**
8073     * The elements in the array.
8074     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8075     */
8076    struct LDKC2Tuple_PublicKeyTypeZ *data;
8077    /**
8078     * The number of elements pointed to by `data`.
8079     */
8080    uintptr_t datalen;
8081 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
8082
8083 /**
8084  * The contents of CResult_boolLightningErrorZ
8085  */
8086 typedef union LDKCResult_boolLightningErrorZPtr {
8087    /**
8088     * A pointer to the contents in the success state.
8089     * Reading from this pointer when `result_ok` is not set is undefined.
8090     */
8091    bool *result;
8092    /**
8093     * A pointer to the contents in the error state.
8094     * Reading from this pointer when `result_ok` is set is undefined.
8095     */
8096    struct LDKLightningError *err;
8097 } LDKCResult_boolLightningErrorZPtr;
8098
8099 /**
8100  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
8101  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
8102  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8103  */
8104 typedef struct LDKCResult_boolLightningErrorZ {
8105    /**
8106     * The contents of this CResult_boolLightningErrorZ, accessible via either
8107     * `err` or `result` depending on the state of `result_ok`.
8108     */
8109    union LDKCResult_boolLightningErrorZPtr contents;
8110    /**
8111     * Whether this CResult_boolLightningErrorZ represents a success state.
8112     */
8113    bool result_ok;
8114 } LDKCResult_boolLightningErrorZ;
8115
8116 /**
8117  * A tuple of 3 elements. See the individual fields for the types contained.
8118  */
8119 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8120    /**
8121     * The element at position 0
8122     */
8123    struct LDKChannelAnnouncement a;
8124    /**
8125     * The element at position 1
8126     */
8127    struct LDKChannelUpdate b;
8128    /**
8129     * The element at position 2
8130     */
8131    struct LDKChannelUpdate c;
8132 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
8133
8134 /**
8135  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
8136  * This corresponds to std::vector in C++
8137  */
8138 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8139    /**
8140     * The elements in the array.
8141     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8142     */
8143    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
8144    /**
8145     * The number of elements pointed to by `data`.
8146     */
8147    uintptr_t datalen;
8148 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
8149
8150 /**
8151  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
8152  * This corresponds to std::vector in C++
8153  */
8154 typedef struct LDKCVec_NodeAnnouncementZ {
8155    /**
8156     * The elements in the array.
8157     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8158     */
8159    struct LDKNodeAnnouncement *data;
8160    /**
8161     * The number of elements pointed to by `data`.
8162     */
8163    uintptr_t datalen;
8164 } LDKCVec_NodeAnnouncementZ;
8165
8166 /**
8167  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
8168  * This corresponds to std::vector in C++
8169  */
8170 typedef struct LDKCVec_PublicKeyZ {
8171    /**
8172     * The elements in the array.
8173     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8174     */
8175    struct LDKPublicKey *data;
8176    /**
8177     * The number of elements pointed to by `data`.
8178     */
8179    uintptr_t datalen;
8180 } LDKCVec_PublicKeyZ;
8181
8182
8183
8184 /**
8185  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
8186  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
8187  * descriptor.
8188  */
8189 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
8190    /**
8191     * A pointer to the opaque Rust object.
8192     * Nearly everywhere, inner must be non-null, however in places where
8193     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8194     */
8195    LDKnativePeerHandleError *inner;
8196    /**
8197     * Indicates that this is the only struct which contains the same pointer.
8198     * Rust functions which take ownership of an object provided via an argument require
8199     * this to be true and invalidate the object pointed to by inner.
8200     */
8201    bool is_owned;
8202 } LDKPeerHandleError;
8203
8204 /**
8205  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
8206  */
8207 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
8208    /**
8209     * A pointer to the contents in the success state.
8210     * Reading from this pointer when `result_ok` is not set is undefined.
8211     */
8212    struct LDKCVec_u8Z *result;
8213    /**
8214     * A pointer to the contents in the error state.
8215     * Reading from this pointer when `result_ok` is set is undefined.
8216     */
8217    struct LDKPeerHandleError *err;
8218 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
8219
8220 /**
8221  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
8222  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8223  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8224  */
8225 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
8226    /**
8227     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
8228     * `err` or `result` depending on the state of `result_ok`.
8229     */
8230    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
8231    /**
8232     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
8233     */
8234    bool result_ok;
8235 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
8236
8237 /**
8238  * The contents of CResult_NonePeerHandleErrorZ
8239  */
8240 typedef union LDKCResult_NonePeerHandleErrorZPtr {
8241    /**
8242     * Note that this value is always NULL, as there are no contents in the OK variant
8243     */
8244    void *result;
8245    /**
8246     * A pointer to the contents in the error state.
8247     * Reading from this pointer when `result_ok` is set is undefined.
8248     */
8249    struct LDKPeerHandleError *err;
8250 } LDKCResult_NonePeerHandleErrorZPtr;
8251
8252 /**
8253  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
8254  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8255  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8256  */
8257 typedef struct LDKCResult_NonePeerHandleErrorZ {
8258    /**
8259     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
8260     * `err` or `result` depending on the state of `result_ok`.
8261     */
8262    union LDKCResult_NonePeerHandleErrorZPtr contents;
8263    /**
8264     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
8265     */
8266    bool result_ok;
8267 } LDKCResult_NonePeerHandleErrorZ;
8268
8269 /**
8270  * The contents of CResult_boolPeerHandleErrorZ
8271  */
8272 typedef union LDKCResult_boolPeerHandleErrorZPtr {
8273    /**
8274     * A pointer to the contents in the success state.
8275     * Reading from this pointer when `result_ok` is not set is undefined.
8276     */
8277    bool *result;
8278    /**
8279     * A pointer to the contents in the error state.
8280     * Reading from this pointer when `result_ok` is set is undefined.
8281     */
8282    struct LDKPeerHandleError *err;
8283 } LDKCResult_boolPeerHandleErrorZPtr;
8284
8285 /**
8286  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
8287  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8288  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8289  */
8290 typedef struct LDKCResult_boolPeerHandleErrorZ {
8291    /**
8292     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
8293     * `err` or `result` depending on the state of `result_ok`.
8294     */
8295    union LDKCResult_boolPeerHandleErrorZPtr contents;
8296    /**
8297     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
8298     */
8299    bool result_ok;
8300 } LDKCResult_boolPeerHandleErrorZ;
8301
8302
8303
8304 /**
8305  * Represents the compressed public key of a node
8306  */
8307 typedef struct MUST_USE_STRUCT LDKNodeId {
8308    /**
8309     * A pointer to the opaque Rust object.
8310     * Nearly everywhere, inner must be non-null, however in places where
8311     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8312     */
8313    LDKnativeNodeId *inner;
8314    /**
8315     * Indicates that this is the only struct which contains the same pointer.
8316     * Rust functions which take ownership of an object provided via an argument require
8317     * this to be true and invalidate the object pointed to by inner.
8318     */
8319    bool is_owned;
8320 } LDKNodeId;
8321
8322 /**
8323  * The contents of CResult_NodeIdDecodeErrorZ
8324  */
8325 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
8326    /**
8327     * A pointer to the contents in the success state.
8328     * Reading from this pointer when `result_ok` is not set is undefined.
8329     */
8330    struct LDKNodeId *result;
8331    /**
8332     * A pointer to the contents in the error state.
8333     * Reading from this pointer when `result_ok` is set is undefined.
8334     */
8335    struct LDKDecodeError *err;
8336 } LDKCResult_NodeIdDecodeErrorZPtr;
8337
8338 /**
8339  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
8340  * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
8341  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8342  */
8343 typedef struct LDKCResult_NodeIdDecodeErrorZ {
8344    /**
8345     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
8346     * `err` or `result` depending on the state of `result_ok`.
8347     */
8348    union LDKCResult_NodeIdDecodeErrorZPtr contents;
8349    /**
8350     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
8351     */
8352    bool result_ok;
8353 } LDKCResult_NodeIdDecodeErrorZ;
8354
8355 /**
8356  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
8357  */
8358 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
8359    /**
8360     * A pointer to the contents in the success state.
8361     * Reading from this pointer when `result_ok` is not set is undefined.
8362     */
8363    struct LDKCOption_NetworkUpdateZ *result;
8364    /**
8365     * A pointer to the contents in the error state.
8366     * Reading from this pointer when `result_ok` is set is undefined.
8367     */
8368    struct LDKDecodeError *err;
8369 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
8370
8371 /**
8372  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
8373  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8374  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8375  */
8376 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
8377    /**
8378     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
8379     * `err` or `result` depending on the state of `result_ok`.
8380     */
8381    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
8382    /**
8383     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
8384     */
8385    bool result_ok;
8386 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
8387
8388 /**
8389  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
8390  * UTXOs.
8391  */
8392 typedef struct LDKAccess {
8393    /**
8394     * An opaque pointer which is passed to your function implementations as an argument.
8395     * This has no meaning in the LDK, and can be NULL or any other value.
8396     */
8397    void *this_arg;
8398    /**
8399     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
8400     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
8401     * is unknown.
8402     *
8403     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
8404     */
8405    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
8406    /**
8407     * Frees any resources associated with this object given its this_arg pointer.
8408     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8409     */
8410    void (*free)(void *this_arg);
8411 } LDKAccess;
8412
8413 /**
8414  * An enum which can either contain a crate::lightning::chain::Access or not
8415  */
8416 typedef enum LDKCOption_AccessZ_Tag {
8417    /**
8418     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
8419     */
8420    LDKCOption_AccessZ_Some,
8421    /**
8422     * When we're in this state, this COption_AccessZ contains nothing
8423     */
8424    LDKCOption_AccessZ_None,
8425    /**
8426     * Must be last for serialization purposes
8427     */
8428    LDKCOption_AccessZ_Sentinel,
8429 } LDKCOption_AccessZ_Tag;
8430
8431 typedef struct LDKCOption_AccessZ {
8432    LDKCOption_AccessZ_Tag tag;
8433    union {
8434       struct {
8435          struct LDKAccess some;
8436       };
8437    };
8438 } LDKCOption_AccessZ;
8439
8440
8441
8442 /**
8443  * Details about one direction of a channel as received within a [`ChannelUpdate`].
8444  */
8445 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
8446    /**
8447     * A pointer to the opaque Rust object.
8448     * Nearly everywhere, inner must be non-null, however in places where
8449     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8450     */
8451    LDKnativeChannelUpdateInfo *inner;
8452    /**
8453     * Indicates that this is the only struct which contains the same pointer.
8454     * Rust functions which take ownership of an object provided via an argument require
8455     * this to be true and invalidate the object pointed to by inner.
8456     */
8457    bool is_owned;
8458 } LDKChannelUpdateInfo;
8459
8460 /**
8461  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
8462  */
8463 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
8464    /**
8465     * A pointer to the contents in the success state.
8466     * Reading from this pointer when `result_ok` is not set is undefined.
8467     */
8468    struct LDKChannelUpdateInfo *result;
8469    /**
8470     * A pointer to the contents in the error state.
8471     * Reading from this pointer when `result_ok` is set is undefined.
8472     */
8473    struct LDKDecodeError *err;
8474 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
8475
8476 /**
8477  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
8478  * containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8479  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8480  */
8481 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
8482    /**
8483     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
8484     * `err` or `result` depending on the state of `result_ok`.
8485     */
8486    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
8487    /**
8488     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
8489     */
8490    bool result_ok;
8491 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
8492
8493
8494
8495 /**
8496  * Details about a channel (both directions).
8497  * Received within a channel announcement.
8498  */
8499 typedef struct MUST_USE_STRUCT LDKChannelInfo {
8500    /**
8501     * A pointer to the opaque Rust object.
8502     * Nearly everywhere, inner must be non-null, however in places where
8503     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8504     */
8505    LDKnativeChannelInfo *inner;
8506    /**
8507     * Indicates that this is the only struct which contains the same pointer.
8508     * Rust functions which take ownership of an object provided via an argument require
8509     * this to be true and invalidate the object pointed to by inner.
8510     */
8511    bool is_owned;
8512 } LDKChannelInfo;
8513
8514 /**
8515  * The contents of CResult_ChannelInfoDecodeErrorZ
8516  */
8517 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
8518    /**
8519     * A pointer to the contents in the success state.
8520     * Reading from this pointer when `result_ok` is not set is undefined.
8521     */
8522    struct LDKChannelInfo *result;
8523    /**
8524     * A pointer to the contents in the error state.
8525     * Reading from this pointer when `result_ok` is set is undefined.
8526     */
8527    struct LDKDecodeError *err;
8528 } LDKCResult_ChannelInfoDecodeErrorZPtr;
8529
8530 /**
8531  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8532  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8533  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8534  */
8535 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
8536    /**
8537     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8538     * `err` or `result` depending on the state of `result_ok`.
8539     */
8540    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
8541    /**
8542     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8543     */
8544    bool result_ok;
8545 } LDKCResult_ChannelInfoDecodeErrorZ;
8546
8547
8548
8549 /**
8550  * Fees for routing via a given channel or a node
8551  */
8552 typedef struct MUST_USE_STRUCT LDKRoutingFees {
8553    /**
8554     * A pointer to the opaque Rust object.
8555     * Nearly everywhere, inner must be non-null, however in places where
8556     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8557     */
8558    LDKnativeRoutingFees *inner;
8559    /**
8560     * Indicates that this is the only struct which contains the same pointer.
8561     * Rust functions which take ownership of an object provided via an argument require
8562     * this to be true and invalidate the object pointed to by inner.
8563     */
8564    bool is_owned;
8565 } LDKRoutingFees;
8566
8567 /**
8568  * The contents of CResult_RoutingFeesDecodeErrorZ
8569  */
8570 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
8571    /**
8572     * A pointer to the contents in the success state.
8573     * Reading from this pointer when `result_ok` is not set is undefined.
8574     */
8575    struct LDKRoutingFees *result;
8576    /**
8577     * A pointer to the contents in the error state.
8578     * Reading from this pointer when `result_ok` is set is undefined.
8579     */
8580    struct LDKDecodeError *err;
8581 } LDKCResult_RoutingFeesDecodeErrorZPtr;
8582
8583 /**
8584  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8585  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8586  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8587  */
8588 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
8589    /**
8590     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8591     * `err` or `result` depending on the state of `result_ok`.
8592     */
8593    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
8594    /**
8595     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8596     */
8597    bool result_ok;
8598 } LDKCResult_RoutingFeesDecodeErrorZ;
8599
8600
8601
8602 /**
8603  * Information received in the latest node_announcement from this node.
8604  */
8605 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
8606    /**
8607     * A pointer to the opaque Rust object.
8608     * Nearly everywhere, inner must be non-null, however in places where
8609     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8610     */
8611    LDKnativeNodeAnnouncementInfo *inner;
8612    /**
8613     * Indicates that this is the only struct which contains the same pointer.
8614     * Rust functions which take ownership of an object provided via an argument require
8615     * this to be true and invalidate the object pointed to by inner.
8616     */
8617    bool is_owned;
8618 } LDKNodeAnnouncementInfo;
8619
8620 /**
8621  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8622  */
8623 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
8624    /**
8625     * A pointer to the contents in the success state.
8626     * Reading from this pointer when `result_ok` is not set is undefined.
8627     */
8628    struct LDKNodeAnnouncementInfo *result;
8629    /**
8630     * A pointer to the contents in the error state.
8631     * Reading from this pointer when `result_ok` is set is undefined.
8632     */
8633    struct LDKDecodeError *err;
8634 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
8635
8636 /**
8637  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8638  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8639  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8640  */
8641 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
8642    /**
8643     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8644     * `err` or `result` depending on the state of `result_ok`.
8645     */
8646    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
8647    /**
8648     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8649     */
8650    bool result_ok;
8651 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
8652
8653 /**
8654  * A dynamically-allocated array of u64s of arbitrary size.
8655  * This corresponds to std::vector in C++
8656  */
8657 typedef struct LDKCVec_u64Z {
8658    /**
8659     * The elements in the array.
8660     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8661     */
8662    uint64_t *data;
8663    /**
8664     * The number of elements pointed to by `data`.
8665     */
8666    uintptr_t datalen;
8667 } LDKCVec_u64Z;
8668
8669
8670
8671 /**
8672  * Details about a node in the network, known from the network announcement.
8673  */
8674 typedef struct MUST_USE_STRUCT LDKNodeInfo {
8675    /**
8676     * A pointer to the opaque Rust object.
8677     * Nearly everywhere, inner must be non-null, however in places where
8678     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8679     */
8680    LDKnativeNodeInfo *inner;
8681    /**
8682     * Indicates that this is the only struct which contains the same pointer.
8683     * Rust functions which take ownership of an object provided via an argument require
8684     * this to be true and invalidate the object pointed to by inner.
8685     */
8686    bool is_owned;
8687 } LDKNodeInfo;
8688
8689 /**
8690  * The contents of CResult_NodeInfoDecodeErrorZ
8691  */
8692 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
8693    /**
8694     * A pointer to the contents in the success state.
8695     * Reading from this pointer when `result_ok` is not set is undefined.
8696     */
8697    struct LDKNodeInfo *result;
8698    /**
8699     * A pointer to the contents in the error state.
8700     * Reading from this pointer when `result_ok` is set is undefined.
8701     */
8702    struct LDKDecodeError *err;
8703 } LDKCResult_NodeInfoDecodeErrorZPtr;
8704
8705 /**
8706  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8707  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8708  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8709  */
8710 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
8711    /**
8712     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8713     * `err` or `result` depending on the state of `result_ok`.
8714     */
8715    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
8716    /**
8717     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8718     */
8719    bool result_ok;
8720 } LDKCResult_NodeInfoDecodeErrorZ;
8721
8722
8723
8724 /**
8725  * Represents the network as nodes and channels between them
8726  */
8727 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
8728    /**
8729     * A pointer to the opaque Rust object.
8730     * Nearly everywhere, inner must be non-null, however in places where
8731     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8732     */
8733    LDKnativeNetworkGraph *inner;
8734    /**
8735     * Indicates that this is the only struct which contains the same pointer.
8736     * Rust functions which take ownership of an object provided via an argument require
8737     * this to be true and invalidate the object pointed to by inner.
8738     */
8739    bool is_owned;
8740 } LDKNetworkGraph;
8741
8742 /**
8743  * The contents of CResult_NetworkGraphDecodeErrorZ
8744  */
8745 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
8746    /**
8747     * A pointer to the contents in the success state.
8748     * Reading from this pointer when `result_ok` is not set is undefined.
8749     */
8750    struct LDKNetworkGraph *result;
8751    /**
8752     * A pointer to the contents in the error state.
8753     * Reading from this pointer when `result_ok` is set is undefined.
8754     */
8755    struct LDKDecodeError *err;
8756 } LDKCResult_NetworkGraphDecodeErrorZPtr;
8757
8758 /**
8759  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
8760  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
8761  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8762  */
8763 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
8764    /**
8765     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
8766     * `err` or `result` depending on the state of `result_ok`.
8767     */
8768    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
8769    /**
8770     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
8771     */
8772    bool result_ok;
8773 } LDKCResult_NetworkGraphDecodeErrorZ;
8774
8775 /**
8776  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
8777  */
8778 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
8779    /**
8780     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
8781     */
8782    LDKCOption_CVec_NetAddressZZ_Some,
8783    /**
8784     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
8785     */
8786    LDKCOption_CVec_NetAddressZZ_None,
8787    /**
8788     * Must be last for serialization purposes
8789     */
8790    LDKCOption_CVec_NetAddressZZ_Sentinel,
8791 } LDKCOption_CVec_NetAddressZZ_Tag;
8792
8793 typedef struct LDKCOption_CVec_NetAddressZZ {
8794    LDKCOption_CVec_NetAddressZZ_Tag tag;
8795    union {
8796       struct {
8797          struct LDKCVec_NetAddressZ some;
8798       };
8799    };
8800 } LDKCOption_CVec_NetAddressZZ;
8801
8802 /**
8803  * The contents of CResult_NetAddressDecodeErrorZ
8804  */
8805 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
8806    /**
8807     * A pointer to the contents in the success state.
8808     * Reading from this pointer when `result_ok` is not set is undefined.
8809     */
8810    struct LDKNetAddress *result;
8811    /**
8812     * A pointer to the contents in the error state.
8813     * Reading from this pointer when `result_ok` is set is undefined.
8814     */
8815    struct LDKDecodeError *err;
8816 } LDKCResult_NetAddressDecodeErrorZPtr;
8817
8818 /**
8819  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
8820  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
8821  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8822  */
8823 typedef struct LDKCResult_NetAddressDecodeErrorZ {
8824    /**
8825     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
8826     * `err` or `result` depending on the state of `result_ok`.
8827     */
8828    union LDKCResult_NetAddressDecodeErrorZPtr contents;
8829    /**
8830     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
8831     */
8832    bool result_ok;
8833 } LDKCResult_NetAddressDecodeErrorZ;
8834
8835
8836
8837 /**
8838  * An update_add_htlc message to be sent or received from a peer
8839  */
8840 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
8841    /**
8842     * A pointer to the opaque Rust object.
8843     * Nearly everywhere, inner must be non-null, however in places where
8844     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8845     */
8846    LDKnativeUpdateAddHTLC *inner;
8847    /**
8848     * Indicates that this is the only struct which contains the same pointer.
8849     * Rust functions which take ownership of an object provided via an argument require
8850     * this to be true and invalidate the object pointed to by inner.
8851     */
8852    bool is_owned;
8853 } LDKUpdateAddHTLC;
8854
8855 /**
8856  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
8857  * This corresponds to std::vector in C++
8858  */
8859 typedef struct LDKCVec_UpdateAddHTLCZ {
8860    /**
8861     * The elements in the array.
8862     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8863     */
8864    struct LDKUpdateAddHTLC *data;
8865    /**
8866     * The number of elements pointed to by `data`.
8867     */
8868    uintptr_t datalen;
8869 } LDKCVec_UpdateAddHTLCZ;
8870
8871
8872
8873 /**
8874  * An update_fulfill_htlc message to be sent or received from a peer
8875  */
8876 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
8877    /**
8878     * A pointer to the opaque Rust object.
8879     * Nearly everywhere, inner must be non-null, however in places where
8880     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8881     */
8882    LDKnativeUpdateFulfillHTLC *inner;
8883    /**
8884     * Indicates that this is the only struct which contains the same pointer.
8885     * Rust functions which take ownership of an object provided via an argument require
8886     * this to be true and invalidate the object pointed to by inner.
8887     */
8888    bool is_owned;
8889 } LDKUpdateFulfillHTLC;
8890
8891 /**
8892  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
8893  * This corresponds to std::vector in C++
8894  */
8895 typedef struct LDKCVec_UpdateFulfillHTLCZ {
8896    /**
8897     * The elements in the array.
8898     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8899     */
8900    struct LDKUpdateFulfillHTLC *data;
8901    /**
8902     * The number of elements pointed to by `data`.
8903     */
8904    uintptr_t datalen;
8905 } LDKCVec_UpdateFulfillHTLCZ;
8906
8907
8908
8909 /**
8910  * An update_fail_htlc message to be sent or received from a peer
8911  */
8912 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
8913    /**
8914     * A pointer to the opaque Rust object.
8915     * Nearly everywhere, inner must be non-null, however in places where
8916     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8917     */
8918    LDKnativeUpdateFailHTLC *inner;
8919    /**
8920     * Indicates that this is the only struct which contains the same pointer.
8921     * Rust functions which take ownership of an object provided via an argument require
8922     * this to be true and invalidate the object pointed to by inner.
8923     */
8924    bool is_owned;
8925 } LDKUpdateFailHTLC;
8926
8927 /**
8928  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
8929  * This corresponds to std::vector in C++
8930  */
8931 typedef struct LDKCVec_UpdateFailHTLCZ {
8932    /**
8933     * The elements in the array.
8934     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8935     */
8936    struct LDKUpdateFailHTLC *data;
8937    /**
8938     * The number of elements pointed to by `data`.
8939     */
8940    uintptr_t datalen;
8941 } LDKCVec_UpdateFailHTLCZ;
8942
8943
8944
8945 /**
8946  * An update_fail_malformed_htlc message to be sent or received from a peer
8947  */
8948 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
8949    /**
8950     * A pointer to the opaque Rust object.
8951     * Nearly everywhere, inner must be non-null, however in places where
8952     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8953     */
8954    LDKnativeUpdateFailMalformedHTLC *inner;
8955    /**
8956     * Indicates that this is the only struct which contains the same pointer.
8957     * Rust functions which take ownership of an object provided via an argument require
8958     * this to be true and invalidate the object pointed to by inner.
8959     */
8960    bool is_owned;
8961 } LDKUpdateFailMalformedHTLC;
8962
8963 /**
8964  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
8965  * This corresponds to std::vector in C++
8966  */
8967 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
8968    /**
8969     * The elements in the array.
8970     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8971     */
8972    struct LDKUpdateFailMalformedHTLC *data;
8973    /**
8974     * The number of elements pointed to by `data`.
8975     */
8976    uintptr_t datalen;
8977 } LDKCVec_UpdateFailMalformedHTLCZ;
8978
8979 /**
8980  * The contents of CResult_AcceptChannelDecodeErrorZ
8981  */
8982 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
8983    /**
8984     * A pointer to the contents in the success state.
8985     * Reading from this pointer when `result_ok` is not set is undefined.
8986     */
8987    struct LDKAcceptChannel *result;
8988    /**
8989     * A pointer to the contents in the error state.
8990     * Reading from this pointer when `result_ok` is set is undefined.
8991     */
8992    struct LDKDecodeError *err;
8993 } LDKCResult_AcceptChannelDecodeErrorZPtr;
8994
8995 /**
8996  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
8997  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
8998  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8999  */
9000 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
9001    /**
9002     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9003     * `err` or `result` depending on the state of `result_ok`.
9004     */
9005    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
9006    /**
9007     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9008     */
9009    bool result_ok;
9010 } LDKCResult_AcceptChannelDecodeErrorZ;
9011
9012 /**
9013  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9014  */
9015 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
9016    /**
9017     * A pointer to the contents in the success state.
9018     * Reading from this pointer when `result_ok` is not set is undefined.
9019     */
9020    struct LDKAnnouncementSignatures *result;
9021    /**
9022     * A pointer to the contents in the error state.
9023     * Reading from this pointer when `result_ok` is set is undefined.
9024     */
9025    struct LDKDecodeError *err;
9026 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
9027
9028 /**
9029  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9030  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9031  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9032  */
9033 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
9034    /**
9035     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9036     * `err` or `result` depending on the state of `result_ok`.
9037     */
9038    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
9039    /**
9040     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9041     */
9042    bool result_ok;
9043 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
9044
9045 /**
9046  * The contents of CResult_ChannelReestablishDecodeErrorZ
9047  */
9048 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
9049    /**
9050     * A pointer to the contents in the success state.
9051     * Reading from this pointer when `result_ok` is not set is undefined.
9052     */
9053    struct LDKChannelReestablish *result;
9054    /**
9055     * A pointer to the contents in the error state.
9056     * Reading from this pointer when `result_ok` is set is undefined.
9057     */
9058    struct LDKDecodeError *err;
9059 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
9060
9061 /**
9062  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9063  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9064  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9065  */
9066 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
9067    /**
9068     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9069     * `err` or `result` depending on the state of `result_ok`.
9070     */
9071    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
9072    /**
9073     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9074     */
9075    bool result_ok;
9076 } LDKCResult_ChannelReestablishDecodeErrorZ;
9077
9078 /**
9079  * The contents of CResult_ClosingSignedDecodeErrorZ
9080  */
9081 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
9082    /**
9083     * A pointer to the contents in the success state.
9084     * Reading from this pointer when `result_ok` is not set is undefined.
9085     */
9086    struct LDKClosingSigned *result;
9087    /**
9088     * A pointer to the contents in the error state.
9089     * Reading from this pointer when `result_ok` is set is undefined.
9090     */
9091    struct LDKDecodeError *err;
9092 } LDKCResult_ClosingSignedDecodeErrorZPtr;
9093
9094 /**
9095  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9096  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9097  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9098  */
9099 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
9100    /**
9101     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9102     * `err` or `result` depending on the state of `result_ok`.
9103     */
9104    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
9105    /**
9106     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9107     */
9108    bool result_ok;
9109 } LDKCResult_ClosingSignedDecodeErrorZ;
9110
9111
9112
9113 /**
9114  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
9115  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
9116  * to use.
9117  */
9118 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
9119    /**
9120     * A pointer to the opaque Rust object.
9121     * Nearly everywhere, inner must be non-null, however in places where
9122     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9123     */
9124    LDKnativeClosingSignedFeeRange *inner;
9125    /**
9126     * Indicates that this is the only struct which contains the same pointer.
9127     * Rust functions which take ownership of an object provided via an argument require
9128     * this to be true and invalidate the object pointed to by inner.
9129     */
9130    bool is_owned;
9131 } LDKClosingSignedFeeRange;
9132
9133 /**
9134  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9135  */
9136 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9137    /**
9138     * A pointer to the contents in the success state.
9139     * Reading from this pointer when `result_ok` is not set is undefined.
9140     */
9141    struct LDKClosingSignedFeeRange *result;
9142    /**
9143     * A pointer to the contents in the error state.
9144     * Reading from this pointer when `result_ok` is set is undefined.
9145     */
9146    struct LDKDecodeError *err;
9147 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
9148
9149 /**
9150  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9151  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9152  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9153  */
9154 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
9155    /**
9156     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9157     * `err` or `result` depending on the state of `result_ok`.
9158     */
9159    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
9160    /**
9161     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9162     */
9163    bool result_ok;
9164 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
9165
9166
9167
9168 /**
9169  * A commitment_signed message to be sent or received from a peer
9170  */
9171 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
9172    /**
9173     * A pointer to the opaque Rust object.
9174     * Nearly everywhere, inner must be non-null, however in places where
9175     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9176     */
9177    LDKnativeCommitmentSigned *inner;
9178    /**
9179     * Indicates that this is the only struct which contains the same pointer.
9180     * Rust functions which take ownership of an object provided via an argument require
9181     * this to be true and invalidate the object pointed to by inner.
9182     */
9183    bool is_owned;
9184 } LDKCommitmentSigned;
9185
9186 /**
9187  * The contents of CResult_CommitmentSignedDecodeErrorZ
9188  */
9189 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
9190    /**
9191     * A pointer to the contents in the success state.
9192     * Reading from this pointer when `result_ok` is not set is undefined.
9193     */
9194    struct LDKCommitmentSigned *result;
9195    /**
9196     * A pointer to the contents in the error state.
9197     * Reading from this pointer when `result_ok` is set is undefined.
9198     */
9199    struct LDKDecodeError *err;
9200 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
9201
9202 /**
9203  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9204  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9205  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9206  */
9207 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
9208    /**
9209     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9210     * `err` or `result` depending on the state of `result_ok`.
9211     */
9212    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
9213    /**
9214     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9215     */
9216    bool result_ok;
9217 } LDKCResult_CommitmentSignedDecodeErrorZ;
9218
9219 /**
9220  * The contents of CResult_FundingCreatedDecodeErrorZ
9221  */
9222 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
9223    /**
9224     * A pointer to the contents in the success state.
9225     * Reading from this pointer when `result_ok` is not set is undefined.
9226     */
9227    struct LDKFundingCreated *result;
9228    /**
9229     * A pointer to the contents in the error state.
9230     * Reading from this pointer when `result_ok` is set is undefined.
9231     */
9232    struct LDKDecodeError *err;
9233 } LDKCResult_FundingCreatedDecodeErrorZPtr;
9234
9235 /**
9236  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9237  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9238  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9239  */
9240 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
9241    /**
9242     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9243     * `err` or `result` depending on the state of `result_ok`.
9244     */
9245    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
9246    /**
9247     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9248     */
9249    bool result_ok;
9250 } LDKCResult_FundingCreatedDecodeErrorZ;
9251
9252 /**
9253  * The contents of CResult_FundingSignedDecodeErrorZ
9254  */
9255 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
9256    /**
9257     * A pointer to the contents in the success state.
9258     * Reading from this pointer when `result_ok` is not set is undefined.
9259     */
9260    struct LDKFundingSigned *result;
9261    /**
9262     * A pointer to the contents in the error state.
9263     * Reading from this pointer when `result_ok` is set is undefined.
9264     */
9265    struct LDKDecodeError *err;
9266 } LDKCResult_FundingSignedDecodeErrorZPtr;
9267
9268 /**
9269  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9270  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9271  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9272  */
9273 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
9274    /**
9275     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9276     * `err` or `result` depending on the state of `result_ok`.
9277     */
9278    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
9279    /**
9280     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9281     */
9282    bool result_ok;
9283 } LDKCResult_FundingSignedDecodeErrorZ;
9284
9285 /**
9286  * The contents of CResult_FundingLockedDecodeErrorZ
9287  */
9288 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
9289    /**
9290     * A pointer to the contents in the success state.
9291     * Reading from this pointer when `result_ok` is not set is undefined.
9292     */
9293    struct LDKFundingLocked *result;
9294    /**
9295     * A pointer to the contents in the error state.
9296     * Reading from this pointer when `result_ok` is set is undefined.
9297     */
9298    struct LDKDecodeError *err;
9299 } LDKCResult_FundingLockedDecodeErrorZPtr;
9300
9301 /**
9302  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
9303  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
9304  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9305  */
9306 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
9307    /**
9308     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
9309     * `err` or `result` depending on the state of `result_ok`.
9310     */
9311    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
9312    /**
9313     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
9314     */
9315    bool result_ok;
9316 } LDKCResult_FundingLockedDecodeErrorZ;
9317
9318
9319
9320 /**
9321  * An init message to be sent or received from a peer
9322  */
9323 typedef struct MUST_USE_STRUCT LDKInit {
9324    /**
9325     * A pointer to the opaque Rust object.
9326     * Nearly everywhere, inner must be non-null, however in places where
9327     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9328     */
9329    LDKnativeInit *inner;
9330    /**
9331     * Indicates that this is the only struct which contains the same pointer.
9332     * Rust functions which take ownership of an object provided via an argument require
9333     * this to be true and invalidate the object pointed to by inner.
9334     */
9335    bool is_owned;
9336 } LDKInit;
9337
9338 /**
9339  * The contents of CResult_InitDecodeErrorZ
9340  */
9341 typedef union LDKCResult_InitDecodeErrorZPtr {
9342    /**
9343     * A pointer to the contents in the success state.
9344     * Reading from this pointer when `result_ok` is not set is undefined.
9345     */
9346    struct LDKInit *result;
9347    /**
9348     * A pointer to the contents in the error state.
9349     * Reading from this pointer when `result_ok` is set is undefined.
9350     */
9351    struct LDKDecodeError *err;
9352 } LDKCResult_InitDecodeErrorZPtr;
9353
9354 /**
9355  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9356  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9357  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9358  */
9359 typedef struct LDKCResult_InitDecodeErrorZ {
9360    /**
9361     * The contents of this CResult_InitDecodeErrorZ, accessible via either
9362     * `err` or `result` depending on the state of `result_ok`.
9363     */
9364    union LDKCResult_InitDecodeErrorZPtr contents;
9365    /**
9366     * Whether this CResult_InitDecodeErrorZ represents a success state.
9367     */
9368    bool result_ok;
9369 } LDKCResult_InitDecodeErrorZ;
9370
9371 /**
9372  * The contents of CResult_OpenChannelDecodeErrorZ
9373  */
9374 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
9375    /**
9376     * A pointer to the contents in the success state.
9377     * Reading from this pointer when `result_ok` is not set is undefined.
9378     */
9379    struct LDKOpenChannel *result;
9380    /**
9381     * A pointer to the contents in the error state.
9382     * Reading from this pointer when `result_ok` is set is undefined.
9383     */
9384    struct LDKDecodeError *err;
9385 } LDKCResult_OpenChannelDecodeErrorZPtr;
9386
9387 /**
9388  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9389  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9390  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9391  */
9392 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
9393    /**
9394     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9395     * `err` or `result` depending on the state of `result_ok`.
9396     */
9397    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
9398    /**
9399     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9400     */
9401    bool result_ok;
9402 } LDKCResult_OpenChannelDecodeErrorZ;
9403
9404 /**
9405  * The contents of CResult_RevokeAndACKDecodeErrorZ
9406  */
9407 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
9408    /**
9409     * A pointer to the contents in the success state.
9410     * Reading from this pointer when `result_ok` is not set is undefined.
9411     */
9412    struct LDKRevokeAndACK *result;
9413    /**
9414     * A pointer to the contents in the error state.
9415     * Reading from this pointer when `result_ok` is set is undefined.
9416     */
9417    struct LDKDecodeError *err;
9418 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
9419
9420 /**
9421  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9422  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9423  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9424  */
9425 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
9426    /**
9427     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9428     * `err` or `result` depending on the state of `result_ok`.
9429     */
9430    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
9431    /**
9432     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9433     */
9434    bool result_ok;
9435 } LDKCResult_RevokeAndACKDecodeErrorZ;
9436
9437 /**
9438  * The contents of CResult_ShutdownDecodeErrorZ
9439  */
9440 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
9441    /**
9442     * A pointer to the contents in the success state.
9443     * Reading from this pointer when `result_ok` is not set is undefined.
9444     */
9445    struct LDKShutdown *result;
9446    /**
9447     * A pointer to the contents in the error state.
9448     * Reading from this pointer when `result_ok` is set is undefined.
9449     */
9450    struct LDKDecodeError *err;
9451 } LDKCResult_ShutdownDecodeErrorZPtr;
9452
9453 /**
9454  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9455  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9456  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9457  */
9458 typedef struct LDKCResult_ShutdownDecodeErrorZ {
9459    /**
9460     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9461     * `err` or `result` depending on the state of `result_ok`.
9462     */
9463    union LDKCResult_ShutdownDecodeErrorZPtr contents;
9464    /**
9465     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9466     */
9467    bool result_ok;
9468 } LDKCResult_ShutdownDecodeErrorZ;
9469
9470 /**
9471  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
9472  */
9473 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
9474    /**
9475     * A pointer to the contents in the success state.
9476     * Reading from this pointer when `result_ok` is not set is undefined.
9477     */
9478    struct LDKUpdateFailHTLC *result;
9479    /**
9480     * A pointer to the contents in the error state.
9481     * Reading from this pointer when `result_ok` is set is undefined.
9482     */
9483    struct LDKDecodeError *err;
9484 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
9485
9486 /**
9487  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9488  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9489  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9490  */
9491 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
9492    /**
9493     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9494     * `err` or `result` depending on the state of `result_ok`.
9495     */
9496    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
9497    /**
9498     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9499     */
9500    bool result_ok;
9501 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
9502
9503 /**
9504  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9505  */
9506 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9507    /**
9508     * A pointer to the contents in the success state.
9509     * Reading from this pointer when `result_ok` is not set is undefined.
9510     */
9511    struct LDKUpdateFailMalformedHTLC *result;
9512    /**
9513     * A pointer to the contents in the error state.
9514     * Reading from this pointer when `result_ok` is set is undefined.
9515     */
9516    struct LDKDecodeError *err;
9517 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
9518
9519 /**
9520  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9521  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9522  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9523  */
9524 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
9525    /**
9526     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9527     * `err` or `result` depending on the state of `result_ok`.
9528     */
9529    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
9530    /**
9531     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9532     */
9533    bool result_ok;
9534 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
9535
9536
9537
9538 /**
9539  * An update_fee message to be sent or received from a peer
9540  */
9541 typedef struct MUST_USE_STRUCT LDKUpdateFee {
9542    /**
9543     * A pointer to the opaque Rust object.
9544     * Nearly everywhere, inner must be non-null, however in places where
9545     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9546     */
9547    LDKnativeUpdateFee *inner;
9548    /**
9549     * Indicates that this is the only struct which contains the same pointer.
9550     * Rust functions which take ownership of an object provided via an argument require
9551     * this to be true and invalidate the object pointed to by inner.
9552     */
9553    bool is_owned;
9554 } LDKUpdateFee;
9555
9556 /**
9557  * The contents of CResult_UpdateFeeDecodeErrorZ
9558  */
9559 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
9560    /**
9561     * A pointer to the contents in the success state.
9562     * Reading from this pointer when `result_ok` is not set is undefined.
9563     */
9564    struct LDKUpdateFee *result;
9565    /**
9566     * A pointer to the contents in the error state.
9567     * Reading from this pointer when `result_ok` is set is undefined.
9568     */
9569    struct LDKDecodeError *err;
9570 } LDKCResult_UpdateFeeDecodeErrorZPtr;
9571
9572 /**
9573  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9574  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9575  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9576  */
9577 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
9578    /**
9579     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9580     * `err` or `result` depending on the state of `result_ok`.
9581     */
9582    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
9583    /**
9584     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9585     */
9586    bool result_ok;
9587 } LDKCResult_UpdateFeeDecodeErrorZ;
9588
9589 /**
9590  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9591  */
9592 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
9593    /**
9594     * A pointer to the contents in the success state.
9595     * Reading from this pointer when `result_ok` is not set is undefined.
9596     */
9597    struct LDKUpdateFulfillHTLC *result;
9598    /**
9599     * A pointer to the contents in the error state.
9600     * Reading from this pointer when `result_ok` is set is undefined.
9601     */
9602    struct LDKDecodeError *err;
9603 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
9604
9605 /**
9606  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9607  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9608  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9609  */
9610 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
9611    /**
9612     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9613     * `err` or `result` depending on the state of `result_ok`.
9614     */
9615    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
9616    /**
9617     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9618     */
9619    bool result_ok;
9620 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
9621
9622 /**
9623  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
9624  */
9625 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
9626    /**
9627     * A pointer to the contents in the success state.
9628     * Reading from this pointer when `result_ok` is not set is undefined.
9629     */
9630    struct LDKUpdateAddHTLC *result;
9631    /**
9632     * A pointer to the contents in the error state.
9633     * Reading from this pointer when `result_ok` is set is undefined.
9634     */
9635    struct LDKDecodeError *err;
9636 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
9637
9638 /**
9639  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9640  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9641  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9642  */
9643 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
9644    /**
9645     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9646     * `err` or `result` depending on the state of `result_ok`.
9647     */
9648    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
9649    /**
9650     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9651     */
9652    bool result_ok;
9653 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
9654
9655
9656
9657 /**
9658  * A ping message to be sent or received from a peer
9659  */
9660 typedef struct MUST_USE_STRUCT LDKPing {
9661    /**
9662     * A pointer to the opaque Rust object.
9663     * Nearly everywhere, inner must be non-null, however in places where
9664     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9665     */
9666    LDKnativePing *inner;
9667    /**
9668     * Indicates that this is the only struct which contains the same pointer.
9669     * Rust functions which take ownership of an object provided via an argument require
9670     * this to be true and invalidate the object pointed to by inner.
9671     */
9672    bool is_owned;
9673 } LDKPing;
9674
9675 /**
9676  * The contents of CResult_PingDecodeErrorZ
9677  */
9678 typedef union LDKCResult_PingDecodeErrorZPtr {
9679    /**
9680     * A pointer to the contents in the success state.
9681     * Reading from this pointer when `result_ok` is not set is undefined.
9682     */
9683    struct LDKPing *result;
9684    /**
9685     * A pointer to the contents in the error state.
9686     * Reading from this pointer when `result_ok` is set is undefined.
9687     */
9688    struct LDKDecodeError *err;
9689 } LDKCResult_PingDecodeErrorZPtr;
9690
9691 /**
9692  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
9693  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
9694  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9695  */
9696 typedef struct LDKCResult_PingDecodeErrorZ {
9697    /**
9698     * The contents of this CResult_PingDecodeErrorZ, accessible via either
9699     * `err` or `result` depending on the state of `result_ok`.
9700     */
9701    union LDKCResult_PingDecodeErrorZPtr contents;
9702    /**
9703     * Whether this CResult_PingDecodeErrorZ represents a success state.
9704     */
9705    bool result_ok;
9706 } LDKCResult_PingDecodeErrorZ;
9707
9708
9709
9710 /**
9711  * A pong message to be sent or received from a peer
9712  */
9713 typedef struct MUST_USE_STRUCT LDKPong {
9714    /**
9715     * A pointer to the opaque Rust object.
9716     * Nearly everywhere, inner must be non-null, however in places where
9717     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9718     */
9719    LDKnativePong *inner;
9720    /**
9721     * Indicates that this is the only struct which contains the same pointer.
9722     * Rust functions which take ownership of an object provided via an argument require
9723     * this to be true and invalidate the object pointed to by inner.
9724     */
9725    bool is_owned;
9726 } LDKPong;
9727
9728 /**
9729  * The contents of CResult_PongDecodeErrorZ
9730  */
9731 typedef union LDKCResult_PongDecodeErrorZPtr {
9732    /**
9733     * A pointer to the contents in the success state.
9734     * Reading from this pointer when `result_ok` is not set is undefined.
9735     */
9736    struct LDKPong *result;
9737    /**
9738     * A pointer to the contents in the error state.
9739     * Reading from this pointer when `result_ok` is set is undefined.
9740     */
9741    struct LDKDecodeError *err;
9742 } LDKCResult_PongDecodeErrorZPtr;
9743
9744 /**
9745  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
9746  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
9747  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9748  */
9749 typedef struct LDKCResult_PongDecodeErrorZ {
9750    /**
9751     * The contents of this CResult_PongDecodeErrorZ, accessible via either
9752     * `err` or `result` depending on the state of `result_ok`.
9753     */
9754    union LDKCResult_PongDecodeErrorZPtr contents;
9755    /**
9756     * Whether this CResult_PongDecodeErrorZ represents a success state.
9757     */
9758    bool result_ok;
9759 } LDKCResult_PongDecodeErrorZ;
9760
9761 /**
9762  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
9763  */
9764 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
9765    /**
9766     * A pointer to the contents in the success state.
9767     * Reading from this pointer when `result_ok` is not set is undefined.
9768     */
9769    struct LDKUnsignedChannelAnnouncement *result;
9770    /**
9771     * A pointer to the contents in the error state.
9772     * Reading from this pointer when `result_ok` is set is undefined.
9773     */
9774    struct LDKDecodeError *err;
9775 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
9776
9777 /**
9778  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9779  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9780  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9781  */
9782 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
9783    /**
9784     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
9785     * `err` or `result` depending on the state of `result_ok`.
9786     */
9787    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
9788    /**
9789     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
9790     */
9791    bool result_ok;
9792 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
9793
9794 /**
9795  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
9796  */
9797 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
9798    /**
9799     * A pointer to the contents in the success state.
9800     * Reading from this pointer when `result_ok` is not set is undefined.
9801     */
9802    struct LDKChannelAnnouncement *result;
9803    /**
9804     * A pointer to the contents in the error state.
9805     * Reading from this pointer when `result_ok` is set is undefined.
9806     */
9807    struct LDKDecodeError *err;
9808 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
9809
9810 /**
9811  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
9812  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
9813  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9814  */
9815 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
9816    /**
9817     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
9818     * `err` or `result` depending on the state of `result_ok`.
9819     */
9820    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
9821    /**
9822     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
9823     */
9824    bool result_ok;
9825 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
9826
9827
9828
9829 /**
9830  * The unsigned part of a channel_update
9831  */
9832 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
9833    /**
9834     * A pointer to the opaque Rust object.
9835     * Nearly everywhere, inner must be non-null, however in places where
9836     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9837     */
9838    LDKnativeUnsignedChannelUpdate *inner;
9839    /**
9840     * Indicates that this is the only struct which contains the same pointer.
9841     * Rust functions which take ownership of an object provided via an argument require
9842     * this to be true and invalidate the object pointed to by inner.
9843     */
9844    bool is_owned;
9845 } LDKUnsignedChannelUpdate;
9846
9847 /**
9848  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
9849  */
9850 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
9851    /**
9852     * A pointer to the contents in the success state.
9853     * Reading from this pointer when `result_ok` is not set is undefined.
9854     */
9855    struct LDKUnsignedChannelUpdate *result;
9856    /**
9857     * A pointer to the contents in the error state.
9858     * Reading from this pointer when `result_ok` is set is undefined.
9859     */
9860    struct LDKDecodeError *err;
9861 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
9862
9863 /**
9864  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
9865  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9866  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9867  */
9868 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
9869    /**
9870     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
9871     * `err` or `result` depending on the state of `result_ok`.
9872     */
9873    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
9874    /**
9875     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
9876     */
9877    bool result_ok;
9878 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
9879
9880 /**
9881  * The contents of CResult_ChannelUpdateDecodeErrorZ
9882  */
9883 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
9884    /**
9885     * A pointer to the contents in the success state.
9886     * Reading from this pointer when `result_ok` is not set is undefined.
9887     */
9888    struct LDKChannelUpdate *result;
9889    /**
9890     * A pointer to the contents in the error state.
9891     * Reading from this pointer when `result_ok` is set is undefined.
9892     */
9893    struct LDKDecodeError *err;
9894 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
9895
9896 /**
9897  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
9898  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
9899  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9900  */
9901 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
9902    /**
9903     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
9904     * `err` or `result` depending on the state of `result_ok`.
9905     */
9906    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
9907    /**
9908     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
9909     */
9910    bool result_ok;
9911 } LDKCResult_ChannelUpdateDecodeErrorZ;
9912
9913 /**
9914  * The contents of CResult_ErrorMessageDecodeErrorZ
9915  */
9916 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
9917    /**
9918     * A pointer to the contents in the success state.
9919     * Reading from this pointer when `result_ok` is not set is undefined.
9920     */
9921    struct LDKErrorMessage *result;
9922    /**
9923     * A pointer to the contents in the error state.
9924     * Reading from this pointer when `result_ok` is set is undefined.
9925     */
9926    struct LDKDecodeError *err;
9927 } LDKCResult_ErrorMessageDecodeErrorZPtr;
9928
9929 /**
9930  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
9931  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
9932  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9933  */
9934 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
9935    /**
9936     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
9937     * `err` or `result` depending on the state of `result_ok`.
9938     */
9939    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
9940    /**
9941     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
9942     */
9943    bool result_ok;
9944 } LDKCResult_ErrorMessageDecodeErrorZ;
9945
9946 /**
9947  * The contents of CResult_WarningMessageDecodeErrorZ
9948  */
9949 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
9950    /**
9951     * A pointer to the contents in the success state.
9952     * Reading from this pointer when `result_ok` is not set is undefined.
9953     */
9954    struct LDKWarningMessage *result;
9955    /**
9956     * A pointer to the contents in the error state.
9957     * Reading from this pointer when `result_ok` is set is undefined.
9958     */
9959    struct LDKDecodeError *err;
9960 } LDKCResult_WarningMessageDecodeErrorZPtr;
9961
9962 /**
9963  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
9964  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
9965  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9966  */
9967 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
9968    /**
9969     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
9970     * `err` or `result` depending on the state of `result_ok`.
9971     */
9972    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
9973    /**
9974     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
9975     */
9976    bool result_ok;
9977 } LDKCResult_WarningMessageDecodeErrorZ;
9978
9979
9980
9981 /**
9982  * The unsigned part of a node_announcement
9983  */
9984 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
9985    /**
9986     * A pointer to the opaque Rust object.
9987     * Nearly everywhere, inner must be non-null, however in places where
9988     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9989     */
9990    LDKnativeUnsignedNodeAnnouncement *inner;
9991    /**
9992     * Indicates that this is the only struct which contains the same pointer.
9993     * Rust functions which take ownership of an object provided via an argument require
9994     * this to be true and invalidate the object pointed to by inner.
9995     */
9996    bool is_owned;
9997 } LDKUnsignedNodeAnnouncement;
9998
9999 /**
10000  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10001  */
10002 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10003    /**
10004     * A pointer to the contents in the success state.
10005     * Reading from this pointer when `result_ok` is not set is undefined.
10006     */
10007    struct LDKUnsignedNodeAnnouncement *result;
10008    /**
10009     * A pointer to the contents in the error state.
10010     * Reading from this pointer when `result_ok` is set is undefined.
10011     */
10012    struct LDKDecodeError *err;
10013 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
10014
10015 /**
10016  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10017  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10018  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10019  */
10020 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
10021    /**
10022     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10023     * `err` or `result` depending on the state of `result_ok`.
10024     */
10025    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
10026    /**
10027     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10028     */
10029    bool result_ok;
10030 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
10031
10032 /**
10033  * The contents of CResult_NodeAnnouncementDecodeErrorZ
10034  */
10035 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
10036    /**
10037     * A pointer to the contents in the success state.
10038     * Reading from this pointer when `result_ok` is not set is undefined.
10039     */
10040    struct LDKNodeAnnouncement *result;
10041    /**
10042     * A pointer to the contents in the error state.
10043     * Reading from this pointer when `result_ok` is set is undefined.
10044     */
10045    struct LDKDecodeError *err;
10046 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
10047
10048 /**
10049  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10050  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10051  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10052  */
10053 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
10054    /**
10055     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10056     * `err` or `result` depending on the state of `result_ok`.
10057     */
10058    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
10059    /**
10060     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10061     */
10062    bool result_ok;
10063 } LDKCResult_NodeAnnouncementDecodeErrorZ;
10064
10065 /**
10066  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10067  */
10068 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
10069    /**
10070     * A pointer to the contents in the success state.
10071     * Reading from this pointer when `result_ok` is not set is undefined.
10072     */
10073    struct LDKQueryShortChannelIds *result;
10074    /**
10075     * A pointer to the contents in the error state.
10076     * Reading from this pointer when `result_ok` is set is undefined.
10077     */
10078    struct LDKDecodeError *err;
10079 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
10080
10081 /**
10082  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10083  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10084  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10085  */
10086 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
10087    /**
10088     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10089     * `err` or `result` depending on the state of `result_ok`.
10090     */
10091    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
10092    /**
10093     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10094     */
10095    bool result_ok;
10096 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
10097
10098
10099
10100 /**
10101  * A reply_short_channel_ids_end message is sent as a reply to a
10102  * query_short_channel_ids message. The query recipient makes a best
10103  * effort to respond based on their local network view which may not be
10104  * a perfect view of the network.
10105  */
10106 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
10107    /**
10108     * A pointer to the opaque Rust object.
10109     * Nearly everywhere, inner must be non-null, however in places where
10110     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10111     */
10112    LDKnativeReplyShortChannelIdsEnd *inner;
10113    /**
10114     * Indicates that this is the only struct which contains the same pointer.
10115     * Rust functions which take ownership of an object provided via an argument require
10116     * this to be true and invalidate the object pointed to by inner.
10117     */
10118    bool is_owned;
10119 } LDKReplyShortChannelIdsEnd;
10120
10121 /**
10122  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10123  */
10124 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10125    /**
10126     * A pointer to the contents in the success state.
10127     * Reading from this pointer when `result_ok` is not set is undefined.
10128     */
10129    struct LDKReplyShortChannelIdsEnd *result;
10130    /**
10131     * A pointer to the contents in the error state.
10132     * Reading from this pointer when `result_ok` is set is undefined.
10133     */
10134    struct LDKDecodeError *err;
10135 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
10136
10137 /**
10138  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10139  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10140  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10141  */
10142 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
10143    /**
10144     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10145     * `err` or `result` depending on the state of `result_ok`.
10146     */
10147    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
10148    /**
10149     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10150     */
10151    bool result_ok;
10152 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
10153
10154 /**
10155  * The contents of CResult_QueryChannelRangeDecodeErrorZ
10156  */
10157 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
10158    /**
10159     * A pointer to the contents in the success state.
10160     * Reading from this pointer when `result_ok` is not set is undefined.
10161     */
10162    struct LDKQueryChannelRange *result;
10163    /**
10164     * A pointer to the contents in the error state.
10165     * Reading from this pointer when `result_ok` is set is undefined.
10166     */
10167    struct LDKDecodeError *err;
10168 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
10169
10170 /**
10171  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10172  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10173  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10174  */
10175 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
10176    /**
10177     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10178     * `err` or `result` depending on the state of `result_ok`.
10179     */
10180    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
10181    /**
10182     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10183     */
10184    bool result_ok;
10185 } LDKCResult_QueryChannelRangeDecodeErrorZ;
10186
10187 /**
10188  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
10189  */
10190 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
10191    /**
10192     * A pointer to the contents in the success state.
10193     * Reading from this pointer when `result_ok` is not set is undefined.
10194     */
10195    struct LDKReplyChannelRange *result;
10196    /**
10197     * A pointer to the contents in the error state.
10198     * Reading from this pointer when `result_ok` is set is undefined.
10199     */
10200    struct LDKDecodeError *err;
10201 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
10202
10203 /**
10204  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10205  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10206  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10207  */
10208 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
10209    /**
10210     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10211     * `err` or `result` depending on the state of `result_ok`.
10212     */
10213    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
10214    /**
10215     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10216     */
10217    bool result_ok;
10218 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
10219
10220
10221
10222 /**
10223  * A gossip_timestamp_filter message is used by a node to request
10224  * gossip relay for messages in the requested time range when the
10225  * gossip_queries feature has been negotiated.
10226  */
10227 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
10228    /**
10229     * A pointer to the opaque Rust object.
10230     * Nearly everywhere, inner must be non-null, however in places where
10231     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10232     */
10233    LDKnativeGossipTimestampFilter *inner;
10234    /**
10235     * Indicates that this is the only struct which contains the same pointer.
10236     * Rust functions which take ownership of an object provided via an argument require
10237     * this to be true and invalidate the object pointed to by inner.
10238     */
10239    bool is_owned;
10240 } LDKGossipTimestampFilter;
10241
10242 /**
10243  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
10244  */
10245 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
10246    /**
10247     * A pointer to the contents in the success state.
10248     * Reading from this pointer when `result_ok` is not set is undefined.
10249     */
10250    struct LDKGossipTimestampFilter *result;
10251    /**
10252     * A pointer to the contents in the error state.
10253     * Reading from this pointer when `result_ok` is set is undefined.
10254     */
10255    struct LDKDecodeError *err;
10256 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
10257
10258 /**
10259  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10260  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10261  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10262  */
10263 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
10264    /**
10265     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10266     * `err` or `result` depending on the state of `result_ok`.
10267     */
10268    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
10269    /**
10270     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10271     */
10272    bool result_ok;
10273 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
10274
10275 /**
10276  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
10277  * This corresponds to std::vector in C++
10278  */
10279 typedef struct LDKCVec_PhantomRouteHintsZ {
10280    /**
10281     * The elements in the array.
10282     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10283     */
10284    struct LDKPhantomRouteHints *data;
10285    /**
10286     * The number of elements pointed to by `data`.
10287     */
10288    uintptr_t datalen;
10289 } LDKCVec_PhantomRouteHintsZ;
10290
10291 /**
10292  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
10293  * may occur.
10294  */
10295 typedef enum LDKSignOrCreationError_Tag {
10296    /**
10297     * An error occurred during signing
10298     */
10299    LDKSignOrCreationError_SignError,
10300    /**
10301     * An error occurred while building the transaction
10302     */
10303    LDKSignOrCreationError_CreationError,
10304    /**
10305     * Must be last for serialization purposes
10306     */
10307    LDKSignOrCreationError_Sentinel,
10308 } LDKSignOrCreationError_Tag;
10309
10310 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
10311    LDKSignOrCreationError_Tag tag;
10312    union {
10313       struct {
10314          enum LDKCreationError creation_error;
10315       };
10316    };
10317 } LDKSignOrCreationError;
10318
10319 /**
10320  * The contents of CResult_InvoiceSignOrCreationErrorZ
10321  */
10322 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
10323    /**
10324     * A pointer to the contents in the success state.
10325     * Reading from this pointer when `result_ok` is not set is undefined.
10326     */
10327    struct LDKInvoice *result;
10328    /**
10329     * A pointer to the contents in the error state.
10330     * Reading from this pointer when `result_ok` is set is undefined.
10331     */
10332    struct LDKSignOrCreationError *err;
10333 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
10334
10335 /**
10336  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10337  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10338  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10339  */
10340 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
10341    /**
10342     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
10343     * `err` or `result` depending on the state of `result_ok`.
10344     */
10345    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
10346    /**
10347     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
10348     */
10349    bool result_ok;
10350 } LDKCResult_InvoiceSignOrCreationErrorZ;
10351
10352
10353
10354 /**
10355  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
10356  *
10357  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
10358  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
10359  * the return value of [`Filter::register_output`].
10360  *
10361  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
10362  * may have been spent there. See [`Filter::register_output`] for details.
10363  *
10364  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
10365  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
10366  */
10367 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
10368    /**
10369     * A pointer to the opaque Rust object.
10370     * Nearly everywhere, inner must be non-null, however in places where
10371     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10372     */
10373    LDKnativeWatchedOutput *inner;
10374    /**
10375     * Indicates that this is the only struct which contains the same pointer.
10376     * Rust functions which take ownership of an object provided via an argument require
10377     * this to be true and invalidate the object pointed to by inner.
10378     */
10379    bool is_owned;
10380 } LDKWatchedOutput;
10381
10382 /**
10383  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
10384  * channels.
10385  *
10386  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
10387  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
10388  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
10389  * receiving full blocks from a chain source, any further filtering is unnecessary.
10390  *
10391  * After an output has been registered, subsequent block retrievals from the chain source must not
10392  * exclude any transactions matching the new criteria nor any in-block descendants of such
10393  * transactions.
10394  *
10395  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
10396  * should not block on I/O. Implementations should instead queue the newly monitored data to be
10397  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
10398  * invocation that has called the `Filter` must return [`TemporaryFailure`].
10399  *
10400  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
10401  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
10402  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
10403  */
10404 typedef struct LDKFilter {
10405    /**
10406     * An opaque pointer which is passed to your function implementations as an argument.
10407     * This has no meaning in the LDK, and can be NULL or any other value.
10408     */
10409    void *this_arg;
10410    /**
10411     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
10412     * a spending condition.
10413     */
10414    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
10415    /**
10416     * Registers interest in spends of a transaction output.
10417     *
10418     * Optionally, when `output.block_hash` is set, should return any transaction spending the
10419     * output that is found in the corresponding block along with its index.
10420     *
10421     * This return value is useful for Electrum clients in order to supply in-block descendant
10422     * transactions which otherwise were not included. This is not necessary for other clients if
10423     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
10424     * full block).
10425     */
10426    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
10427    /**
10428     * Frees any resources associated with this object given its this_arg pointer.
10429     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10430     */
10431    void (*free)(void *this_arg);
10432 } LDKFilter;
10433
10434 /**
10435  * An enum which can either contain a crate::lightning::chain::Filter or not
10436  */
10437 typedef enum LDKCOption_FilterZ_Tag {
10438    /**
10439     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
10440     */
10441    LDKCOption_FilterZ_Some,
10442    /**
10443     * When we're in this state, this COption_FilterZ contains nothing
10444     */
10445    LDKCOption_FilterZ_None,
10446    /**
10447     * Must be last for serialization purposes
10448     */
10449    LDKCOption_FilterZ_Sentinel,
10450 } LDKCOption_FilterZ_Tag;
10451
10452 typedef struct LDKCOption_FilterZ {
10453    LDKCOption_FilterZ_Tag tag;
10454    union {
10455       struct {
10456          struct LDKFilter some;
10457       };
10458    };
10459 } LDKCOption_FilterZ;
10460
10461
10462
10463 /**
10464  * A read-only reference to a current ChannelMonitor.
10465  *
10466  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
10467  * released.
10468  */
10469 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
10470    /**
10471     * A pointer to the opaque Rust object.
10472     * Nearly everywhere, inner must be non-null, however in places where
10473     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10474     */
10475    LDKnativeLockedChannelMonitor *inner;
10476    /**
10477     * Indicates that this is the only struct which contains the same pointer.
10478     * Rust functions which take ownership of an object provided via an argument require
10479     * this to be true and invalidate the object pointed to by inner.
10480     */
10481    bool is_owned;
10482 } LDKLockedChannelMonitor;
10483
10484 /**
10485  * The contents of CResult_LockedChannelMonitorNoneZ
10486  */
10487 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
10488    /**
10489     * A pointer to the contents in the success state.
10490     * Reading from this pointer when `result_ok` is not set is undefined.
10491     */
10492    struct LDKLockedChannelMonitor *result;
10493    /**
10494     * Note that this value is always NULL, as there are no contents in the Err variant
10495     */
10496    void *err;
10497 } LDKCResult_LockedChannelMonitorNoneZPtr;
10498
10499 /**
10500  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
10501  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
10502  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10503  */
10504 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
10505    /**
10506     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
10507     * `err` or `result` depending on the state of `result_ok`.
10508     */
10509    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
10510    /**
10511     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
10512     */
10513    bool result_ok;
10514 } LDKCResult_LockedChannelMonitorNoneZ;
10515
10516 /**
10517  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
10518  * This corresponds to std::vector in C++
10519  */
10520 typedef struct LDKCVec_OutPointZ {
10521    /**
10522     * The elements in the array.
10523     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10524     */
10525    struct LDKOutPoint *data;
10526    /**
10527     * The number of elements pointed to by `data`.
10528     */
10529    uintptr_t datalen;
10530 } LDKCVec_OutPointZ;
10531
10532 /**
10533  * A trait indicating an object may generate message send events
10534  */
10535 typedef struct LDKMessageSendEventsProvider {
10536    /**
10537     * An opaque pointer which is passed to your function implementations as an argument.
10538     * This has no meaning in the LDK, and can be NULL or any other value.
10539     */
10540    void *this_arg;
10541    /**
10542     * Gets the list of pending events which were generated by previous actions, clearing the list
10543     * in the process.
10544     */
10545    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
10546    /**
10547     * Frees any resources associated with this object given its this_arg pointer.
10548     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10549     */
10550    void (*free)(void *this_arg);
10551 } LDKMessageSendEventsProvider;
10552
10553 /**
10554  * A trait implemented for objects handling events from [`EventsProvider`].
10555  */
10556 typedef struct LDKEventHandler {
10557    /**
10558     * An opaque pointer which is passed to your function implementations as an argument.
10559     * This has no meaning in the LDK, and can be NULL or any other value.
10560     */
10561    void *this_arg;
10562    /**
10563     * Handles the given [`Event`].
10564     *
10565     * See [`EventsProvider`] for details that must be considered when implementing this method.
10566     */
10567    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
10568    /**
10569     * Frees any resources associated with this object given its this_arg pointer.
10570     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10571     */
10572    void (*free)(void *this_arg);
10573 } LDKEventHandler;
10574
10575 /**
10576  * A trait indicating an object may generate events.
10577  *
10578  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
10579  *
10580  * # Requirements
10581  *
10582  * See [`process_pending_events`] for requirements around event processing.
10583  *
10584  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
10585  * event since the last invocation. The handler must either act upon the event immediately
10586  * or preserve it for later handling.
10587  *
10588  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
10589  * consult the provider's documentation on the implication of processing events and how a handler
10590  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
10591  * [`ChainMonitor::process_pending_events`]).
10592  *
10593  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
10594  * own type(s).
10595  *
10596  * [`process_pending_events`]: Self::process_pending_events
10597  * [`handle_event`]: EventHandler::handle_event
10598  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
10599  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
10600  */
10601 typedef struct LDKEventsProvider {
10602    /**
10603     * An opaque pointer which is passed to your function implementations as an argument.
10604     * This has no meaning in the LDK, and can be NULL or any other value.
10605     */
10606    void *this_arg;
10607    /**
10608     * Processes any events generated since the last call using the given event handler.
10609     *
10610     * Subsequent calls must only process new events. However, handlers must be capable of handling
10611     * duplicate events across process restarts. This may occur if the provider was recovered from
10612     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
10613     */
10614    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
10615    /**
10616     * Frees any resources associated with this object given its this_arg pointer.
10617     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10618     */
10619    void (*free)(void *this_arg);
10620 } LDKEventsProvider;
10621
10622
10623
10624 /**
10625  * Configuration we set when applicable.
10626  *
10627  * Default::default() provides sane defaults.
10628  */
10629 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
10630    /**
10631     * A pointer to the opaque Rust object.
10632     * Nearly everywhere, inner must be non-null, however in places where
10633     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10634     */
10635    LDKnativeChannelHandshakeConfig *inner;
10636    /**
10637     * Indicates that this is the only struct which contains the same pointer.
10638     * Rust functions which take ownership of an object provided via an argument require
10639     * this to be true and invalidate the object pointed to by inner.
10640     */
10641    bool is_owned;
10642 } LDKChannelHandshakeConfig;
10643
10644
10645
10646 /**
10647  * Optional channel limits which are applied during channel creation.
10648  *
10649  * These limits are only applied to our counterparty's limits, not our own.
10650  *
10651  * Use 0/<type>::max_value() as appropriate to skip checking.
10652  *
10653  * Provides sane defaults for most configurations.
10654  *
10655  * Most additional limits are disabled except those with which specify a default in individual
10656  * field documentation. Note that this may result in barely-usable channels, but since they
10657  * are applied mostly only to incoming channels that's not much of a problem.
10658  */
10659 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
10660    /**
10661     * A pointer to the opaque Rust object.
10662     * Nearly everywhere, inner must be non-null, however in places where
10663     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10664     */
10665    LDKnativeChannelHandshakeLimits *inner;
10666    /**
10667     * Indicates that this is the only struct which contains the same pointer.
10668     * Rust functions which take ownership of an object provided via an argument require
10669     * this to be true and invalidate the object pointed to by inner.
10670     */
10671    bool is_owned;
10672 } LDKChannelHandshakeLimits;
10673
10674
10675
10676 /**
10677  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
10678  *
10679  * Default::default() provides sane defaults for most configurations
10680  * (but currently with 0 relay fees!)
10681  */
10682 typedef struct MUST_USE_STRUCT LDKUserConfig {
10683    /**
10684     * A pointer to the opaque Rust object.
10685     * Nearly everywhere, inner must be non-null, however in places where
10686     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10687     */
10688    LDKnativeUserConfig *inner;
10689    /**
10690     * Indicates that this is the only struct which contains the same pointer.
10691     * Rust functions which take ownership of an object provided via an argument require
10692     * this to be true and invalidate the object pointed to by inner.
10693     */
10694    bool is_owned;
10695 } LDKUserConfig;
10696
10697
10698
10699 /**
10700  * The best known block as identified by its hash and height.
10701  */
10702 typedef struct MUST_USE_STRUCT LDKBestBlock {
10703    /**
10704     * A pointer to the opaque Rust object.
10705     * Nearly everywhere, inner must be non-null, however in places where
10706     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10707     */
10708    LDKnativeBestBlock *inner;
10709    /**
10710     * Indicates that this is the only struct which contains the same pointer.
10711     * Rust functions which take ownership of an object provided via an argument require
10712     * this to be true and invalidate the object pointed to by inner.
10713     */
10714    bool is_owned;
10715 } LDKBestBlock;
10716
10717 /**
10718  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
10719  * chain.
10720  *
10721  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
10722  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
10723  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
10724  * when needed.
10725  */
10726 typedef struct LDKListen {
10727    /**
10728     * An opaque pointer which is passed to your function implementations as an argument.
10729     * This has no meaning in the LDK, and can be NULL or any other value.
10730     */
10731    void *this_arg;
10732    /**
10733     * Notifies the listener that a block was added at the given height.
10734     */
10735    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
10736    /**
10737     * Notifies the listener that a block was removed at the given height.
10738     */
10739    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
10740    /**
10741     * Frees any resources associated with this object given its this_arg pointer.
10742     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10743     */
10744    void (*free)(void *this_arg);
10745 } LDKListen;
10746
10747 /**
10748  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
10749  * unconfirmed during a chain reorganization.
10750  *
10751  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
10752  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
10753  * related to registered transactions and outputs. Upon notification, it would pass along the
10754  * matching transactions using this interface.
10755  *
10756  * # Use
10757  *
10758  * The intended use is as follows:
10759  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
10760  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
10761  *   that has been reorganized out of the chain.
10762  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
10763  *
10764  * # Order
10765  *
10766  * Clients must call these methods in chain order. Specifically:
10767  * - Transactions confirmed in a block must be given before transactions confirmed in a later
10768  *   block.
10769  * - Dependent transactions within the same block must be given in topological order, possibly in
10770  *   separate calls.
10771  * - Unconfirmed transactions must be given after the original confirmations and before any
10772  *   reconfirmation.
10773  *
10774  * See individual method documentation for further details.
10775  *
10776  * [`transactions_confirmed`]: Self::transactions_confirmed
10777  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10778  * [`best_block_updated`]: Self::best_block_updated
10779  * [`get_relevant_txids`]: Self::get_relevant_txids
10780  */
10781 typedef struct LDKConfirm {
10782    /**
10783     * An opaque pointer which is passed to your function implementations as an argument.
10784     * This has no meaning in the LDK, and can be NULL or any other value.
10785     */
10786    void *this_arg;
10787    /**
10788     * Processes transactions confirmed in a block with a given header and height.
10789     *
10790     * Should be called for any transactions registered by [`Filter::register_tx`] or any
10791     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
10792     * appearing in the same block do not need to be included in the same call; instead, multiple
10793     * calls with additional transactions may be made so long as they are made in [chain order].
10794     *
10795     * May be called before or after [`best_block_updated`] for the corresponding block. However,
10796     * in the event of a chain reorganization, it must not be called with a `header` that is no
10797     * longer in the chain as of the last call to [`best_block_updated`].
10798     *
10799     * [chain order]: Confirm#Order
10800     * [`best_block_updated`]: Self::best_block_updated
10801     */
10802    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
10803    /**
10804     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
10805     *
10806     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
10807     * reorganized out of the best chain. Once called, the given transaction should not be returned
10808     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
10809     *
10810     * [`get_relevant_txids`]: Self::get_relevant_txids
10811     * [`transactions_confirmed`]: Self::transactions_confirmed
10812     */
10813    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
10814    /**
10815     * Processes an update to the best header connected at the given height.
10816     *
10817     * Should be called when a new header is available but may be skipped for intermediary blocks
10818     * if they become available at the same time.
10819     */
10820    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
10821    /**
10822     * Returns transactions that should be monitored for reorganization out of the chain.
10823     *
10824     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
10825     * confirmations to be safe from a chain reorganization. Should not include any transactions
10826     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
10827     *
10828     * May be called to determine the subset of transactions that must still be monitored for
10829     * reorganization. Will be idempotent between calls but may change as a result of calls to the
10830     * other interface methods. Thus, this is useful to determine which transactions may need to be
10831     * given to [`transaction_unconfirmed`].
10832     *
10833     * [`transactions_confirmed`]: Self::transactions_confirmed
10834     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
10835     */
10836    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
10837    /**
10838     * Frees any resources associated with this object given its this_arg pointer.
10839     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10840     */
10841    void (*free)(void *this_arg);
10842 } LDKConfirm;
10843
10844
10845
10846 /**
10847  * An opaque identifier describing a specific [`Persist`] method call.
10848  */
10849 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
10850    /**
10851     * A pointer to the opaque Rust object.
10852     * Nearly everywhere, inner must be non-null, however in places where
10853     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10854     */
10855    LDKnativeMonitorUpdateId *inner;
10856    /**
10857     * Indicates that this is the only struct which contains the same pointer.
10858     * Rust functions which take ownership of an object provided via an argument require
10859     * this to be true and invalidate the object pointed to by inner.
10860     */
10861    bool is_owned;
10862 } LDKMonitorUpdateId;
10863
10864 /**
10865  * `Persist` defines behavior for persisting channel monitors: this could mean
10866  * writing once to disk, and/or uploading to one or more backup services.
10867  *
10868  * Each method can return three possible values:
10869  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
10870  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
10871  *  * If persistence happens asynchronously, implementations should first ensure the
10872  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
10873  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
10874  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
10875  *    called with the corresponding [`MonitorUpdateId`].
10876  *
10877  *    Note that unlike the direct [`chain::Watch`] interface,
10878  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
10879  *
10880  *  * If persistence fails for some reason, implementations should return
10881  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
10882  *    closed without broadcasting the latest state. See
10883  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
10884  */
10885 typedef struct LDKPersist {
10886    /**
10887     * An opaque pointer which is passed to your function implementations as an argument.
10888     * This has no meaning in the LDK, and can be NULL or any other value.
10889     */
10890    void *this_arg;
10891    /**
10892     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
10893     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
10894     *
10895     * The data can be stored any way you want, but the identifier provided by LDK is the
10896     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
10897     * and the stored channel data). Note that you **must** persist every new monitor to disk.
10898     *
10899     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
10900     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
10901     *
10902     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
10903     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
10904     *
10905     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
10906     * [`Writeable::write`]: crate::util::ser::Writeable::write
10907     */
10908    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
10909    /**
10910     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
10911     * update.
10912     *
10913     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
10914     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
10915     * details.
10916     *
10917     * During blockchain synchronization operations, this may be called with no
10918     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
10919     * Note that after the full [`ChannelMonitor`] is persisted any previous
10920     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
10921     * applied to the persisted [`ChannelMonitor`] as they were already applied.
10922     *
10923     * If an implementer chooses to persist the updates only, they need to make
10924     * sure that all the updates are applied to the `ChannelMonitors` *before*
10925     * the set of channel monitors is given to the `ChannelManager`
10926     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
10927     * applying a monitor update to a monitor. If full `ChannelMonitors` are
10928     * persisted, then there is no need to persist individual updates.
10929     *
10930     * Note that there could be a performance tradeoff between persisting complete
10931     * channel monitors on every update vs. persisting only updates and applying
10932     * them in batches. The size of each monitor grows `O(number of state updates)`
10933     * whereas updates are small and `O(1)`.
10934     *
10935     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
10936     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
10937     *
10938     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
10939     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
10940     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
10941     *
10942     * [`Writeable::write`]: crate::util::ser::Writeable::write
10943     *
10944     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
10945     */
10946    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);
10947    /**
10948     * Frees any resources associated with this object given its this_arg pointer.
10949     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10950     */
10951    void (*free)(void *this_arg);
10952 } LDKPersist;
10953
10954
10955
10956 /**
10957  * An implementation of [`chain::Watch`] for monitoring channels.
10958  *
10959  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
10960  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
10961  * or used independently to monitor channels remotely. See the [module-level documentation] for
10962  * details.
10963  *
10964  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
10965  * [module-level documentation]: crate::chain::chainmonitor
10966  */
10967 typedef struct MUST_USE_STRUCT LDKChainMonitor {
10968    /**
10969     * A pointer to the opaque Rust object.
10970     * Nearly everywhere, inner must be non-null, however in places where
10971     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10972     */
10973    LDKnativeChainMonitor *inner;
10974    /**
10975     * Indicates that this is the only struct which contains the same pointer.
10976     * Rust functions which take ownership of an object provided via an argument require
10977     * this to be true and invalidate the object pointed to by inner.
10978     */
10979    bool is_owned;
10980 } LDKChainMonitor;
10981
10982
10983
10984 /**
10985  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
10986  * and derives keys from that.
10987  *
10988  * Your node_id is seed/0'
10989  * ChannelMonitor closes may use seed/1'
10990  * Cooperative closes may use seed/2'
10991  * The two close keys may be needed to claim on-chain funds!
10992  *
10993  * This struct cannot be used for nodes that wish to support receiving phantom payments;
10994  * [`PhantomKeysManager`] must be used instead.
10995  *
10996  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
10997  * previously issued invoices and attempts to pay previous invoices will fail.
10998  */
10999 typedef struct MUST_USE_STRUCT LDKKeysManager {
11000    /**
11001     * A pointer to the opaque Rust object.
11002     * Nearly everywhere, inner must be non-null, however in places where
11003     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11004     */
11005    LDKnativeKeysManager *inner;
11006    /**
11007     * Indicates that this is the only struct which contains the same pointer.
11008     * Rust functions which take ownership of an object provided via an argument require
11009     * this to be true and invalidate the object pointed to by inner.
11010     */
11011    bool is_owned;
11012 } LDKKeysManager;
11013
11014
11015
11016 /**
11017  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
11018  * payments.
11019  *
11020  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
11021  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
11022  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
11023  * itself without ever needing to forward to this fake node.
11024  *
11025  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
11026  * provide some fault tolerance, because payers will automatically retry paying other provided
11027  * nodes in the case that one node goes down.
11028  *
11029  * Note that multi-path payments are not supported in phantom invoices for security reasons.
11030  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
11031  * invoices and attempts to pay previous invoices will fail.
11032  */
11033 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
11034    /**
11035     * A pointer to the opaque Rust object.
11036     * Nearly everywhere, inner must be non-null, however in places where
11037     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11038     */
11039    LDKnativePhantomKeysManager *inner;
11040    /**
11041     * Indicates that this is the only struct which contains the same pointer.
11042     * Rust functions which take ownership of an object provided via an argument require
11043     * this to be true and invalidate the object pointed to by inner.
11044     */
11045    bool is_owned;
11046 } LDKPhantomKeysManager;
11047
11048
11049
11050 /**
11051  * Chain-related parameters used to construct a new `ChannelManager`.
11052  *
11053  * Typically, the block-specific parameters are derived from the best block hash for the network,
11054  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
11055  * are not needed when deserializing a previously constructed `ChannelManager`.
11056  */
11057 typedef struct MUST_USE_STRUCT LDKChainParameters {
11058    /**
11059     * A pointer to the opaque Rust object.
11060     * Nearly everywhere, inner must be non-null, however in places where
11061     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11062     */
11063    LDKnativeChainParameters *inner;
11064    /**
11065     * Indicates that this is the only struct which contains the same pointer.
11066     * Rust functions which take ownership of an object provided via an argument require
11067     * this to be true and invalidate the object pointed to by inner.
11068     */
11069    bool is_owned;
11070 } LDKChainParameters;
11071
11072 /**
11073  * A 3-byte byte array.
11074  */
11075 typedef struct LDKThreeBytes {
11076    /**
11077     * The three bytes
11078     */
11079    uint8_t data[3];
11080 } LDKThreeBytes;
11081
11082 /**
11083  * A trait to describe an object which can receive channel messages.
11084  *
11085  * Messages MAY be called in parallel when they originate from different their_node_ids, however
11086  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
11087  */
11088 typedef struct LDKChannelMessageHandler {
11089    /**
11090     * An opaque pointer which is passed to your function implementations as an argument.
11091     * This has no meaning in the LDK, and can be NULL or any other value.
11092     */
11093    void *this_arg;
11094    /**
11095     * Handle an incoming open_channel message from the given peer.
11096     */
11097    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
11098    /**
11099     * Handle an incoming accept_channel message from the given peer.
11100     */
11101    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
11102    /**
11103     * Handle an incoming funding_created message from the given peer.
11104     */
11105    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
11106    /**
11107     * Handle an incoming funding_signed message from the given peer.
11108     */
11109    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
11110    /**
11111     * Handle an incoming funding_locked message from the given peer.
11112     */
11113    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
11114    /**
11115     * Handle an incoming shutdown message from the given peer.
11116     */
11117    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);
11118    /**
11119     * Handle an incoming closing_signed message from the given peer.
11120     */
11121    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
11122    /**
11123     * Handle an incoming update_add_htlc message from the given peer.
11124     */
11125    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
11126    /**
11127     * Handle an incoming update_fulfill_htlc message from the given peer.
11128     */
11129    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
11130    /**
11131     * Handle an incoming update_fail_htlc message from the given peer.
11132     */
11133    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
11134    /**
11135     * Handle an incoming update_fail_malformed_htlc message from the given peer.
11136     */
11137    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
11138    /**
11139     * Handle an incoming commitment_signed message from the given peer.
11140     */
11141    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
11142    /**
11143     * Handle an incoming revoke_and_ack message from the given peer.
11144     */
11145    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
11146    /**
11147     * Handle an incoming update_fee message from the given peer.
11148     */
11149    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
11150    /**
11151     * Handle an incoming announcement_signatures message from the given peer.
11152     */
11153    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
11154    /**
11155     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
11156     * is believed to be possible in the future (eg they're sending us messages we don't
11157     * understand or indicate they require unknown feature bits), no_connection_possible is set
11158     * and any outstanding channels should be failed.
11159     */
11160    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
11161    /**
11162     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
11163     */
11164    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
11165    /**
11166     * Handle an incoming channel_reestablish message from the given peer.
11167     */
11168    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
11169    /**
11170     * Handle an incoming channel update from the given peer.
11171     */
11172    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
11173    /**
11174     * Handle an incoming error message from the given peer.
11175     */
11176    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
11177    /**
11178     * Implementation of MessageSendEventsProvider for this object.
11179     */
11180    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11181    /**
11182     * Frees any resources associated with this object given its this_arg pointer.
11183     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11184     */
11185    void (*free)(void *this_arg);
11186 } LDKChannelMessageHandler;
11187
11188
11189
11190 /**
11191  * Arguments for the creation of a ChannelManager that are not deserialized.
11192  *
11193  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
11194  * is:
11195  * 1) Deserialize all stored [`ChannelMonitor`]s.
11196  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
11197  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
11198  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
11199  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
11200  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
11201  *    same way you would handle a [`chain::Filter`] call using
11202  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
11203  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
11204  * 5) Disconnect/connect blocks on the [`ChannelManager`].
11205  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
11206  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
11207  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
11208  *    the next step.
11209  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
11210  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
11211  *
11212  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
11213  * call any other methods on the newly-deserialized [`ChannelManager`].
11214  *
11215  * Note that because some channels may be closed during deserialization, it is critical that you
11216  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
11217  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
11218  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
11219  * not force-close the same channels but consider them live), you may end up revoking a state for
11220  * which you've already broadcasted the transaction.
11221  *
11222  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
11223  */
11224 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
11225    /**
11226     * A pointer to the opaque Rust object.
11227     * Nearly everywhere, inner must be non-null, however in places where
11228     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11229     */
11230    LDKnativeChannelManagerReadArgs *inner;
11231    /**
11232     * Indicates that this is the only struct which contains the same pointer.
11233     * Rust functions which take ownership of an object provided via an argument require
11234     * this to be true and invalidate the object pointed to by inner.
11235     */
11236    bool is_owned;
11237 } LDKChannelManagerReadArgs;
11238
11239
11240
11241 /**
11242  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
11243  * This is used to convince the recipient that the channel is at a certain commitment
11244  * number even if they lost that data due to a local failure.  Of course, the peer may lie
11245  * and even later commitments may have been revoked.
11246  */
11247 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
11248    /**
11249     * A pointer to the opaque Rust object.
11250     * Nearly everywhere, inner must be non-null, however in places where
11251     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11252     */
11253    LDKnativeDataLossProtect *inner;
11254    /**
11255     * Indicates that this is the only struct which contains the same pointer.
11256     * Rust functions which take ownership of an object provided via an argument require
11257     * this to be true and invalidate the object pointed to by inner.
11258     */
11259    bool is_owned;
11260 } LDKDataLossProtect;
11261
11262 /**
11263  * A trait to describe an object which can receive routing messages.
11264  *
11265  * # Implementor DoS Warnings
11266  *
11267  * For `gossip_queries` messages there are potential DoS vectors when handling
11268  * inbound queries. Implementors using an on-disk network graph should be aware of
11269  * repeated disk I/O for queries accessing different parts of the network graph.
11270  */
11271 typedef struct LDKRoutingMessageHandler {
11272    /**
11273     * An opaque pointer which is passed to your function implementations as an argument.
11274     * This has no meaning in the LDK, and can be NULL or any other value.
11275     */
11276    void *this_arg;
11277    /**
11278     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
11279     * false or returning an Err otherwise.
11280     */
11281    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
11282    /**
11283     * Handle a channel_announcement message, returning true if it should be forwarded on, false
11284     * or returning an Err otherwise.
11285     */
11286    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
11287    /**
11288     * Handle an incoming channel_update message, returning true if it should be forwarded on,
11289     * false or returning an Err otherwise.
11290     */
11291    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
11292    /**
11293     * Gets a subset of the channel announcements and updates required to dump our routing table
11294     * to a remote node, starting at the short_channel_id indicated by starting_point and
11295     * including the batch_amount entries immediately higher in numerical value than starting_point.
11296     */
11297    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
11298    /**
11299     * Gets a subset of the node announcements required to dump our routing table to a remote node,
11300     * starting at the node *after* the provided publickey and including batch_amount entries
11301     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
11302     * If None is provided for starting_point, we start at the first node.
11303     *
11304     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
11305     */
11306    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
11307    /**
11308     * Called when a connection is established with a peer. This can be used to
11309     * perform routing table synchronization using a strategy defined by the
11310     * implementor.
11311     */
11312    void (*sync_routing_table)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
11313    /**
11314     * Handles the reply of a query we initiated to learn about channels
11315     * for a given range of blocks. We can expect to receive one or more
11316     * replies to a single query.
11317     */
11318    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
11319    /**
11320     * Handles the reply of a query we initiated asking for routing gossip
11321     * messages for a list of channels. We should receive this message when
11322     * a node has completed its best effort to send us the pertaining routing
11323     * gossip messages.
11324     */
11325    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
11326    /**
11327     * Handles when a peer asks us to send a list of short_channel_ids
11328     * for the requested range of blocks.
11329     */
11330    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
11331    /**
11332     * Handles when a peer asks us to send routing gossip messages for a
11333     * list of short_channel_ids.
11334     */
11335    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
11336    /**
11337     * Implementation of MessageSendEventsProvider for this object.
11338     */
11339    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11340    /**
11341     * Frees any resources associated with this object given its this_arg pointer.
11342     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11343     */
11344    void (*free)(void *this_arg);
11345 } LDKRoutingMessageHandler;
11346
11347 /**
11348  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
11349  * decoders.
11350  */
11351 typedef struct LDKCustomMessageReader {
11352    /**
11353     * An opaque pointer which is passed to your function implementations as an argument.
11354     * This has no meaning in the LDK, and can be NULL or any other value.
11355     */
11356    void *this_arg;
11357    /**
11358     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
11359     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
11360     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
11361     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
11362     */
11363    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
11364    /**
11365     * Frees any resources associated with this object given its this_arg pointer.
11366     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11367     */
11368    void (*free)(void *this_arg);
11369 } LDKCustomMessageReader;
11370
11371 /**
11372  * Handler for BOLT1-compliant messages.
11373  */
11374 typedef struct LDKCustomMessageHandler {
11375    /**
11376     * An opaque pointer which is passed to your function implementations as an argument.
11377     * This has no meaning in the LDK, and can be NULL or any other value.
11378     */
11379    void *this_arg;
11380    /**
11381     * Called with the message type that was received and the buffer to be read.
11382     * Can return a `MessageHandlingError` if the message could not be handled.
11383     */
11384    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
11385    /**
11386     * Gets the list of pending messages which were generated by the custom message
11387     * handler, clearing the list in the process. The first tuple element must
11388     * correspond to the intended recipients node ids. If no connection to one of the
11389     * specified node does not exist, the message is simply not sent to it.
11390     */
11391    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
11392    /**
11393     * Implementation of CustomMessageReader for this object.
11394     */
11395    struct LDKCustomMessageReader CustomMessageReader;
11396    /**
11397     * Frees any resources associated with this object given its this_arg pointer.
11398     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11399     */
11400    void (*free)(void *this_arg);
11401 } LDKCustomMessageHandler;
11402
11403
11404
11405 /**
11406  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
11407  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
11408  */
11409 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
11410    /**
11411     * A pointer to the opaque Rust object.
11412     * Nearly everywhere, inner must be non-null, however in places where
11413     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11414     */
11415    LDKnativeIgnoringMessageHandler *inner;
11416    /**
11417     * Indicates that this is the only struct which contains the same pointer.
11418     * Rust functions which take ownership of an object provided via an argument require
11419     * this to be true and invalidate the object pointed to by inner.
11420     */
11421    bool is_owned;
11422 } LDKIgnoringMessageHandler;
11423
11424
11425
11426 /**
11427  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
11428  * You can provide one of these as the route_handler in a MessageHandler.
11429  */
11430 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
11431    /**
11432     * A pointer to the opaque Rust object.
11433     * Nearly everywhere, inner must be non-null, however in places where
11434     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11435     */
11436    LDKnativeErroringMessageHandler *inner;
11437    /**
11438     * Indicates that this is the only struct which contains the same pointer.
11439     * Rust functions which take ownership of an object provided via an argument require
11440     * this to be true and invalidate the object pointed to by inner.
11441     */
11442    bool is_owned;
11443 } LDKErroringMessageHandler;
11444
11445
11446
11447 /**
11448  * Provides references to trait impls which handle different types of messages.
11449  */
11450 typedef struct MUST_USE_STRUCT LDKMessageHandler {
11451    /**
11452     * A pointer to the opaque Rust object.
11453     * Nearly everywhere, inner must be non-null, however in places where
11454     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11455     */
11456    LDKnativeMessageHandler *inner;
11457    /**
11458     * Indicates that this is the only struct which contains the same pointer.
11459     * Rust functions which take ownership of an object provided via an argument require
11460     * this to be true and invalidate the object pointed to by inner.
11461     */
11462    bool is_owned;
11463 } LDKMessageHandler;
11464
11465 /**
11466  * Provides an object which can be used to send data to and which uniquely identifies a connection
11467  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
11468  * implement Hash to meet the PeerManager API.
11469  *
11470  * For efficiency, Clone should be relatively cheap for this type.
11471  *
11472  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
11473  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
11474  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
11475  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
11476  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
11477  * to simply use another value which is guaranteed to be globally unique instead.
11478  */
11479 typedef struct LDKSocketDescriptor {
11480    /**
11481     * An opaque pointer which is passed to your function implementations as an argument.
11482     * This has no meaning in the LDK, and can be NULL or any other value.
11483     */
11484    void *this_arg;
11485    /**
11486     * Attempts to send some data from the given slice to the peer.
11487     *
11488     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
11489     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
11490     * called and further write attempts may occur until that time.
11491     *
11492     * If the returned size is smaller than `data.len()`, a
11493     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
11494     * written. Additionally, until a `send_data` event completes fully, no further
11495     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
11496     * prevent denial-of-service issues, you should not read or buffer any data from the socket
11497     * until then.
11498     *
11499     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
11500     * (indicating that read events should be paused to prevent DoS in the send buffer),
11501     * `resume_read` may be set indicating that read events on this descriptor should resume. A
11502     * `resume_read` of false carries no meaning, and should not cause any action.
11503     */
11504    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
11505    /**
11506     * Disconnect the socket pointed to by this SocketDescriptor.
11507     *
11508     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
11509     * call (doing so is a noop).
11510     */
11511    void (*disconnect_socket)(void *this_arg);
11512    /**
11513     * Checks if two objects are equal given this object's this_arg pointer and another object.
11514     */
11515    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
11516    /**
11517     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
11518     * This is used, for example, for inclusion of this object in a hash map.
11519     */
11520    uint64_t (*hash)(const void *this_arg);
11521    /**
11522     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
11523     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
11524     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
11525     */
11526    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
11527    /**
11528     * Frees any resources associated with this object given its this_arg pointer.
11529     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11530     */
11531    void (*free)(void *this_arg);
11532 } LDKSocketDescriptor;
11533
11534
11535
11536 /**
11537  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
11538  * socket events into messages which it passes on to its [`MessageHandler`].
11539  *
11540  * Locks are taken internally, so you must never assume that reentrancy from a
11541  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
11542  *
11543  * Calls to [`read_event`] will decode relevant messages and pass them to the
11544  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
11545  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
11546  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
11547  * calls only after previous ones have returned.
11548  *
11549  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
11550  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
11551  * essentially you should default to using a SimpleRefPeerManager, and use a
11552  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
11553  * you're using lightning-net-tokio.
11554  *
11555  * [`read_event`]: PeerManager::read_event
11556  */
11557 typedef struct MUST_USE_STRUCT LDKPeerManager {
11558    /**
11559     * A pointer to the opaque Rust object.
11560     * Nearly everywhere, inner must be non-null, however in places where
11561     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11562     */
11563    LDKnativePeerManager *inner;
11564    /**
11565     * Indicates that this is the only struct which contains the same pointer.
11566     * Rust functions which take ownership of an object provided via an argument require
11567     * this to be true and invalidate the object pointed to by inner.
11568     */
11569    bool is_owned;
11570 } LDKPeerManager;
11571
11572
11573
11574 /**
11575  * Static channel fields used to build transactions given per-commitment fields, organized by
11576  * broadcaster/countersignatory.
11577  *
11578  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
11579  * as_holder_broadcastable and as_counterparty_broadcastable functions.
11580  */
11581 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
11582    /**
11583     * A pointer to the opaque Rust object.
11584     * Nearly everywhere, inner must be non-null, however in places where
11585     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11586     */
11587    LDKnativeDirectedChannelTransactionParameters *inner;
11588    /**
11589     * Indicates that this is the only struct which contains the same pointer.
11590     * Rust functions which take ownership of an object provided via an argument require
11591     * this to be true and invalidate the object pointed to by inner.
11592     */
11593    bool is_owned;
11594 } LDKDirectedChannelTransactionParameters;
11595
11596
11597
11598 /**
11599  * A read-only view of [`NetworkGraph`].
11600  */
11601 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
11602    /**
11603     * A pointer to the opaque Rust object.
11604     * Nearly everywhere, inner must be non-null, however in places where
11605     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11606     */
11607    LDKnativeReadOnlyNetworkGraph *inner;
11608    /**
11609     * Indicates that this is the only struct which contains the same pointer.
11610     * Rust functions which take ownership of an object provided via an argument require
11611     * this to be true and invalidate the object pointed to by inner.
11612     */
11613    bool is_owned;
11614 } LDKReadOnlyNetworkGraph;
11615
11616
11617
11618 /**
11619  * Receives and validates network updates from peers,
11620  * stores authentic and relevant data as a network graph.
11621  * This network graph is then used for routing payments.
11622  * Provides interface to help with initial routing sync by
11623  * serving historical announcements.
11624  *
11625  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
11626  * [`NetworkGraph`].
11627  */
11628 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
11629    /**
11630     * A pointer to the opaque Rust object.
11631     * Nearly everywhere, inner must be non-null, however in places where
11632     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11633     */
11634    LDKnativeNetGraphMsgHandler *inner;
11635    /**
11636     * Indicates that this is the only struct which contains the same pointer.
11637     * Rust functions which take ownership of an object provided via an argument require
11638     * this to be true and invalidate the object pointed to by inner.
11639     */
11640    bool is_owned;
11641 } LDKNetGraphMsgHandler;
11642
11643
11644
11645 /**
11646  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
11647  * source node to a target node.
11648  */
11649 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
11650    /**
11651     * A pointer to the opaque Rust object.
11652     * Nearly everywhere, inner must be non-null, however in places where
11653     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11654     */
11655    LDKnativeDirectedChannelInfo *inner;
11656    /**
11657     * Indicates that this is the only struct which contains the same pointer.
11658     * Rust functions which take ownership of an object provided via an argument require
11659     * this to be true and invalidate the object pointed to by inner.
11660     */
11661    bool is_owned;
11662 } LDKDirectedChannelInfo;
11663
11664 /**
11665  * The effective capacity of a channel for routing purposes.
11666  *
11667  * While this may be smaller than the actual channel capacity, amounts greater than
11668  * [`Self::as_msat`] should not be routed through the channel.
11669  */
11670 typedef enum LDKEffectiveCapacity_Tag {
11671    /**
11672     * The available liquidity in the channel known from being a channel counterparty, and thus a
11673     * direct hop.
11674     */
11675    LDKEffectiveCapacity_ExactLiquidity,
11676    /**
11677     * The maximum HTLC amount in one direction as advertised on the gossip network.
11678     */
11679    LDKEffectiveCapacity_MaximumHTLC,
11680    /**
11681     * The total capacity of the channel as determined by the funding transaction.
11682     */
11683    LDKEffectiveCapacity_Total,
11684    /**
11685     * A capacity sufficient to route any payment, typically used for private channels provided by
11686     * an invoice.
11687     */
11688    LDKEffectiveCapacity_Infinite,
11689    /**
11690     * A capacity that is unknown possibly because either the chain state is unavailable to know
11691     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
11692     */
11693    LDKEffectiveCapacity_Unknown,
11694    /**
11695     * Must be last for serialization purposes
11696     */
11697    LDKEffectiveCapacity_Sentinel,
11698 } LDKEffectiveCapacity_Tag;
11699
11700 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
11701    /**
11702     * Either the inbound or outbound liquidity depending on the direction, denominated in
11703     * millisatoshi.
11704     */
11705    uint64_t liquidity_msat;
11706 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
11707
11708 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
11709    /**
11710     * The maximum HTLC amount denominated in millisatoshi.
11711     */
11712    uint64_t amount_msat;
11713 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
11714
11715 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
11716    /**
11717     * The funding amount denominated in millisatoshi.
11718     */
11719    uint64_t capacity_msat;
11720 } LDKEffectiveCapacity_LDKTotal_Body;
11721
11722 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
11723    LDKEffectiveCapacity_Tag tag;
11724    union {
11725       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
11726       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
11727       LDKEffectiveCapacity_LDKTotal_Body total;
11728    };
11729 } LDKEffectiveCapacity;
11730
11731 /**
11732  * An interface used to score payment channels for path finding.
11733  *
11734  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
11735  */
11736 typedef struct LDKScore {
11737    /**
11738     * An opaque pointer which is passed to your function implementations as an argument.
11739     * This has no meaning in the LDK, and can be NULL or any other value.
11740     */
11741    void *this_arg;
11742    /**
11743     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
11744     * given channel in the direction from `source` to `target`.
11745     *
11746     * The channel's capacity (less any other MPP parts that are also being considered for use in
11747     * the same payment) is given by `capacity_msat`. It may be determined from various sources
11748     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
11749     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
11750     * Thus, implementations should be overflow-safe.
11751     */
11752    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);
11753    /**
11754     * Handles updating channel penalties after failing to route through a channel.
11755     */
11756    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
11757    /**
11758     * Handles updating channel penalties after successfully routing along a path.
11759     */
11760    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
11761    /**
11762     * Serialize the object into a byte array
11763     */
11764    struct LDKCVec_u8Z (*write)(const void *this_arg);
11765    /**
11766     * Frees any resources associated with this object given its this_arg pointer.
11767     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11768     */
11769    void (*free)(void *this_arg);
11770 } LDKScore;
11771
11772 /**
11773  * A scorer that is accessed under a lock.
11774  *
11775  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
11776  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
11777  * implementations. Internal locking would be detrimental to route finding performance and could
11778  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
11779  *
11780  * [`find_route`]: crate::routing::router::find_route
11781  */
11782 typedef struct LDKLockableScore {
11783    /**
11784     * An opaque pointer which is passed to your function implementations as an argument.
11785     * This has no meaning in the LDK, and can be NULL or any other value.
11786     */
11787    void *this_arg;
11788    /**
11789     * Returns the locked scorer.
11790     */
11791    struct LDKScore (*lock)(const void *this_arg);
11792    /**
11793     * Frees any resources associated with this object given its this_arg pointer.
11794     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11795     */
11796    void (*free)(void *this_arg);
11797 } LDKLockableScore;
11798
11799
11800
11801 /**
11802  * A concrete implementation of [`LockableScore`] which supports multi-threading.
11803  */
11804 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
11805    /**
11806     * A pointer to the opaque Rust object.
11807     * Nearly everywhere, inner must be non-null, however in places where
11808     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11809     */
11810    LDKnativeMultiThreadedLockableScore *inner;
11811    /**
11812     * Indicates that this is the only struct which contains the same pointer.
11813     * Rust functions which take ownership of an object provided via an argument require
11814     * this to be true and invalidate the object pointed to by inner.
11815     */
11816    bool is_owned;
11817 } LDKMultiThreadedLockableScore;
11818
11819
11820
11821 /**
11822  * FilesystemPersister persists channel data on disk, where each channel's
11823  * data is stored in a file named after its funding outpoint.
11824  *
11825  * Warning: this module does the best it can with calls to persist data, but it
11826  * can only guarantee that the data is passed to the drive. It is up to the
11827  * drive manufacturers to do the actual persistence properly, which they often
11828  * don't (especially on consumer-grade hardware). Therefore, it is up to the
11829  * user to validate their entire storage stack, to ensure the writes are
11830  * persistent.
11831  * Corollary: especially when dealing with larger amounts of money, it is best
11832  * practice to have multiple channel data backups and not rely only on one
11833  * FilesystemPersister.
11834  */
11835 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
11836    /**
11837     * A pointer to the opaque Rust object.
11838     * Nearly everywhere, inner must be non-null, however in places where
11839     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11840     */
11841    LDKnativeFilesystemPersister *inner;
11842    /**
11843     * Indicates that this is the only struct which contains the same pointer.
11844     * Rust functions which take ownership of an object provided via an argument require
11845     * this to be true and invalidate the object pointed to by inner.
11846     */
11847    bool is_owned;
11848 } LDKFilesystemPersister;
11849
11850
11851
11852 /**
11853  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
11854  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
11855  * responsibilities are:
11856  * * Processing [`Event`]s with a user-provided [`EventHandler`].
11857  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
11858  *   writing it to disk/backups by invoking the callback given to it at startup.
11859  *   [`ChannelManager`] persistence should be done in the background.
11860  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
11861  *   at the appropriate intervals.
11862  * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to
11863  *   [`BackgroundProcessor::start`]).
11864  *
11865  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
11866  * upon as doing so may result in high latency.
11867  *
11868  * # Note
11869  *
11870  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
11871  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
11872  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
11873  * unilateral chain closure fees are at risk.
11874  *
11875  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
11876  * [`Event`]: lightning::util::events::Event
11877  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
11878  */
11879 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
11880    /**
11881     * A pointer to the opaque Rust object.
11882     * Nearly everywhere, inner must be non-null, however in places where
11883     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11884     */
11885    LDKnativeBackgroundProcessor *inner;
11886    /**
11887     * Indicates that this is the only struct which contains the same pointer.
11888     * Rust functions which take ownership of an object provided via an argument require
11889     * this to be true and invalidate the object pointed to by inner.
11890     */
11891    bool is_owned;
11892 } LDKBackgroundProcessor;
11893
11894 /**
11895  * Trait which handles persisting a [`ChannelManager`] to disk.
11896  *
11897  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
11898  */
11899 typedef struct LDKChannelManagerPersister {
11900    /**
11901     * An opaque pointer which is passed to your function implementations as an argument.
11902     * This has no meaning in the LDK, and can be NULL or any other value.
11903     */
11904    void *this_arg;
11905    /**
11906     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
11907     * (which will cause the [`BackgroundProcessor`] which called this method to exit.
11908     *
11909     * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
11910     */
11911    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
11912    /**
11913     * Frees any resources associated with this object given its this_arg pointer.
11914     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11915     */
11916    void (*free)(void *this_arg);
11917 } LDKChannelManagerPersister;
11918
11919
11920
11921 /**
11922  * Data of the `RawInvoice` that is encoded in the data part
11923  */
11924 typedef struct MUST_USE_STRUCT LDKRawDataPart {
11925    /**
11926     * A pointer to the opaque Rust object.
11927     * Nearly everywhere, inner must be non-null, however in places where
11928     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11929     */
11930    LDKnativeRawDataPart *inner;
11931    /**
11932     * Indicates that this is the only struct which contains the same pointer.
11933     * Rust functions which take ownership of an object provided via an argument require
11934     * this to be true and invalidate the object pointed to by inner.
11935     */
11936    bool is_owned;
11937 } LDKRawDataPart;
11938
11939
11940
11941 /**
11942  * SHA-256 hash
11943  */
11944 typedef struct MUST_USE_STRUCT LDKSha256 {
11945    /**
11946     * A pointer to the opaque Rust object.
11947     * Nearly everywhere, inner must be non-null, however in places where
11948     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11949     */
11950    LDKnativeSha256 *inner;
11951    /**
11952     * Indicates that this is the only struct which contains the same pointer.
11953     * Rust functions which take ownership of an object provided via an argument require
11954     * this to be true and invalidate the object pointed to by inner.
11955     */
11956    bool is_owned;
11957 } LDKSha256;
11958
11959
11960
11961 /**
11962  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
11963  * expires
11964  */
11965 typedef struct MUST_USE_STRUCT LDKExpiryTime {
11966    /**
11967     * A pointer to the opaque Rust object.
11968     * Nearly everywhere, inner must be non-null, however in places where
11969     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11970     */
11971    LDKnativeExpiryTime *inner;
11972    /**
11973     * Indicates that this is the only struct which contains the same pointer.
11974     * Rust functions which take ownership of an object provided via an argument require
11975     * this to be true and invalidate the object pointed to by inner.
11976     */
11977    bool is_owned;
11978 } LDKExpiryTime;
11979
11980
11981
11982 /**
11983  * `min_final_cltv_expiry` to use for the last HTLC in the route
11984  */
11985 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
11986    /**
11987     * A pointer to the opaque Rust object.
11988     * Nearly everywhere, inner must be non-null, however in places where
11989     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11990     */
11991    LDKnativeMinFinalCltvExpiry *inner;
11992    /**
11993     * Indicates that this is the only struct which contains the same pointer.
11994     * Rust functions which take ownership of an object provided via an argument require
11995     * this to be true and invalidate the object pointed to by inner.
11996     */
11997    bool is_owned;
11998 } LDKMinFinalCltvExpiry;
11999
12000 /**
12001  * A 20-byte byte array.
12002  */
12003 typedef struct LDKTwentyBytes {
12004    /**
12005     * The twenty bytes
12006     */
12007    uint8_t data[20];
12008 } LDKTwentyBytes;
12009
12010 /**
12011  * Fallback address in case no LN payment is possible
12012  */
12013 typedef enum LDKFallback_Tag {
12014    LDKFallback_SegWitProgram,
12015    LDKFallback_PubKeyHash,
12016    LDKFallback_ScriptHash,
12017    /**
12018     * Must be last for serialization purposes
12019     */
12020    LDKFallback_Sentinel,
12021 } LDKFallback_Tag;
12022
12023 typedef struct LDKFallback_LDKSegWitProgram_Body {
12024    struct LDKu5 version;
12025    struct LDKCVec_u8Z program;
12026 } LDKFallback_LDKSegWitProgram_Body;
12027
12028 typedef struct MUST_USE_STRUCT LDKFallback {
12029    LDKFallback_Tag tag;
12030    union {
12031       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
12032       struct {
12033          struct LDKTwentyBytes pub_key_hash;
12034       };
12035       struct {
12036          struct LDKTwentyBytes script_hash;
12037       };
12038    };
12039 } LDKFallback;
12040
12041 /**
12042  * A trait defining behavior of an [`Invoice`] payer.
12043  */
12044 typedef struct LDKPayer {
12045    /**
12046     * An opaque pointer which is passed to your function implementations as an argument.
12047     * This has no meaning in the LDK, and can be NULL or any other value.
12048     */
12049    void *this_arg;
12050    /**
12051     * Returns the payer's node id.
12052     */
12053    struct LDKPublicKey (*node_id)(const void *this_arg);
12054    /**
12055     * Returns the payer's channels.
12056     */
12057    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
12058    /**
12059     * Sends a payment over the Lightning Network using the given [`Route`].
12060     *
12061     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
12062     */
12063    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
12064    /**
12065     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
12066     */
12067    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
12068    /**
12069     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
12070     */
12071    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
12072    /**
12073     * Signals that no further retries for the given payment will occur.
12074     */
12075    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
12076    /**
12077     * Frees any resources associated with this object given its this_arg pointer.
12078     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12079     */
12080    void (*free)(void *this_arg);
12081 } LDKPayer;
12082
12083 /**
12084  * A trait defining behavior for routing an [`Invoice`] payment.
12085  */
12086 typedef struct LDKRouter {
12087    /**
12088     * An opaque pointer which is passed to your function implementations as an argument.
12089     * This has no meaning in the LDK, and can be NULL or any other value.
12090     */
12091    void *this_arg;
12092    /**
12093     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
12094     *
12095     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
12096     */
12097    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);
12098    /**
12099     * Frees any resources associated with this object given its this_arg pointer.
12100     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12101     */
12102    void (*free)(void *this_arg);
12103 } LDKRouter;
12104
12105
12106
12107 /**
12108  * A utility for paying [`Invoice`]s and sending spontaneous payments.
12109  *
12110  * See [module-level documentation] for details.
12111  *
12112  * [module-level documentation]: crate::payment
12113  */
12114 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
12115    /**
12116     * A pointer to the opaque Rust object.
12117     * Nearly everywhere, inner must be non-null, however in places where
12118     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12119     */
12120    LDKnativeInvoicePayer *inner;
12121    /**
12122     * Indicates that this is the only struct which contains the same pointer.
12123     * Rust functions which take ownership of an object provided via an argument require
12124     * this to be true and invalidate the object pointed to by inner.
12125     */
12126    bool is_owned;
12127 } LDKInvoicePayer;
12128
12129
12130
12131 /**
12132  * Number of attempts to retry payment path failures for an [`Invoice`].
12133  *
12134  * Note that this is the number of *path* failures, not full payment retries. For multi-path
12135  * payments, if this is less than the total number of paths, we will never even retry all of the
12136  * payment's paths.
12137  */
12138 typedef struct MUST_USE_STRUCT LDKRetryAttempts {
12139    /**
12140     * A pointer to the opaque Rust object.
12141     * Nearly everywhere, inner must be non-null, however in places where
12142     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12143     */
12144    LDKnativeRetryAttempts *inner;
12145    /**
12146     * Indicates that this is the only struct which contains the same pointer.
12147     * Rust functions which take ownership of an object provided via an argument require
12148     * this to be true and invalidate the object pointed to by inner.
12149     */
12150    bool is_owned;
12151 } LDKRetryAttempts;
12152
12153
12154
12155 /**
12156  * A [`Router`] implemented using [`find_route`].
12157  */
12158 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
12159    /**
12160     * A pointer to the opaque Rust object.
12161     * Nearly everywhere, inner must be non-null, however in places where
12162     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12163     */
12164    LDKnativeDefaultRouter *inner;
12165    /**
12166     * Indicates that this is the only struct which contains the same pointer.
12167     * Rust functions which take ownership of an object provided via an argument require
12168     * this to be true and invalidate the object pointed to by inner.
12169     */
12170    bool is_owned;
12171 } LDKDefaultRouter;
12172
12173 extern const uintptr_t MAX_BUF_SIZE;
12174
12175 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
12176
12177 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
12178
12179 extern const uint32_t ANTI_REORG_DELAY;
12180
12181 extern const uint16_t BREAKDOWN_TIMEOUT;
12182
12183 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
12184
12185 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
12186
12187 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
12188
12189 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
12190
12191 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
12192
12193 extern const uint64_t MAX_TIMESTAMP;
12194
12195 extern const uint64_t DEFAULT_EXPIRY_TIME;
12196
12197 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
12198
12199 extern const uint8_t TAG_PAYMENT_HASH;
12200
12201 extern const uint8_t TAG_DESCRIPTION;
12202
12203 extern const uint8_t TAG_PAYEE_PUB_KEY;
12204
12205 extern const uint8_t TAG_DESCRIPTION_HASH;
12206
12207 extern const uint8_t TAG_EXPIRY_TIME;
12208
12209 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
12210
12211 extern const uint8_t TAG_FALLBACK;
12212
12213 extern const uint8_t TAG_PRIVATE_ROUTE;
12214
12215 extern const uint8_t TAG_PAYMENT_SECRET;
12216
12217 extern const uint8_t TAG_FEATURES;
12218
12219 struct LDKStr _ldk_get_compiled_version(void);
12220
12221 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
12222
12223 /**
12224  * Frees the data buffer, if data_is_owned is set and datalen > 0.
12225  */
12226 void Transaction_free(struct LDKTransaction _res);
12227
12228 /**
12229  * Convenience function for constructing a new TxOut
12230  */
12231 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
12232
12233 /**
12234  * Frees the data pointed to by script_pubkey.
12235  */
12236 void TxOut_free(struct LDKTxOut _res);
12237
12238 /**
12239  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
12240  */
12241 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
12242
12243 /**
12244  * Frees the data buffer, if chars_is_owned is set and len > 0.
12245  */
12246 void Str_free(struct LDKStr _res);
12247
12248 #if defined(LDK_DEBUG_BUILD)
12249 /**
12250  * This function exists for memory safety testing purposes. It should never be used in production
12251  * code
12252  */
12253 const void *__unmangle_inner_ptr(const void *ptr);
12254 #endif
12255
12256 /**
12257  * Creates a new CResult_NoneNoneZ in the success state.
12258  */
12259 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
12260
12261 /**
12262  * Creates a new CResult_NoneNoneZ in the error state.
12263  */
12264 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
12265
12266 /**
12267  * Checks if the given object is currently in the success state
12268  */
12269 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
12270
12271 /**
12272  * Frees any resources used by the CResult_NoneNoneZ.
12273  */
12274 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
12275
12276 /**
12277  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
12278  * but with all dynamically-allocated buffers duplicated in new buffers.
12279  */
12280 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
12281
12282 /**
12283  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
12284  */
12285 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
12286
12287 /**
12288  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
12289  */
12290 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
12291
12292 /**
12293  * Checks if the given object is currently in the success state
12294  */
12295 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
12296
12297 /**
12298  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
12299  */
12300 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
12301
12302 /**
12303  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
12304  * but with all dynamically-allocated buffers duplicated in new buffers.
12305  */
12306 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
12307
12308 /**
12309  * Creates a new CResult_SecretKeyErrorZ in the success state.
12310  */
12311 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
12312
12313 /**
12314  * Creates a new CResult_SecretKeyErrorZ in the error state.
12315  */
12316 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
12317
12318 /**
12319  * Checks if the given object is currently in the success state
12320  */
12321 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
12322
12323 /**
12324  * Frees any resources used by the CResult_SecretKeyErrorZ.
12325  */
12326 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
12327
12328 /**
12329  * Creates a new CResult_PublicKeyErrorZ in the success state.
12330  */
12331 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
12332
12333 /**
12334  * Creates a new CResult_PublicKeyErrorZ in the error state.
12335  */
12336 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
12337
12338 /**
12339  * Checks if the given object is currently in the success state
12340  */
12341 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
12342
12343 /**
12344  * Frees any resources used by the CResult_PublicKeyErrorZ.
12345  */
12346 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
12347
12348 /**
12349  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
12350  * but with all dynamically-allocated buffers duplicated in new buffers.
12351  */
12352 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
12353
12354 /**
12355  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
12356  */
12357 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
12358
12359 /**
12360  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
12361  */
12362 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
12363
12364 /**
12365  * Checks if the given object is currently in the success state
12366  */
12367 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
12368
12369 /**
12370  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
12371  */
12372 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
12373
12374 /**
12375  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
12376  * but with all dynamically-allocated buffers duplicated in new buffers.
12377  */
12378 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
12379
12380 /**
12381  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
12382  */
12383 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
12384
12385 /**
12386  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
12387  */
12388 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
12389
12390 /**
12391  * Checks if the given object is currently in the success state
12392  */
12393 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
12394
12395 /**
12396  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
12397  */
12398 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
12399
12400 /**
12401  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
12402  * but with all dynamically-allocated buffers duplicated in new buffers.
12403  */
12404 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
12405
12406 /**
12407  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
12408  */
12409 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
12410
12411 /**
12412  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
12413  */
12414 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
12415
12416 /**
12417  * Checks if the given object is currently in the success state
12418  */
12419 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
12420
12421 /**
12422  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
12423  */
12424 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
12425
12426 /**
12427  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
12428  * but with all dynamically-allocated buffers duplicated in new buffers.
12429  */
12430 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
12431
12432 /**
12433  * Constructs a new COption_u32Z containing a u32
12434  */
12435 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
12436
12437 /**
12438  * Constructs a new COption_u32Z containing nothing
12439  */
12440 struct LDKCOption_u32Z COption_u32Z_none(void);
12441
12442 /**
12443  * Frees any resources associated with the u32, if we are in the Some state
12444  */
12445 void COption_u32Z_free(struct LDKCOption_u32Z _res);
12446
12447 /**
12448  * Creates a new COption_u32Z which has the same data as `orig`
12449  * but with all dynamically-allocated buffers duplicated in new buffers.
12450  */
12451 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
12452
12453 /**
12454  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
12455  */
12456 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
12457
12458 /**
12459  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
12460  */
12461 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
12462
12463 /**
12464  * Checks if the given object is currently in the success state
12465  */
12466 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
12467
12468 /**
12469  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
12470  */
12471 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
12472
12473 /**
12474  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
12475  * but with all dynamically-allocated buffers duplicated in new buffers.
12476  */
12477 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
12478
12479 /**
12480  * Constructs a new COption_NoneZ containing a
12481  */
12482 enum LDKCOption_NoneZ COption_NoneZ_some(void);
12483
12484 /**
12485  * Constructs a new COption_NoneZ containing nothing
12486  */
12487 enum LDKCOption_NoneZ COption_NoneZ_none(void);
12488
12489 /**
12490  * Frees any resources associated with the , if we are in the Some state
12491  */
12492 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
12493
12494 /**
12495  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
12496  */
12497 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
12498
12499 /**
12500  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
12501  */
12502 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
12503
12504 /**
12505  * Checks if the given object is currently in the success state
12506  */
12507 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
12508
12509 /**
12510  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
12511  */
12512 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
12513
12514 /**
12515  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
12516  * but with all dynamically-allocated buffers duplicated in new buffers.
12517  */
12518 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
12519
12520 /**
12521  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
12522  */
12523 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
12524
12525 /**
12526  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
12527  */
12528 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
12529
12530 /**
12531  * Checks if the given object is currently in the success state
12532  */
12533 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
12534
12535 /**
12536  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
12537  */
12538 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
12539
12540 /**
12541  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
12542  * but with all dynamically-allocated buffers duplicated in new buffers.
12543  */
12544 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
12545
12546 /**
12547  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12548  */
12549 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
12550
12551 /**
12552  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
12553  */
12554 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
12555
12556 /**
12557  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
12558  */
12559 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12560
12561 /**
12562  * Checks if the given object is currently in the success state
12563  */
12564 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12565
12566 /**
12567  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
12568  */
12569 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
12570
12571 /**
12572  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
12573  * but with all dynamically-allocated buffers duplicated in new buffers.
12574  */
12575 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12576
12577 /**
12578  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
12579  */
12580 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
12581
12582 /**
12583  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
12584  */
12585 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12586
12587 /**
12588  * Checks if the given object is currently in the success state
12589  */
12590 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12591
12592 /**
12593  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
12594  */
12595 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
12596
12597 /**
12598  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
12599  * but with all dynamically-allocated buffers duplicated in new buffers.
12600  */
12601 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12602
12603 /**
12604  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
12605  */
12606 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
12607
12608 /**
12609  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
12610  */
12611 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
12612
12613 /**
12614  * Checks if the given object is currently in the success state
12615  */
12616 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
12617
12618 /**
12619  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
12620  */
12621 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
12622
12623 /**
12624  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
12625  */
12626 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
12627
12628 /**
12629  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
12630  */
12631 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12632
12633 /**
12634  * Checks if the given object is currently in the success state
12635  */
12636 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12637
12638 /**
12639  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
12640  */
12641 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
12642
12643 /**
12644  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
12645  * but with all dynamically-allocated buffers duplicated in new buffers.
12646  */
12647 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12648
12649 /**
12650  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
12651  */
12652 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
12653
12654 /**
12655  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
12656  */
12657 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
12658
12659 /**
12660  * Checks if the given object is currently in the success state
12661  */
12662 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
12663
12664 /**
12665  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
12666  */
12667 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
12668
12669 /**
12670  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
12671  */
12672 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
12673
12674 /**
12675  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
12676  */
12677 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
12678
12679 /**
12680  * Checks if the given object is currently in the success state
12681  */
12682 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
12683
12684 /**
12685  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
12686  */
12687 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
12688
12689 /**
12690  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
12691  * but with all dynamically-allocated buffers duplicated in new buffers.
12692  */
12693 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
12694
12695 /**
12696  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
12697  */
12698 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
12699
12700 /**
12701  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
12702  */
12703 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
12704
12705 /**
12706  * Checks if the given object is currently in the success state
12707  */
12708 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
12709
12710 /**
12711  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
12712  */
12713 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
12714
12715 /**
12716  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
12717  * but with all dynamically-allocated buffers duplicated in new buffers.
12718  */
12719 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
12720
12721 /**
12722  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
12723  */
12724 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
12725
12726 /**
12727  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
12728  */
12729 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
12730
12731 /**
12732  * Checks if the given object is currently in the success state
12733  */
12734 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
12735
12736 /**
12737  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
12738  */
12739 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
12740
12741 /**
12742  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
12743  * but with all dynamically-allocated buffers duplicated in new buffers.
12744  */
12745 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
12746
12747 /**
12748  * Creates a new CResult_NoneErrorZ in the success state.
12749  */
12750 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
12751
12752 /**
12753  * Creates a new CResult_NoneErrorZ in the error state.
12754  */
12755 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
12756
12757 /**
12758  * Checks if the given object is currently in the success state
12759  */
12760 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
12761
12762 /**
12763  * Frees any resources used by the CResult_NoneErrorZ.
12764  */
12765 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
12766
12767 /**
12768  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
12769  * but with all dynamically-allocated buffers duplicated in new buffers.
12770  */
12771 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
12772
12773 /**
12774  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
12775  */
12776 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
12777
12778 /**
12779  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
12780  */
12781 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
12782
12783 /**
12784  * Checks if the given object is currently in the success state
12785  */
12786 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
12787
12788 /**
12789  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
12790  */
12791 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
12792
12793 /**
12794  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
12795  * but with all dynamically-allocated buffers duplicated in new buffers.
12796  */
12797 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
12798
12799 /**
12800  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12801  */
12802 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
12803
12804 /**
12805  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12806  */
12807 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
12808
12809 /**
12810  * Creates a new CResult_RouteDecodeErrorZ in the success state.
12811  */
12812 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
12813
12814 /**
12815  * Creates a new CResult_RouteDecodeErrorZ in the error state.
12816  */
12817 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
12818
12819 /**
12820  * Checks if the given object is currently in the success state
12821  */
12822 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
12823
12824 /**
12825  * Frees any resources used by the CResult_RouteDecodeErrorZ.
12826  */
12827 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
12828
12829 /**
12830  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
12831  * but with all dynamically-allocated buffers duplicated in new buffers.
12832  */
12833 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
12834
12835 /**
12836  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
12837  */
12838 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
12839
12840 /**
12841  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
12842  */
12843 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
12844
12845 /**
12846  * Checks if the given object is currently in the success state
12847  */
12848 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
12849
12850 /**
12851  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
12852  */
12853 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
12854
12855 /**
12856  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
12857  * but with all dynamically-allocated buffers duplicated in new buffers.
12858  */
12859 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
12860
12861 /**
12862  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12863  */
12864 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
12865
12866 /**
12867  * Constructs a new COption_u64Z containing a u64
12868  */
12869 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
12870
12871 /**
12872  * Constructs a new COption_u64Z containing nothing
12873  */
12874 struct LDKCOption_u64Z COption_u64Z_none(void);
12875
12876 /**
12877  * Frees any resources associated with the u64, if we are in the Some state
12878  */
12879 void COption_u64Z_free(struct LDKCOption_u64Z _res);
12880
12881 /**
12882  * Creates a new COption_u64Z which has the same data as `orig`
12883  * but with all dynamically-allocated buffers duplicated in new buffers.
12884  */
12885 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
12886
12887 /**
12888  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
12889  */
12890 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
12891
12892 /**
12893  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
12894  */
12895 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
12896
12897 /**
12898  * Checks if the given object is currently in the success state
12899  */
12900 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
12901
12902 /**
12903  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
12904  */
12905 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
12906
12907 /**
12908  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
12909  * but with all dynamically-allocated buffers duplicated in new buffers.
12910  */
12911 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
12912
12913 /**
12914  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12915  */
12916 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
12917
12918 /**
12919  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
12920  */
12921 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
12922
12923 /**
12924  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
12925  */
12926 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
12927
12928 /**
12929  * Checks if the given object is currently in the success state
12930  */
12931 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
12932
12933 /**
12934  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
12935  */
12936 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
12937
12938 /**
12939  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
12940  * but with all dynamically-allocated buffers duplicated in new buffers.
12941  */
12942 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
12943
12944 /**
12945  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
12946  */
12947 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
12948
12949 /**
12950  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
12951  */
12952 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
12953
12954 /**
12955  * Checks if the given object is currently in the success state
12956  */
12957 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
12958
12959 /**
12960  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
12961  */
12962 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
12963
12964 /**
12965  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
12966  * but with all dynamically-allocated buffers duplicated in new buffers.
12967  */
12968 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
12969
12970 /**
12971  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12972  */
12973 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
12974
12975 /**
12976  * Creates a new CResult_RouteLightningErrorZ in the success state.
12977  */
12978 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
12979
12980 /**
12981  * Creates a new CResult_RouteLightningErrorZ in the error state.
12982  */
12983 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
12984
12985 /**
12986  * Checks if the given object is currently in the success state
12987  */
12988 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
12989
12990 /**
12991  * Frees any resources used by the CResult_RouteLightningErrorZ.
12992  */
12993 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
12994
12995 /**
12996  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
12997  * but with all dynamically-allocated buffers duplicated in new buffers.
12998  */
12999 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
13000
13001 /**
13002  * Creates a new CResult_TxOutAccessErrorZ in the success state.
13003  */
13004 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
13005
13006 /**
13007  * Creates a new CResult_TxOutAccessErrorZ in the error state.
13008  */
13009 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
13010
13011 /**
13012  * Checks if the given object is currently in the success state
13013  */
13014 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
13015
13016 /**
13017  * Frees any resources used by the CResult_TxOutAccessErrorZ.
13018  */
13019 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
13020
13021 /**
13022  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
13023  * but with all dynamically-allocated buffers duplicated in new buffers.
13024  */
13025 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
13026
13027 /**
13028  * Creates a new tuple which has the same data as `orig`
13029  * but with all dynamically-allocated buffers duplicated in new buffers.
13030  */
13031 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
13032
13033 /**
13034  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
13035  */
13036 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
13037
13038 /**
13039  * Frees any resources used by the C2Tuple_usizeTransactionZ.
13040  */
13041 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
13042
13043 /**
13044  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13045  */
13046 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
13047
13048 /**
13049  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13050  */
13051 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
13052
13053 /**
13054  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
13055  */
13056 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
13057
13058 /**
13059  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
13060  */
13061 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
13062
13063 /**
13064  * Checks if the given object is currently in the success state
13065  */
13066 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
13067
13068 /**
13069  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
13070  */
13071 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
13072
13073 /**
13074  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
13075  * but with all dynamically-allocated buffers duplicated in new buffers.
13076  */
13077 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
13078
13079 /**
13080  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13081  */
13082 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
13083
13084 /**
13085  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
13086  */
13087 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
13088
13089 /**
13090  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
13091  */
13092 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
13093
13094 /**
13095  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
13096  */
13097 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
13098
13099 /**
13100  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
13101  * but with all dynamically-allocated buffers duplicated in new buffers.
13102  */
13103 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
13104
13105 /**
13106  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
13107  */
13108 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
13109
13110 /**
13111  * Constructs a new COption_ClosureReasonZ containing nothing
13112  */
13113 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
13114
13115 /**
13116  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
13117  */
13118 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
13119
13120 /**
13121  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
13122  * but with all dynamically-allocated buffers duplicated in new buffers.
13123  */
13124 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
13125
13126 /**
13127  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
13128  */
13129 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
13130
13131 /**
13132  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
13133  */
13134 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
13135
13136 /**
13137  * Checks if the given object is currently in the success state
13138  */
13139 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
13140
13141 /**
13142  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
13143  */
13144 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
13145
13146 /**
13147  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
13148  * but with all dynamically-allocated buffers duplicated in new buffers.
13149  */
13150 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
13151
13152 /**
13153  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
13154  */
13155 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
13156
13157 /**
13158  * Constructs a new COption_NetworkUpdateZ containing nothing
13159  */
13160 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
13161
13162 /**
13163  * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
13164  */
13165 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
13166
13167 /**
13168  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
13169  * but with all dynamically-allocated buffers duplicated in new buffers.
13170  */
13171 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
13172
13173 /**
13174  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13175  */
13176 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
13177
13178 /**
13179  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
13180  */
13181 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
13182
13183 /**
13184  * Constructs a new COption_EventZ containing nothing
13185  */
13186 struct LDKCOption_EventZ COption_EventZ_none(void);
13187
13188 /**
13189  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
13190  */
13191 void COption_EventZ_free(struct LDKCOption_EventZ _res);
13192
13193 /**
13194  * Creates a new COption_EventZ which has the same data as `orig`
13195  * but with all dynamically-allocated buffers duplicated in new buffers.
13196  */
13197 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
13198
13199 /**
13200  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
13201  */
13202 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
13203
13204 /**
13205  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
13206  */
13207 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
13208
13209 /**
13210  * Checks if the given object is currently in the success state
13211  */
13212 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
13213
13214 /**
13215  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
13216  */
13217 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
13218
13219 /**
13220  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
13221  * but with all dynamically-allocated buffers duplicated in new buffers.
13222  */
13223 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
13224
13225 /**
13226  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13227  */
13228 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
13229
13230 /**
13231  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
13232  */
13233 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
13234
13235 /**
13236  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
13237  */
13238 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
13239
13240 /**
13241  * Checks if the given object is currently in the success state
13242  */
13243 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
13244
13245 /**
13246  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
13247  */
13248 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
13249
13250 /**
13251  * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
13252  */
13253 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
13254
13255 /**
13256  * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
13257  */
13258 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
13259
13260 /**
13261  * Checks if the given object is currently in the success state
13262  */
13263 bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o);
13264
13265 /**
13266  * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
13267  */
13268 void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
13269
13270 /**
13271  * Creates a new CResult_ScorerDecodeErrorZ in the success state.
13272  */
13273 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
13274
13275 /**
13276  * Creates a new CResult_ScorerDecodeErrorZ in the error state.
13277  */
13278 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
13279
13280 /**
13281  * Checks if the given object is currently in the success state
13282  */
13283 bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o);
13284
13285 /**
13286  * Frees any resources used by the CResult_ScorerDecodeErrorZ.
13287  */
13288 void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
13289
13290 /**
13291  * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state.
13292  */
13293 struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(struct LDKProbabilisticScoringParameters o);
13294
13295 /**
13296  * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state.
13297  */
13298 struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
13299
13300 /**
13301  * Checks if the given object is currently in the success state
13302  */
13303 bool CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR o);
13304
13305 /**
13306  * Frees any resources used by the CResult_ProbabilisticScoringParametersDecodeErrorZ.
13307  */
13308 void CResult_ProbabilisticScoringParametersDecodeErrorZ_free(struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res);
13309
13310 /**
13311  * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig`
13312  * but with all dynamically-allocated buffers duplicated in new buffers.
13313  */
13314 struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR orig);
13315
13316 /**
13317  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
13318  */
13319 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
13320
13321 /**
13322  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
13323  */
13324 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13325
13326 /**
13327  * Checks if the given object is currently in the success state
13328  */
13329 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
13330
13331 /**
13332  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
13333  */
13334 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
13335
13336 /**
13337  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
13338  */
13339 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
13340
13341 /**
13342  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
13343  */
13344 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13345
13346 /**
13347  * Checks if the given object is currently in the success state
13348  */
13349 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
13350
13351 /**
13352  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
13353  */
13354 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
13355
13356 /**
13357  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
13358  */
13359 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
13360
13361 /**
13362  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
13363  */
13364 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13365
13366 /**
13367  * Checks if the given object is currently in the success state
13368  */
13369 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
13370
13371 /**
13372  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
13373  */
13374 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
13375
13376 /**
13377  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
13378  */
13379 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
13380
13381 /**
13382  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
13383  */
13384 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13385
13386 /**
13387  * Checks if the given object is currently in the success state
13388  */
13389 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
13390
13391 /**
13392  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
13393  */
13394 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
13395
13396 /**
13397  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
13398  */
13399 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
13400
13401 /**
13402  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
13403  */
13404 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13405
13406 /**
13407  * Checks if the given object is currently in the success state
13408  */
13409 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
13410
13411 /**
13412  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
13413  */
13414 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
13415
13416 /**
13417  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
13418  */
13419 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
13420
13421 /**
13422  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
13423  */
13424 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13425
13426 /**
13427  * Checks if the given object is currently in the success state
13428  */
13429 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13430
13431 /**
13432  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
13433  */
13434 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
13435
13436 /**
13437  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
13438  * but with all dynamically-allocated buffers duplicated in new buffers.
13439  */
13440 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13441
13442 /**
13443  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
13444  */
13445 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
13446
13447 /**
13448  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
13449  */
13450 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13451
13452 /**
13453  * Checks if the given object is currently in the success state
13454  */
13455 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13456
13457 /**
13458  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
13459  */
13460 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
13461
13462 /**
13463  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
13464  * but with all dynamically-allocated buffers duplicated in new buffers.
13465  */
13466 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13467
13468 /**
13469  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
13470  */
13471 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
13472
13473 /**
13474  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
13475  */
13476 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13477
13478 /**
13479  * Checks if the given object is currently in the success state
13480  */
13481 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13482
13483 /**
13484  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
13485  */
13486 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
13487
13488 /**
13489  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
13490  * but with all dynamically-allocated buffers duplicated in new buffers.
13491  */
13492 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13493
13494 /**
13495  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13496  */
13497 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
13498
13499 /**
13500  * Creates a new tuple which has the same data as `orig`
13501  * but with all dynamically-allocated buffers duplicated in new buffers.
13502  */
13503 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
13504
13505 /**
13506  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
13507  */
13508 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
13509
13510 /**
13511  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
13512  */
13513 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
13514
13515 /**
13516  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
13517  */
13518 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
13519
13520 /**
13521  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
13522  */
13523 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
13524
13525 /**
13526  * Checks if the given object is currently in the success state
13527  */
13528 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
13529
13530 /**
13531  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
13532  */
13533 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
13534
13535 /**
13536  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
13537  * but with all dynamically-allocated buffers duplicated in new buffers.
13538  */
13539 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
13540
13541 /**
13542  * Creates a new CResult_SignatureNoneZ in the success state.
13543  */
13544 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
13545
13546 /**
13547  * Creates a new CResult_SignatureNoneZ in the error state.
13548  */
13549 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
13550
13551 /**
13552  * Checks if the given object is currently in the success state
13553  */
13554 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
13555
13556 /**
13557  * Frees any resources used by the CResult_SignatureNoneZ.
13558  */
13559 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
13560
13561 /**
13562  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
13563  * but with all dynamically-allocated buffers duplicated in new buffers.
13564  */
13565 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
13566
13567 /**
13568  * Creates a new tuple which has the same data as `orig`
13569  * but with all dynamically-allocated buffers duplicated in new buffers.
13570  */
13571 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
13572
13573 /**
13574  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
13575  */
13576 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
13577
13578 /**
13579  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
13580  */
13581 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
13582
13583 /**
13584  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
13585  */
13586 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
13587
13588 /**
13589  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
13590  */
13591 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
13592
13593 /**
13594  * Checks if the given object is currently in the success state
13595  */
13596 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
13597
13598 /**
13599  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
13600  */
13601 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
13602
13603 /**
13604  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
13605  * but with all dynamically-allocated buffers duplicated in new buffers.
13606  */
13607 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
13608
13609 /**
13610  * Creates a new CResult_SecretKeyNoneZ in the success state.
13611  */
13612 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
13613
13614 /**
13615  * Creates a new CResult_SecretKeyNoneZ in the error state.
13616  */
13617 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
13618
13619 /**
13620  * Checks if the given object is currently in the success state
13621  */
13622 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
13623
13624 /**
13625  * Frees any resources used by the CResult_SecretKeyNoneZ.
13626  */
13627 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
13628
13629 /**
13630  * Creates a new CResult_SignDecodeErrorZ in the success state.
13631  */
13632 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
13633
13634 /**
13635  * Creates a new CResult_SignDecodeErrorZ in the error state.
13636  */
13637 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
13638
13639 /**
13640  * Checks if the given object is currently in the success state
13641  */
13642 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
13643
13644 /**
13645  * Frees any resources used by the CResult_SignDecodeErrorZ.
13646  */
13647 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
13648
13649 /**
13650  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
13651  * but with all dynamically-allocated buffers duplicated in new buffers.
13652  */
13653 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
13654
13655 /**
13656  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13657  */
13658 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
13659
13660 /**
13661  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
13662  */
13663 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
13664
13665 /**
13666  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
13667  */
13668 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
13669
13670 /**
13671  * Checks if the given object is currently in the success state
13672  */
13673 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
13674
13675 /**
13676  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
13677  */
13678 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
13679
13680 /**
13681  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
13682  * but with all dynamically-allocated buffers duplicated in new buffers.
13683  */
13684 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
13685
13686 /**
13687  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13688  */
13689 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
13690
13691 /**
13692  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13693  */
13694 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
13695
13696 /**
13697  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
13698  */
13699 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
13700
13701 /**
13702  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
13703  */
13704 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
13705
13706 /**
13707  * Checks if the given object is currently in the success state
13708  */
13709 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
13710
13711 /**
13712  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
13713  */
13714 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
13715
13716 /**
13717  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
13718  * but with all dynamically-allocated buffers duplicated in new buffers.
13719  */
13720 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
13721
13722 /**
13723  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
13724  */
13725 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
13726
13727 /**
13728  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
13729  */
13730 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
13731
13732 /**
13733  * Checks if the given object is currently in the success state
13734  */
13735 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
13736
13737 /**
13738  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
13739  */
13740 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
13741
13742 /**
13743  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
13744  * but with all dynamically-allocated buffers duplicated in new buffers.
13745  */
13746 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
13747
13748 /**
13749  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13750  */
13751 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
13752
13753 /**
13754  * Creates a new CResult_TransactionNoneZ in the success state.
13755  */
13756 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
13757
13758 /**
13759  * Creates a new CResult_TransactionNoneZ in the error state.
13760  */
13761 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
13762
13763 /**
13764  * Checks if the given object is currently in the success state
13765  */
13766 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
13767
13768 /**
13769  * Frees any resources used by the CResult_TransactionNoneZ.
13770  */
13771 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
13772
13773 /**
13774  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
13775  * but with all dynamically-allocated buffers duplicated in new buffers.
13776  */
13777 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
13778
13779 /**
13780  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
13781  */
13782 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
13783
13784 /**
13785  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
13786  */
13787 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
13788
13789 /**
13790  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13791  */
13792 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
13793
13794 /**
13795  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
13796  */
13797 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
13798
13799 /**
13800  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
13801  */
13802 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
13803
13804 /**
13805  * Checks if the given object is currently in the success state
13806  */
13807 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
13808
13809 /**
13810  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
13811  */
13812 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
13813
13814 /**
13815  * Constructs a new COption_u16Z containing a u16
13816  */
13817 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
13818
13819 /**
13820  * Constructs a new COption_u16Z containing nothing
13821  */
13822 struct LDKCOption_u16Z COption_u16Z_none(void);
13823
13824 /**
13825  * Frees any resources associated with the u16, if we are in the Some state
13826  */
13827 void COption_u16Z_free(struct LDKCOption_u16Z _res);
13828
13829 /**
13830  * Creates a new COption_u16Z which has the same data as `orig`
13831  * but with all dynamically-allocated buffers duplicated in new buffers.
13832  */
13833 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
13834
13835 /**
13836  * Creates a new CResult_NoneAPIErrorZ in the success state.
13837  */
13838 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
13839
13840 /**
13841  * Creates a new CResult_NoneAPIErrorZ in the error state.
13842  */
13843 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
13844
13845 /**
13846  * Checks if the given object is currently in the success state
13847  */
13848 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
13849
13850 /**
13851  * Frees any resources used by the CResult_NoneAPIErrorZ.
13852  */
13853 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
13854
13855 /**
13856  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
13857  * but with all dynamically-allocated buffers duplicated in new buffers.
13858  */
13859 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
13860
13861 /**
13862  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13863  */
13864 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
13865
13866 /**
13867  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13868  */
13869 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
13870
13871 /**
13872  * Creates a new CResult__u832APIErrorZ in the success state.
13873  */
13874 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
13875
13876 /**
13877  * Creates a new CResult__u832APIErrorZ in the error state.
13878  */
13879 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
13880
13881 /**
13882  * Checks if the given object is currently in the success state
13883  */
13884 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
13885
13886 /**
13887  * Frees any resources used by the CResult__u832APIErrorZ.
13888  */
13889 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
13890
13891 /**
13892  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
13893  * but with all dynamically-allocated buffers duplicated in new buffers.
13894  */
13895 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
13896
13897 /**
13898  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
13899  */
13900 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
13901
13902 /**
13903  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
13904  */
13905 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
13906
13907 /**
13908  * Checks if the given object is currently in the success state
13909  */
13910 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
13911
13912 /**
13913  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
13914  */
13915 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
13916
13917 /**
13918  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
13919  * but with all dynamically-allocated buffers duplicated in new buffers.
13920  */
13921 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
13922
13923 /**
13924  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
13925  */
13926 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
13927
13928 /**
13929  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
13930  */
13931 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
13932
13933 /**
13934  * Checks if the given object is currently in the success state
13935  */
13936 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
13937
13938 /**
13939  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
13940  */
13941 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
13942
13943 /**
13944  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
13945  * but with all dynamically-allocated buffers duplicated in new buffers.
13946  */
13947 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
13948
13949 /**
13950  * Creates a new tuple which has the same data as `orig`
13951  * but with all dynamically-allocated buffers duplicated in new buffers.
13952  */
13953 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
13954
13955 /**
13956  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
13957  */
13958 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
13959
13960 /**
13961  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
13962  */
13963 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
13964
13965 /**
13966  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
13967  */
13968 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
13969
13970 /**
13971  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
13972  */
13973 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
13974
13975 /**
13976  * Checks if the given object is currently in the success state
13977  */
13978 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
13979
13980 /**
13981  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
13982  */
13983 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
13984
13985 /**
13986  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
13987  * but with all dynamically-allocated buffers duplicated in new buffers.
13988  */
13989 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
13990
13991 /**
13992  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13993  */
13994 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
13995
13996 /**
13997  * Creates a new tuple which has the same data as `orig`
13998  * but with all dynamically-allocated buffers duplicated in new buffers.
13999  */
14000 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
14001
14002 /**
14003  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
14004  */
14005 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14006
14007 /**
14008  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
14009  */
14010 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
14011
14012 /**
14013  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
14014  */
14015 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14016
14017 /**
14018  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
14019  */
14020 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
14021
14022 /**
14023  * Checks if the given object is currently in the success state
14024  */
14025 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
14026
14027 /**
14028  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
14029  */
14030 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
14031
14032 /**
14033  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
14034  * but with all dynamically-allocated buffers duplicated in new buffers.
14035  */
14036 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
14037
14038 /**
14039  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
14040  */
14041 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14042
14043 /**
14044  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
14045  */
14046 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
14047
14048 /**
14049  * Checks if the given object is currently in the success state
14050  */
14051 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
14052
14053 /**
14054  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
14055  */
14056 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
14057
14058 /**
14059  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
14060  * but with all dynamically-allocated buffers duplicated in new buffers.
14061  */
14062 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
14063
14064 /**
14065  * Creates a new CResult_PaymentSecretNoneZ in the success state.
14066  */
14067 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
14068
14069 /**
14070  * Creates a new CResult_PaymentSecretNoneZ in the error state.
14071  */
14072 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
14073
14074 /**
14075  * Checks if the given object is currently in the success state
14076  */
14077 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
14078
14079 /**
14080  * Frees any resources used by the CResult_PaymentSecretNoneZ.
14081  */
14082 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
14083
14084 /**
14085  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
14086  * but with all dynamically-allocated buffers duplicated in new buffers.
14087  */
14088 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
14089
14090 /**
14091  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
14092  */
14093 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
14094
14095 /**
14096  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
14097  */
14098 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
14099
14100 /**
14101  * Checks if the given object is currently in the success state
14102  */
14103 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
14104
14105 /**
14106  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
14107  */
14108 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
14109
14110 /**
14111  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
14112  * but with all dynamically-allocated buffers duplicated in new buffers.
14113  */
14114 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
14115
14116 /**
14117  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
14118  */
14119 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
14120
14121 /**
14122  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
14123  */
14124 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
14125
14126 /**
14127  * Checks if the given object is currently in the success state
14128  */
14129 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
14130
14131 /**
14132  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
14133  */
14134 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
14135
14136 /**
14137  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
14138  * but with all dynamically-allocated buffers duplicated in new buffers.
14139  */
14140 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
14141
14142 /**
14143  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
14144  */
14145 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
14146
14147 /**
14148  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
14149  */
14150 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
14151
14152 /**
14153  * Checks if the given object is currently in the success state
14154  */
14155 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
14156
14157 /**
14158  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
14159  */
14160 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
14161
14162 /**
14163  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
14164  * but with all dynamically-allocated buffers duplicated in new buffers.
14165  */
14166 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
14167
14168 /**
14169  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
14170  */
14171 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
14172
14173 /**
14174  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
14175  */
14176 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
14177
14178 /**
14179  * Checks if the given object is currently in the success state
14180  */
14181 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
14182
14183 /**
14184  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
14185  */
14186 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
14187
14188 /**
14189  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
14190  * but with all dynamically-allocated buffers duplicated in new buffers.
14191  */
14192 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
14193
14194 /**
14195  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
14196  */
14197 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
14198
14199 /**
14200  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
14201  */
14202 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
14203
14204 /**
14205  * Checks if the given object is currently in the success state
14206  */
14207 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
14208
14209 /**
14210  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
14211  */
14212 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
14213
14214 /**
14215  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
14216  * but with all dynamically-allocated buffers duplicated in new buffers.
14217  */
14218 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
14219
14220 /**
14221  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
14222  */
14223 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
14224
14225 /**
14226  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
14227  */
14228 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
14229
14230 /**
14231  * Checks if the given object is currently in the success state
14232  */
14233 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
14234
14235 /**
14236  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
14237  */
14238 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
14239
14240 /**
14241  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14242  */
14243 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
14244
14245 /**
14246  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
14247  */
14248 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
14249
14250 /**
14251  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
14252  */
14253 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
14254
14255 /**
14256  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
14257  */
14258 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
14259
14260 /**
14261  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
14262  */
14263 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
14264
14265 /**
14266  * Checks if the given object is currently in the success state
14267  */
14268 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
14269
14270 /**
14271  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
14272  */
14273 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
14274
14275 /**
14276  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
14277  */
14278 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
14279
14280 /**
14281  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
14282  */
14283 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
14284
14285 /**
14286  * Checks if the given object is currently in the success state
14287  */
14288 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
14289
14290 /**
14291  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
14292  */
14293 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
14294
14295 /**
14296  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
14297  * but with all dynamically-allocated buffers duplicated in new buffers.
14298  */
14299 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
14300
14301 /**
14302  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
14303  */
14304 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
14305
14306 /**
14307  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
14308  */
14309 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
14310
14311 /**
14312  * Checks if the given object is currently in the success state
14313  */
14314 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
14315
14316 /**
14317  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
14318  */
14319 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
14320
14321 /**
14322  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
14323  * but with all dynamically-allocated buffers duplicated in new buffers.
14324  */
14325 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
14326
14327 /**
14328  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
14329  */
14330 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
14331
14332 /**
14333  * Constructs a new COption_TypeZ containing nothing
14334  */
14335 struct LDKCOption_TypeZ COption_TypeZ_none(void);
14336
14337 /**
14338  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
14339  */
14340 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
14341
14342 /**
14343  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
14344  */
14345 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
14346
14347 /**
14348  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
14349  */
14350 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
14351
14352 /**
14353  * Checks if the given object is currently in the success state
14354  */
14355 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
14356
14357 /**
14358  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
14359  */
14360 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
14361
14362 /**
14363  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
14364  */
14365 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
14366
14367 /**
14368  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
14369  */
14370 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
14371
14372 /**
14373  * Checks if the given object is currently in the success state
14374  */
14375 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
14376
14377 /**
14378  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
14379  */
14380 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
14381
14382 /**
14383  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
14384  * but with all dynamically-allocated buffers duplicated in new buffers.
14385  */
14386 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
14387
14388 /**
14389  * Creates a new CResult_SiPrefixNoneZ in the success state.
14390  */
14391 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
14392
14393 /**
14394  * Creates a new CResult_SiPrefixNoneZ in the error state.
14395  */
14396 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
14397
14398 /**
14399  * Checks if the given object is currently in the success state
14400  */
14401 bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o);
14402
14403 /**
14404  * Frees any resources used by the CResult_SiPrefixNoneZ.
14405  */
14406 void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res);
14407
14408 /**
14409  * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig`
14410  * but with all dynamically-allocated buffers duplicated in new buffers.
14411  */
14412 struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig);
14413
14414 /**
14415  * Creates a new CResult_InvoiceNoneZ in the success state.
14416  */
14417 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o);
14418
14419 /**
14420  * Creates a new CResult_InvoiceNoneZ in the error state.
14421  */
14422 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void);
14423
14424 /**
14425  * Checks if the given object is currently in the success state
14426  */
14427 bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o);
14428
14429 /**
14430  * Frees any resources used by the CResult_InvoiceNoneZ.
14431  */
14432 void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res);
14433
14434 /**
14435  * Creates a new CResult_InvoiceNoneZ which has the same data as `orig`
14436  * but with all dynamically-allocated buffers duplicated in new buffers.
14437  */
14438 struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig);
14439
14440 /**
14441  * Creates a new CResult_SignedRawInvoiceNoneZ in the success state.
14442  */
14443 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o);
14444
14445 /**
14446  * Creates a new CResult_SignedRawInvoiceNoneZ in the error state.
14447  */
14448 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void);
14449
14450 /**
14451  * Checks if the given object is currently in the success state
14452  */
14453 bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o);
14454
14455 /**
14456  * Frees any resources used by the CResult_SignedRawInvoiceNoneZ.
14457  */
14458 void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res);
14459
14460 /**
14461  * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig`
14462  * but with all dynamically-allocated buffers duplicated in new buffers.
14463  */
14464 struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig);
14465
14466 /**
14467  * Creates a new tuple which has the same data as `orig`
14468  * but with all dynamically-allocated buffers duplicated in new buffers.
14469  */
14470 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
14471
14472 /**
14473  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
14474  */
14475 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
14476
14477 /**
14478  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
14479  */
14480 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
14481
14482 /**
14483  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
14484  */
14485 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
14486
14487 /**
14488  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
14489  */
14490 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
14491
14492 /**
14493  * Checks if the given object is currently in the success state
14494  */
14495 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
14496
14497 /**
14498  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
14499  */
14500 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
14501
14502 /**
14503  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
14504  * but with all dynamically-allocated buffers duplicated in new buffers.
14505  */
14506 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
14507
14508 /**
14509  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14510  */
14511 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
14512
14513 /**
14514  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
14515  */
14516 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
14517
14518 /**
14519  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
14520  */
14521 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
14522
14523 /**
14524  * Checks if the given object is currently in the success state
14525  */
14526 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
14527
14528 /**
14529  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
14530  */
14531 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
14532
14533 /**
14534  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
14535  * but with all dynamically-allocated buffers duplicated in new buffers.
14536  */
14537 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
14538
14539 /**
14540  * Creates a new CResult_NoneSemanticErrorZ in the success state.
14541  */
14542 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
14543
14544 /**
14545  * Creates a new CResult_NoneSemanticErrorZ in the error state.
14546  */
14547 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
14548
14549 /**
14550  * Checks if the given object is currently in the success state
14551  */
14552 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
14553
14554 /**
14555  * Frees any resources used by the CResult_NoneSemanticErrorZ.
14556  */
14557 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
14558
14559 /**
14560  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
14561  * but with all dynamically-allocated buffers duplicated in new buffers.
14562  */
14563 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
14564
14565 /**
14566  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
14567  */
14568 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
14569
14570 /**
14571  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
14572  */
14573 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
14574
14575 /**
14576  * Checks if the given object is currently in the success state
14577  */
14578 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
14579
14580 /**
14581  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
14582  */
14583 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
14584
14585 /**
14586  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
14587  * but with all dynamically-allocated buffers duplicated in new buffers.
14588  */
14589 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
14590
14591 /**
14592  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
14593  */
14594 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
14595
14596 /**
14597  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
14598  */
14599 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
14600
14601 /**
14602  * Checks if the given object is currently in the success state
14603  */
14604 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
14605
14606 /**
14607  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
14608  */
14609 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
14610
14611 /**
14612  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
14613  * but with all dynamically-allocated buffers duplicated in new buffers.
14614  */
14615 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
14616
14617 /**
14618  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
14619  */
14620 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
14621
14622 /**
14623  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
14624  */
14625 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
14626
14627 /**
14628  * Checks if the given object is currently in the success state
14629  */
14630 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
14631
14632 /**
14633  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
14634  */
14635 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
14636
14637 /**
14638  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
14639  * but with all dynamically-allocated buffers duplicated in new buffers.
14640  */
14641 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
14642
14643 /**
14644  * Creates a new CResult_StringErrorZ in the success state.
14645  */
14646 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
14647
14648 /**
14649  * Creates a new CResult_StringErrorZ in the error state.
14650  */
14651 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
14652
14653 /**
14654  * Checks if the given object is currently in the success state
14655  */
14656 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
14657
14658 /**
14659  * Frees any resources used by the CResult_StringErrorZ.
14660  */
14661 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
14662
14663 /**
14664  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
14665  */
14666 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
14667
14668 /**
14669  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
14670  */
14671 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
14672
14673 /**
14674  * Checks if the given object is currently in the success state
14675  */
14676 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
14677
14678 /**
14679  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
14680  */
14681 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
14682
14683 /**
14684  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
14685  * but with all dynamically-allocated buffers duplicated in new buffers.
14686  */
14687 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
14688
14689 /**
14690  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
14691  */
14692 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
14693
14694 /**
14695  * Constructs a new COption_MonitorEventZ containing nothing
14696  */
14697 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
14698
14699 /**
14700  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
14701  */
14702 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
14703
14704 /**
14705  * Creates a new COption_MonitorEventZ which has the same data as `orig`
14706  * but with all dynamically-allocated buffers duplicated in new buffers.
14707  */
14708 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
14709
14710 /**
14711  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
14712  */
14713 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
14714
14715 /**
14716  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
14717  */
14718 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
14719
14720 /**
14721  * Checks if the given object is currently in the success state
14722  */
14723 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
14724
14725 /**
14726  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
14727  */
14728 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
14729
14730 /**
14731  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
14732  * but with all dynamically-allocated buffers duplicated in new buffers.
14733  */
14734 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
14735
14736 /**
14737  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
14738  */
14739 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
14740
14741 /**
14742  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
14743  */
14744 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
14745
14746 /**
14747  * Checks if the given object is currently in the success state
14748  */
14749 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
14750
14751 /**
14752  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
14753  */
14754 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
14755
14756 /**
14757  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
14758  * but with all dynamically-allocated buffers duplicated in new buffers.
14759  */
14760 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
14761
14762 /**
14763  * Creates a new tuple which has the same data as `orig`
14764  * but with all dynamically-allocated buffers duplicated in new buffers.
14765  */
14766 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
14767
14768 /**
14769  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
14770  */
14771 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
14772
14773 /**
14774  * Frees any resources used by the C2Tuple_OutPointScriptZ.
14775  */
14776 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
14777
14778 /**
14779  * Creates a new tuple which has the same data as `orig`
14780  * but with all dynamically-allocated buffers duplicated in new buffers.
14781  */
14782 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
14783
14784 /**
14785  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
14786  */
14787 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
14788
14789 /**
14790  * Frees any resources used by the C2Tuple_u32ScriptZ.
14791  */
14792 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
14793
14794 /**
14795  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14796  */
14797 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
14798
14799 /**
14800  * Creates a new tuple which has the same data as `orig`
14801  * but with all dynamically-allocated buffers duplicated in new buffers.
14802  */
14803 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
14804
14805 /**
14806  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
14807  */
14808 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
14809
14810 /**
14811  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
14812  */
14813 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
14814
14815 /**
14816  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14817  */
14818 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
14819
14820 /**
14821  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14822  */
14823 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
14824
14825 /**
14826  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14827  */
14828 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
14829
14830 /**
14831  * Creates a new tuple which has the same data as `orig`
14832  * but with all dynamically-allocated buffers duplicated in new buffers.
14833  */
14834 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
14835
14836 /**
14837  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
14838  */
14839 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
14840
14841 /**
14842  * Frees any resources used by the C2Tuple_u32TxOutZ.
14843  */
14844 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
14845
14846 /**
14847  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14848  */
14849 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
14850
14851 /**
14852  * Creates a new tuple which has the same data as `orig`
14853  * but with all dynamically-allocated buffers duplicated in new buffers.
14854  */
14855 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
14856
14857 /**
14858  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
14859  */
14860 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
14861
14862 /**
14863  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
14864  */
14865 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
14866
14867 /**
14868  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14869  */
14870 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
14871
14872 /**
14873  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14874  */
14875 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
14876
14877 /**
14878  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
14879  */
14880 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
14881
14882 /**
14883  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
14884  */
14885 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
14886
14887 /**
14888  * Checks if the given object is currently in the success state
14889  */
14890 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
14891
14892 /**
14893  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
14894  */
14895 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
14896
14897 /**
14898  * Creates a new CResult_NoneLightningErrorZ in the success state.
14899  */
14900 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
14901
14902 /**
14903  * Creates a new CResult_NoneLightningErrorZ in the error state.
14904  */
14905 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
14906
14907 /**
14908  * Checks if the given object is currently in the success state
14909  */
14910 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
14911
14912 /**
14913  * Frees any resources used by the CResult_NoneLightningErrorZ.
14914  */
14915 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
14916
14917 /**
14918  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
14919  * but with all dynamically-allocated buffers duplicated in new buffers.
14920  */
14921 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
14922
14923 /**
14924  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
14925  */
14926 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
14927
14928 /**
14929  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
14930  */
14931 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
14932
14933 /**
14934  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14935  */
14936 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
14937
14938 /**
14939  * Creates a new CResult_boolLightningErrorZ in the success state.
14940  */
14941 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
14942
14943 /**
14944  * Creates a new CResult_boolLightningErrorZ in the error state.
14945  */
14946 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
14947
14948 /**
14949  * Checks if the given object is currently in the success state
14950  */
14951 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
14952
14953 /**
14954  * Frees any resources used by the CResult_boolLightningErrorZ.
14955  */
14956 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
14957
14958 /**
14959  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
14960  * but with all dynamically-allocated buffers duplicated in new buffers.
14961  */
14962 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
14963
14964 /**
14965  * Creates a new tuple which has the same data as `orig`
14966  * but with all dynamically-allocated buffers duplicated in new buffers.
14967  */
14968 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
14969
14970 /**
14971  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
14972  */
14973 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
14974
14975 /**
14976  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
14977  */
14978 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
14979
14980 /**
14981  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14982  */
14983 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
14984
14985 /**
14986  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14987  */
14988 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
14989
14990 /**
14991  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14992  */
14993 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
14994
14995 /**
14996  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
14997  */
14998 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
14999
15000 /**
15001  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
15002  */
15003 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15004
15005 /**
15006  * Checks if the given object is currently in the success state
15007  */
15008 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
15009
15010 /**
15011  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
15012  */
15013 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
15014
15015 /**
15016  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
15017  * but with all dynamically-allocated buffers duplicated in new buffers.
15018  */
15019 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
15020
15021 /**
15022  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
15023  */
15024 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
15025
15026 /**
15027  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
15028  */
15029 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
15030
15031 /**
15032  * Checks if the given object is currently in the success state
15033  */
15034 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
15035
15036 /**
15037  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
15038  */
15039 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
15040
15041 /**
15042  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
15043  * but with all dynamically-allocated buffers duplicated in new buffers.
15044  */
15045 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
15046
15047 /**
15048  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
15049  */
15050 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
15051
15052 /**
15053  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
15054  */
15055 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15056
15057 /**
15058  * Checks if the given object is currently in the success state
15059  */
15060 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
15061
15062 /**
15063  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
15064  */
15065 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
15066
15067 /**
15068  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
15069  * but with all dynamically-allocated buffers duplicated in new buffers.
15070  */
15071 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
15072
15073 /**
15074  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
15075  */
15076 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
15077
15078 /**
15079  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
15080  */
15081 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
15082
15083 /**
15084  * Checks if the given object is currently in the success state
15085  */
15086 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
15087
15088 /**
15089  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
15090  */
15091 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
15092
15093 /**
15094  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
15095  * but with all dynamically-allocated buffers duplicated in new buffers.
15096  */
15097 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
15098
15099 /**
15100  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
15101  */
15102 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
15103
15104 /**
15105  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
15106  */
15107 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
15108
15109 /**
15110  * Checks if the given object is currently in the success state
15111  */
15112 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
15113
15114 /**
15115  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
15116  */
15117 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
15118
15119 /**
15120  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
15121  * but with all dynamically-allocated buffers duplicated in new buffers.
15122  */
15123 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
15124
15125 /**
15126  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
15127  */
15128 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
15129
15130 /**
15131  * Constructs a new COption_AccessZ containing nothing
15132  */
15133 struct LDKCOption_AccessZ COption_AccessZ_none(void);
15134
15135 /**
15136  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
15137  */
15138 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
15139
15140 /**
15141  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
15142  */
15143 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
15144
15145 /**
15146  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
15147  */
15148 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
15149
15150 /**
15151  * Checks if the given object is currently in the success state
15152  */
15153 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
15154
15155 /**
15156  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
15157  */
15158 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
15159
15160 /**
15161  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
15162  * but with all dynamically-allocated buffers duplicated in new buffers.
15163  */
15164 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
15165
15166 /**
15167  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
15168  */
15169 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
15170
15171 /**
15172  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
15173  */
15174 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
15175
15176 /**
15177  * Checks if the given object is currently in the success state
15178  */
15179 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
15180
15181 /**
15182  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
15183  */
15184 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
15185
15186 /**
15187  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
15188  * but with all dynamically-allocated buffers duplicated in new buffers.
15189  */
15190 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
15191
15192 /**
15193  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
15194  */
15195 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
15196
15197 /**
15198  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
15199  */
15200 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
15201
15202 /**
15203  * Checks if the given object is currently in the success state
15204  */
15205 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
15206
15207 /**
15208  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
15209  */
15210 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
15211
15212 /**
15213  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
15214  * but with all dynamically-allocated buffers duplicated in new buffers.
15215  */
15216 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
15217
15218 /**
15219  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
15220  */
15221 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
15222
15223 /**
15224  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
15225  */
15226 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
15227
15228 /**
15229  * Checks if the given object is currently in the success state
15230  */
15231 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
15232
15233 /**
15234  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
15235  */
15236 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
15237
15238 /**
15239  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
15240  * but with all dynamically-allocated buffers duplicated in new buffers.
15241  */
15242 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
15243
15244 /**
15245  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15246  */
15247 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
15248
15249 /**
15250  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
15251  */
15252 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
15253
15254 /**
15255  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
15256  */
15257 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
15258
15259 /**
15260  * Checks if the given object is currently in the success state
15261  */
15262 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
15263
15264 /**
15265  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
15266  */
15267 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
15268
15269 /**
15270  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
15271  * but with all dynamically-allocated buffers duplicated in new buffers.
15272  */
15273 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
15274
15275 /**
15276  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
15277  */
15278 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
15279
15280 /**
15281  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
15282  */
15283 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
15284
15285 /**
15286  * Checks if the given object is currently in the success state
15287  */
15288 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
15289
15290 /**
15291  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
15292  */
15293 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
15294
15295 /**
15296  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
15297  * but with all dynamically-allocated buffers duplicated in new buffers.
15298  */
15299 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
15300
15301 /**
15302  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
15303  */
15304 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
15305
15306 /**
15307  * Constructs a new COption_CVec_NetAddressZZ containing nothing
15308  */
15309 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
15310
15311 /**
15312  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
15313  */
15314 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
15315
15316 /**
15317  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
15318  * but with all dynamically-allocated buffers duplicated in new buffers.
15319  */
15320 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
15321
15322 /**
15323  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
15324  */
15325 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
15326
15327 /**
15328  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
15329  */
15330 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
15331
15332 /**
15333  * Checks if the given object is currently in the success state
15334  */
15335 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
15336
15337 /**
15338  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
15339  */
15340 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
15341
15342 /**
15343  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
15344  * but with all dynamically-allocated buffers duplicated in new buffers.
15345  */
15346 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
15347
15348 /**
15349  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15350  */
15351 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
15352
15353 /**
15354  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15355  */
15356 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
15357
15358 /**
15359  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15360  */
15361 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
15362
15363 /**
15364  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15365  */
15366 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
15367
15368 /**
15369  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15370  */
15371 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
15372
15373 /**
15374  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15375  */
15376 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
15377
15378 /**
15379  * Checks if the given object is currently in the success state
15380  */
15381 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
15382
15383 /**
15384  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
15385  */
15386 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
15387
15388 /**
15389  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
15390  * but with all dynamically-allocated buffers duplicated in new buffers.
15391  */
15392 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
15393
15394 /**
15395  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
15396  */
15397 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
15398
15399 /**
15400  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
15401  */
15402 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
15403
15404 /**
15405  * Checks if the given object is currently in the success state
15406  */
15407 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
15408
15409 /**
15410  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
15411  */
15412 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
15413
15414 /**
15415  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
15416  * but with all dynamically-allocated buffers duplicated in new buffers.
15417  */
15418 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
15419
15420 /**
15421  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
15422  */
15423 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
15424
15425 /**
15426  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
15427  */
15428 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
15429
15430 /**
15431  * Checks if the given object is currently in the success state
15432  */
15433 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
15434
15435 /**
15436  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
15437  */
15438 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
15439
15440 /**
15441  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
15442  * but with all dynamically-allocated buffers duplicated in new buffers.
15443  */
15444 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
15445
15446 /**
15447  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
15448  */
15449 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
15450
15451 /**
15452  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
15453  */
15454 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
15455
15456 /**
15457  * Checks if the given object is currently in the success state
15458  */
15459 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
15460
15461 /**
15462  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
15463  */
15464 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
15465
15466 /**
15467  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
15468  * but with all dynamically-allocated buffers duplicated in new buffers.
15469  */
15470 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
15471
15472 /**
15473  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
15474  */
15475 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
15476
15477 /**
15478  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
15479  */
15480 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
15481
15482 /**
15483  * Checks if the given object is currently in the success state
15484  */
15485 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
15486
15487 /**
15488  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
15489  */
15490 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
15491
15492 /**
15493  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
15494  * but with all dynamically-allocated buffers duplicated in new buffers.
15495  */
15496 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
15497
15498 /**
15499  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
15500  */
15501 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
15502
15503 /**
15504  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
15505  */
15506 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
15507
15508 /**
15509  * Checks if the given object is currently in the success state
15510  */
15511 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
15512
15513 /**
15514  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
15515  */
15516 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
15517
15518 /**
15519  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
15520  * but with all dynamically-allocated buffers duplicated in new buffers.
15521  */
15522 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
15523
15524 /**
15525  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
15526  */
15527 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
15528
15529 /**
15530  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
15531  */
15532 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
15533
15534 /**
15535  * Checks if the given object is currently in the success state
15536  */
15537 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
15538
15539 /**
15540  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
15541  */
15542 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
15543
15544 /**
15545  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
15546  * but with all dynamically-allocated buffers duplicated in new buffers.
15547  */
15548 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
15549
15550 /**
15551  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
15552  */
15553 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
15554
15555 /**
15556  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
15557  */
15558 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
15559
15560 /**
15561  * Checks if the given object is currently in the success state
15562  */
15563 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
15564
15565 /**
15566  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
15567  */
15568 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
15569
15570 /**
15571  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
15572  * but with all dynamically-allocated buffers duplicated in new buffers.
15573  */
15574 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
15575
15576 /**
15577  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
15578  */
15579 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
15580
15581 /**
15582  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
15583  */
15584 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
15585
15586 /**
15587  * Checks if the given object is currently in the success state
15588  */
15589 bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o);
15590
15591 /**
15592  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
15593  */
15594 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
15595
15596 /**
15597  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
15598  * but with all dynamically-allocated buffers duplicated in new buffers.
15599  */
15600 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
15601
15602 /**
15603  * Creates a new CResult_InitDecodeErrorZ in the success state.
15604  */
15605 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
15606
15607 /**
15608  * Creates a new CResult_InitDecodeErrorZ in the error state.
15609  */
15610 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
15611
15612 /**
15613  * Checks if the given object is currently in the success state
15614  */
15615 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
15616
15617 /**
15618  * Frees any resources used by the CResult_InitDecodeErrorZ.
15619  */
15620 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
15621
15622 /**
15623  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15624  * but with all dynamically-allocated buffers duplicated in new buffers.
15625  */
15626 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
15627
15628 /**
15629  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15630  */
15631 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
15632
15633 /**
15634  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15635  */
15636 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
15637
15638 /**
15639  * Checks if the given object is currently in the success state
15640  */
15641 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
15642
15643 /**
15644  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15645  */
15646 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
15647
15648 /**
15649  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15650  * but with all dynamically-allocated buffers duplicated in new buffers.
15651  */
15652 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
15653
15654 /**
15655  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15656  */
15657 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
15658
15659 /**
15660  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15661  */
15662 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
15663
15664 /**
15665  * Checks if the given object is currently in the success state
15666  */
15667 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
15668
15669 /**
15670  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15671  */
15672 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
15673
15674 /**
15675  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15676  * but with all dynamically-allocated buffers duplicated in new buffers.
15677  */
15678 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
15679
15680 /**
15681  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15682  */
15683 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
15684
15685 /**
15686  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15687  */
15688 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
15689
15690 /**
15691  * Checks if the given object is currently in the success state
15692  */
15693 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
15694
15695 /**
15696  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
15697  */
15698 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
15699
15700 /**
15701  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
15702  * but with all dynamically-allocated buffers duplicated in new buffers.
15703  */
15704 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
15705
15706 /**
15707  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
15708  */
15709 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
15710
15711 /**
15712  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
15713  */
15714 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15715
15716 /**
15717  * Checks if the given object is currently in the success state
15718  */
15719 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
15720
15721 /**
15722  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
15723  */
15724 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
15725
15726 /**
15727  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
15728  * but with all dynamically-allocated buffers duplicated in new buffers.
15729  */
15730 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
15731
15732 /**
15733  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
15734  */
15735 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
15736
15737 /**
15738  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
15739  */
15740 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15741
15742 /**
15743  * Checks if the given object is currently in the success state
15744  */
15745 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
15746
15747 /**
15748  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
15749  */
15750 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
15751
15752 /**
15753  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
15754  * but with all dynamically-allocated buffers duplicated in new buffers.
15755  */
15756 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
15757
15758 /**
15759  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
15760  */
15761 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
15762
15763 /**
15764  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
15765  */
15766 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
15767
15768 /**
15769  * Checks if the given object is currently in the success state
15770  */
15771 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
15772
15773 /**
15774  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
15775  */
15776 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
15777
15778 /**
15779  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
15780  * but with all dynamically-allocated buffers duplicated in new buffers.
15781  */
15782 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
15783
15784 /**
15785  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
15786  */
15787 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
15788
15789 /**
15790  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
15791  */
15792 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15793
15794 /**
15795  * Checks if the given object is currently in the success state
15796  */
15797 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
15798
15799 /**
15800  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
15801  */
15802 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
15803
15804 /**
15805  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
15806  * but with all dynamically-allocated buffers duplicated in new buffers.
15807  */
15808 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
15809
15810 /**
15811  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
15812  */
15813 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
15814
15815 /**
15816  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
15817  */
15818 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
15819
15820 /**
15821  * Checks if the given object is currently in the success state
15822  */
15823 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
15824
15825 /**
15826  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
15827  */
15828 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
15829
15830 /**
15831  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
15832  * but with all dynamically-allocated buffers duplicated in new buffers.
15833  */
15834 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
15835
15836 /**
15837  * Creates a new CResult_PingDecodeErrorZ in the success state.
15838  */
15839 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
15840
15841 /**
15842  * Creates a new CResult_PingDecodeErrorZ in the error state.
15843  */
15844 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
15845
15846 /**
15847  * Checks if the given object is currently in the success state
15848  */
15849 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
15850
15851 /**
15852  * Frees any resources used by the CResult_PingDecodeErrorZ.
15853  */
15854 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
15855
15856 /**
15857  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
15858  * but with all dynamically-allocated buffers duplicated in new buffers.
15859  */
15860 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
15861
15862 /**
15863  * Creates a new CResult_PongDecodeErrorZ in the success state.
15864  */
15865 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
15866
15867 /**
15868  * Creates a new CResult_PongDecodeErrorZ in the error state.
15869  */
15870 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
15871
15872 /**
15873  * Checks if the given object is currently in the success state
15874  */
15875 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
15876
15877 /**
15878  * Frees any resources used by the CResult_PongDecodeErrorZ.
15879  */
15880 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
15881
15882 /**
15883  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
15884  * but with all dynamically-allocated buffers duplicated in new buffers.
15885  */
15886 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
15887
15888 /**
15889  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
15890  */
15891 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
15892
15893 /**
15894  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
15895  */
15896 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
15897
15898 /**
15899  * Checks if the given object is currently in the success state
15900  */
15901 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
15902
15903 /**
15904  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
15905  */
15906 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
15907
15908 /**
15909  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15910  * but with all dynamically-allocated buffers duplicated in new buffers.
15911  */
15912 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
15913
15914 /**
15915  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
15916  */
15917 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
15918
15919 /**
15920  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
15921  */
15922 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
15923
15924 /**
15925  * Checks if the given object is currently in the success state
15926  */
15927 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
15928
15929 /**
15930  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
15931  */
15932 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
15933
15934 /**
15935  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
15936  * but with all dynamically-allocated buffers duplicated in new buffers.
15937  */
15938 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
15939
15940 /**
15941  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
15942  */
15943 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
15944
15945 /**
15946  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
15947  */
15948 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15949
15950 /**
15951  * Checks if the given object is currently in the success state
15952  */
15953 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
15954
15955 /**
15956  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
15957  */
15958 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
15959
15960 /**
15961  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
15962  * but with all dynamically-allocated buffers duplicated in new buffers.
15963  */
15964 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
15965
15966 /**
15967  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
15968  */
15969 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
15970
15971 /**
15972  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
15973  */
15974 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15975
15976 /**
15977  * Checks if the given object is currently in the success state
15978  */
15979 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
15980
15981 /**
15982  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
15983  */
15984 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
15985
15986 /**
15987  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
15988  * but with all dynamically-allocated buffers duplicated in new buffers.
15989  */
15990 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
15991
15992 /**
15993  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
15994  */
15995 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
15996
15997 /**
15998  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
15999  */
16000 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
16001
16002 /**
16003  * Checks if the given object is currently in the success state
16004  */
16005 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
16006
16007 /**
16008  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16009  */
16010 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
16011
16012 /**
16013  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16014  * but with all dynamically-allocated buffers duplicated in new buffers.
16015  */
16016 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
16017
16018 /**
16019  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16020  */
16021 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
16022
16023 /**
16024  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16025  */
16026 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
16027
16028 /**
16029  * Checks if the given object is currently in the success state
16030  */
16031 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
16032
16033 /**
16034  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16035  */
16036 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
16037
16038 /**
16039  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16040  * but with all dynamically-allocated buffers duplicated in new buffers.
16041  */
16042 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
16043
16044 /**
16045  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16046  */
16047 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
16048
16049 /**
16050  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16051  */
16052 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16053
16054 /**
16055  * Checks if the given object is currently in the success state
16056  */
16057 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16058
16059 /**
16060  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16061  */
16062 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
16063
16064 /**
16065  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16066  * but with all dynamically-allocated buffers duplicated in new buffers.
16067  */
16068 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16069
16070 /**
16071  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16072  */
16073 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
16074
16075 /**
16076  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16077  */
16078 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16079
16080 /**
16081  * Checks if the given object is currently in the success state
16082  */
16083 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16084
16085 /**
16086  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16087  */
16088 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
16089
16090 /**
16091  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16092  * but with all dynamically-allocated buffers duplicated in new buffers.
16093  */
16094 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16095
16096 /**
16097  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16098  */
16099 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
16100
16101 /**
16102  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16103  */
16104 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
16105
16106 /**
16107  * Checks if the given object is currently in the success state
16108  */
16109 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
16110
16111 /**
16112  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16113  */
16114 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
16115
16116 /**
16117  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16118  * but with all dynamically-allocated buffers duplicated in new buffers.
16119  */
16120 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
16121
16122 /**
16123  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16124  */
16125 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
16126
16127 /**
16128  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16129  */
16130 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
16131
16132 /**
16133  * Checks if the given object is currently in the success state
16134  */
16135 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
16136
16137 /**
16138  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16139  */
16140 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
16141
16142 /**
16143  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16144  * but with all dynamically-allocated buffers duplicated in new buffers.
16145  */
16146 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
16147
16148 /**
16149  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16150  */
16151 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
16152
16153 /**
16154  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16155  */
16156 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16157
16158 /**
16159  * Checks if the given object is currently in the success state
16160  */
16161 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
16162
16163 /**
16164  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16165  */
16166 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
16167
16168 /**
16169  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16170  * but with all dynamically-allocated buffers duplicated in new buffers.
16171  */
16172 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16173
16174 /**
16175  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16176  */
16177 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
16178
16179 /**
16180  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16181  */
16182 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16183
16184 /**
16185  * Checks if the given object is currently in the success state
16186  */
16187 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
16188
16189 /**
16190  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16191  */
16192 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
16193
16194 /**
16195  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16196  * but with all dynamically-allocated buffers duplicated in new buffers.
16197  */
16198 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16199
16200 /**
16201  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16202  */
16203 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
16204
16205 /**
16206  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16207  */
16208 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
16209
16210 /**
16211  * Checks if the given object is currently in the success state
16212  */
16213 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
16214
16215 /**
16216  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16217  */
16218 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
16219
16220 /**
16221  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16222  * but with all dynamically-allocated buffers duplicated in new buffers.
16223  */
16224 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
16225
16226 /**
16227  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16228  */
16229 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
16230
16231 /**
16232  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16233  */
16234 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
16235
16236 /**
16237  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16238  */
16239 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
16240
16241 /**
16242  * Checks if the given object is currently in the success state
16243  */
16244 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
16245
16246 /**
16247  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16248  */
16249 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
16250
16251 /**
16252  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16253  * but with all dynamically-allocated buffers duplicated in new buffers.
16254  */
16255 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
16256
16257 /**
16258  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16259  */
16260 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
16261
16262 /**
16263  * Constructs a new COption_FilterZ containing nothing
16264  */
16265 struct LDKCOption_FilterZ COption_FilterZ_none(void);
16266
16267 /**
16268  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16269  */
16270 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
16271
16272 /**
16273  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16274  */
16275 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
16276
16277 /**
16278  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16279  */
16280 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
16281
16282 /**
16283  * Checks if the given object is currently in the success state
16284  */
16285 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
16286
16287 /**
16288  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16289  */
16290 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
16291
16292 /**
16293  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16294  */
16295 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
16296
16297 /**
16298  * Frees any resources used by the PaymentPurpose
16299  */
16300 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
16301
16302 /**
16303  * Creates a copy of the PaymentPurpose
16304  */
16305 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
16306
16307 /**
16308  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
16309  */
16310 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
16311
16312 /**
16313  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
16314  */
16315 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
16316
16317 /**
16318  * Frees any resources used by the ClosureReason
16319  */
16320 void ClosureReason_free(struct LDKClosureReason this_ptr);
16321
16322 /**
16323  * Creates a copy of the ClosureReason
16324  */
16325 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
16326
16327 /**
16328  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
16329  */
16330 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
16331
16332 /**
16333  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
16334  */
16335 struct LDKClosureReason ClosureReason_holder_force_closed(void);
16336
16337 /**
16338  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
16339  */
16340 struct LDKClosureReason ClosureReason_cooperative_closure(void);
16341
16342 /**
16343  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
16344  */
16345 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
16346
16347 /**
16348  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
16349  */
16350 struct LDKClosureReason ClosureReason_funding_timed_out(void);
16351
16352 /**
16353  * Utility method to constructs a new ProcessingError-variant ClosureReason
16354  */
16355 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
16356
16357 /**
16358  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
16359  */
16360 struct LDKClosureReason ClosureReason_disconnected_peer(void);
16361
16362 /**
16363  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
16364  */
16365 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
16366
16367 /**
16368  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
16369  */
16370 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
16371
16372 /**
16373  * Read a ClosureReason from a byte array, created by ClosureReason_write
16374  */
16375 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
16376
16377 /**
16378  * Frees any resources used by the Event
16379  */
16380 void Event_free(struct LDKEvent this_ptr);
16381
16382 /**
16383  * Creates a copy of the Event
16384  */
16385 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
16386
16387 /**
16388  * Utility method to constructs a new FundingGenerationReady-variant Event
16389  */
16390 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);
16391
16392 /**
16393  * Utility method to constructs a new PaymentReceived-variant Event
16394  */
16395 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
16396
16397 /**
16398  * Utility method to constructs a new PaymentSent-variant Event
16399  */
16400 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
16401
16402 /**
16403  * Utility method to constructs a new PaymentPathFailed-variant Event
16404  */
16405 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);
16406
16407 /**
16408  * Utility method to constructs a new PaymentFailed-variant Event
16409  */
16410 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
16411
16412 /**
16413  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
16414  */
16415 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
16416
16417 /**
16418  * Utility method to constructs a new SpendableOutputs-variant Event
16419  */
16420 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
16421
16422 /**
16423  * Utility method to constructs a new PaymentForwarded-variant Event
16424  */
16425 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
16426
16427 /**
16428  * Utility method to constructs a new ChannelClosed-variant Event
16429  */
16430 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
16431
16432 /**
16433  * Utility method to constructs a new DiscardFunding-variant Event
16434  */
16435 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
16436
16437 /**
16438  * Utility method to constructs a new PaymentPathSuccessful-variant Event
16439  */
16440 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
16441
16442 /**
16443  * Utility method to constructs a new OpenChannelRequest-variant Event
16444  */
16445 struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat);
16446
16447 /**
16448  * Serialize the Event object into a byte array which can be read by Event_read
16449  */
16450 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
16451
16452 /**
16453  * Read a Event from a byte array, created by Event_write
16454  */
16455 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
16456
16457 /**
16458  * Frees any resources used by the MessageSendEvent
16459  */
16460 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
16461
16462 /**
16463  * Creates a copy of the MessageSendEvent
16464  */
16465 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
16466
16467 /**
16468  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
16469  */
16470 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
16471
16472 /**
16473  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
16474  */
16475 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
16476
16477 /**
16478  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
16479  */
16480 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
16481
16482 /**
16483  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
16484  */
16485 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
16486
16487 /**
16488  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
16489  */
16490 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
16491
16492 /**
16493  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
16494  */
16495 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
16496
16497 /**
16498  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
16499  */
16500 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
16501
16502 /**
16503  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
16504  */
16505 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
16506
16507 /**
16508  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
16509  */
16510 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
16511
16512 /**
16513  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
16514  */
16515 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
16516
16517 /**
16518  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
16519  */
16520 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
16521
16522 /**
16523  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
16524  */
16525 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
16526
16527 /**
16528  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
16529  */
16530 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
16531
16532 /**
16533  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
16534  */
16535 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
16536
16537 /**
16538  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
16539  */
16540 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
16541
16542 /**
16543  * Utility method to constructs a new HandleError-variant MessageSendEvent
16544  */
16545 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
16546
16547 /**
16548  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
16549  */
16550 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
16551
16552 /**
16553  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
16554  */
16555 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
16556
16557 /**
16558  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
16559  */
16560 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
16561
16562 /**
16563  * Calls the free function if one is set
16564  */
16565 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
16566
16567 /**
16568  * Calls the free function if one is set
16569  */
16570 void EventsProvider_free(struct LDKEventsProvider this_ptr);
16571
16572 /**
16573  * Calls the free function if one is set
16574  */
16575 void EventHandler_free(struct LDKEventHandler this_ptr);
16576
16577 /**
16578  * Frees any resources used by the APIError
16579  */
16580 void APIError_free(struct LDKAPIError this_ptr);
16581
16582 /**
16583  * Creates a copy of the APIError
16584  */
16585 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
16586
16587 /**
16588  * Utility method to constructs a new APIMisuseError-variant APIError
16589  */
16590 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
16591
16592 /**
16593  * Utility method to constructs a new FeeRateTooHigh-variant APIError
16594  */
16595 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
16596
16597 /**
16598  * Utility method to constructs a new RouteError-variant APIError
16599  */
16600 struct LDKAPIError APIError_route_error(struct LDKStr err);
16601
16602 /**
16603  * Utility method to constructs a new ChannelUnavailable-variant APIError
16604  */
16605 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
16606
16607 /**
16608  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
16609  */
16610 struct LDKAPIError APIError_monitor_update_failed(void);
16611
16612 /**
16613  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
16614  */
16615 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
16616
16617 /**
16618  * Creates a digital signature of a message given a SecretKey, like the node's secret.
16619  * 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.
16620  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
16621  */
16622 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
16623
16624 /**
16625  * Recovers the PublicKey of the signer of the message given the message and the signature.
16626  */
16627 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
16628
16629 /**
16630  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
16631  * and the PublicKey.
16632  */
16633 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
16634
16635 /**
16636  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
16637  */
16638 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
16639
16640 /**
16641  * Creates a copy of the Level
16642  */
16643 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
16644
16645 /**
16646  * Utility method to constructs a new Gossip-variant Level
16647  */
16648 enum LDKLevel Level_gossip(void);
16649
16650 /**
16651  * Utility method to constructs a new Trace-variant Level
16652  */
16653 enum LDKLevel Level_trace(void);
16654
16655 /**
16656  * Utility method to constructs a new Debug-variant Level
16657  */
16658 enum LDKLevel Level_debug(void);
16659
16660 /**
16661  * Utility method to constructs a new Info-variant Level
16662  */
16663 enum LDKLevel Level_info(void);
16664
16665 /**
16666  * Utility method to constructs a new Warn-variant Level
16667  */
16668 enum LDKLevel Level_warn(void);
16669
16670 /**
16671  * Utility method to constructs a new Error-variant Level
16672  */
16673 enum LDKLevel Level_error(void);
16674
16675 /**
16676  * Checks if two Levels contain equal inner contents.
16677  * This ignores pointers and is_owned flags and looks at the values in fields.
16678  */
16679 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
16680
16681 /**
16682  * Checks if two Levels contain equal inner contents.
16683  */
16684 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
16685
16686 /**
16687  * Returns the most verbose logging level.
16688  */
16689 MUST_USE_RES enum LDKLevel Level_max(void);
16690
16691 /**
16692  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
16693  */
16694 void Record_free(struct LDKRecord this_obj);
16695
16696 /**
16697  * The verbosity level of the message.
16698  */
16699 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
16700
16701 /**
16702  * The verbosity level of the message.
16703  */
16704 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
16705
16706 /**
16707  * The message body.
16708  */
16709 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
16710
16711 /**
16712  * The message body.
16713  */
16714 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
16715
16716 /**
16717  * The module path of the message.
16718  */
16719 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
16720
16721 /**
16722  * The module path of the message.
16723  */
16724 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
16725
16726 /**
16727  * The source file containing the message.
16728  */
16729 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
16730
16731 /**
16732  * The source file containing the message.
16733  */
16734 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
16735
16736 /**
16737  * The line containing the message.
16738  */
16739 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
16740
16741 /**
16742  * The line containing the message.
16743  */
16744 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
16745
16746 /**
16747  * Creates a copy of the Record
16748  */
16749 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
16750
16751 /**
16752  * Calls the free function if one is set
16753  */
16754 void Logger_free(struct LDKLogger this_ptr);
16755
16756 /**
16757  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
16758  */
16759 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
16760
16761 /**
16762  * Confirmations we will wait for before considering the channel locked in.
16763  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
16764  * equivalent limit applied to outbound channels).
16765  *
16766  * Default value: 6.
16767  */
16768 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
16769
16770 /**
16771  * Confirmations we will wait for before considering the channel locked in.
16772  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
16773  * equivalent limit applied to outbound channels).
16774  *
16775  * Default value: 6.
16776  */
16777 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
16778
16779 /**
16780  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
16781  * the number of blocks we have to punish our counterparty if they broadcast a revoked
16782  * transaction).
16783  *
16784  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
16785  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
16786  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
16787  * possibly with time in between to RBF the spending transaction).
16788  *
16789  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
16790  * case of an honest unilateral channel close, which implicitly decrease the economic value of
16791  * our channel.
16792  *
16793  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
16794  * can tweak config to ask for more security, not less.
16795  */
16796 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
16797
16798 /**
16799  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
16800  * the number of blocks we have to punish our counterparty if they broadcast a revoked
16801  * transaction).
16802  *
16803  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
16804  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
16805  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
16806  * possibly with time in between to RBF the spending transaction).
16807  *
16808  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
16809  * case of an honest unilateral channel close, which implicitly decrease the economic value of
16810  * our channel.
16811  *
16812  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
16813  * can tweak config to ask for more security, not less.
16814  */
16815 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
16816
16817 /**
16818  * Set to the smallest value HTLC we will accept to process.
16819  *
16820  * This value is sent to our counterparty on channel-open and we close the channel any time
16821  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
16822  *
16823  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
16824  * by the protocol.
16825  */
16826 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
16827
16828 /**
16829  * Set to the smallest value HTLC we will accept to process.
16830  *
16831  * This value is sent to our counterparty on channel-open and we close the channel any time
16832  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
16833  *
16834  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
16835  * by the protocol.
16836  */
16837 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
16838
16839 /**
16840  * Constructs a new ChannelHandshakeConfig given each field
16841  */
16842 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);
16843
16844 /**
16845  * Creates a copy of the ChannelHandshakeConfig
16846  */
16847 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
16848
16849 /**
16850  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
16851  */
16852 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
16853
16854 /**
16855  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
16856  */
16857 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
16858
16859 /**
16860  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
16861  * only applies to inbound channels.
16862  *
16863  * Default value: 0.
16864  */
16865 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16866
16867 /**
16868  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
16869  * only applies to inbound channels.
16870  *
16871  * Default value: 0.
16872  */
16873 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
16874
16875 /**
16876  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
16877  * you to limit the maximum minimum-size they can require.
16878  *
16879  * Default value: u64::max_value.
16880  */
16881 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16882
16883 /**
16884  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
16885  * you to limit the maximum minimum-size they can require.
16886  *
16887  * Default value: u64::max_value.
16888  */
16889 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
16890
16891 /**
16892  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
16893  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
16894  *
16895  * Default value: 0.
16896  */
16897 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16898
16899 /**
16900  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
16901  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
16902  *
16903  * Default value: 0.
16904  */
16905 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
16906
16907 /**
16908  * The remote node will require we keep a certain amount in direct payment to ourselves at all
16909  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
16910  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
16911  *
16912  * Default value: u64::max_value.
16913  */
16914 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16915
16916 /**
16917  * The remote node will require we keep a certain amount in direct payment to ourselves at all
16918  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
16919  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
16920  *
16921  * Default value: u64::max_value.
16922  */
16923 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
16924
16925 /**
16926  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
16927  * time. This allows you to set a minimum such value.
16928  *
16929  * Default value: 0.
16930  */
16931 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16932
16933 /**
16934  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
16935  * time. This allows you to set a minimum such value.
16936  *
16937  * Default value: 0.
16938  */
16939 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
16940
16941 /**
16942  * Before a channel is usable the funding transaction will need to be confirmed by at least a
16943  * certain number of blocks, specified by the node which is not the funder (as the funder can
16944  * assume they aren't going to double-spend themselves).
16945  * This config allows you to set a limit on the maximum amount of time to wait.
16946  *
16947  * Default value: 144, or roughly one day and only applies to outbound channels.
16948  */
16949 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16950
16951 /**
16952  * Before a channel is usable the funding transaction will need to be confirmed by at least a
16953  * certain number of blocks, specified by the node which is not the funder (as the funder can
16954  * assume they aren't going to double-spend themselves).
16955  * This config allows you to set a limit on the maximum amount of time to wait.
16956  *
16957  * Default value: 144, or roughly one day and only applies to outbound channels.
16958  */
16959 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
16960
16961 /**
16962  * Set to force an incoming channel to match our announced channel preference in
16963  * [`ChannelConfig::announced_channel`].
16964  *
16965  * For a node which is not online reliably, this should be set to true and
16966  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
16967  * channels will ever be opened.
16968  *
16969  * Default value: true.
16970  */
16971 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16972
16973 /**
16974  * Set to force an incoming channel to match our announced channel preference in
16975  * [`ChannelConfig::announced_channel`].
16976  *
16977  * For a node which is not online reliably, this should be set to true and
16978  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
16979  * channels will ever be opened.
16980  *
16981  * Default value: true.
16982  */
16983 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
16984
16985 /**
16986  * Set to the amount of time we're willing to wait to claim money back to us.
16987  *
16988  * Not checking this value would be a security issue, as our peer would be able to set it to
16989  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
16990  *
16991  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
16992  * reduce the loss of having useless locked funds (if your peer accepts)
16993  */
16994 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
16995
16996 /**
16997  * Set to the amount of time we're willing to wait to claim money back to us.
16998  *
16999  * Not checking this value would be a security issue, as our peer would be able to set it to
17000  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17001  *
17002  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17003  * reduce the loss of having useless locked funds (if your peer accepts)
17004  */
17005 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17006
17007 /**
17008  * Constructs a new ChannelHandshakeLimits given each field
17009  */
17010 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);
17011
17012 /**
17013  * Creates a copy of the ChannelHandshakeLimits
17014  */
17015 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
17016
17017 /**
17018  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
17019  */
17020 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
17021
17022 /**
17023  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
17024  */
17025 void ChannelConfig_free(struct LDKChannelConfig this_obj);
17026
17027 /**
17028  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17029  * over the channel.
17030  * This may be allowed to change at runtime in a later update, however doing so must result in
17031  * update messages sent to notify all nodes of our updated relay fee.
17032  *
17033  * Default value: 0.
17034  */
17035 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17036
17037 /**
17038  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17039  * over the channel.
17040  * This may be allowed to change at runtime in a later update, however doing so must result in
17041  * update messages sent to notify all nodes of our updated relay fee.
17042  *
17043  * Default value: 0.
17044  */
17045 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17046
17047 /**
17048  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17049  * excess of [`forwarding_fee_proportional_millionths`].
17050  * This may be allowed to change at runtime in a later update, however doing so must result in
17051  * update messages sent to notify all nodes of our updated relay fee.
17052  *
17053  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17054  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17055  * this node.
17056  *
17057  * Default value: 1000.
17058  *
17059  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17060  */
17061 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17062
17063 /**
17064  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17065  * excess of [`forwarding_fee_proportional_millionths`].
17066  * This may be allowed to change at runtime in a later update, however doing so must result in
17067  * update messages sent to notify all nodes of our updated relay fee.
17068  *
17069  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17070  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17071  * this node.
17072  *
17073  * Default value: 1000.
17074  *
17075  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17076  */
17077 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17078
17079 /**
17080  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17081  * the channel this config applies to.
17082  *
17083  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17084  * HTLC balance when a channel appears on-chain whereas
17085  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17086  * (non-HTLC-encumbered) balance.
17087  *
17088  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17089  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17090  * commitment transaction at least once per this many blocks (minus some margin to allow us
17091  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17092  * the spending transaction).
17093  *
17094  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17095  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17096  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17097  *
17098  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17099  */
17100 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17101
17102 /**
17103  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17104  * the channel this config applies to.
17105  *
17106  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17107  * HTLC balance when a channel appears on-chain whereas
17108  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17109  * (non-HTLC-encumbered) balance.
17110  *
17111  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17112  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17113  * commitment transaction at least once per this many blocks (minus some margin to allow us
17114  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17115  * the spending transaction).
17116  *
17117  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17118  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17119  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17120  *
17121  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17122  */
17123 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
17124
17125 /**
17126  * Set to announce the channel publicly and notify all nodes that they can route via this
17127  * channel.
17128  *
17129  * This should only be set to true for nodes which expect to be online reliably.
17130  *
17131  * As the node which funds a channel picks this value this will only apply for new outbound
17132  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17133  *
17134  * This cannot be changed after the initial channel handshake.
17135  *
17136  * Default value: false.
17137  */
17138 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17139
17140 /**
17141  * Set to announce the channel publicly and notify all nodes that they can route via this
17142  * channel.
17143  *
17144  * This should only be set to true for nodes which expect to be online reliably.
17145  *
17146  * As the node which funds a channel picks this value this will only apply for new outbound
17147  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17148  *
17149  * This cannot be changed after the initial channel handshake.
17150  *
17151  * Default value: false.
17152  */
17153 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
17154
17155 /**
17156  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17157  * supports it, they will then enforce the mutual-close output to us matches what we provided
17158  * at intialization, preventing us from closing to an alternate pubkey.
17159  *
17160  * This is set to true by default to provide a slight increase in security, though ultimately
17161  * any attacker who is able to take control of a channel can just as easily send the funds via
17162  * lightning payments, so we never require that our counterparties support this option.
17163  *
17164  * This cannot be changed after a channel has been initialized.
17165  *
17166  * Default value: true.
17167  */
17168 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17169
17170 /**
17171  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17172  * supports it, they will then enforce the mutual-close output to us matches what we provided
17173  * at intialization, preventing us from closing to an alternate pubkey.
17174  *
17175  * This is set to true by default to provide a slight increase in security, though ultimately
17176  * any attacker who is able to take control of a channel can just as easily send the funds via
17177  * lightning payments, so we never require that our counterparties support this option.
17178  *
17179  * This cannot be changed after a channel has been initialized.
17180  *
17181  * Default value: true.
17182  */
17183 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
17184
17185 /**
17186  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
17187  * small to claim on-chain.
17188  *
17189  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
17190  * not be claimable on-chain, instead being turned into additional miner fees if either
17191  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
17192  * to such payments may be sustantial if there are many dust HTLCs present when the
17193  * channel is force-closed.
17194  *
17195  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
17196  * exposure across all three types per-channel. Setting this too low may prevent the
17197  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
17198  * important to prevent stealing of dust HTLCs by miners.
17199  *
17200  * Default value: 5_000_000 msat.
17201  */
17202 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17203
17204 /**
17205  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
17206  * small to claim on-chain.
17207  *
17208  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
17209  * not be claimable on-chain, instead being turned into additional miner fees if either
17210  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
17211  * to such payments may be sustantial if there are many dust HTLCs present when the
17212  * channel is force-closed.
17213  *
17214  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
17215  * exposure across all three types per-channel. Setting this too low may prevent the
17216  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
17217  * important to prevent stealing of dust HTLCs by miners.
17218  *
17219  * Default value: 5_000_000 msat.
17220  */
17221 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
17222
17223 /**
17224  * The additional fee we're willing to pay to avoid waiting for the counterparty's
17225  * `to_self_delay` to reclaim funds.
17226  *
17227  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
17228  * closing transaction which both sides find acceptable, ultimately paid by the channel
17229  * funder/initiator.
17230  *
17231  * When we are the funder, because we have to pay the channel closing fee, we bound the
17232  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
17233  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
17234  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
17235  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
17236  * funds.
17237  *
17238  * When we are not the funder, we require the closing transaction fee pay at least our
17239  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
17240  * Thus, this value is ignored when we are not the funder.
17241  *
17242  * Default value: 1000 satoshis.
17243  *
17244  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
17245  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
17246  */
17247 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17248
17249 /**
17250  * The additional fee we're willing to pay to avoid waiting for the counterparty's
17251  * `to_self_delay` to reclaim funds.
17252  *
17253  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
17254  * closing transaction which both sides find acceptable, ultimately paid by the channel
17255  * funder/initiator.
17256  *
17257  * When we are the funder, because we have to pay the channel closing fee, we bound the
17258  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
17259  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
17260  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
17261  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
17262  * funds.
17263  *
17264  * When we are not the funder, we require the closing transaction fee pay at least our
17265  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
17266  * Thus, this value is ignored when we are not the funder.
17267  *
17268  * Default value: 1000 satoshis.
17269  *
17270  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
17271  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
17272  */
17273 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
17274
17275 /**
17276  * Constructs a new ChannelConfig given each field
17277  */
17278 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);
17279
17280 /**
17281  * Creates a copy of the ChannelConfig
17282  */
17283 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
17284
17285 /**
17286  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
17287  */
17288 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
17289
17290 /**
17291  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
17292  */
17293 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
17294
17295 /**
17296  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
17297  */
17298 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
17299
17300 /**
17301  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
17302  */
17303 void UserConfig_free(struct LDKUserConfig this_obj);
17304
17305 /**
17306  * Channel config that we propose to our counterparty.
17307  */
17308 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17309
17310 /**
17311  * Channel config that we propose to our counterparty.
17312  */
17313 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
17314
17315 /**
17316  * Limits applied to our counterparty's proposed channel config settings.
17317  */
17318 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17319
17320 /**
17321  * Limits applied to our counterparty's proposed channel config settings.
17322  */
17323 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
17324
17325 /**
17326  * Channel config which affects behavior during channel lifetime.
17327  */
17328 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17329
17330 /**
17331  * Channel config which affects behavior during channel lifetime.
17332  */
17333 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
17334
17335 /**
17336  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
17337  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
17338  * node which is not online reliably.
17339  *
17340  * For nodes which are not online reliably, you should set all channels to *not* be announced
17341  * (using [`ChannelConfig::announced_channel`] and
17342  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
17343  * ensure you are not exposed to any forwarding risk.
17344  *
17345  * Note that because you cannot change a channel's announced state after creation, there is no
17346  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
17347  * from a publicly-announced forwarding node to a private non-forwarding node you must close
17348  * all your channels and open new ones. For privacy, you should also change your node_id
17349  * (swapping all private and public key material for new ones) at that time.
17350  *
17351  * Default value: false.
17352  */
17353 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17354
17355 /**
17356  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
17357  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
17358  * node which is not online reliably.
17359  *
17360  * For nodes which are not online reliably, you should set all channels to *not* be announced
17361  * (using [`ChannelConfig::announced_channel`] and
17362  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
17363  * ensure you are not exposed to any forwarding risk.
17364  *
17365  * Note that because you cannot change a channel's announced state after creation, there is no
17366  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
17367  * from a publicly-announced forwarding node to a private non-forwarding node you must close
17368  * all your channels and open new ones. For privacy, you should also change your node_id
17369  * (swapping all private and public key material for new ones) at that time.
17370  *
17371  * Default value: false.
17372  */
17373 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17374
17375 /**
17376  * If this is set to false, we do not accept inbound requests to open a new channel.
17377  * Default value: true.
17378  */
17379 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17380
17381 /**
17382  * If this is set to false, we do not accept inbound requests to open a new channel.
17383  * Default value: true.
17384  */
17385 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17386
17387 /**
17388  * If this is set to true, the user needs to manually accept inbound requests to open a new
17389  * channel.
17390  *
17391  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
17392  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
17393  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
17394  * user explicitly chooses to accept the request.
17395  *
17396  * Default value: false.
17397  *
17398  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
17399  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
17400  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
17401  */
17402 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17403
17404 /**
17405  * If this is set to true, the user needs to manually accept inbound requests to open a new
17406  * channel.
17407  *
17408  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
17409  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
17410  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
17411  * user explicitly chooses to accept the request.
17412  *
17413  * Default value: false.
17414  *
17415  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
17416  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
17417  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
17418  */
17419 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17420
17421 /**
17422  * Constructs a new UserConfig given each field
17423  */
17424 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);
17425
17426 /**
17427  * Creates a copy of the UserConfig
17428  */
17429 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
17430
17431 /**
17432  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
17433  */
17434 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
17435
17436 /**
17437  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
17438  */
17439 void BestBlock_free(struct LDKBestBlock this_obj);
17440
17441 /**
17442  * Creates a copy of the BestBlock
17443  */
17444 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
17445
17446 /**
17447  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
17448  * network.
17449  */
17450 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
17451
17452 /**
17453  * Returns a `BestBlock` as identified by the given block hash and height.
17454  */
17455 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
17456
17457 /**
17458  * Returns the best block hash.
17459  */
17460 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
17461
17462 /**
17463  * Returns the best block height.
17464  */
17465 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
17466
17467 /**
17468  * Creates a copy of the AccessError
17469  */
17470 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
17471
17472 /**
17473  * Utility method to constructs a new UnknownChain-variant AccessError
17474  */
17475 enum LDKAccessError AccessError_unknown_chain(void);
17476
17477 /**
17478  * Utility method to constructs a new UnknownTx-variant AccessError
17479  */
17480 enum LDKAccessError AccessError_unknown_tx(void);
17481
17482 /**
17483  * Calls the free function if one is set
17484  */
17485 void Access_free(struct LDKAccess this_ptr);
17486
17487 /**
17488  * Calls the free function if one is set
17489  */
17490 void Listen_free(struct LDKListen this_ptr);
17491
17492 /**
17493  * Calls the free function if one is set
17494  */
17495 void Confirm_free(struct LDKConfirm this_ptr);
17496
17497 /**
17498  * Creates a copy of the ChannelMonitorUpdateErr
17499  */
17500 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
17501
17502 /**
17503  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
17504  */
17505 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
17506
17507 /**
17508  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
17509  */
17510 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
17511
17512 /**
17513  * Calls the free function if one is set
17514  */
17515 void Watch_free(struct LDKWatch this_ptr);
17516
17517 /**
17518  * Calls the free function if one is set
17519  */
17520 void Filter_free(struct LDKFilter this_ptr);
17521
17522 /**
17523  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
17524  */
17525 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
17526
17527 /**
17528  * First block where the transaction output may have been spent.
17529  *
17530  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17531  */
17532 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17533
17534 /**
17535  * First block where the transaction output may have been spent.
17536  *
17537  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17538  */
17539 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17540
17541 /**
17542  * Outpoint identifying the transaction output.
17543  */
17544 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17545
17546 /**
17547  * Outpoint identifying the transaction output.
17548  */
17549 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
17550
17551 /**
17552  * Spending condition of the transaction output.
17553  */
17554 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17555
17556 /**
17557  * Spending condition of the transaction output.
17558  */
17559 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
17560
17561 /**
17562  * Constructs a new WatchedOutput given each field
17563  */
17564 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
17565
17566 /**
17567  * Creates a copy of the WatchedOutput
17568  */
17569 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
17570
17571 /**
17572  * Checks if two WatchedOutputs contain equal inner contents.
17573  */
17574 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
17575
17576 /**
17577  * Calls the free function if one is set
17578  */
17579 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
17580
17581 /**
17582  * Creates a copy of the ConfirmationTarget
17583  */
17584 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
17585
17586 /**
17587  * Utility method to constructs a new Background-variant ConfirmationTarget
17588  */
17589 enum LDKConfirmationTarget ConfirmationTarget_background(void);
17590
17591 /**
17592  * Utility method to constructs a new Normal-variant ConfirmationTarget
17593  */
17594 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
17595
17596 /**
17597  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
17598  */
17599 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
17600
17601 /**
17602  * Checks if two ConfirmationTargets contain equal inner contents.
17603  * This ignores pointers and is_owned flags and looks at the values in fields.
17604  */
17605 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
17606
17607 /**
17608  * Calls the free function if one is set
17609  */
17610 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
17611
17612 /**
17613  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
17614  */
17615 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
17616
17617 /**
17618  * Creates a copy of the MonitorUpdateId
17619  */
17620 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
17621
17622 /**
17623  * Checks if two MonitorUpdateIds contain equal inner contents.
17624  */
17625 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
17626
17627 /**
17628  * Checks if two MonitorUpdateIds contain equal inner contents.
17629  * This ignores pointers and is_owned flags and looks at the values in fields.
17630  * Two objects with NULL inner values will be considered "equal" here.
17631  */
17632 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
17633
17634 /**
17635  * Calls the free function if one is set
17636  */
17637 void Persist_free(struct LDKPersist this_ptr);
17638
17639 /**
17640  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
17641  */
17642 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
17643
17644 /**
17645  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
17646  */
17647 void ChainMonitor_free(struct LDKChainMonitor this_obj);
17648
17649 /**
17650  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
17651  *
17652  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
17653  * will call back to it indicating transactions and outputs of interest. This allows clients to
17654  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
17655  * always need to fetch full blocks absent another means for determining which blocks contain
17656  * transactions relevant to the watched channels.
17657  */
17658 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
17659
17660 /**
17661  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
17662  * claims which are awaiting confirmation.
17663  *
17664  * Includes the balances from each [`ChannelMonitor`] *except* those included in
17665  * `ignored_channels`, allowing you to filter out balances from channels which are still open
17666  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
17667  *
17668  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
17669  * inclusion in the return value.
17670  */
17671 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
17672
17673 /**
17674  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
17675  * such [`ChannelMonitor`] is currently being monitored for.
17676  *
17677  * Note that the result holds a mutex over our monitor set, and should not be held
17678  * indefinitely.
17679  */
17680 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
17681
17682 /**
17683  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
17684  *
17685  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
17686  * monitoring for on-chain state resolutions.
17687  */
17688 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17689
17690 /**
17691  * Indicates the persistence of a [`ChannelMonitor`] has completed after
17692  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
17693  *
17694  * Thus, the anticipated use is, at a high level:
17695  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
17696  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
17697  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
17698  *  2) once all remote copies are updated, you call this function with the
17699  *     `completed_update_id` that completed, and once all pending updates have completed the
17700  *     channel will be re-enabled.
17701  *
17702  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
17703  * registered [`ChannelMonitor`]s.
17704  */
17705 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);
17706
17707 /**
17708  * Constructs a new Listen which calls the relevant methods on this_arg.
17709  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
17710  */
17711 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17712
17713 /**
17714  * Constructs a new Confirm which calls the relevant methods on this_arg.
17715  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
17716  */
17717 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17718
17719 /**
17720  * Constructs a new Watch which calls the relevant methods on this_arg.
17721  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
17722  */
17723 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17724
17725 /**
17726  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
17727  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
17728  */
17729 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
17730
17731 /**
17732  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
17733  */
17734 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
17735
17736 /**
17737  * The sequence number of this update. Updates *must* be replayed in-order according to this
17738  * sequence number (and updates may panic if they are not). The update_id values are strictly
17739  * increasing and increase by one for each new update, with one exception specified below.
17740  *
17741  * This sequence number is also used to track up to which points updates which returned
17742  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
17743  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
17744  *
17745  * The only instance where update_id values are not strictly increasing is the case where we
17746  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
17747  * its docs for more details.
17748  */
17749 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
17750
17751 /**
17752  * The sequence number of this update. Updates *must* be replayed in-order according to this
17753  * sequence number (and updates may panic if they are not). The update_id values are strictly
17754  * increasing and increase by one for each new update, with one exception specified below.
17755  *
17756  * This sequence number is also used to track up to which points updates which returned
17757  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
17758  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
17759  *
17760  * The only instance where update_id values are not strictly increasing is the case where we
17761  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
17762  * its docs for more details.
17763  */
17764 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
17765
17766 /**
17767  * Creates a copy of the ChannelMonitorUpdate
17768  */
17769 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
17770
17771 /**
17772  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
17773  */
17774 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
17775
17776 /**
17777  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
17778  */
17779 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
17780
17781 /**
17782  * Frees any resources used by the MonitorEvent
17783  */
17784 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
17785
17786 /**
17787  * Creates a copy of the MonitorEvent
17788  */
17789 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
17790
17791 /**
17792  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
17793  */
17794 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
17795
17796 /**
17797  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
17798  */
17799 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
17800
17801 /**
17802  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
17803  */
17804 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
17805
17806 /**
17807  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
17808  */
17809 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
17810
17811 /**
17812  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
17813  */
17814 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
17815
17816 /**
17817  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
17818  */
17819 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
17820
17821 /**
17822  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
17823  */
17824 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
17825
17826 /**
17827  * Creates a copy of the HTLCUpdate
17828  */
17829 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
17830
17831 /**
17832  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
17833  */
17834 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
17835
17836 /**
17837  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
17838  */
17839 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
17840
17841 /**
17842  * Frees any resources used by the Balance
17843  */
17844 void Balance_free(struct LDKBalance this_ptr);
17845
17846 /**
17847  * Creates a copy of the Balance
17848  */
17849 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
17850
17851 /**
17852  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
17853  */
17854 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
17855
17856 /**
17857  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
17858  */
17859 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
17860
17861 /**
17862  * Utility method to constructs a new ContentiousClaimable-variant Balance
17863  */
17864 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
17865
17866 /**
17867  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
17868  */
17869 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
17870
17871 /**
17872  * Checks if two Balances contain equal inner contents.
17873  * This ignores pointers and is_owned flags and looks at the values in fields.
17874  */
17875 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
17876
17877 /**
17878  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
17879  */
17880 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
17881
17882 /**
17883  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
17884  */
17885 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
17886
17887 /**
17888  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
17889  * itself.
17890  *
17891  * panics if the given update is not the next update by update_id.
17892  */
17893 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);
17894
17895 /**
17896  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
17897  * ChannelMonitor.
17898  */
17899 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
17900
17901 /**
17902  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
17903  */
17904 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
17905
17906 /**
17907  * Gets a list of txids, with their output scripts (in the order they appear in the
17908  * transaction), which we must learn about spends of via block_connected().
17909  */
17910 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
17911
17912 /**
17913  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
17914  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
17915  * have been registered.
17916  */
17917 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
17918
17919 /**
17920  * Get the list of HTLCs who's status has been updated on chain. This should be called by
17921  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
17922  */
17923 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
17924
17925 /**
17926  * Gets the list of pending events which were generated by previous actions, clearing the list
17927  * in the process.
17928  *
17929  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
17930  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
17931  * no internal locking in ChannelMonitors.
17932  */
17933 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
17934
17935 /**
17936  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
17937  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
17938  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
17939  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
17940  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
17941  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
17942  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
17943  * out-of-band the other node operator to coordinate with him if option is available to you.
17944  * In any-case, choice is up to the user.
17945  */
17946 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);
17947
17948 /**
17949  * Processes transactions in a newly connected block, which may result in any of the following:
17950  * - update the monitor's state against resolved HTLCs
17951  * - punish the counterparty in the case of seeing a revoked commitment transaction
17952  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
17953  * - detect settled outputs for later spending
17954  * - schedule and bump any in-flight claims
17955  *
17956  * Returns any new outputs to watch from `txdata`; after called, these are also included in
17957  * [`get_outputs_to_watch`].
17958  *
17959  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
17960  */
17961 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);
17962
17963 /**
17964  * Determines if the disconnected block contained any transactions of interest and updates
17965  * appropriately.
17966  */
17967 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);
17968
17969 /**
17970  * Processes transactions confirmed in a block with the given header and height, returning new
17971  * outputs to watch. See [`block_connected`] for details.
17972  *
17973  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
17974  * blocks. See [`chain::Confirm`] for calling expectations.
17975  *
17976  * [`block_connected`]: Self::block_connected
17977  */
17978 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);
17979
17980 /**
17981  * Processes a transaction that was reorganized out of the chain.
17982  *
17983  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
17984  * than blocks. See [`chain::Confirm`] for calling expectations.
17985  *
17986  * [`block_disconnected`]: Self::block_disconnected
17987  */
17988 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);
17989
17990 /**
17991  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
17992  * [`block_connected`] for details.
17993  *
17994  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
17995  * blocks. See [`chain::Confirm`] for calling expectations.
17996  *
17997  * [`block_connected`]: Self::block_connected
17998  */
17999 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);
18000
18001 /**
18002  * Returns the set of txids that should be monitored for re-organization out of the chain.
18003  */
18004 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18005
18006 /**
18007  * Gets the latest best block which was connected either via the [`chain::Listen`] or
18008  * [`chain::Confirm`] interfaces.
18009  */
18010 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18011
18012 /**
18013  * Gets the balances in this channel which are either claimable by us if we were to
18014  * force-close the channel now or which are claimable on-chain (possibly awaiting
18015  * confirmation).
18016  *
18017  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
18018  * included here until an [`Event::SpendableOutputs`] event has been generated for the
18019  * balance, or until our counterparty has claimed the balance and accrued several
18020  * confirmations on the claim transaction.
18021  *
18022  * Note that the balances available when you or your counterparty have broadcasted revoked
18023  * state(s) may not be fully captured here.
18024  *
18025  * See [`Balance`] for additional details on the types of claimable balances which
18026  * may be returned here and their meanings.
18027  */
18028 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18029
18030 /**
18031  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
18032  */
18033 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
18034
18035 /**
18036  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
18037  */
18038 void OutPoint_free(struct LDKOutPoint this_obj);
18039
18040 /**
18041  * The referenced transaction's txid.
18042  */
18043 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
18044
18045 /**
18046  * The referenced transaction's txid.
18047  */
18048 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18049
18050 /**
18051  * The index of the referenced output in its transaction's vout.
18052  */
18053 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
18054
18055 /**
18056  * The index of the referenced output in its transaction's vout.
18057  */
18058 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
18059
18060 /**
18061  * Constructs a new OutPoint given each field
18062  */
18063 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
18064
18065 /**
18066  * Creates a copy of the OutPoint
18067  */
18068 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
18069
18070 /**
18071  * Checks if two OutPoints contain equal inner contents.
18072  * This ignores pointers and is_owned flags and looks at the values in fields.
18073  * Two objects with NULL inner values will be considered "equal" here.
18074  */
18075 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
18076
18077 /**
18078  * Checks if two OutPoints contain equal inner contents.
18079  */
18080 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
18081
18082 /**
18083  * Convert an `OutPoint` to a lightning channel id.
18084  */
18085 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
18086
18087 /**
18088  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
18089  */
18090 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
18091
18092 /**
18093  * Read a OutPoint from a byte array, created by OutPoint_write
18094  */
18095 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
18096
18097 /**
18098  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
18099  */
18100 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
18101
18102 /**
18103  * The outpoint which is spendable
18104  */
18105 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18106
18107 /**
18108  * The outpoint which is spendable
18109  */
18110 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18111
18112 /**
18113  * Per commitment point to derive delayed_payment_key by key holder
18114  */
18115 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18116
18117 /**
18118  * Per commitment point to derive delayed_payment_key by key holder
18119  */
18120 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18121
18122 /**
18123  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
18124  * the witness_script.
18125  */
18126 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18127
18128 /**
18129  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
18130  * the witness_script.
18131  */
18132 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
18133
18134 /**
18135  * The output which is referenced by the given outpoint
18136  */
18137 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
18138
18139 /**
18140  * The revocation point specific to the commitment transaction which was broadcast. Used to
18141  * derive the witnessScript for this output.
18142  */
18143 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18144
18145 /**
18146  * The revocation point specific to the commitment transaction which was broadcast. Used to
18147  * derive the witnessScript for this output.
18148  */
18149 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18150
18151 /**
18152  * Arbitrary identification information returned by a call to
18153  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18154  * the channel to spend the output.
18155  */
18156 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
18157
18158 /**
18159  * Arbitrary identification information returned by a call to
18160  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18161  * the channel to spend the output.
18162  */
18163 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18164
18165 /**
18166  * The value of the channel which this output originated from, possibly indirectly.
18167  */
18168 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18169
18170 /**
18171  * The value of the channel which this output originated from, possibly indirectly.
18172  */
18173 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
18174
18175 /**
18176  * Constructs a new DelayedPaymentOutputDescriptor given each field
18177  */
18178 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);
18179
18180 /**
18181  * Creates a copy of the DelayedPaymentOutputDescriptor
18182  */
18183 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
18184
18185 /**
18186  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
18187  */
18188 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
18189
18190 /**
18191  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
18192  */
18193 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
18194
18195 /**
18196  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
18197  */
18198 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
18199
18200 /**
18201  * The outpoint which is spendable
18202  */
18203 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18204
18205 /**
18206  * The outpoint which is spendable
18207  */
18208 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18209
18210 /**
18211  * The output which is referenced by the given outpoint
18212  */
18213 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
18214
18215 /**
18216  * Arbitrary identification information returned by a call to
18217  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18218  * the channel to spend the output.
18219  */
18220 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
18221
18222 /**
18223  * Arbitrary identification information returned by a call to
18224  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18225  * the channel to spend the output.
18226  */
18227 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18228
18229 /**
18230  * The value of the channel which this transactions spends.
18231  */
18232 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18233
18234 /**
18235  * The value of the channel which this transactions spends.
18236  */
18237 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
18238
18239 /**
18240  * Constructs a new StaticPaymentOutputDescriptor given each field
18241  */
18242 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);
18243
18244 /**
18245  * Creates a copy of the StaticPaymentOutputDescriptor
18246  */
18247 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
18248
18249 /**
18250  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
18251  */
18252 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
18253
18254 /**
18255  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
18256  */
18257 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
18258
18259 /**
18260  * Frees any resources used by the SpendableOutputDescriptor
18261  */
18262 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
18263
18264 /**
18265  * Creates a copy of the SpendableOutputDescriptor
18266  */
18267 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
18268
18269 /**
18270  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
18271  */
18272 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
18273
18274 /**
18275  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
18276  */
18277 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
18278
18279 /**
18280  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
18281  */
18282 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
18283
18284 /**
18285  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
18286  */
18287 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
18288
18289 /**
18290  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
18291  */
18292 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
18293
18294 /**
18295  * Calls the free function if one is set
18296  */
18297 void BaseSign_free(struct LDKBaseSign this_ptr);
18298
18299 /**
18300  * Creates a copy of a Sign
18301  */
18302 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
18303
18304 /**
18305  * Calls the free function if one is set
18306  */
18307 void Sign_free(struct LDKSign this_ptr);
18308
18309 /**
18310  * Creates a copy of the Recipient
18311  */
18312 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
18313
18314 /**
18315  * Utility method to constructs a new Node-variant Recipient
18316  */
18317 enum LDKRecipient Recipient_node(void);
18318
18319 /**
18320  * Utility method to constructs a new PhantomNode-variant Recipient
18321  */
18322 enum LDKRecipient Recipient_phantom_node(void);
18323
18324 /**
18325  * Calls the free function if one is set
18326  */
18327 void KeysInterface_free(struct LDKKeysInterface this_ptr);
18328
18329 /**
18330  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
18331  */
18332 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
18333
18334 /**
18335  * Private key of anchor tx
18336  */
18337 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18338
18339 /**
18340  * Private key of anchor tx
18341  */
18342 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18343
18344 /**
18345  * Holder secret key for blinded revocation pubkey
18346  */
18347 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18348
18349 /**
18350  * Holder secret key for blinded revocation pubkey
18351  */
18352 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18353
18354 /**
18355  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
18356  */
18357 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18358
18359 /**
18360  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
18361  */
18362 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18363
18364 /**
18365  * Holder secret key used in HTLC tx
18366  */
18367 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18368
18369 /**
18370  * Holder secret key used in HTLC tx
18371  */
18372 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18373
18374 /**
18375  * Holder htlc secret key used in commitment tx htlc outputs
18376  */
18377 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18378
18379 /**
18380  * Holder htlc secret key used in commitment tx htlc outputs
18381  */
18382 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18383
18384 /**
18385  * Commitment seed
18386  */
18387 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18388
18389 /**
18390  * Commitment seed
18391  */
18392 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18393
18394 /**
18395  * Creates a copy of the InMemorySigner
18396  */
18397 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
18398
18399 /**
18400  * Create a new InMemorySigner
18401  */
18402 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);
18403
18404 /**
18405  * Counterparty pubkeys.
18406  * Will panic if ready_channel wasn't called.
18407  */
18408 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18409
18410 /**
18411  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
18412  * transactions, ie the amount of time that we have to wait to recover our funds if we
18413  * broadcast a transaction.
18414  * Will panic if ready_channel wasn't called.
18415  */
18416 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18417
18418 /**
18419  * The contest_delay value specified by us and applied on transactions broadcastable
18420  * by our counterparty, ie the amount of time that they have to wait to recover their funds
18421  * if they broadcast a transaction.
18422  * Will panic if ready_channel wasn't called.
18423  */
18424 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18425
18426 /**
18427  * Whether the holder is the initiator
18428  * Will panic if ready_channel wasn't called.
18429  */
18430 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18431
18432 /**
18433  * Funding outpoint
18434  * Will panic if ready_channel wasn't called.
18435  */
18436 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18437
18438 /**
18439  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
18440  * building transactions.
18441  *
18442  * Will panic if ready_channel wasn't called.
18443  */
18444 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18445
18446 /**
18447  * Whether anchors should be used.
18448  * Will panic if ready_channel wasn't called.
18449  */
18450 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18451
18452 /**
18453  * Sign the single input of spend_tx at index `input_idx` which spends the output
18454  * described by descriptor, returning the witness stack for the input.
18455  *
18456  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
18457  * is not spending the outpoint described by `descriptor.outpoint`,
18458  * or if an output descriptor script_pubkey does not match the one we can spend.
18459  */
18460 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);
18461
18462 /**
18463  * Sign the single input of spend_tx at index `input_idx` which spends the output
18464  * described by descriptor, returning the witness stack for the input.
18465  *
18466  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
18467  * is not spending the outpoint described by `descriptor.outpoint`, does not have a
18468  * sequence set to `descriptor.to_self_delay`, or if an output descriptor
18469  * script_pubkey does not match the one we can spend.
18470  */
18471 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);
18472
18473 /**
18474  * Constructs a new BaseSign which calls the relevant methods on this_arg.
18475  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
18476  */
18477 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18478
18479 /**
18480  * Constructs a new Sign which calls the relevant methods on this_arg.
18481  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
18482  */
18483 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18484
18485 /**
18486  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
18487  */
18488 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
18489
18490 /**
18491  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
18492  */
18493 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
18494
18495 /**
18496  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
18497  */
18498 void KeysManager_free(struct LDKKeysManager this_obj);
18499
18500 /**
18501  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
18502  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
18503  * starting_time isn't strictly required to actually be a time, but it must absolutely,
18504  * without a doubt, be unique to this instance. ie if you start multiple times with the same
18505  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
18506  * simply use the current time (with very high precision).
18507  *
18508  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
18509  * obviously, starting_time should be unique every time you reload the library - it is only
18510  * used to generate new ephemeral key data (which will be stored by the individual channel if
18511  * necessary).
18512  *
18513  * Note that the seed is required to recover certain on-chain funds independent of
18514  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
18515  * channel, and some on-chain during-closing funds.
18516  *
18517  * Note that until the 0.1 release there is no guarantee of backward compatibility between
18518  * versions. Once the library is more fully supported, the docs will be updated to include a
18519  * detailed description of the guarantee.
18520  */
18521 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
18522
18523 /**
18524  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
18525  *
18526  * Key derivation parameters are accessible through a per-channel secrets
18527  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
18528  * onchain output detection for which a corresponding delayed_payment_key must be derived.
18529  */
18530 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]);
18531
18532 /**
18533  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
18534  * output to the given change destination (if sufficient change value remains). The
18535  * transaction will have a feerate, at least, of the given value.
18536  *
18537  * Returns `Err(())` if the output value is greater than the input value minus required fee,
18538  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
18539  * does not match the one we can spend.
18540  *
18541  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
18542  *
18543  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
18544  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
18545  */
18546 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);
18547
18548 /**
18549  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
18550  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
18551  */
18552 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
18553
18554 /**
18555  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
18556  */
18557 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
18558
18559 /**
18560  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
18561  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
18562  */
18563 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
18564
18565 /**
18566  * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
18567  * that is shared across all nodes that intend to participate in [phantom node payments] together.
18568  *
18569  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
18570  * `starting_time_nanos`.
18571  *
18572  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
18573  * same across restarts, or else inbound payments may fail.
18574  *
18575  * [phantom node payments]: PhantomKeysManager
18576  */
18577 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]);
18578
18579 /**
18580  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
18581  */
18582 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);
18583
18584 /**
18585  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
18586  */
18587 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]);
18588
18589 /**
18590  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
18591  */
18592 void ChannelManager_free(struct LDKChannelManager this_obj);
18593
18594 /**
18595  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
18596  */
18597 void ChainParameters_free(struct LDKChainParameters this_obj);
18598
18599 /**
18600  * The network for determining the `chain_hash` in Lightning messages.
18601  */
18602 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
18603
18604 /**
18605  * The network for determining the `chain_hash` in Lightning messages.
18606  */
18607 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
18608
18609 /**
18610  * The hash and height of the latest block successfully connected.
18611  *
18612  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
18613  */
18614 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
18615
18616 /**
18617  * The hash and height of the latest block successfully connected.
18618  *
18619  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
18620  */
18621 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
18622
18623 /**
18624  * Constructs a new ChainParameters given each field
18625  */
18626 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
18627
18628 /**
18629  * Creates a copy of the ChainParameters
18630  */
18631 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
18632
18633 /**
18634  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
18635  */
18636 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
18637
18638 /**
18639  * Base routing fee in millisatoshis.
18640  */
18641 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
18642
18643 /**
18644  * Base routing fee in millisatoshis.
18645  */
18646 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
18647
18648 /**
18649  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
18650  */
18651 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
18652
18653 /**
18654  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
18655  */
18656 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
18657
18658 /**
18659  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
18660  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
18661  * `cltv_expiry_delta` for more details.
18662  */
18663 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
18664
18665 /**
18666  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
18667  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
18668  * `cltv_expiry_delta` for more details.
18669  */
18670 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
18671
18672 /**
18673  * Constructs a new CounterpartyForwardingInfo given each field
18674  */
18675 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);
18676
18677 /**
18678  * Creates a copy of the CounterpartyForwardingInfo
18679  */
18680 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
18681
18682 /**
18683  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
18684  */
18685 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
18686
18687 /**
18688  * The node_id of our counterparty
18689  */
18690 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18691
18692 /**
18693  * The node_id of our counterparty
18694  */
18695 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18696
18697 /**
18698  * The Features the channel counterparty provided upon last connection.
18699  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
18700  * many routing-relevant features are present in the init context.
18701  */
18702 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18703
18704 /**
18705  * The Features the channel counterparty provided upon last connection.
18706  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
18707  * many routing-relevant features are present in the init context.
18708  */
18709 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
18710
18711 /**
18712  * The value, in satoshis, that must always be held in the channel for our counterparty. This
18713  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
18714  * claiming at least this value on chain.
18715  *
18716  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
18717  *
18718  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
18719  */
18720 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18721
18722 /**
18723  * The value, in satoshis, that must always be held in the channel for our counterparty. This
18724  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
18725  * claiming at least this value on chain.
18726  *
18727  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
18728  *
18729  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
18730  */
18731 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
18732
18733 /**
18734  * Information on the fees and requirements that the counterparty requires when forwarding
18735  * payments to us through this channel.
18736  *
18737  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18738  */
18739 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
18740
18741 /**
18742  * Information on the fees and requirements that the counterparty requires when forwarding
18743  * payments to us through this channel.
18744  *
18745  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18746  */
18747 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
18748
18749 /**
18750  * Constructs a new ChannelCounterparty given each field
18751  */
18752 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);
18753
18754 /**
18755  * Creates a copy of the ChannelCounterparty
18756  */
18757 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
18758
18759 /**
18760  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
18761  */
18762 void ChannelDetails_free(struct LDKChannelDetails this_obj);
18763
18764 /**
18765  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
18766  * thereafter this is the txid of the funding transaction xor the funding transaction output).
18767  * Note that this means this value is *not* persistent - it can change once during the
18768  * lifetime of the channel.
18769  */
18770 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
18771
18772 /**
18773  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
18774  * thereafter this is the txid of the funding transaction xor the funding transaction output).
18775  * Note that this means this value is *not* persistent - it can change once during the
18776  * lifetime of the channel.
18777  */
18778 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18779
18780 /**
18781  * Parameters which apply to our counterparty. See individual fields for more information.
18782  */
18783 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18784
18785 /**
18786  * Parameters which apply to our counterparty. See individual fields for more information.
18787  */
18788 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
18789
18790 /**
18791  * The Channel's funding transaction output, if we've negotiated the funding transaction with
18792  * our counterparty already.
18793  *
18794  * Note that, if this has been set, `channel_id` will be equivalent to
18795  * `funding_txo.unwrap().to_channel_id()`.
18796  *
18797  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18798  */
18799 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18800
18801 /**
18802  * The Channel's funding transaction output, if we've negotiated the funding transaction with
18803  * our counterparty already.
18804  *
18805  * Note that, if this has been set, `channel_id` will be equivalent to
18806  * `funding_txo.unwrap().to_channel_id()`.
18807  *
18808  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18809  */
18810 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18811
18812 /**
18813  * The position of the funding transaction in the chain. None if the funding transaction has
18814  * not yet been confirmed and the channel fully opened.
18815  */
18816 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18817
18818 /**
18819  * The position of the funding transaction in the chain. None if the funding transaction has
18820  * not yet been confirmed and the channel fully opened.
18821  */
18822 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
18823
18824 /**
18825  * The value, in satoshis, of this channel as appears in the funding output
18826  */
18827 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18828
18829 /**
18830  * The value, in satoshis, of this channel as appears in the funding output
18831  */
18832 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
18833
18834 /**
18835  * The value, in satoshis, that must always be held in the channel for us. This value ensures
18836  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
18837  * this value on chain.
18838  *
18839  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
18840  *
18841  * This value will be `None` for outbound channels until the counterparty accepts the channel.
18842  *
18843  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
18844  */
18845 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18846
18847 /**
18848  * The value, in satoshis, that must always be held in the channel for us. This value ensures
18849  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
18850  * this value on chain.
18851  *
18852  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
18853  *
18854  * This value will be `None` for outbound channels until the counterparty accepts the channel.
18855  *
18856  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
18857  */
18858 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
18859
18860 /**
18861  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
18862  */
18863 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18864
18865 /**
18866  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
18867  */
18868 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
18869
18870 /**
18871  * Our total balance.  This is the amount we would get if we close the channel.
18872  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
18873  * amount is not likely to be recoverable on close.
18874  *
18875  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
18876  * balance is not available for inclusion in new outbound HTLCs). This further does not include
18877  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
18878  * This does not consider any on-chain fees.
18879  *
18880  * See also [`ChannelDetails::outbound_capacity_msat`]
18881  */
18882 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18883
18884 /**
18885  * Our total balance.  This is the amount we would get if we close the channel.
18886  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
18887  * amount is not likely to be recoverable on close.
18888  *
18889  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
18890  * balance is not available for inclusion in new outbound HTLCs). This further does not include
18891  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
18892  * This does not consider any on-chain fees.
18893  *
18894  * See also [`ChannelDetails::outbound_capacity_msat`]
18895  */
18896 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
18897
18898 /**
18899  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
18900  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
18901  * available for inclusion in new outbound HTLCs). This further does not include any pending
18902  * outgoing HTLCs which are awaiting some other resolution to be sent.
18903  *
18904  * See also [`ChannelDetails::balance_msat`]
18905  *
18906  * This value is not exact. Due to various in-flight changes, feerate changes, and our
18907  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
18908  * should be able to spend nearly this amount.
18909  */
18910 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18911
18912 /**
18913  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
18914  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
18915  * available for inclusion in new outbound HTLCs). This further does not include any pending
18916  * outgoing HTLCs which are awaiting some other resolution to be sent.
18917  *
18918  * See also [`ChannelDetails::balance_msat`]
18919  *
18920  * This value is not exact. Due to various in-flight changes, feerate changes, and our
18921  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
18922  * should be able to spend nearly this amount.
18923  */
18924 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
18925
18926 /**
18927  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
18928  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
18929  * available for inclusion in new inbound HTLCs).
18930  * Note that there are some corner cases not fully handled here, so the actual available
18931  * inbound capacity may be slightly higher than this.
18932  *
18933  * This value is not exact. Due to various in-flight changes, feerate changes, and our
18934  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
18935  * However, our counterparty should be able to spend nearly this amount.
18936  */
18937 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18938
18939 /**
18940  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
18941  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
18942  * available for inclusion in new inbound HTLCs).
18943  * Note that there are some corner cases not fully handled here, so the actual available
18944  * inbound capacity may be slightly higher than this.
18945  *
18946  * This value is not exact. Due to various in-flight changes, feerate changes, and our
18947  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
18948  * However, our counterparty should be able to spend nearly this amount.
18949  */
18950 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
18951
18952 /**
18953  * The number of required confirmations on the funding transaction before the funding will be
18954  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
18955  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
18956  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
18957  * [`ChannelHandshakeLimits::max_minimum_depth`].
18958  *
18959  * This value will be `None` for outbound channels until the counterparty accepts the channel.
18960  *
18961  * [`is_outbound`]: ChannelDetails::is_outbound
18962  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
18963  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
18964  */
18965 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18966
18967 /**
18968  * The number of required confirmations on the funding transaction before the funding will be
18969  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
18970  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
18971  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
18972  * [`ChannelHandshakeLimits::max_minimum_depth`].
18973  *
18974  * This value will be `None` for outbound channels until the counterparty accepts the channel.
18975  *
18976  * [`is_outbound`]: ChannelDetails::is_outbound
18977  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
18978  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
18979  */
18980 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
18981
18982 /**
18983  * The number of blocks (after our commitment transaction confirms) that we will need to wait
18984  * until we can claim our funds after we force-close the channel. During this time our
18985  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
18986  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
18987  * time to claim our non-HTLC-encumbered funds.
18988  *
18989  * This value will be `None` for outbound channels until the counterparty accepts the channel.
18990  */
18991 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
18992
18993 /**
18994  * The number of blocks (after our commitment transaction confirms) that we will need to wait
18995  * until we can claim our funds after we force-close the channel. During this time our
18996  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
18997  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
18998  * time to claim our non-HTLC-encumbered funds.
18999  *
19000  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19001  */
19002 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
19003
19004 /**
19005  * True if the channel was initiated (and thus funded) by us.
19006  */
19007 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19008
19009 /**
19010  * True if the channel was initiated (and thus funded) by us.
19011  */
19012 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19013
19014 /**
19015  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
19016  * channel is not currently being shut down. `funding_locked` message exchange implies the
19017  * required confirmation count has been reached (and we were connected to the peer at some
19018  * point after the funding transaction received enough confirmations). The required
19019  * confirmation count is provided in [`confirmations_required`].
19020  *
19021  * [`confirmations_required`]: ChannelDetails::confirmations_required
19022  */
19023 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19024
19025 /**
19026  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
19027  * channel is not currently being shut down. `funding_locked` message exchange implies the
19028  * required confirmation count has been reached (and we were connected to the peer at some
19029  * point after the funding transaction received enough confirmations). The required
19030  * confirmation count is provided in [`confirmations_required`].
19031  *
19032  * [`confirmations_required`]: ChannelDetails::confirmations_required
19033  */
19034 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19035
19036 /**
19037  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
19038  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
19039  *
19040  * This is a strict superset of `is_funding_locked`.
19041  */
19042 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19043
19044 /**
19045  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
19046  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
19047  *
19048  * This is a strict superset of `is_funding_locked`.
19049  */
19050 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19051
19052 /**
19053  * True if this channel is (or will be) publicly-announced.
19054  */
19055 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19056
19057 /**
19058  * True if this channel is (or will be) publicly-announced.
19059  */
19060 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19061
19062 /**
19063  * Constructs a new ChannelDetails given each field
19064  */
19065 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
19066
19067 /**
19068  * Creates a copy of the ChannelDetails
19069  */
19070 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
19071
19072 /**
19073  * Frees any resources used by the PaymentSendFailure
19074  */
19075 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
19076
19077 /**
19078  * Creates a copy of the PaymentSendFailure
19079  */
19080 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
19081
19082 /**
19083  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
19084  */
19085 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
19086
19087 /**
19088  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
19089  */
19090 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
19091
19092 /**
19093  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
19094  */
19095 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
19096
19097 /**
19098  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
19099  */
19100 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
19101
19102 /**
19103  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
19104  */
19105 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
19106
19107 /**
19108  * The list of channels to be included in the invoice route hints.
19109  */
19110 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19111
19112 /**
19113  * The list of channels to be included in the invoice route hints.
19114  */
19115 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
19116
19117 /**
19118  * A fake scid used for representing the phantom node's fake channel in generating the invoice
19119  * route hints.
19120  */
19121 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19122
19123 /**
19124  * A fake scid used for representing the phantom node's fake channel in generating the invoice
19125  * route hints.
19126  */
19127 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
19128
19129 /**
19130  * The pubkey of the real backing node that would ultimately receive the payment.
19131  */
19132 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19133
19134 /**
19135  * The pubkey of the real backing node that would ultimately receive the payment.
19136  */
19137 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19138
19139 /**
19140  * Constructs a new PhantomRouteHints given each field
19141  */
19142 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
19143
19144 /**
19145  * Constructs a new ChannelManager to hold several channels and route between them.
19146  *
19147  * This is the main \"logic hub\" for all channel-related actions, and implements
19148  * ChannelMessageHandler.
19149  *
19150  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
19151  *
19152  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
19153  *
19154  * Users need to notify the new ChannelManager when a new block is connected or
19155  * disconnected using its `block_connected` and `block_disconnected` methods, starting
19156  * from after `params.latest_hash`.
19157  */
19158 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);
19159
19160 /**
19161  * Gets the current configuration applied to all new channels,  as
19162  */
19163 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
19164
19165 /**
19166  * Creates a new outbound channel to the given remote node and with the given value.
19167  *
19168  * `user_channel_id` will be provided back as in
19169  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
19170  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
19171  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
19172  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
19173  * ignored.
19174  *
19175  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
19176  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
19177  *
19178  * Note that we do not check if you are currently connected to the given peer. If no
19179  * connection is available, the outbound `open_channel` message may fail to send, resulting in
19180  * the channel eventually being silently forgotten (dropped on reload).
19181  *
19182  * Returns the new Channel's temporary `channel_id`. This ID will appear as
19183  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
19184  * [`ChannelDetails::channel_id`] until after
19185  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
19186  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
19187  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
19188  *
19189  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
19190  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
19191  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
19192  *
19193  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
19194  */
19195 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);
19196
19197 /**
19198  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
19199  * more information.
19200  */
19201 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19202
19203 /**
19204  * Gets the list of usable channels, in random order. Useful as an argument to
19205  * get_route to ensure non-announced channels are used.
19206  *
19207  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
19208  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
19209  * are.
19210  */
19211 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19212
19213 /**
19214  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
19215  * will be accepted on the given channel, and after additional timeout/the closing of all
19216  * pending HTLCs, the channel will be closed on chain.
19217  *
19218  *  * If we are the channel initiator, we will pay between our [`Background`] and
19219  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
19220  *    estimate.
19221  *  * If our counterparty is the channel initiator, we will require a channel closing
19222  *    transaction feerate of at least our [`Background`] feerate or the feerate which
19223  *    would appear on a force-closure transaction, whichever is lower. We will allow our
19224  *    counterparty to pay as much fee as they'd like, however.
19225  *
19226  * May generate a SendShutdown message event on success, which should be relayed.
19227  *
19228  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
19229  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
19230  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
19231  */
19232 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
19233
19234 /**
19235  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
19236  * will be accepted on the given channel, and after additional timeout/the closing of all
19237  * pending HTLCs, the channel will be closed on chain.
19238  *
19239  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
19240  * the channel being closed or not:
19241  *  * If we are the channel initiator, we will pay at least this feerate on the closing
19242  *    transaction. The upper-bound is set by
19243  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
19244  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
19245  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
19246  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
19247  *    will appear on a force-closure transaction, whichever is lower).
19248  *
19249  * May generate a SendShutdown message event on success, which should be relayed.
19250  *
19251  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
19252  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
19253  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
19254  */
19255 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);
19256
19257 /**
19258  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
19259  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
19260  */
19261 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
19262
19263 /**
19264  * Force close all channels, immediately broadcasting the latest local commitment transaction
19265  * for each to the chain and rejecting new HTLCs on each.
19266  */
19267 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19268
19269 /**
19270  * Sends a payment along a given route.
19271  *
19272  * Value parameters are provided via the last hop in route, see documentation for RouteHop
19273  * fields for more info.
19274  *
19275  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
19276  * payment), we don't do anything to stop you! We always try to ensure that if the provided
19277  * next hop knows the preimage to payment_hash they can claim an additional amount as
19278  * specified in the last hop in the route! Thus, you should probably do your own
19279  * payment_preimage tracking (which you should already be doing as they represent \"proof of
19280  * payment\") and prevent double-sends yourself.
19281  *
19282  * May generate SendHTLCs message(s) event on success, which should be relayed.
19283  *
19284  * Each path may have a different return value, and PaymentSendValue may return a Vec with
19285  * each entry matching the corresponding-index entry in the route paths, see
19286  * PaymentSendFailure for more info.
19287  *
19288  * In general, a path may raise:
19289  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
19290  *    node public key) is specified.
19291  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
19292  *    (including due to previous monitor update failure or new permanent monitor update
19293  *    failure).
19294  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
19295  *    relevant updates.
19296  *
19297  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
19298  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
19299  * different route unless you intend to pay twice!
19300  *
19301  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
19302  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
19303  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
19304  * must not contain multiple paths as multi-path payments require a recipient-provided
19305  * payment_secret.
19306  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
19307  * bit set (either as required or as available). If multiple paths are present in the Route,
19308  * we assume the invoice had the basic_mpp feature set.
19309  *
19310  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
19311  */
19312 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);
19313
19314 /**
19315  * Retries a payment along the given [`Route`].
19316  *
19317  * Errors returned are a superset of those returned from [`send_payment`], so see
19318  * [`send_payment`] documentation for more details on errors. This method will also error if the
19319  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
19320  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
19321  * further retries have been disabled with [`abandon_payment`].
19322  *
19323  * [`send_payment`]: [`ChannelManager::send_payment`]
19324  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
19325  */
19326 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);
19327
19328 /**
19329  * Signals that no further retries for the given payment will occur.
19330  *
19331  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
19332  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
19333  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
19334  * pending HTLCs for this payment.
19335  *
19336  * Note that calling this method does *not* prevent a payment from succeeding. You must still
19337  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
19338  * determine the ultimate status of a payment.
19339  *
19340  * [`retry_payment`]: Self::retry_payment
19341  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
19342  * [`Event::PaymentSent`]: events::Event::PaymentSent
19343  */
19344 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
19345
19346 /**
19347  * Send a spontaneous payment, which is a payment that does not require the recipient to have
19348  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
19349  * the preimage, it must be a cryptographically secure random value that no intermediate node
19350  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
19351  * never reach the recipient.
19352  *
19353  * See [`send_payment`] documentation for more details on the return value of this function.
19354  *
19355  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
19356  * [`send_payment`] for more information about the risks of duplicate preimage usage.
19357  *
19358  * Note that `route` must have exactly one path.
19359  *
19360  * [`send_payment`]: Self::send_payment
19361  *
19362  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
19363  */
19364 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);
19365
19366 /**
19367  * Call this upon creation of a funding transaction for the given channel.
19368  *
19369  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
19370  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
19371  *
19372  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
19373  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
19374  *
19375  * May panic if the output found in the funding transaction is duplicative with some other
19376  * channel (note that this should be trivially prevented by using unique funding transaction
19377  * keys per-channel).
19378  *
19379  * Do NOT broadcast the funding transaction yourself. When we have safely received our
19380  * counterparty's signature the funding transaction will automatically be broadcast via the
19381  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
19382  *
19383  * Note that this includes RBF or similar transaction replacement strategies - lightning does
19384  * not currently support replacing a funding transaction on an existing channel. Instead,
19385  * create a new channel with a conflicting funding transaction.
19386  *
19387  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
19388  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
19389  */
19390 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);
19391
19392 /**
19393  * Regenerates channel_announcements and generates a signed node_announcement from the given
19394  * arguments, providing them in corresponding events via
19395  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
19396  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
19397  * announcement to ensure that the lightning P2P network is aware of the channels we have and
19398  * our network addresses.
19399  *
19400  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
19401  * node to humans. They carry no in-protocol meaning.
19402  *
19403  * `addresses` represent the set (possibly empty) of socket addresses on which this node
19404  * accepts incoming connections. These will be included in the node_announcement, publicly
19405  * tying these addresses together and to this node. If you wish to preserve user privacy,
19406  * addresses should likely contain only Tor Onion addresses.
19407  *
19408  * Panics if `addresses` is absurdly large (more than 500).
19409  *
19410  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
19411  */
19412 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
19413
19414 /**
19415  * Processes HTLCs which are pending waiting on random forward delay.
19416  *
19417  * Should only really ever be called in response to a PendingHTLCsForwardable event.
19418  * Will likely generate further events.
19419  */
19420 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
19421
19422 /**
19423  * Performs actions which should happen on startup and roughly once per minute thereafter.
19424  *
19425  * This currently includes:
19426  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
19427  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
19428  *    than a minute, informing the network that they should no longer attempt to route over
19429  *    the channel.
19430  *
19431  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
19432  * estimate fetches.
19433  */
19434 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
19435
19436 /**
19437  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
19438  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
19439  * along the path (including in our own channel on which we received it).
19440  * Returns false if no payment was found to fail backwards, true if the process of failing the
19441  * HTLC backwards has been started.
19442  */
19443 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
19444
19445 /**
19446  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
19447  * [`MessageSendEvent`]s needed to claim the payment.
19448  *
19449  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
19450  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
19451  * event matches your expectation. If you fail to do so and call this method, you may provide
19452  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
19453  *
19454  * Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now
19455  * pending for processing via [`get_and_clear_pending_msg_events`].
19456  *
19457  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
19458  * [`create_inbound_payment`]: Self::create_inbound_payment
19459  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19460  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
19461  */
19462 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
19463
19464 /**
19465  * Gets the node_id held by this ChannelManager
19466  */
19467 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
19468
19469 /**
19470  * Called to accept a request to open a channel after [`Event::OpenChannelRequest`] has been
19471  * triggered.
19472  *
19473  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted.
19474  *
19475  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
19476  */
19477 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32]);
19478
19479 /**
19480  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
19481  * to pay us.
19482  *
19483  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
19484  * [`PaymentHash`] and [`PaymentPreimage`] for you.
19485  *
19486  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
19487  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
19488  * passed directly to [`claim_funds`].
19489  *
19490  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
19491  *
19492  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
19493  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
19494  *
19495  * # Note
19496  *
19497  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
19498  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
19499  *
19500  * Errors if `min_value_msat` is greater than total bitcoin supply.
19501  *
19502  * [`claim_funds`]: Self::claim_funds
19503  * [`PaymentReceived`]: events::Event::PaymentReceived
19504  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
19505  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19506  */
19507 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);
19508
19509 /**
19510  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
19511  * serialized state with LDK node(s) running 0.0.103 and earlier.
19512  *
19513  * # Note
19514  * This method is deprecated and will be removed soon.
19515  *
19516  * [`create_inbound_payment`]: Self::create_inbound_payment
19517  */
19518 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);
19519
19520 /**
19521  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
19522  * stored external to LDK.
19523  *
19524  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
19525  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
19526  * the `min_value_msat` provided here, if one is provided.
19527  *
19528  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
19529  * note that LDK will not stop you from registering duplicate payment hashes for inbound
19530  * payments.
19531  *
19532  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
19533  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
19534  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
19535  * sender \"proof-of-payment\" unless they have paid the required amount.
19536  *
19537  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
19538  * in excess of the current time. This should roughly match the expiry time set in the invoice.
19539  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
19540  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
19541  * invoices when no timeout is set.
19542  *
19543  * Note that we use block header time to time-out pending inbound payments (with some margin
19544  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
19545  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
19546  * If you need exact expiry semantics, you should enforce them upon receipt of
19547  * [`PaymentReceived`].
19548  *
19549  * May panic if `invoice_expiry_delta_secs` is greater than one year.
19550  *
19551  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
19552  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
19553  *
19554  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
19555  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
19556  *
19557  * # Note
19558  *
19559  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
19560  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
19561  *
19562  * Errors if `min_value_msat` is greater than total bitcoin supply.
19563  *
19564  * [`create_inbound_payment`]: Self::create_inbound_payment
19565  * [`PaymentReceived`]: events::Event::PaymentReceived
19566  */
19567 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);
19568
19569 /**
19570  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
19571  * serialized state with LDK node(s) running 0.0.103 and earlier.
19572  *
19573  * # Note
19574  * This method is deprecated and will be removed soon.
19575  *
19576  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19577  */
19578 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);
19579
19580 /**
19581  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
19582  * previously returned from [`create_inbound_payment`].
19583  *
19584  * [`create_inbound_payment`]: Self::create_inbound_payment
19585  */
19586 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);
19587
19588 /**
19589  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
19590  * are used when constructing the phantom invoice's route hints.
19591  *
19592  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
19593  */
19594 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
19595
19596 /**
19597  * Gets route hints for use in receiving [phantom node payments].
19598  *
19599  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
19600  */
19601 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
19602
19603 /**
19604  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
19605  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
19606  */
19607 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
19608
19609 /**
19610  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
19611  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
19612  */
19613 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
19614
19615 /**
19616  * Constructs a new Listen which calls the relevant methods on this_arg.
19617  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
19618  */
19619 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
19620
19621 /**
19622  * Constructs a new Confirm which calls the relevant methods on this_arg.
19623  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
19624  */
19625 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
19626
19627 /**
19628  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
19629  * indicating whether persistence is necessary. Only one listener on
19630  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
19631  * up.
19632  *
19633  * Note that this method is not available with the `no-std` feature.
19634  */
19635 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
19636
19637 /**
19638  * Blocks until ChannelManager needs to be persisted. Only one listener on
19639  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
19640  * up.
19641  */
19642 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
19643
19644 /**
19645  * Gets the latest best block which was connected either via the [`chain::Listen`] or
19646  * [`chain::Confirm`] interfaces.
19647  */
19648 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
19649
19650 /**
19651  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
19652  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
19653  */
19654 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
19655
19656 /**
19657  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
19658  */
19659 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
19660
19661 /**
19662  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
19663  */
19664 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
19665
19666 /**
19667  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
19668  */
19669 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
19670
19671 /**
19672  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
19673  */
19674 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
19675
19676 /**
19677  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
19678  */
19679 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
19680
19681 /**
19682  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
19683  */
19684 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
19685
19686 /**
19687  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
19688  */
19689 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
19690
19691 /**
19692  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
19693  */
19694 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
19695
19696 /**
19697  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
19698  */
19699 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
19700
19701 /**
19702  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
19703  */
19704 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
19705
19706 /**
19707  * The keys provider which will give us relevant keys. Some keys will be loaded during
19708  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
19709  * signing data.
19710  */
19711 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19712
19713 /**
19714  * The keys provider which will give us relevant keys. Some keys will be loaded during
19715  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
19716  * signing data.
19717  */
19718 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
19719
19720 /**
19721  * The fee_estimator for use in the ChannelManager in the future.
19722  *
19723  * No calls to the FeeEstimator will be made during deserialization.
19724  */
19725 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19726
19727 /**
19728  * The fee_estimator for use in the ChannelManager in the future.
19729  *
19730  * No calls to the FeeEstimator will be made during deserialization.
19731  */
19732 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
19733
19734 /**
19735  * The chain::Watch for use in the ChannelManager in the future.
19736  *
19737  * No calls to the chain::Watch will be made during deserialization. It is assumed that
19738  * you have deserialized ChannelMonitors separately and will add them to your
19739  * chain::Watch after deserializing this ChannelManager.
19740  */
19741 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19742
19743 /**
19744  * The chain::Watch for use in the ChannelManager in the future.
19745  *
19746  * No calls to the chain::Watch will be made during deserialization. It is assumed that
19747  * you have deserialized ChannelMonitors separately and will add them to your
19748  * chain::Watch after deserializing this ChannelManager.
19749  */
19750 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
19751
19752 /**
19753  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
19754  * used to broadcast the latest local commitment transactions of channels which must be
19755  * force-closed during deserialization.
19756  */
19757 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19758
19759 /**
19760  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
19761  * used to broadcast the latest local commitment transactions of channels which must be
19762  * force-closed during deserialization.
19763  */
19764 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
19765
19766 /**
19767  * The Logger for use in the ChannelManager and which may be used to log information during
19768  * deserialization.
19769  */
19770 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19771
19772 /**
19773  * The Logger for use in the ChannelManager and which may be used to log information during
19774  * deserialization.
19775  */
19776 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
19777
19778 /**
19779  * Default settings used for new channels. Any existing channels will continue to use the
19780  * runtime settings which were stored when the ChannelManager was serialized.
19781  */
19782 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
19783
19784 /**
19785  * Default settings used for new channels. Any existing channels will continue to use the
19786  * runtime settings which were stored when the ChannelManager was serialized.
19787  */
19788 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
19789
19790 /**
19791  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
19792  * HashMap for you. This is primarily useful for C bindings where it is not practical to
19793  * populate a HashMap directly from C.
19794  */
19795 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);
19796
19797 /**
19798  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
19799  */
19800 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
19801
19802 /**
19803  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
19804  */
19805 void DecodeError_free(struct LDKDecodeError this_obj);
19806
19807 /**
19808  * Creates a copy of the DecodeError
19809  */
19810 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
19811
19812 /**
19813  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
19814  */
19815 void Init_free(struct LDKInit this_obj);
19816
19817 /**
19818  * The relevant features which the sender supports
19819  */
19820 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
19821
19822 /**
19823  * The relevant features which the sender supports
19824  */
19825 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
19826
19827 /**
19828  * Constructs a new Init given each field
19829  */
19830 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg);
19831
19832 /**
19833  * Creates a copy of the Init
19834  */
19835 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
19836
19837 /**
19838  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
19839  */
19840 void ErrorMessage_free(struct LDKErrorMessage this_obj);
19841
19842 /**
19843  * The channel ID involved in the error.
19844  *
19845  * All-0s indicates a general error unrelated to a specific channel, after which all channels
19846  * with the sending peer should be closed.
19847  */
19848 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
19849
19850 /**
19851  * The channel ID involved in the error.
19852  *
19853  * All-0s indicates a general error unrelated to a specific channel, after which all channels
19854  * with the sending peer should be closed.
19855  */
19856 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19857
19858 /**
19859  * A possibly human-readable error description.
19860  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
19861  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
19862  * the terminal emulator or the logging subsystem.
19863  */
19864 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
19865
19866 /**
19867  * A possibly human-readable error description.
19868  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
19869  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
19870  * the terminal emulator or the logging subsystem.
19871  */
19872 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
19873
19874 /**
19875  * Constructs a new ErrorMessage given each field
19876  */
19877 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
19878
19879 /**
19880  * Creates a copy of the ErrorMessage
19881  */
19882 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
19883
19884 /**
19885  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
19886  */
19887 void WarningMessage_free(struct LDKWarningMessage this_obj);
19888
19889 /**
19890  * The channel ID involved in the warning.
19891  *
19892  * All-0s indicates a warning unrelated to a specific channel.
19893  */
19894 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
19895
19896 /**
19897  * The channel ID involved in the warning.
19898  *
19899  * All-0s indicates a warning unrelated to a specific channel.
19900  */
19901 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19902
19903 /**
19904  * A possibly human-readable warning description.
19905  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
19906  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
19907  * the terminal emulator or the logging subsystem.
19908  */
19909 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
19910
19911 /**
19912  * A possibly human-readable warning description.
19913  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
19914  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
19915  * the terminal emulator or the logging subsystem.
19916  */
19917 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
19918
19919 /**
19920  * Constructs a new WarningMessage given each field
19921  */
19922 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
19923
19924 /**
19925  * Creates a copy of the WarningMessage
19926  */
19927 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
19928
19929 /**
19930  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
19931  */
19932 void Ping_free(struct LDKPing this_obj);
19933
19934 /**
19935  * The desired response length
19936  */
19937 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
19938
19939 /**
19940  * The desired response length
19941  */
19942 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
19943
19944 /**
19945  * The ping packet size.
19946  * This field is not sent on the wire. byteslen zeros are sent.
19947  */
19948 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
19949
19950 /**
19951  * The ping packet size.
19952  * This field is not sent on the wire. byteslen zeros are sent.
19953  */
19954 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
19955
19956 /**
19957  * Constructs a new Ping given each field
19958  */
19959 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
19960
19961 /**
19962  * Creates a copy of the Ping
19963  */
19964 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
19965
19966 /**
19967  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
19968  */
19969 void Pong_free(struct LDKPong this_obj);
19970
19971 /**
19972  * The pong packet size.
19973  * This field is not sent on the wire. byteslen zeros are sent.
19974  */
19975 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
19976
19977 /**
19978  * The pong packet size.
19979  * This field is not sent on the wire. byteslen zeros are sent.
19980  */
19981 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
19982
19983 /**
19984  * Constructs a new Pong given each field
19985  */
19986 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
19987
19988 /**
19989  * Creates a copy of the Pong
19990  */
19991 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
19992
19993 /**
19994  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
19995  */
19996 void OpenChannel_free(struct LDKOpenChannel this_obj);
19997
19998 /**
19999  * The genesis hash of the blockchain where the channel is to be opened
20000  */
20001 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
20002
20003 /**
20004  * The genesis hash of the blockchain where the channel is to be opened
20005  */
20006 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20007
20008 /**
20009  * A temporary channel ID, until the funding outpoint is announced
20010  */
20011 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
20012
20013 /**
20014  * A temporary channel ID, until the funding outpoint is announced
20015  */
20016 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20017
20018 /**
20019  * The channel value
20020  */
20021 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20022
20023 /**
20024  * The channel value
20025  */
20026 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20027
20028 /**
20029  * The amount to push to the counterparty as part of the open, in milli-satoshi
20030  */
20031 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20032
20033 /**
20034  * The amount to push to the counterparty as part of the open, in milli-satoshi
20035  */
20036 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20037
20038 /**
20039  * The threshold below which outputs on transactions broadcast by sender will be omitted
20040  */
20041 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20042
20043 /**
20044  * The threshold below which outputs on transactions broadcast by sender will be omitted
20045  */
20046 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20047
20048 /**
20049  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20050  */
20051 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20052
20053 /**
20054  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20055  */
20056 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20057
20058 /**
20059  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20060  */
20061 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20062
20063 /**
20064  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20065  */
20066 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20067
20068 /**
20069  * The minimum HTLC size incoming to sender, in milli-satoshi
20070  */
20071 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20072
20073 /**
20074  * The minimum HTLC size incoming to sender, in milli-satoshi
20075  */
20076 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20077
20078 /**
20079  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
20080  */
20081 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20082
20083 /**
20084  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
20085  */
20086 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
20087
20088 /**
20089  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20090  */
20091 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20092
20093 /**
20094  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20095  */
20096 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
20097
20098 /**
20099  * The maximum number of inbound HTLCs towards sender
20100  */
20101 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20102
20103 /**
20104  * The maximum number of inbound HTLCs towards sender
20105  */
20106 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
20107
20108 /**
20109  * The sender's key controlling the funding transaction
20110  */
20111 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20112
20113 /**
20114  * The sender's key controlling the funding transaction
20115  */
20116 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20117
20118 /**
20119  * Used to derive a revocation key for transactions broadcast by counterparty
20120  */
20121 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20122
20123 /**
20124  * Used to derive a revocation key for transactions broadcast by counterparty
20125  */
20126 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20127
20128 /**
20129  * A payment key to sender for transactions broadcast by counterparty
20130  */
20131 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20132
20133 /**
20134  * A payment key to sender for transactions broadcast by counterparty
20135  */
20136 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20137
20138 /**
20139  * Used to derive a payment key to sender for transactions broadcast by sender
20140  */
20141 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20142
20143 /**
20144  * Used to derive a payment key to sender for transactions broadcast by sender
20145  */
20146 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20147
20148 /**
20149  * Used to derive an HTLC payment key to sender
20150  */
20151 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20152
20153 /**
20154  * Used to derive an HTLC payment key to sender
20155  */
20156 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20157
20158 /**
20159  * The first to-be-broadcast-by-sender transaction's per commitment point
20160  */
20161 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20162
20163 /**
20164  * The first to-be-broadcast-by-sender transaction's per commitment point
20165  */
20166 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20167
20168 /**
20169  * Channel flags
20170  */
20171 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20172
20173 /**
20174  * Channel flags
20175  */
20176 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
20177
20178 /**
20179  * The channel type that this channel will represent. If none is set, we derive the channel
20180  * type from the intersection of our feature bits with our counterparty's feature bits from
20181  * the Init message.
20182  *
20183  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20184  */
20185 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20186
20187 /**
20188  * The channel type that this channel will represent. If none is set, we derive the channel
20189  * type from the intersection of our feature bits with our counterparty's feature bits from
20190  * the Init message.
20191  *
20192  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20193  */
20194 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
20195
20196 /**
20197  * Creates a copy of the OpenChannel
20198  */
20199 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
20200
20201 /**
20202  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
20203  */
20204 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
20205
20206 /**
20207  * A temporary channel ID, until the funding outpoint is announced
20208  */
20209 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
20210
20211 /**
20212  * A temporary channel ID, until the funding outpoint is announced
20213  */
20214 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20215
20216 /**
20217  * The threshold below which outputs on transactions broadcast by sender will be omitted
20218  */
20219 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20220
20221 /**
20222  * The threshold below which outputs on transactions broadcast by sender will be omitted
20223  */
20224 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20225
20226 /**
20227  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20228  */
20229 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20230
20231 /**
20232  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20233  */
20234 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20235
20236 /**
20237  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20238  */
20239 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20240
20241 /**
20242  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20243  */
20244 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20245
20246 /**
20247  * The minimum HTLC size incoming to sender, in milli-satoshi
20248  */
20249 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20250
20251 /**
20252  * The minimum HTLC size incoming to sender, in milli-satoshi
20253  */
20254 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20255
20256 /**
20257  * Minimum depth of the funding transaction before the channel is considered open
20258  */
20259 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20260
20261 /**
20262  * Minimum depth of the funding transaction before the channel is considered open
20263  */
20264 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
20265
20266 /**
20267  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20268  */
20269 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20270
20271 /**
20272  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20273  */
20274 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
20275
20276 /**
20277  * The maximum number of inbound HTLCs towards sender
20278  */
20279 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20280
20281 /**
20282  * The maximum number of inbound HTLCs towards sender
20283  */
20284 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
20285
20286 /**
20287  * The sender's key controlling the funding transaction
20288  */
20289 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20290
20291 /**
20292  * The sender's key controlling the funding transaction
20293  */
20294 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20295
20296 /**
20297  * Used to derive a revocation key for transactions broadcast by counterparty
20298  */
20299 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20300
20301 /**
20302  * Used to derive a revocation key for transactions broadcast by counterparty
20303  */
20304 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20305
20306 /**
20307  * A payment key to sender for transactions broadcast by counterparty
20308  */
20309 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20310
20311 /**
20312  * A payment key to sender for transactions broadcast by counterparty
20313  */
20314 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20315
20316 /**
20317  * Used to derive a payment key to sender for transactions broadcast by sender
20318  */
20319 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20320
20321 /**
20322  * Used to derive a payment key to sender for transactions broadcast by sender
20323  */
20324 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20325
20326 /**
20327  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
20328  */
20329 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20330
20331 /**
20332  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
20333  */
20334 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20335
20336 /**
20337  * The first to-be-broadcast-by-sender transaction's per commitment point
20338  */
20339 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20340
20341 /**
20342  * The first to-be-broadcast-by-sender transaction's per commitment point
20343  */
20344 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20345
20346 /**
20347  * The channel type that this channel will represent. If none is set, we derive the channel
20348  * type from the intersection of our feature bits with our counterparty's feature bits from
20349  * the Init message.
20350  *
20351  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
20352  *
20353  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20354  */
20355 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20356
20357 /**
20358  * The channel type that this channel will represent. If none is set, we derive the channel
20359  * type from the intersection of our feature bits with our counterparty's feature bits from
20360  * the Init message.
20361  *
20362  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
20363  *
20364  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20365  */
20366 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
20367
20368 /**
20369  * Creates a copy of the AcceptChannel
20370  */
20371 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
20372
20373 /**
20374  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
20375  */
20376 void FundingCreated_free(struct LDKFundingCreated this_obj);
20377
20378 /**
20379  * A temporary channel ID, until the funding is established
20380  */
20381 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
20382
20383 /**
20384  * A temporary channel ID, until the funding is established
20385  */
20386 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20387
20388 /**
20389  * The funding transaction ID
20390  */
20391 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
20392
20393 /**
20394  * The funding transaction ID
20395  */
20396 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20397
20398 /**
20399  * The specific output index funding this channel
20400  */
20401 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
20402
20403 /**
20404  * The specific output index funding this channel
20405  */
20406 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
20407
20408 /**
20409  * The signature of the channel initiator (funder) on the initial commitment transaction
20410  */
20411 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
20412
20413 /**
20414  * The signature of the channel initiator (funder) on the initial commitment transaction
20415  */
20416 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
20417
20418 /**
20419  * Constructs a new FundingCreated given each field
20420  */
20421 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);
20422
20423 /**
20424  * Creates a copy of the FundingCreated
20425  */
20426 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
20427
20428 /**
20429  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
20430  */
20431 void FundingSigned_free(struct LDKFundingSigned this_obj);
20432
20433 /**
20434  * The channel ID
20435  */
20436 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
20437
20438 /**
20439  * The channel ID
20440  */
20441 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20442
20443 /**
20444  * The signature of the channel acceptor (fundee) on the initial commitment transaction
20445  */
20446 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
20447
20448 /**
20449  * The signature of the channel acceptor (fundee) on the initial commitment transaction
20450  */
20451 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
20452
20453 /**
20454  * Constructs a new FundingSigned given each field
20455  */
20456 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
20457
20458 /**
20459  * Creates a copy of the FundingSigned
20460  */
20461 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
20462
20463 /**
20464  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
20465  */
20466 void FundingLocked_free(struct LDKFundingLocked this_obj);
20467
20468 /**
20469  * The channel ID
20470  */
20471 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
20472
20473 /**
20474  * The channel ID
20475  */
20476 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20477
20478 /**
20479  * The per-commitment point of the second commitment transaction
20480  */
20481 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
20482
20483 /**
20484  * The per-commitment point of the second commitment transaction
20485  */
20486 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20487
20488 /**
20489  * Constructs a new FundingLocked given each field
20490  */
20491 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg);
20492
20493 /**
20494  * Creates a copy of the FundingLocked
20495  */
20496 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
20497
20498 /**
20499  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
20500  */
20501 void Shutdown_free(struct LDKShutdown this_obj);
20502
20503 /**
20504  * The channel ID
20505  */
20506 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
20507
20508 /**
20509  * The channel ID
20510  */
20511 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20512
20513 /**
20514  * The destination of this peer's funds on closing.
20515  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
20516  */
20517 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
20518
20519 /**
20520  * The destination of this peer's funds on closing.
20521  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
20522  */
20523 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
20524
20525 /**
20526  * Constructs a new Shutdown given each field
20527  */
20528 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
20529
20530 /**
20531  * Creates a copy of the Shutdown
20532  */
20533 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
20534
20535 /**
20536  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
20537  */
20538 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
20539
20540 /**
20541  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
20542  * transaction.
20543  */
20544 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
20545
20546 /**
20547  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
20548  * transaction.
20549  */
20550 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
20551
20552 /**
20553  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
20554  * transaction.
20555  */
20556 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
20557
20558 /**
20559  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
20560  * transaction.
20561  */
20562 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
20563
20564 /**
20565  * Constructs a new ClosingSignedFeeRange given each field
20566  */
20567 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
20568
20569 /**
20570  * Creates a copy of the ClosingSignedFeeRange
20571  */
20572 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
20573
20574 /**
20575  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
20576  */
20577 void ClosingSigned_free(struct LDKClosingSigned this_obj);
20578
20579 /**
20580  * The channel ID
20581  */
20582 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
20583
20584 /**
20585  * The channel ID
20586  */
20587 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20588
20589 /**
20590  * The proposed total fee for the closing transaction
20591  */
20592 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
20593
20594 /**
20595  * The proposed total fee for the closing transaction
20596  */
20597 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
20598
20599 /**
20600  * A signature on the closing transaction
20601  */
20602 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
20603
20604 /**
20605  * A signature on the closing transaction
20606  */
20607 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
20608
20609 /**
20610  * The minimum and maximum fees which the sender is willing to accept, provided only by new
20611  * nodes.
20612  *
20613  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20614  */
20615 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
20616
20617 /**
20618  * The minimum and maximum fees which the sender is willing to accept, provided only by new
20619  * nodes.
20620  *
20621  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20622  */
20623 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
20624
20625 /**
20626  * Constructs a new ClosingSigned given each field
20627  */
20628 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);
20629
20630 /**
20631  * Creates a copy of the ClosingSigned
20632  */
20633 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
20634
20635 /**
20636  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
20637  */
20638 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
20639
20640 /**
20641  * The channel ID
20642  */
20643 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
20644
20645 /**
20646  * The channel ID
20647  */
20648 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20649
20650 /**
20651  * The HTLC ID
20652  */
20653 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
20654
20655 /**
20656  * The HTLC ID
20657  */
20658 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
20659
20660 /**
20661  * The HTLC value in milli-satoshi
20662  */
20663 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
20664
20665 /**
20666  * The HTLC value in milli-satoshi
20667  */
20668 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
20669
20670 /**
20671  * The payment hash, the pre-image of which controls HTLC redemption
20672  */
20673 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
20674
20675 /**
20676  * The payment hash, the pre-image of which controls HTLC redemption
20677  */
20678 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20679
20680 /**
20681  * The expiry height of the HTLC
20682  */
20683 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
20684
20685 /**
20686  * The expiry height of the HTLC
20687  */
20688 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
20689
20690 /**
20691  * Creates a copy of the UpdateAddHTLC
20692  */
20693 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
20694
20695 /**
20696  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
20697  */
20698 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
20699
20700 /**
20701  * The channel ID
20702  */
20703 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
20704
20705 /**
20706  * The channel ID
20707  */
20708 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20709
20710 /**
20711  * The HTLC ID
20712  */
20713 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
20714
20715 /**
20716  * The HTLC ID
20717  */
20718 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
20719
20720 /**
20721  * The pre-image of the payment hash, allowing HTLC redemption
20722  */
20723 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
20724
20725 /**
20726  * The pre-image of the payment hash, allowing HTLC redemption
20727  */
20728 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20729
20730 /**
20731  * Constructs a new UpdateFulfillHTLC given each field
20732  */
20733 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
20734
20735 /**
20736  * Creates a copy of the UpdateFulfillHTLC
20737  */
20738 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
20739
20740 /**
20741  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
20742  */
20743 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
20744
20745 /**
20746  * The channel ID
20747  */
20748 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
20749
20750 /**
20751  * The channel ID
20752  */
20753 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20754
20755 /**
20756  * The HTLC ID
20757  */
20758 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
20759
20760 /**
20761  * The HTLC ID
20762  */
20763 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
20764
20765 /**
20766  * Creates a copy of the UpdateFailHTLC
20767  */
20768 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
20769
20770 /**
20771  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
20772  */
20773 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
20774
20775 /**
20776  * The channel ID
20777  */
20778 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
20779
20780 /**
20781  * The channel ID
20782  */
20783 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20784
20785 /**
20786  * The HTLC ID
20787  */
20788 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
20789
20790 /**
20791  * The HTLC ID
20792  */
20793 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
20794
20795 /**
20796  * The failure code
20797  */
20798 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
20799
20800 /**
20801  * The failure code
20802  */
20803 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
20804
20805 /**
20806  * Creates a copy of the UpdateFailMalformedHTLC
20807  */
20808 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
20809
20810 /**
20811  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
20812  */
20813 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
20814
20815 /**
20816  * The channel ID
20817  */
20818 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
20819
20820 /**
20821  * The channel ID
20822  */
20823 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20824
20825 /**
20826  * A signature on the commitment transaction
20827  */
20828 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
20829
20830 /**
20831  * A signature on the commitment transaction
20832  */
20833 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
20834
20835 /**
20836  * Signatures on the HTLC transactions
20837  */
20838 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
20839
20840 /**
20841  * Constructs a new CommitmentSigned given each field
20842  */
20843 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
20844
20845 /**
20846  * Creates a copy of the CommitmentSigned
20847  */
20848 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
20849
20850 /**
20851  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
20852  */
20853 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
20854
20855 /**
20856  * The channel ID
20857  */
20858 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
20859
20860 /**
20861  * The channel ID
20862  */
20863 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20864
20865 /**
20866  * The secret corresponding to the per-commitment point
20867  */
20868 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
20869
20870 /**
20871  * The secret corresponding to the per-commitment point
20872  */
20873 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20874
20875 /**
20876  * The next sender-broadcast commitment transaction's per-commitment point
20877  */
20878 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
20879
20880 /**
20881  * The next sender-broadcast commitment transaction's per-commitment point
20882  */
20883 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20884
20885 /**
20886  * Constructs a new RevokeAndACK given each field
20887  */
20888 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);
20889
20890 /**
20891  * Creates a copy of the RevokeAndACK
20892  */
20893 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
20894
20895 /**
20896  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
20897  */
20898 void UpdateFee_free(struct LDKUpdateFee this_obj);
20899
20900 /**
20901  * The channel ID
20902  */
20903 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
20904
20905 /**
20906  * The channel ID
20907  */
20908 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20909
20910 /**
20911  * Fee rate per 1000-weight of the transaction
20912  */
20913 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
20914
20915 /**
20916  * Fee rate per 1000-weight of the transaction
20917  */
20918 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
20919
20920 /**
20921  * Constructs a new UpdateFee given each field
20922  */
20923 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
20924
20925 /**
20926  * Creates a copy of the UpdateFee
20927  */
20928 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
20929
20930 /**
20931  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
20932  */
20933 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
20934
20935 /**
20936  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
20937  * belonging to the recipient
20938  */
20939 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
20940
20941 /**
20942  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
20943  * belonging to the recipient
20944  */
20945 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20946
20947 /**
20948  * The sender's per-commitment point for their current commitment transaction
20949  */
20950 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
20951
20952 /**
20953  * The sender's per-commitment point for their current commitment transaction
20954  */
20955 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20956
20957 /**
20958  * Constructs a new DataLossProtect given each field
20959  */
20960 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
20961
20962 /**
20963  * Creates a copy of the DataLossProtect
20964  */
20965 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
20966
20967 /**
20968  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
20969  */
20970 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
20971
20972 /**
20973  * The channel ID
20974  */
20975 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
20976
20977 /**
20978  * The channel ID
20979  */
20980 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20981
20982 /**
20983  * The next commitment number for the sender
20984  */
20985 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
20986
20987 /**
20988  * The next commitment number for the sender
20989  */
20990 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
20991
20992 /**
20993  * The next commitment number for the recipient
20994  */
20995 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
20996
20997 /**
20998  * The next commitment number for the recipient
20999  */
21000 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
21001
21002 /**
21003  * Creates a copy of the ChannelReestablish
21004  */
21005 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
21006
21007 /**
21008  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
21009  */
21010 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
21011
21012 /**
21013  * The channel ID
21014  */
21015 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
21016
21017 /**
21018  * The channel ID
21019  */
21020 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21021
21022 /**
21023  * The short channel ID
21024  */
21025 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21026
21027 /**
21028  * The short channel ID
21029  */
21030 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
21031
21032 /**
21033  * A signature by the node key
21034  */
21035 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21036
21037 /**
21038  * A signature by the node key
21039  */
21040 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
21041
21042 /**
21043  * A signature by the funding key
21044  */
21045 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21046
21047 /**
21048  * A signature by the funding key
21049  */
21050 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
21051
21052 /**
21053  * Constructs a new AnnouncementSignatures given each field
21054  */
21055 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);
21056
21057 /**
21058  * Creates a copy of the AnnouncementSignatures
21059  */
21060 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
21061
21062 /**
21063  * Frees any resources used by the NetAddress
21064  */
21065 void NetAddress_free(struct LDKNetAddress this_ptr);
21066
21067 /**
21068  * Creates a copy of the NetAddress
21069  */
21070 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
21071
21072 /**
21073  * Utility method to constructs a new IPv4-variant NetAddress
21074  */
21075 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
21076
21077 /**
21078  * Utility method to constructs a new IPv6-variant NetAddress
21079  */
21080 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
21081
21082 /**
21083  * Utility method to constructs a new OnionV2-variant NetAddress
21084  */
21085 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
21086
21087 /**
21088  * Utility method to constructs a new OnionV3-variant NetAddress
21089  */
21090 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
21091
21092 /**
21093  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
21094  */
21095 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
21096
21097 /**
21098  * Read a NetAddress from a byte array, created by NetAddress_write
21099  */
21100 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
21101
21102 /**
21103  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
21104  */
21105 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
21106
21107 /**
21108  * The advertised features
21109  */
21110 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21111
21112 /**
21113  * The advertised features
21114  */
21115 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
21116
21117 /**
21118  * A strictly monotonic announcement counter, with gaps allowed
21119  */
21120 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21121
21122 /**
21123  * A strictly monotonic announcement counter, with gaps allowed
21124  */
21125 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
21126
21127 /**
21128  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
21129  * to this node).
21130  */
21131 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21132
21133 /**
21134  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
21135  * to this node).
21136  */
21137 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21138
21139 /**
21140  * An RGB color for UI purposes
21141  */
21142 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
21143
21144 /**
21145  * An RGB color for UI purposes
21146  */
21147 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
21148
21149 /**
21150  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
21151  * of uniqueness.
21152  */
21153 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
21154
21155 /**
21156  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
21157  * of uniqueness.
21158  */
21159 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21160
21161 /**
21162  * List of addresses on which this node is reachable
21163  */
21164 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
21165
21166 /**
21167  * Creates a copy of the UnsignedNodeAnnouncement
21168  */
21169 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
21170
21171 /**
21172  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
21173  */
21174 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
21175
21176 /**
21177  * The signature by the node key
21178  */
21179 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
21180
21181 /**
21182  * The signature by the node key
21183  */
21184 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21185
21186 /**
21187  * The actual content of the announcement
21188  */
21189 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
21190
21191 /**
21192  * The actual content of the announcement
21193  */
21194 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
21195
21196 /**
21197  * Constructs a new NodeAnnouncement given each field
21198  */
21199 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
21200
21201 /**
21202  * Creates a copy of the NodeAnnouncement
21203  */
21204 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
21205
21206 /**
21207  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
21208  */
21209 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
21210
21211 /**
21212  * The advertised channel features
21213  */
21214 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21215
21216 /**
21217  * The advertised channel features
21218  */
21219 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
21220
21221 /**
21222  * The genesis hash of the blockchain where the channel is to be opened
21223  */
21224 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
21225
21226 /**
21227  * The genesis hash of the blockchain where the channel is to be opened
21228  */
21229 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21230
21231 /**
21232  * The short channel ID
21233  */
21234 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21235
21236 /**
21237  * The short channel ID
21238  */
21239 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
21240
21241 /**
21242  * One of the two node_ids which are endpoints of this channel
21243  */
21244 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21245
21246 /**
21247  * One of the two node_ids which are endpoints of this channel
21248  */
21249 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21250
21251 /**
21252  * The other of the two node_ids which are endpoints of this channel
21253  */
21254 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21255
21256 /**
21257  * The other of the two node_ids which are endpoints of this channel
21258  */
21259 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21260
21261 /**
21262  * The funding key for the first node
21263  */
21264 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21265
21266 /**
21267  * The funding key for the first node
21268  */
21269 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21270
21271 /**
21272  * The funding key for the second node
21273  */
21274 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21275
21276 /**
21277  * The funding key for the second node
21278  */
21279 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21280
21281 /**
21282  * Creates a copy of the UnsignedChannelAnnouncement
21283  */
21284 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
21285
21286 /**
21287  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
21288  */
21289 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
21290
21291 /**
21292  * Authentication of the announcement by the first public node
21293  */
21294 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21295
21296 /**
21297  * Authentication of the announcement by the first public node
21298  */
21299 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21300
21301 /**
21302  * Authentication of the announcement by the second public node
21303  */
21304 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21305
21306 /**
21307  * Authentication of the announcement by the second public node
21308  */
21309 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21310
21311 /**
21312  * Proof of funding UTXO ownership by the first public node
21313  */
21314 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21315
21316 /**
21317  * Proof of funding UTXO ownership by the first public node
21318  */
21319 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21320
21321 /**
21322  * Proof of funding UTXO ownership by the second public node
21323  */
21324 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21325
21326 /**
21327  * Proof of funding UTXO ownership by the second public node
21328  */
21329 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21330
21331 /**
21332  * The actual announcement
21333  */
21334 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21335
21336 /**
21337  * The actual announcement
21338  */
21339 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
21340
21341 /**
21342  * Constructs a new ChannelAnnouncement given each field
21343  */
21344 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);
21345
21346 /**
21347  * Creates a copy of the ChannelAnnouncement
21348  */
21349 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
21350
21351 /**
21352  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
21353  */
21354 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
21355
21356 /**
21357  * The genesis hash of the blockchain where the channel is to be opened
21358  */
21359 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
21360
21361 /**
21362  * The genesis hash of the blockchain where the channel is to be opened
21363  */
21364 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21365
21366 /**
21367  * The short channel ID
21368  */
21369 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21370
21371 /**
21372  * The short channel ID
21373  */
21374 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
21375
21376 /**
21377  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
21378  */
21379 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21380
21381 /**
21382  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
21383  */
21384 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21385
21386 /**
21387  * Channel flags
21388  */
21389 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21390
21391 /**
21392  * Channel flags
21393  */
21394 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
21395
21396 /**
21397  * The number of blocks such that if:
21398  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
21399  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
21400  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
21401  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
21402  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
21403  * forwarding. Note that the HTLC sender is the one who originally sets this value when
21404  * constructing the route.
21405  */
21406 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21407
21408 /**
21409  * The number of blocks such that if:
21410  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
21411  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
21412  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
21413  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
21414  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
21415  * forwarding. Note that the HTLC sender is the one who originally sets this value when
21416  * constructing the route.
21417  */
21418 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
21419
21420 /**
21421  * The minimum HTLC size incoming to sender, in milli-satoshi
21422  */
21423 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21424
21425 /**
21426  * The minimum HTLC size incoming to sender, in milli-satoshi
21427  */
21428 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
21429
21430 /**
21431  * The base HTLC fee charged by sender, in milli-satoshi
21432  */
21433 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21434
21435 /**
21436  * The base HTLC fee charged by sender, in milli-satoshi
21437  */
21438 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21439
21440 /**
21441  * The amount to fee multiplier, in micro-satoshi
21442  */
21443 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21444
21445 /**
21446  * The amount to fee multiplier, in micro-satoshi
21447  */
21448 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21449
21450 /**
21451  * Creates a copy of the UnsignedChannelUpdate
21452  */
21453 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
21454
21455 /**
21456  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
21457  */
21458 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
21459
21460 /**
21461  * A signature of the channel update
21462  */
21463 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
21464
21465 /**
21466  * A signature of the channel update
21467  */
21468 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
21469
21470 /**
21471  * The actual channel update
21472  */
21473 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
21474
21475 /**
21476  * The actual channel update
21477  */
21478 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
21479
21480 /**
21481  * Constructs a new ChannelUpdate given each field
21482  */
21483 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
21484
21485 /**
21486  * Creates a copy of the ChannelUpdate
21487  */
21488 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
21489
21490 /**
21491  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
21492  */
21493 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
21494
21495 /**
21496  * The genesis hash of the blockchain being queried
21497  */
21498 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
21499
21500 /**
21501  * The genesis hash of the blockchain being queried
21502  */
21503 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21504
21505 /**
21506  * The height of the first block for the channel UTXOs being queried
21507  */
21508 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
21509
21510 /**
21511  * The height of the first block for the channel UTXOs being queried
21512  */
21513 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21514
21515 /**
21516  * The number of blocks to include in the query results
21517  */
21518 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
21519
21520 /**
21521  * The number of blocks to include in the query results
21522  */
21523 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21524
21525 /**
21526  * Constructs a new QueryChannelRange given each field
21527  */
21528 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
21529
21530 /**
21531  * Creates a copy of the QueryChannelRange
21532  */
21533 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
21534
21535 /**
21536  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
21537  */
21538 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
21539
21540 /**
21541  * The genesis hash of the blockchain being queried
21542  */
21543 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
21544
21545 /**
21546  * The genesis hash of the blockchain being queried
21547  */
21548 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21549
21550 /**
21551  * The height of the first block in the range of the reply
21552  */
21553 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
21554
21555 /**
21556  * The height of the first block in the range of the reply
21557  */
21558 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21559
21560 /**
21561  * The number of blocks included in the range of the reply
21562  */
21563 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
21564
21565 /**
21566  * The number of blocks included in the range of the reply
21567  */
21568 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21569
21570 /**
21571  * True when this is the final reply for a query
21572  */
21573 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
21574
21575 /**
21576  * True when this is the final reply for a query
21577  */
21578 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
21579
21580 /**
21581  * The short_channel_ids in the channel range
21582  */
21583 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
21584
21585 /**
21586  * Constructs a new ReplyChannelRange given each field
21587  */
21588 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);
21589
21590 /**
21591  * Creates a copy of the ReplyChannelRange
21592  */
21593 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
21594
21595 /**
21596  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
21597  */
21598 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
21599
21600 /**
21601  * The genesis hash of the blockchain being queried
21602  */
21603 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
21604
21605 /**
21606  * The genesis hash of the blockchain being queried
21607  */
21608 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21609
21610 /**
21611  * The short_channel_ids that are being queried
21612  */
21613 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
21614
21615 /**
21616  * Constructs a new QueryShortChannelIds given each field
21617  */
21618 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
21619
21620 /**
21621  * Creates a copy of the QueryShortChannelIds
21622  */
21623 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
21624
21625 /**
21626  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
21627  */
21628 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
21629
21630 /**
21631  * The genesis hash of the blockchain that was queried
21632  */
21633 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
21634
21635 /**
21636  * The genesis hash of the blockchain that was queried
21637  */
21638 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21639
21640 /**
21641  * Indicates if the query recipient maintains up-to-date channel
21642  * information for the chain_hash
21643  */
21644 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
21645
21646 /**
21647  * Indicates if the query recipient maintains up-to-date channel
21648  * information for the chain_hash
21649  */
21650 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
21651
21652 /**
21653  * Constructs a new ReplyShortChannelIdsEnd given each field
21654  */
21655 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
21656
21657 /**
21658  * Creates a copy of the ReplyShortChannelIdsEnd
21659  */
21660 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
21661
21662 /**
21663  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
21664  */
21665 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
21666
21667 /**
21668  * The genesis hash of the blockchain for channel and node information
21669  */
21670 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
21671
21672 /**
21673  * The genesis hash of the blockchain for channel and node information
21674  */
21675 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21676
21677 /**
21678  * The starting unix timestamp
21679  */
21680 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
21681
21682 /**
21683  * The starting unix timestamp
21684  */
21685 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
21686
21687 /**
21688  * The range of information in seconds
21689  */
21690 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
21691
21692 /**
21693  * The range of information in seconds
21694  */
21695 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
21696
21697 /**
21698  * Constructs a new GossipTimestampFilter given each field
21699  */
21700 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
21701
21702 /**
21703  * Creates a copy of the GossipTimestampFilter
21704  */
21705 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
21706
21707 /**
21708  * Frees any resources used by the ErrorAction
21709  */
21710 void ErrorAction_free(struct LDKErrorAction this_ptr);
21711
21712 /**
21713  * Creates a copy of the ErrorAction
21714  */
21715 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
21716
21717 /**
21718  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
21719  */
21720 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
21721
21722 /**
21723  * Utility method to constructs a new IgnoreError-variant ErrorAction
21724  */
21725 struct LDKErrorAction ErrorAction_ignore_error(void);
21726
21727 /**
21728  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
21729  */
21730 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
21731
21732 /**
21733  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
21734  */
21735 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
21736
21737 /**
21738  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
21739  */
21740 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
21741
21742 /**
21743  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
21744  */
21745 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
21746
21747 /**
21748  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
21749  */
21750 void LightningError_free(struct LDKLightningError this_obj);
21751
21752 /**
21753  * A human-readable message describing the error
21754  */
21755 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
21756
21757 /**
21758  * A human-readable message describing the error
21759  */
21760 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
21761
21762 /**
21763  * The action which should be taken against the offending peer.
21764  */
21765 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
21766
21767 /**
21768  * The action which should be taken against the offending peer.
21769  */
21770 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
21771
21772 /**
21773  * Constructs a new LightningError given each field
21774  */
21775 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
21776
21777 /**
21778  * Creates a copy of the LightningError
21779  */
21780 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
21781
21782 /**
21783  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
21784  */
21785 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
21786
21787 /**
21788  * update_add_htlc messages which should be sent
21789  */
21790 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21791
21792 /**
21793  * update_add_htlc messages which should be sent
21794  */
21795 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
21796
21797 /**
21798  * update_fulfill_htlc messages which should be sent
21799  */
21800 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21801
21802 /**
21803  * update_fulfill_htlc messages which should be sent
21804  */
21805 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
21806
21807 /**
21808  * update_fail_htlc messages which should be sent
21809  */
21810 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21811
21812 /**
21813  * update_fail_htlc messages which should be sent
21814  */
21815 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
21816
21817 /**
21818  * update_fail_malformed_htlc messages which should be sent
21819  */
21820 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21821
21822 /**
21823  * update_fail_malformed_htlc messages which should be sent
21824  */
21825 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
21826
21827 /**
21828  * An update_fee message which should be sent
21829  *
21830  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21831  */
21832 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21833
21834 /**
21835  * An update_fee message which should be sent
21836  *
21837  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21838  */
21839 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
21840
21841 /**
21842  * Finally, the commitment_signed message which should be sent
21843  */
21844 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
21845
21846 /**
21847  * Finally, the commitment_signed message which should be sent
21848  */
21849 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
21850
21851 /**
21852  * Constructs a new CommitmentUpdate given each field
21853  */
21854 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);
21855
21856 /**
21857  * Creates a copy of the CommitmentUpdate
21858  */
21859 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
21860
21861 /**
21862  * Calls the free function if one is set
21863  */
21864 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
21865
21866 /**
21867  * Calls the free function if one is set
21868  */
21869 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
21870
21871 /**
21872  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
21873  */
21874 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
21875
21876 /**
21877  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
21878  */
21879 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
21880
21881 /**
21882  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
21883  */
21884 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
21885
21886 /**
21887  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
21888  */
21889 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
21890
21891 /**
21892  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
21893  */
21894 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
21895
21896 /**
21897  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
21898  */
21899 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
21900
21901 /**
21902  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
21903  */
21904 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
21905
21906 /**
21907  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
21908  */
21909 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
21910
21911 /**
21912  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
21913  */
21914 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
21915
21916 /**
21917  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
21918  */
21919 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
21920
21921 /**
21922  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
21923  */
21924 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
21925
21926 /**
21927  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
21928  */
21929 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
21930
21931 /**
21932  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
21933  */
21934 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
21935
21936 /**
21937  * Read a FundingCreated from a byte array, created by FundingCreated_write
21938  */
21939 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
21940
21941 /**
21942  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
21943  */
21944 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
21945
21946 /**
21947  * Read a FundingSigned from a byte array, created by FundingSigned_write
21948  */
21949 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
21950
21951 /**
21952  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
21953  */
21954 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
21955
21956 /**
21957  * Read a FundingLocked from a byte array, created by FundingLocked_write
21958  */
21959 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
21960
21961 /**
21962  * Serialize the Init object into a byte array which can be read by Init_read
21963  */
21964 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
21965
21966 /**
21967  * Read a Init from a byte array, created by Init_write
21968  */
21969 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
21970
21971 /**
21972  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
21973  */
21974 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
21975
21976 /**
21977  * Read a OpenChannel from a byte array, created by OpenChannel_write
21978  */
21979 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
21980
21981 /**
21982  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
21983  */
21984 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
21985
21986 /**
21987  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
21988  */
21989 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
21990
21991 /**
21992  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
21993  */
21994 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
21995
21996 /**
21997  * Read a Shutdown from a byte array, created by Shutdown_write
21998  */
21999 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
22000
22001 /**
22002  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
22003  */
22004 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
22005
22006 /**
22007  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
22008  */
22009 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
22010
22011 /**
22012  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
22013  */
22014 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
22015
22016 /**
22017  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
22018  */
22019 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
22020
22021 /**
22022  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
22023  */
22024 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
22025
22026 /**
22027  * Read a UpdateFee from a byte array, created by UpdateFee_write
22028  */
22029 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
22030
22031 /**
22032  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
22033  */
22034 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
22035
22036 /**
22037  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
22038  */
22039 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
22040
22041 /**
22042  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
22043  */
22044 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
22045
22046 /**
22047  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
22048  */
22049 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
22050
22051 /**
22052  * Serialize the Ping object into a byte array which can be read by Ping_read
22053  */
22054 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
22055
22056 /**
22057  * Read a Ping from a byte array, created by Ping_write
22058  */
22059 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
22060
22061 /**
22062  * Serialize the Pong object into a byte array which can be read by Pong_read
22063  */
22064 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
22065
22066 /**
22067  * Read a Pong from a byte array, created by Pong_write
22068  */
22069 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
22070
22071 /**
22072  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
22073  */
22074 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
22075
22076 /**
22077  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
22078  */
22079 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
22080
22081 /**
22082  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
22083  */
22084 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
22085
22086 /**
22087  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
22088  */
22089 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
22090
22091 /**
22092  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
22093  */
22094 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
22095
22096 /**
22097  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
22098  */
22099 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
22100
22101 /**
22102  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
22103  */
22104 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
22105
22106 /**
22107  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
22108  */
22109 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
22110
22111 /**
22112  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
22113  */
22114 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
22115
22116 /**
22117  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
22118  */
22119 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
22120
22121 /**
22122  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
22123  */
22124 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
22125
22126 /**
22127  * Read a WarningMessage from a byte array, created by WarningMessage_write
22128  */
22129 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
22130
22131 /**
22132  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
22133  */
22134 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
22135
22136 /**
22137  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
22138  */
22139 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
22140
22141 /**
22142  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
22143  */
22144 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
22145
22146 /**
22147  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
22148  */
22149 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
22150
22151 /**
22152  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
22153  */
22154 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
22155
22156 /**
22157  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
22158  */
22159 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
22160
22161 /**
22162  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
22163  */
22164 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
22165
22166 /**
22167  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
22168  */
22169 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
22170
22171 /**
22172  *\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
22173  */
22174 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
22175
22176 /**
22177  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
22178  */
22179 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
22180
22181 /**
22182  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
22183  */
22184 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
22185
22186 /**
22187  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
22188  */
22189 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
22190
22191 /**
22192  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
22193  */
22194 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
22195
22196 /**
22197  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
22198  */
22199 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
22200
22201 /**
22202  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
22203  */
22204 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
22205
22206 /**
22207  * Calls the free function if one is set
22208  */
22209 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
22210
22211 /**
22212  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
22213  */
22214 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
22215
22216 /**
22217  * Constructs a new IgnoringMessageHandler given each field
22218  */
22219 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
22220
22221 /**
22222  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22223  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22224  */
22225 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22226
22227 /**
22228  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
22229  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
22230  */
22231 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22232
22233 /**
22234  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
22235  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
22236  */
22237 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22238
22239 /**
22240  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
22241  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
22242  */
22243 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22244
22245 /**
22246  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
22247  */
22248 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
22249
22250 /**
22251  * Constructs a new ErroringMessageHandler
22252  */
22253 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
22254
22255 /**
22256  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22257  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22258  */
22259 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
22260
22261 /**
22262  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
22263  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
22264  */
22265 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
22266
22267 /**
22268  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
22269  */
22270 void MessageHandler_free(struct LDKMessageHandler this_obj);
22271
22272 /**
22273  * A message handler which handles messages specific to channels. Usually this is just a
22274  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
22275  *
22276  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
22277  */
22278 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
22279
22280 /**
22281  * A message handler which handles messages specific to channels. Usually this is just a
22282  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
22283  *
22284  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
22285  */
22286 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
22287
22288 /**
22289  * A message handler which handles messages updating our knowledge of the network channel
22290  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
22291  * [`IgnoringMessageHandler`].
22292  *
22293  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
22294  */
22295 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
22296
22297 /**
22298  * A message handler which handles messages updating our knowledge of the network channel
22299  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
22300  * [`IgnoringMessageHandler`].
22301  *
22302  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
22303  */
22304 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
22305
22306 /**
22307  * Constructs a new MessageHandler given each field
22308  */
22309 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
22310
22311 /**
22312  * Creates a copy of a SocketDescriptor
22313  */
22314 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
22315
22316 /**
22317  * Calls the free function if one is set
22318  */
22319 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
22320
22321 /**
22322  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
22323  */
22324 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
22325
22326 /**
22327  * Used to indicate that we probably can't make any future connections to this peer, implying
22328  * we should go ahead and force-close any channels we have with it.
22329  */
22330 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
22331
22332 /**
22333  * Used to indicate that we probably can't make any future connections to this peer, implying
22334  * we should go ahead and force-close any channels we have with it.
22335  */
22336 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
22337
22338 /**
22339  * Constructs a new PeerHandleError given each field
22340  */
22341 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
22342
22343 /**
22344  * Creates a copy of the PeerHandleError
22345  */
22346 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
22347
22348 /**
22349  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
22350  */
22351 void PeerManager_free(struct LDKPeerManager this_obj);
22352
22353 /**
22354  * Constructs a new PeerManager with the given message handlers and node_id secret key
22355  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
22356  * cryptographically secure random bytes.
22357  */
22358 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);
22359
22360 /**
22361  * Get the list of node ids for peers which have completed the initial handshake.
22362  *
22363  * For outbound connections, this will be the same as the their_node_id parameter passed in to
22364  * new_outbound_connection, however entries will only appear once the initial handshake has
22365  * completed and we are sure the remote peer has the private key for the given node_id.
22366  */
22367 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
22368
22369 /**
22370  * Indicates a new outbound connection has been established to a node with the given node_id.
22371  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
22372  * descriptor but must disconnect the connection immediately.
22373  *
22374  * Returns a small number of bytes to send to the remote node (currently always 50).
22375  *
22376  * Panics if descriptor is duplicative with some other descriptor which has not yet been
22377  * [`socket_disconnected()`].
22378  *
22379  * [`socket_disconnected()`]: PeerManager::socket_disconnected
22380  */
22381 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);
22382
22383 /**
22384  * Indicates a new inbound connection has been established.
22385  *
22386  * May refuse the connection by returning an Err, but will never write bytes to the remote end
22387  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
22388  * call socket_disconnected for the new descriptor but must disconnect the connection
22389  * immediately.
22390  *
22391  * Panics if descriptor is duplicative with some other descriptor which has not yet been
22392  * [`socket_disconnected()`].
22393  *
22394  * [`socket_disconnected()`]: PeerManager::socket_disconnected
22395  */
22396 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor);
22397
22398 /**
22399  * Indicates that there is room to write data to the given socket descriptor.
22400  *
22401  * May return an Err to indicate that the connection should be closed.
22402  *
22403  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
22404  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
22405  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
22406  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
22407  * sufficient!
22408  *
22409  * [`send_data`]: SocketDescriptor::send_data
22410  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
22411  */
22412 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
22413
22414 /**
22415  * Indicates that data was read from the given socket descriptor.
22416  *
22417  * May return an Err to indicate that the connection should be closed.
22418  *
22419  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
22420  * Thus, however, you should call [`process_events`] after any `read_event` to generate
22421  * [`send_data`] calls to handle responses.
22422  *
22423  * If `Ok(true)` is returned, further read_events should not be triggered until a
22424  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
22425  * send buffer).
22426  *
22427  * [`send_data`]: SocketDescriptor::send_data
22428  * [`process_events`]: PeerManager::process_events
22429  */
22430 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);
22431
22432 /**
22433  * Checks for any events generated by our handlers and processes them. Includes sending most
22434  * response messages as well as messages generated by calls to handler functions directly (eg
22435  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
22436  *
22437  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
22438  * issues!
22439  *
22440  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
22441  * or one of the other clients provided in our language bindings.
22442  *
22443  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
22444  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
22445  * [`send_data`]: SocketDescriptor::send_data
22446  */
22447 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
22448
22449 /**
22450  * Indicates that the given socket descriptor's connection is now closed.
22451  */
22452 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
22453
22454 /**
22455  * Disconnect a peer given its node id.
22456  *
22457  * Set `no_connection_possible` to true to prevent any further connection with this peer,
22458  * force-closing any channels we have with it.
22459  *
22460  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
22461  * peer. Thus, be very careful about reentrancy issues.
22462  *
22463  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
22464  */
22465 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
22466
22467 /**
22468  * Disconnects all currently-connected peers. This is useful on platforms where there may be
22469  * an indication that TCP sockets have stalled even if we weren't around to time them out
22470  * using regular ping/pongs.
22471  */
22472 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
22473
22474 /**
22475  * Send pings to each peer and disconnect those which did not respond to the last round of
22476  * pings.
22477  *
22478  * This may be called on any timescale you want, however, roughly once every five to ten
22479  * seconds is preferred. The call rate determines both how often we send a ping to our peers
22480  * and how much time they have to respond before we disconnect them.
22481  *
22482  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
22483  * issues!
22484  *
22485  * [`send_data`]: SocketDescriptor::send_data
22486  */
22487 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
22488
22489 /**
22490  * Gets the weight for an HTLC-Success transaction.
22491  */
22492 uint64_t htlc_success_tx_weight(bool opt_anchors);
22493
22494 /**
22495  * Gets the weight for an HTLC-Timeout transaction.
22496  */
22497 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
22498
22499 /**
22500  * Build the commitment secret from the seed and the commitment number
22501  */
22502 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
22503
22504 /**
22505  * Build a closing transaction
22506  */
22507 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);
22508
22509 /**
22510  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
22511  */
22512 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
22513
22514 /**
22515  * Creates a copy of the CounterpartyCommitmentSecrets
22516  */
22517 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
22518
22519 /**
22520  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
22521  */
22522 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
22523
22524 /**
22525  * Returns the minimum index of all stored secrets. Note that indexes start
22526  * at 1 << 48 and get decremented by one for each new secret.
22527  */
22528 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
22529
22530 /**
22531  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
22532  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
22533  */
22534 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
22535
22536 /**
22537  * Returns the secret at `idx`.
22538  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
22539  *
22540  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22541  */
22542 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
22543
22544 /**
22545  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
22546  */
22547 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
22548
22549 /**
22550  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
22551  */
22552 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
22553
22554 /**
22555  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
22556  * from the base secret and the per_commitment_point.
22557  *
22558  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22559  * generated (ie our own).
22560  */
22561 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
22562
22563 /**
22564  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
22565  * from the base point and the per_commitment_key. This is the public equivalent of
22566  * derive_private_key - using only public keys to derive a public key instead of private keys.
22567  *
22568  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22569  * generated (ie our own).
22570  */
22571 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
22572
22573 /**
22574  * Derives a per-commitment-transaction revocation key from its constituent parts.
22575  *
22576  * Only the cheating participant owns a valid witness to propagate a revoked
22577  * commitment transaction, thus per_commitment_secret always come from cheater
22578  * and revocation_base_secret always come from punisher, which is the broadcaster
22579  * of the transaction spending with this key knowledge.
22580  *
22581  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22582  * generated (ie our own).
22583  */
22584 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
22585
22586 /**
22587  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
22588  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
22589  * public key instead of private keys.
22590  *
22591  * Only the cheating participant owns a valid witness to propagate a revoked
22592  * commitment transaction, thus per_commitment_point always come from cheater
22593  * and revocation_base_point always come from punisher, which is the broadcaster
22594  * of the transaction spending with this key knowledge.
22595  *
22596  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
22597  * generated (ie our own).
22598  */
22599 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
22600
22601 /**
22602  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
22603  */
22604 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
22605
22606 /**
22607  * The broadcaster's per-commitment public key which was used to derive the other keys.
22608  */
22609 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22610
22611 /**
22612  * The broadcaster's per-commitment public key which was used to derive the other keys.
22613  */
22614 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22615
22616 /**
22617  * The revocation key which is used to allow the broadcaster of the commitment
22618  * transaction to provide their counterparty the ability to punish them if they broadcast
22619  * an old state.
22620  */
22621 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22622
22623 /**
22624  * The revocation key which is used to allow the broadcaster of the commitment
22625  * transaction to provide their counterparty the ability to punish them if they broadcast
22626  * an old state.
22627  */
22628 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22629
22630 /**
22631  * Broadcaster's HTLC Key
22632  */
22633 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22634
22635 /**
22636  * Broadcaster's HTLC Key
22637  */
22638 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22639
22640 /**
22641  * Countersignatory's HTLC Key
22642  */
22643 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22644
22645 /**
22646  * Countersignatory's HTLC Key
22647  */
22648 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22649
22650 /**
22651  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
22652  */
22653 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
22654
22655 /**
22656  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
22657  */
22658 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22659
22660 /**
22661  * Constructs a new TxCreationKeys given each field
22662  */
22663 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);
22664
22665 /**
22666  * Creates a copy of the TxCreationKeys
22667  */
22668 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
22669
22670 /**
22671  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
22672  */
22673 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
22674
22675 /**
22676  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
22677  */
22678 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
22679
22680 /**
22681  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
22682  */
22683 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
22684
22685 /**
22686  * The public key which is used to sign all commitment transactions, as it appears in the
22687  * on-chain channel lock-in 2-of-2 multisig output.
22688  */
22689 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
22690
22691 /**
22692  * The public key which is used to sign all commitment transactions, as it appears in the
22693  * on-chain channel lock-in 2-of-2 multisig output.
22694  */
22695 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22696
22697 /**
22698  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
22699  * revocation keys. This is combined with the per-commitment-secret generated by the
22700  * counterparty to create a secret which the counterparty can reveal to revoke previous
22701  * states.
22702  */
22703 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
22704
22705 /**
22706  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
22707  * revocation keys. This is combined with the per-commitment-secret generated by the
22708  * counterparty to create a secret which the counterparty can reveal to revoke previous
22709  * states.
22710  */
22711 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22712
22713 /**
22714  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
22715  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
22716  * static across every commitment transaction.
22717  */
22718 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
22719
22720 /**
22721  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
22722  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
22723  * static across every commitment transaction.
22724  */
22725 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22726
22727 /**
22728  * The base point which is used (with derive_public_key) to derive a per-commitment payment
22729  * public key which receives non-HTLC-encumbered funds which are only available for spending
22730  * after some delay (or can be claimed via the revocation path).
22731  */
22732 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
22733
22734 /**
22735  * The base point which is used (with derive_public_key) to derive a per-commitment payment
22736  * public key which receives non-HTLC-encumbered funds which are only available for spending
22737  * after some delay (or can be claimed via the revocation path).
22738  */
22739 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22740
22741 /**
22742  * The base point which is used (with derive_public_key) to derive a per-commitment public key
22743  * which is used to encumber HTLC-in-flight outputs.
22744  */
22745 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
22746
22747 /**
22748  * The base point which is used (with derive_public_key) to derive a per-commitment public key
22749  * which is used to encumber HTLC-in-flight outputs.
22750  */
22751 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22752
22753 /**
22754  * Constructs a new ChannelPublicKeys given each field
22755  */
22756 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);
22757
22758 /**
22759  * Creates a copy of the ChannelPublicKeys
22760  */
22761 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
22762
22763 /**
22764  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
22765  */
22766 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
22767
22768 /**
22769  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
22770  */
22771 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
22772
22773 /**
22774  * Create per-state keys from channel base points and the per-commitment point.
22775  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
22776  */
22777 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);
22778
22779 /**
22780  * Generate per-state keys from channel static keys.
22781  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
22782  */
22783 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);
22784
22785 /**
22786  * A script either spendable by the revocation
22787  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
22788  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
22789  */
22790 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
22791
22792 /**
22793  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
22794  */
22795 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
22796
22797 /**
22798  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
22799  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
22800  * need to compare this value to whether the commitment transaction in question is that of
22801  * the counterparty or our own.
22802  */
22803 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
22804
22805 /**
22806  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
22807  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
22808  * need to compare this value to whether the commitment transaction in question is that of
22809  * the counterparty or our own.
22810  */
22811 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
22812
22813 /**
22814  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
22815  * this divided by 1000.
22816  */
22817 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
22818
22819 /**
22820  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
22821  * this divided by 1000.
22822  */
22823 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
22824
22825 /**
22826  * The CLTV lock-time at which this HTLC expires.
22827  */
22828 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
22829
22830 /**
22831  * The CLTV lock-time at which this HTLC expires.
22832  */
22833 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
22834
22835 /**
22836  * The hash of the preimage which unlocks this HTLC.
22837  */
22838 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
22839
22840 /**
22841  * The hash of the preimage which unlocks this HTLC.
22842  */
22843 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22844
22845 /**
22846  * The position within the commitment transactions' outputs. This may be None if the value is
22847  * below the dust limit (in which case no output appears in the commitment transaction and the
22848  * value is spent to additional transaction fees).
22849  */
22850 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
22851
22852 /**
22853  * The position within the commitment transactions' outputs. This may be None if the value is
22854  * below the dust limit (in which case no output appears in the commitment transaction and the
22855  * value is spent to additional transaction fees).
22856  */
22857 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
22858
22859 /**
22860  * Constructs a new HTLCOutputInCommitment given each field
22861  */
22862 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);
22863
22864 /**
22865  * Creates a copy of the HTLCOutputInCommitment
22866  */
22867 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
22868
22869 /**
22870  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
22871  */
22872 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
22873
22874 /**
22875  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
22876  */
22877 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
22878
22879 /**
22880  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
22881  * does not need to have its previous_output_index filled.
22882  */
22883 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
22884
22885 /**
22886  * Gets the redeemscript for a funding output from the two funding public keys.
22887  * Note that the order of funding public keys does not matter.
22888  */
22889 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
22890
22891 /**
22892  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
22893  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
22894  * transaction which needs signing, and can be used to construct an HTLC transaction which is
22895  * broadcastable given a counterparty HTLC signature.
22896  *
22897  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
22898  * commitment transaction).
22899  */
22900 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);
22901
22902 /**
22903  * Gets the witnessScript for an anchor output from the funding public key.
22904  * The witness in the spending input must be:
22905  * <BIP 143 funding_signature>
22906  * After 16 blocks of confirmation, an alternative satisfying witness could be:
22907  * <>
22908  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
22909  */
22910 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
22911
22912 /**
22913  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
22914  */
22915 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
22916
22917 /**
22918  * Holder public keys
22919  */
22920 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
22921
22922 /**
22923  * Holder public keys
22924  */
22925 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
22926
22927 /**
22928  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
22929  */
22930 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
22931
22932 /**
22933  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
22934  */
22935 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
22936
22937 /**
22938  * Whether the holder is the initiator of this channel.
22939  * This is an input to the commitment number obscure factor computation.
22940  */
22941 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
22942
22943 /**
22944  * Whether the holder is the initiator of this channel.
22945  * This is an input to the commitment number obscure factor computation.
22946  */
22947 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
22948
22949 /**
22950  * The late-bound counterparty channel transaction parameters.
22951  * These parameters are populated at the point in the protocol where the counterparty provides them.
22952  *
22953  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22954  */
22955 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
22956
22957 /**
22958  * The late-bound counterparty channel transaction parameters.
22959  * These parameters are populated at the point in the protocol where the counterparty provides them.
22960  *
22961  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22962  */
22963 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
22964
22965 /**
22966  * The late-bound funding outpoint
22967  *
22968  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22969  */
22970 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
22971
22972 /**
22973  * The late-bound funding outpoint
22974  *
22975  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22976  */
22977 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
22978
22979 /**
22980  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
22981  */
22982 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
22983
22984 /**
22985  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
22986  */
22987 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
22988
22989 /**
22990  * Constructs a new ChannelTransactionParameters given each field
22991  */
22992 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);
22993
22994 /**
22995  * Creates a copy of the ChannelTransactionParameters
22996  */
22997 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
22998
22999 /**
23000  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23001  */
23002 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
23003
23004 /**
23005  * Counter-party public keys
23006  */
23007 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
23008
23009 /**
23010  * Counter-party public keys
23011  */
23012 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
23013
23014 /**
23015  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
23016  */
23017 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
23018
23019 /**
23020  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
23021  */
23022 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
23023
23024 /**
23025  * Constructs a new CounterpartyChannelTransactionParameters given each field
23026  */
23027 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
23028
23029 /**
23030  * Creates a copy of the CounterpartyChannelTransactionParameters
23031  */
23032 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
23033
23034 /**
23035  * Whether the late bound parameters are populated.
23036  */
23037 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23038
23039 /**
23040  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
23041  * given that the holder is the broadcaster.
23042  *
23043  * self.is_populated() must be true before calling this function.
23044  */
23045 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23046
23047 /**
23048  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
23049  * given that the counterparty is the broadcaster.
23050  *
23051  * self.is_populated() must be true before calling this function.
23052  */
23053 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23054
23055 /**
23056  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
23057  */
23058 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
23059
23060 /**
23061  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
23062  */
23063 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
23064
23065 /**
23066  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
23067  */
23068 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
23069
23070 /**
23071  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
23072  */
23073 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
23074
23075 /**
23076  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23077  */
23078 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
23079
23080 /**
23081  * Get the channel pubkeys for the broadcaster
23082  */
23083 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23084
23085 /**
23086  * Get the channel pubkeys for the countersignatory
23087  */
23088 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23089
23090 /**
23091  * Get the contest delay applicable to the transactions.
23092  * Note that the contest delay was selected by the countersignatory.
23093  */
23094 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23095
23096 /**
23097  * Whether the channel is outbound from the broadcaster.
23098  *
23099  * The boolean representing the side that initiated the channel is
23100  * an input to the commitment number obscure factor computation.
23101  */
23102 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23103
23104 /**
23105  * The funding outpoint
23106  */
23107 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23108
23109 /**
23110  * Whether to use anchors for this channel
23111  */
23112 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23113
23114 /**
23115  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
23116  */
23117 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
23118
23119 /**
23120  * Our counterparty's signature for the transaction
23121  */
23122 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
23123
23124 /**
23125  * Our counterparty's signature for the transaction
23126  */
23127 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
23128
23129 /**
23130  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
23131  */
23132 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
23133
23134 /**
23135  * Creates a copy of the HolderCommitmentTransaction
23136  */
23137 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
23138
23139 /**
23140  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
23141  */
23142 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
23143
23144 /**
23145  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
23146  */
23147 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
23148
23149 /**
23150  * Create a new holder transaction with the given counterparty signatures.
23151  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
23152  */
23153 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);
23154
23155 /**
23156  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
23157  */
23158 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
23159
23160 /**
23161  * The commitment transaction
23162  */
23163 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
23164
23165 /**
23166  * The commitment transaction
23167  */
23168 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
23169
23170 /**
23171  * The txid for the commitment transaction.
23172  *
23173  * This is provided as a performance optimization, instead of calling transaction.txid()
23174  * multiple times.
23175  */
23176 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
23177
23178 /**
23179  * The txid for the commitment transaction.
23180  *
23181  * This is provided as a performance optimization, instead of calling transaction.txid()
23182  * multiple times.
23183  */
23184 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23185
23186 /**
23187  * Constructs a new BuiltCommitmentTransaction given each field
23188  */
23189 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
23190
23191 /**
23192  * Creates a copy of the BuiltCommitmentTransaction
23193  */
23194 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
23195
23196 /**
23197  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
23198  */
23199 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
23200
23201 /**
23202  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
23203  */
23204 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
23205
23206 /**
23207  * Get the SIGHASH_ALL sighash value of the transaction.
23208  *
23209  * This can be used to verify a signature.
23210  */
23211 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);
23212
23213 /**
23214  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
23215  * because we are about to broadcast a holder transaction.
23216  */
23217 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);
23218
23219 /**
23220  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
23221  */
23222 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
23223
23224 /**
23225  * Creates a copy of the ClosingTransaction
23226  */
23227 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
23228
23229 /**
23230  * Checks if two ClosingTransactions contain equal inner contents.
23231  */
23232 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
23233
23234 /**
23235  * Construct an object of the class
23236  */
23237 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);
23238
23239 /**
23240  * Trust our pre-built transaction.
23241  *
23242  * Applies a wrapper which allows access to the transaction.
23243  *
23244  * This should only be used if you fully trust the builder of this object. It should not
23245  * be used by an external signer - instead use the verify function.
23246  */
23247 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23248
23249 /**
23250  * Verify our pre-built transaction.
23251  *
23252  * Applies a wrapper which allows access to the transaction.
23253  *
23254  * An external validating signer must call this method before signing
23255  * or using the built transaction.
23256  */
23257 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
23258
23259 /**
23260  * The value to be sent to the holder, or zero if the output will be omitted
23261  */
23262 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23263
23264 /**
23265  * The value to be sent to the counterparty, or zero if the output will be omitted
23266  */
23267 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23268
23269 /**
23270  * The destination of the holder's output
23271  */
23272 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23273
23274 /**
23275  * The destination of the counterparty's output
23276  */
23277 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23278
23279 /**
23280  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
23281  */
23282 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
23283
23284 /**
23285  * The pre-built Bitcoin commitment transaction
23286  */
23287 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
23288
23289 /**
23290  * Get the SIGHASH_ALL sighash value of the transaction.
23291  *
23292  * This can be used to verify a signature.
23293  */
23294 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);
23295
23296 /**
23297  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
23298  * because we are about to broadcast a holder transaction.
23299  */
23300 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);
23301
23302 /**
23303  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
23304  */
23305 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
23306
23307 /**
23308  * Creates a copy of the CommitmentTransaction
23309  */
23310 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
23311
23312 /**
23313  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
23314  */
23315 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
23316
23317 /**
23318  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
23319  */
23320 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
23321
23322 /**
23323  * The backwards-counting commitment number
23324  */
23325 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23326
23327 /**
23328  * The value to be sent to the broadcaster
23329  */
23330 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23331
23332 /**
23333  * The value to be sent to the counterparty
23334  */
23335 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23336
23337 /**
23338  * The feerate paid per 1000-weight-unit in this commitment transaction.
23339  */
23340 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23341
23342 /**
23343  * Trust our pre-built transaction and derived transaction creation public keys.
23344  *
23345  * Applies a wrapper which allows access to these fields.
23346  *
23347  * This should only be used if you fully trust the builder of this object.  It should not
23348  * be used by an external signer - instead use the verify function.
23349  */
23350 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23351
23352 /**
23353  * Verify our pre-built transaction and derived transaction creation public keys.
23354  *
23355  * Applies a wrapper which allows access to these fields.
23356  *
23357  * An external validating signer must call this method before signing
23358  * or using the built transaction.
23359  */
23360 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);
23361
23362 /**
23363  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
23364  */
23365 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
23366
23367 /**
23368  * The transaction ID of the built Bitcoin transaction
23369  */
23370 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23371
23372 /**
23373  * The pre-built Bitcoin commitment transaction
23374  */
23375 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23376
23377 /**
23378  * The pre-calculated transaction creation public keys.
23379  */
23380 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23381
23382 /**
23383  * Should anchors be used.
23384  */
23385 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23386
23387 /**
23388  * Get a signature for each HTLC which was included in the commitment transaction (ie for
23389  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
23390  *
23391  * The returned Vec has one entry for each HTLC, and in the same order.
23392  *
23393  * This function is only valid in the holder commitment context, it always uses SigHashType::All.
23394  */
23395 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);
23396
23397 /**
23398  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
23399  * shared secret first. This prevents on-chain observers from discovering how many commitment
23400  * transactions occurred in a channel before it was closed.
23401  *
23402  * This function gets the shared secret from relevant channel public keys and can be used to
23403  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
23404  */
23405 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
23406
23407 /**
23408  * Checks if two InitFeaturess contain equal inner contents.
23409  * This ignores pointers and is_owned flags and looks at the values in fields.
23410  * Two objects with NULL inner values will be considered "equal" here.
23411  */
23412 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
23413
23414 /**
23415  * Checks if two NodeFeaturess contain equal inner contents.
23416  * This ignores pointers and is_owned flags and looks at the values in fields.
23417  * Two objects with NULL inner values will be considered "equal" here.
23418  */
23419 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
23420
23421 /**
23422  * Checks if two ChannelFeaturess contain equal inner contents.
23423  * This ignores pointers and is_owned flags and looks at the values in fields.
23424  * Two objects with NULL inner values will be considered "equal" here.
23425  */
23426 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
23427
23428 /**
23429  * Checks if two InvoiceFeaturess contain equal inner contents.
23430  * This ignores pointers and is_owned flags and looks at the values in fields.
23431  * Two objects with NULL inner values will be considered "equal" here.
23432  */
23433 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
23434
23435 /**
23436  * Checks if two ChannelTypeFeaturess contain equal inner contents.
23437  * This ignores pointers and is_owned flags and looks at the values in fields.
23438  * Two objects with NULL inner values will be considered "equal" here.
23439  */
23440 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
23441
23442 /**
23443  * Creates a copy of the InitFeatures
23444  */
23445 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
23446
23447 /**
23448  * Creates a copy of the NodeFeatures
23449  */
23450 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
23451
23452 /**
23453  * Creates a copy of the ChannelFeatures
23454  */
23455 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
23456
23457 /**
23458  * Creates a copy of the InvoiceFeatures
23459  */
23460 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
23461
23462 /**
23463  * Creates a copy of the ChannelTypeFeatures
23464  */
23465 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
23466
23467 /**
23468  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
23469  */
23470 void InitFeatures_free(struct LDKInitFeatures this_obj);
23471
23472 /**
23473  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
23474  */
23475 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
23476
23477 /**
23478  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
23479  */
23480 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
23481
23482 /**
23483  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
23484  */
23485 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
23486
23487 /**
23488  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
23489  */
23490 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
23491
23492 /**
23493  * Create a blank Features with no features set
23494  */
23495 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
23496
23497 /**
23498  * Creates a Features with the bits set which are known by the implementation
23499  */
23500 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
23501
23502 /**
23503  * Returns true if this `Features` object contains unknown feature flags which are set as
23504  * \"required\".
23505  */
23506 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
23507
23508 /**
23509  * Create a blank Features with no features set
23510  */
23511 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
23512
23513 /**
23514  * Creates a Features with the bits set which are known by the implementation
23515  */
23516 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
23517
23518 /**
23519  * Returns true if this `Features` object contains unknown feature flags which are set as
23520  * \"required\".
23521  */
23522 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
23523
23524 /**
23525  * Create a blank Features with no features set
23526  */
23527 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
23528
23529 /**
23530  * Creates a Features with the bits set which are known by the implementation
23531  */
23532 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
23533
23534 /**
23535  * Returns true if this `Features` object contains unknown feature flags which are set as
23536  * \"required\".
23537  */
23538 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
23539
23540 /**
23541  * Create a blank Features with no features set
23542  */
23543 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
23544
23545 /**
23546  * Creates a Features with the bits set which are known by the implementation
23547  */
23548 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
23549
23550 /**
23551  * Returns true if this `Features` object contains unknown feature flags which are set as
23552  * \"required\".
23553  */
23554 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
23555
23556 /**
23557  * Create a blank Features with no features set
23558  */
23559 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
23560
23561 /**
23562  * Creates a Features with the bits set which are known by the implementation
23563  */
23564 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
23565
23566 /**
23567  * Returns true if this `Features` object contains unknown feature flags which are set as
23568  * \"required\".
23569  */
23570 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
23571
23572 /**
23573  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
23574  */
23575 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
23576
23577 /**
23578  * Read a InitFeatures from a byte array, created by InitFeatures_write
23579  */
23580 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
23581
23582 /**
23583  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
23584  */
23585 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
23586
23587 /**
23588  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
23589  */
23590 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
23591
23592 /**
23593  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
23594  */
23595 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
23596
23597 /**
23598  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
23599  */
23600 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
23601
23602 /**
23603  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
23604  */
23605 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
23606
23607 /**
23608  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
23609  */
23610 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
23611
23612 /**
23613  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
23614  */
23615 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
23616
23617 /**
23618  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
23619  */
23620 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
23621
23622 /**
23623  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
23624  */
23625 void ShutdownScript_free(struct LDKShutdownScript this_obj);
23626
23627 /**
23628  * Creates a copy of the ShutdownScript
23629  */
23630 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
23631
23632 /**
23633  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
23634  */
23635 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
23636
23637 /**
23638  * The script that did not meet the requirements from [BOLT #2].
23639  *
23640  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
23641  */
23642 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
23643
23644 /**
23645  * The script that did not meet the requirements from [BOLT #2].
23646  *
23647  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
23648  */
23649 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
23650
23651 /**
23652  * Constructs a new InvalidShutdownScript given each field
23653  */
23654 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
23655
23656 /**
23657  * Creates a copy of the InvalidShutdownScript
23658  */
23659 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
23660
23661 /**
23662  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
23663  */
23664 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
23665
23666 /**
23667  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
23668  */
23669 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
23670
23671 /**
23672  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
23673  */
23674 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
23675
23676 /**
23677  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
23678  */
23679 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
23680
23681 /**
23682  * Generates a witness script pubkey from the given segwit version and program.
23683  *
23684  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
23685  * [`ShutdownScript::new_p2wsh`] instead.
23686  *
23687  * # Errors
23688  *
23689  * This function may return an error if `program` is invalid for the segwit `version`.
23690  */
23691 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
23692
23693 /**
23694  * Converts the shutdown script into the underlying [`Script`].
23695  */
23696 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
23697
23698 /**
23699  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
23700  *
23701  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23702  */
23703 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
23704
23705 /**
23706  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
23707  *
23708  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
23709  */
23710 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
23711
23712 /**
23713  * Calls the free function if one is set
23714  */
23715 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
23716
23717 /**
23718  * Calls the free function if one is set
23719  */
23720 void Type_free(struct LDKType this_ptr);
23721
23722 /**
23723  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
23724  */
23725 void NodeId_free(struct LDKNodeId this_obj);
23726
23727 /**
23728  * Creates a copy of the NodeId
23729  */
23730 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
23731
23732 /**
23733  * Create a new NodeId from a public key
23734  */
23735 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
23736
23737 /**
23738  * Get the public key slice from this NodeId
23739  */
23740 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
23741
23742 /**
23743  * Checks if two NodeIds contain equal inner contents.
23744  */
23745 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
23746
23747 /**
23748  * Serialize the NodeId object into a byte array which can be read by NodeId_read
23749  */
23750 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
23751
23752 /**
23753  * Read a NodeId from a byte array, created by NodeId_write
23754  */
23755 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
23756
23757 /**
23758  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
23759  */
23760 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
23761
23762 /**
23763  * Creates a copy of the NetworkGraph
23764  */
23765 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
23766
23767 /**
23768  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
23769  */
23770 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
23771
23772 /**
23773  * Frees any resources used by the NetworkUpdate
23774  */
23775 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
23776
23777 /**
23778  * Creates a copy of the NetworkUpdate
23779  */
23780 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
23781
23782 /**
23783  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
23784  */
23785 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
23786
23787 /**
23788  * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
23789  */
23790 struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
23791
23792 /**
23793  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
23794  */
23795 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
23796
23797 /**
23798  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
23799  */
23800 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
23801
23802 /**
23803  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
23804  */
23805 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
23806
23807 /**
23808  * Constructs a new EventHandler which calls the relevant methods on this_arg.
23809  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
23810  */
23811 struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
23812
23813 /**
23814  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
23815  */
23816 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
23817
23818 /**
23819  * Creates a new tracker of the actual state of the network of channels and nodes,
23820  * assuming an existing Network Graph.
23821  * Chain monitor is used to make sure announced channels exist on-chain,
23822  * channel data is correct, and that the announcement is signed with
23823  * channel owners' keys.
23824  */
23825 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
23826
23827 /**
23828  * Adds a provider used to check new announcements. Does not affect
23829  * existing announcements unless they are updated.
23830  * Add, update or remove the provider would replace the current one.
23831  */
23832 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
23833
23834 /**
23835  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
23836  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
23837  */
23838 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
23839
23840 /**
23841  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
23842  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
23843  */
23844 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
23845
23846 /**
23847  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
23848  */
23849 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
23850
23851 /**
23852  * When the last update to the channel direction was issued.
23853  * Value is opaque, as set in the announcement.
23854  */
23855 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23856
23857 /**
23858  * When the last update to the channel direction was issued.
23859  * Value is opaque, as set in the announcement.
23860  */
23861 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
23862
23863 /**
23864  * Whether the channel can be currently used for payments (in this one direction).
23865  */
23866 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23867
23868 /**
23869  * Whether the channel can be currently used for payments (in this one direction).
23870  */
23871 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
23872
23873 /**
23874  * The difference in CLTV values that you must have when routing through this channel.
23875  */
23876 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23877
23878 /**
23879  * The difference in CLTV values that you must have when routing through this channel.
23880  */
23881 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
23882
23883 /**
23884  * The minimum value, which must be relayed to the next hop via the channel
23885  */
23886 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23887
23888 /**
23889  * The minimum value, which must be relayed to the next hop via the channel
23890  */
23891 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
23892
23893 /**
23894  * The maximum value which may be relayed to the next hop via the channel.
23895  */
23896 struct LDKCOption_u64Z ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23897
23898 /**
23899  * The maximum value which may be relayed to the next hop via the channel.
23900  */
23901 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
23902
23903 /**
23904  * Fees charged when the channel is used for routing
23905  */
23906 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23907
23908 /**
23909  * Fees charged when the channel is used for routing
23910  */
23911 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
23912
23913 /**
23914  * Most recent update for the channel received from the network
23915  * Mostly redundant with the data we store in fields explicitly.
23916  * Everything else is useful only for sending out for initial routing sync.
23917  * Not stored if contains excess data to prevent DoS.
23918  *
23919  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23920  */
23921 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
23922
23923 /**
23924  * Most recent update for the channel received from the network
23925  * Mostly redundant with the data we store in fields explicitly.
23926  * Everything else is useful only for sending out for initial routing sync.
23927  * Not stored if contains excess data to prevent DoS.
23928  *
23929  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23930  */
23931 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
23932
23933 /**
23934  * Constructs a new ChannelUpdateInfo given each field
23935  */
23936 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);
23937
23938 /**
23939  * Creates a copy of the ChannelUpdateInfo
23940  */
23941 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
23942
23943 /**
23944  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
23945  */
23946 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
23947
23948 /**
23949  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
23950  */
23951 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
23952
23953 /**
23954  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
23955  */
23956 void ChannelInfo_free(struct LDKChannelInfo this_obj);
23957
23958 /**
23959  * Protocol features of a channel communicated during its announcement
23960  */
23961 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
23962
23963 /**
23964  * Protocol features of a channel communicated during its announcement
23965  */
23966 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
23967
23968 /**
23969  * Source node of the first direction of a channel
23970  */
23971 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
23972
23973 /**
23974  * Source node of the first direction of a channel
23975  */
23976 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
23977
23978 /**
23979  * Details about the first direction of a channel
23980  *
23981  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23982  */
23983 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
23984
23985 /**
23986  * Details about the first direction of a channel
23987  *
23988  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23989  */
23990 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
23991
23992 /**
23993  * Source node of the second direction of a channel
23994  */
23995 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
23996
23997 /**
23998  * Source node of the second direction of a channel
23999  */
24000 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
24001
24002 /**
24003  * Details about the second direction of a channel
24004  *
24005  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24006  */
24007 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24008
24009 /**
24010  * Details about the second direction of a channel
24011  *
24012  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24013  */
24014 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
24015
24016 /**
24017  * The channel capacity as seen on-chain, if chain lookup is available.
24018  */
24019 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24020
24021 /**
24022  * The channel capacity as seen on-chain, if chain lookup is available.
24023  */
24024 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24025
24026 /**
24027  * An initial announcement of the channel
24028  * Mostly redundant with the data we store in fields explicitly.
24029  * Everything else is useful only for sending out for initial routing sync.
24030  * Not stored if contains excess data to prevent DoS.
24031  *
24032  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24033  */
24034 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24035
24036 /**
24037  * An initial announcement of the channel
24038  * Mostly redundant with the data we store in fields explicitly.
24039  * Everything else is useful only for sending out for initial routing sync.
24040  * Not stored if contains excess data to prevent DoS.
24041  *
24042  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24043  */
24044 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
24045
24046 /**
24047  * Creates a copy of the ChannelInfo
24048  */
24049 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
24050
24051 /**
24052  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
24053  */
24054 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
24055
24056 /**
24057  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
24058  */
24059 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
24060
24061 /**
24062  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
24063  */
24064 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
24065
24066 /**
24067  * Creates a copy of the DirectedChannelInfo
24068  */
24069 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
24070
24071 /**
24072  * Returns information for the channel.
24073  */
24074 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
24075
24076 /**
24077  * Returns information for the direction.
24078  *
24079  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24080  */
24081 MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
24082
24083 /**
24084  * Returns the [`EffectiveCapacity`] of the channel in the direction.
24085  *
24086  * This is either the total capacity from the funding transaction, if known, or the
24087  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
24088  * whichever is smaller.
24089  */
24090 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
24091
24092 /**
24093  * Frees any resources used by the EffectiveCapacity
24094  */
24095 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
24096
24097 /**
24098  * Creates a copy of the EffectiveCapacity
24099  */
24100 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
24101
24102 /**
24103  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
24104  */
24105 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
24106
24107 /**
24108  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
24109  */
24110 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
24111
24112 /**
24113  * Utility method to constructs a new Total-variant EffectiveCapacity
24114  */
24115 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat);
24116
24117 /**
24118  * Utility method to constructs a new Infinite-variant EffectiveCapacity
24119  */
24120 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
24121
24122 /**
24123  * Utility method to constructs a new Unknown-variant EffectiveCapacity
24124  */
24125 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
24126
24127 /**
24128  * Returns the effective capacity denominated in millisatoshi.
24129  */
24130 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
24131
24132 /**
24133  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
24134  */
24135 void RoutingFees_free(struct LDKRoutingFees this_obj);
24136
24137 /**
24138  * Flat routing fee in satoshis
24139  */
24140 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
24141
24142 /**
24143  * Flat routing fee in satoshis
24144  */
24145 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
24146
24147 /**
24148  * Liquidity-based routing fee in millionths of a routed amount.
24149  * In other words, 10000 is 1%.
24150  */
24151 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
24152
24153 /**
24154  * Liquidity-based routing fee in millionths of a routed amount.
24155  * In other words, 10000 is 1%.
24156  */
24157 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
24158
24159 /**
24160  * Constructs a new RoutingFees given each field
24161  */
24162 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
24163
24164 /**
24165  * Checks if two RoutingFeess contain equal inner contents.
24166  * This ignores pointers and is_owned flags and looks at the values in fields.
24167  * Two objects with NULL inner values will be considered "equal" here.
24168  */
24169 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
24170
24171 /**
24172  * Creates a copy of the RoutingFees
24173  */
24174 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
24175
24176 /**
24177  * Checks if two RoutingFeess contain equal inner contents.
24178  */
24179 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
24180
24181 /**
24182  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
24183  */
24184 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
24185
24186 /**
24187  * Read a RoutingFees from a byte array, created by RoutingFees_write
24188  */
24189 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
24190
24191 /**
24192  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
24193  */
24194 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
24195
24196 /**
24197  * Protocol features the node announced support for
24198  */
24199 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
24200
24201 /**
24202  * Protocol features the node announced support for
24203  */
24204 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
24205
24206 /**
24207  * When the last known update to the node state was issued.
24208  * Value is opaque, as set in the announcement.
24209  */
24210 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
24211
24212 /**
24213  * When the last known update to the node state was issued.
24214  * Value is opaque, as set in the announcement.
24215  */
24216 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
24217
24218 /**
24219  * Color assigned to the node
24220  */
24221 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
24222
24223 /**
24224  * Color assigned to the node
24225  */
24226 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
24227
24228 /**
24229  * Moniker assigned to the node.
24230  * May be invalid or malicious (eg control chars),
24231  * should not be exposed to the user.
24232  */
24233 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
24234
24235 /**
24236  * Moniker assigned to the node.
24237  * May be invalid or malicious (eg control chars),
24238  * should not be exposed to the user.
24239  */
24240 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24241
24242 /**
24243  * Internet-level addresses via which one can connect to the node
24244  */
24245 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
24246
24247 /**
24248  * An initial announcement of the node
24249  * Mostly redundant with the data we store in fields explicitly.
24250  * Everything else is useful only for sending out for initial routing sync.
24251  * Not stored if contains excess data to prevent DoS.
24252  *
24253  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24254  */
24255 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
24256
24257 /**
24258  * An initial announcement of the node
24259  * Mostly redundant with the data we store in fields explicitly.
24260  * Everything else is useful only for sending out for initial routing sync.
24261  * Not stored if contains excess data to prevent DoS.
24262  *
24263  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24264  */
24265 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
24266
24267 /**
24268  * Constructs a new NodeAnnouncementInfo given each field
24269  */
24270 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);
24271
24272 /**
24273  * Creates a copy of the NodeAnnouncementInfo
24274  */
24275 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
24276
24277 /**
24278  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
24279  */
24280 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
24281
24282 /**
24283  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
24284  */
24285 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
24286
24287 /**
24288  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
24289  */
24290 void NodeInfo_free(struct LDKNodeInfo this_obj);
24291
24292 /**
24293  * All valid channels a node has announced
24294  */
24295 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
24296
24297 /**
24298  * Lowest fees enabling routing via any of the enabled, known channels to a node.
24299  * The two fields (flat and proportional fee) are independent,
24300  * meaning they don't have to refer to the same 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 LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
24305
24306 /**
24307  * Lowest fees enabling routing via any of the enabled, known channels to a node.
24308  * The two fields (flat and proportional fee) are independent,
24309  * meaning they don't have to refer to the same channel.
24310  *
24311  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24312  */
24313 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
24314
24315 /**
24316  * More information about a node from node_announcement.
24317  * Optional because we store a Node entry after learning about it from
24318  * a channel announcement, but before receiving a node announcement.
24319  *
24320  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24321  */
24322 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
24323
24324 /**
24325  * More information about a node from node_announcement.
24326  * Optional because we store a Node entry after learning about it from
24327  * a channel announcement, but before receiving a node announcement.
24328  *
24329  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24330  */
24331 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
24332
24333 /**
24334  * Constructs a new NodeInfo given each field
24335  */
24336 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
24337
24338 /**
24339  * Creates a copy of the NodeInfo
24340  */
24341 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
24342
24343 /**
24344  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
24345  */
24346 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
24347
24348 /**
24349  * Read a NodeInfo from a byte array, created by NodeInfo_write
24350  */
24351 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
24352
24353 /**
24354  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
24355  */
24356 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
24357
24358 /**
24359  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
24360  */
24361 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
24362
24363 /**
24364  * Creates a new, empty, network graph.
24365  */
24366 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
24367
24368 /**
24369  * Returns a read-only view of the network graph.
24370  */
24371 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
24372
24373 /**
24374  * For an already known node (from channel announcements), update its stored properties from a
24375  * given node announcement.
24376  *
24377  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
24378  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
24379  * routing messages from a source using a protocol other than the lightning P2P protocol.
24380  */
24381 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
24382
24383 /**
24384  * For an already known node (from channel announcements), update its stored properties from a
24385  * given node announcement without verifying the associated signatures. Because we aren't
24386  * given the associated signatures here we cannot relay the node announcement to any of our
24387  * peers.
24388  */
24389 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);
24390
24391 /**
24392  * Store or update channel info from a channel announcement.
24393  *
24394  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
24395  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
24396  * routing messages from a source using a protocol other than the lightning P2P protocol.
24397  *
24398  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
24399  * the corresponding UTXO exists on chain and is correctly-formatted.
24400  */
24401 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);
24402
24403 /**
24404  * Store or update channel info from a channel announcement without verifying the associated
24405  * signatures. Because we aren't given the associated signatures here we cannot relay the
24406  * channel announcement to any of our peers.
24407  *
24408  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
24409  * the corresponding UTXO exists on chain and is correctly-formatted.
24410  */
24411 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);
24412
24413 /**
24414  * Close a channel if a corresponding HTLC fail was sent.
24415  * If permanent, removes a channel from the local storage.
24416  * May cause the removal of nodes too, if this was their last channel.
24417  * If not permanent, makes channels unavailable for routing.
24418  */
24419 void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
24420
24421 /**
24422  * Marks a node in the graph as failed.
24423  */
24424 void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
24425
24426 /**
24427  * Removes information about channels that we haven't heard any updates about in some time.
24428  * This can be used regularly to prune the network graph of channels that likely no longer
24429  * exist.
24430  *
24431  * While there is no formal requirement that nodes regularly re-broadcast their channel
24432  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
24433  * pruning occur for updates which are at least two weeks old, which we implement here.
24434  *
24435  * Note that for users of the `lightning-background-processor` crate this method may be
24436  * automatically called regularly for you.
24437  *
24438  * This method is only available with the `std` feature. See
24439  * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
24440  */
24441 void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
24442
24443 /**
24444  * Removes information about channels that we haven't heard any updates about in some time.
24445  * This can be used regularly to prune the network graph of channels that likely no longer
24446  * exist.
24447  *
24448  * While there is no formal requirement that nodes regularly re-broadcast their channel
24449  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
24450  * pruning occur for updates which are at least two weeks old, which we implement here.
24451  *
24452  * This function takes the current unix time as an argument. For users with the `std` feature
24453  * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
24454  */
24455 void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
24456
24457 /**
24458  * For an already known (from announcement) channel, update info about one of the directions
24459  * of the channel.
24460  *
24461  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
24462  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
24463  * routing messages from a source using a protocol other than the lightning P2P protocol.
24464  *
24465  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
24466  * materially in the future will be rejected.
24467  */
24468 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
24469
24470 /**
24471  * For an already known (from announcement) channel, update info about one of the directions
24472  * of the channel without verifying the associated signatures. Because we aren't given the
24473  * associated signatures here we cannot relay the channel update to any of our peers.
24474  *
24475  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
24476  * materially in the future will be rejected.
24477  */
24478 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
24479
24480 /**
24481  * Get network addresses by node id.
24482  * Returns None if the requested node is completely unknown,
24483  * or if node announcement for the node was never received.
24484  */
24485 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
24486
24487 /**
24488  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
24489  */
24490 void RouteHop_free(struct LDKRouteHop this_obj);
24491
24492 /**
24493  * The node_id of the node at this hop.
24494  */
24495 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24496
24497 /**
24498  * The node_id of the node at this hop.
24499  */
24500 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24501
24502 /**
24503  * The node_announcement features of the node at this hop. For the last hop, these may be
24504  * amended to match the features present in the invoice this node generated.
24505  */
24506 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24507
24508 /**
24509  * The node_announcement features of the node at this hop. For the last hop, these may be
24510  * amended to match the features present in the invoice this node generated.
24511  */
24512 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
24513
24514 /**
24515  * The channel that should be used from the previous hop to reach this node.
24516  */
24517 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24518
24519 /**
24520  * The channel that should be used from the previous hop to reach this node.
24521  */
24522 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
24523
24524 /**
24525  * The channel_announcement features of the channel that should be used from the previous hop
24526  * to reach this node.
24527  */
24528 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24529
24530 /**
24531  * The channel_announcement features of the channel that should be used from the previous hop
24532  * to reach this node.
24533  */
24534 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
24535
24536 /**
24537  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
24538  * For the last hop, this should be the full value of the payment (might be more than
24539  * requested if we had to match htlc_minimum_msat).
24540  */
24541 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24542
24543 /**
24544  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
24545  * For the last hop, this should be the full value of the payment (might be more than
24546  * requested if we had to match htlc_minimum_msat).
24547  */
24548 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
24549
24550 /**
24551  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
24552  * expected at the destination, in excess of the current block height.
24553  */
24554 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
24555
24556 /**
24557  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
24558  * expected at the destination, in excess of the current block height.
24559  */
24560 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
24561
24562 /**
24563  * Constructs a new RouteHop given each field
24564  */
24565 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);
24566
24567 /**
24568  * Creates a copy of the RouteHop
24569  */
24570 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
24571
24572 /**
24573  * Checks if two RouteHops contain equal inner contents.
24574  */
24575 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
24576
24577 /**
24578  * Checks if two RouteHops contain equal inner contents.
24579  * This ignores pointers and is_owned flags and looks at the values in fields.
24580  * Two objects with NULL inner values will be considered "equal" here.
24581  */
24582 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
24583
24584 /**
24585  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
24586  */
24587 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
24588
24589 /**
24590  * Read a RouteHop from a byte array, created by RouteHop_write
24591  */
24592 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
24593
24594 /**
24595  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
24596  */
24597 void Route_free(struct LDKRoute this_obj);
24598
24599 /**
24600  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
24601  * last RouteHop in each path must be the same.
24602  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
24603  * destination. Thus, this must always be at least length one. While the maximum length of any
24604  * given path is variable, keeping the length of any path to less than 20 should currently
24605  * ensure it is viable.
24606  */
24607 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
24608
24609 /**
24610  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
24611  * last RouteHop in each path must be the same.
24612  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
24613  * destination. Thus, this must always be at least length one. While the maximum length of any
24614  * given path is variable, keeping the length of any path to less than 20 should currently
24615  * ensure it is viable.
24616  */
24617 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
24618
24619 /**
24620  * The `payment_params` parameter passed to [`find_route`].
24621  * This is used by `ChannelManager` to track information which may be required for retries,
24622  * provided back to you via [`Event::PaymentPathFailed`].
24623  *
24624  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
24625  *
24626  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24627  */
24628 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
24629
24630 /**
24631  * The `payment_params` parameter passed to [`find_route`].
24632  * This is used by `ChannelManager` to track information which may be required for retries,
24633  * provided back to you via [`Event::PaymentPathFailed`].
24634  *
24635  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
24636  *
24637  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24638  */
24639 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
24640
24641 /**
24642  * Constructs a new Route given each field
24643  */
24644 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
24645
24646 /**
24647  * Creates a copy of the Route
24648  */
24649 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
24650
24651 /**
24652  * Checks if two Routes contain equal inner contents.
24653  */
24654 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
24655
24656 /**
24657  * Checks if two Routes contain equal inner contents.
24658  * This ignores pointers and is_owned flags and looks at the values in fields.
24659  * Two objects with NULL inner values will be considered "equal" here.
24660  */
24661 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
24662
24663 /**
24664  * Returns the total amount of fees paid on this [`Route`].
24665  *
24666  * This doesn't include any extra payment made to the recipient, which can happen in excess of
24667  * the amount passed to [`find_route`]'s `params.final_value_msat`.
24668  */
24669 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
24670
24671 /**
24672  * Returns the total amount paid on this [`Route`], excluding the fees.
24673  */
24674 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
24675
24676 /**
24677  * Serialize the Route object into a byte array which can be read by Route_read
24678  */
24679 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
24680
24681 /**
24682  * Read a Route from a byte array, created by Route_write
24683  */
24684 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
24685
24686 /**
24687  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
24688  */
24689 void RouteParameters_free(struct LDKRouteParameters this_obj);
24690
24691 /**
24692  * The parameters of the failed payment path.
24693  */
24694 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
24695
24696 /**
24697  * The parameters of the failed payment path.
24698  */
24699 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
24700
24701 /**
24702  * The amount in msats sent on the failed payment path.
24703  */
24704 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
24705
24706 /**
24707  * The amount in msats sent on the failed payment path.
24708  */
24709 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
24710
24711 /**
24712  * The CLTV on the final hop of the failed payment path.
24713  */
24714 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
24715
24716 /**
24717  * The CLTV on the final hop of the failed payment path.
24718  */
24719 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
24720
24721 /**
24722  * Constructs a new RouteParameters given each field
24723  */
24724 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);
24725
24726 /**
24727  * Creates a copy of the RouteParameters
24728  */
24729 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
24730
24731 /**
24732  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
24733  */
24734 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
24735
24736 /**
24737  * Read a RouteParameters from a byte array, created by RouteParameters_write
24738  */
24739 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
24740
24741 /**
24742  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
24743  */
24744 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
24745
24746 /**
24747  * The node id of the payee.
24748  */
24749 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
24750
24751 /**
24752  * The node id of the payee.
24753  */
24754 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24755
24756 /**
24757  * Features supported by the payee.
24758  *
24759  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
24760  * does not contain any features.
24761  *
24762  * [`for_keysend`]: Self::for_keysend
24763  *
24764  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24765  */
24766 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
24767
24768 /**
24769  * Features supported by the payee.
24770  *
24771  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
24772  * does not contain any features.
24773  *
24774  * [`for_keysend`]: Self::for_keysend
24775  *
24776  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24777  */
24778 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
24779
24780 /**
24781  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
24782  */
24783 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
24784
24785 /**
24786  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
24787  */
24788 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
24789
24790 /**
24791  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
24792  */
24793 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
24794
24795 /**
24796  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
24797  */
24798 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24799
24800 /**
24801  * The maximum total CLTV delta we accept for the route.
24802  */
24803 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
24804
24805 /**
24806  * The maximum total CLTV delta we accept for the route.
24807  */
24808 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
24809
24810 /**
24811  * Constructs a new PaymentParameters given each field
24812  */
24813 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);
24814
24815 /**
24816  * Creates a copy of the PaymentParameters
24817  */
24818 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
24819
24820 /**
24821  * Checks if two PaymentParameterss contain equal inner contents.
24822  */
24823 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
24824
24825 /**
24826  * Checks if two PaymentParameterss contain equal inner contents.
24827  * This ignores pointers and is_owned flags and looks at the values in fields.
24828  * Two objects with NULL inner values will be considered "equal" here.
24829  */
24830 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
24831
24832 /**
24833  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
24834  */
24835 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
24836
24837 /**
24838  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
24839  */
24840 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
24841
24842 /**
24843  * Creates a payee with the node id of the given `pubkey`.
24844  */
24845 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
24846
24847 /**
24848  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
24849  */
24850 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
24851
24852 /**
24853  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
24854  */
24855 void RouteHint_free(struct LDKRouteHint this_obj);
24856
24857 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
24858
24859 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
24860
24861 /**
24862  * Constructs a new RouteHint given each field
24863  */
24864 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
24865
24866 /**
24867  * Creates a copy of the RouteHint
24868  */
24869 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
24870
24871 /**
24872  * Checks if two RouteHints contain equal inner contents.
24873  */
24874 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
24875
24876 /**
24877  * Checks if two RouteHints contain equal inner contents.
24878  * This ignores pointers and is_owned flags and looks at the values in fields.
24879  * Two objects with NULL inner values will be considered "equal" here.
24880  */
24881 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
24882
24883 /**
24884  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
24885  */
24886 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
24887
24888 /**
24889  * Read a RouteHint from a byte array, created by RouteHint_write
24890  */
24891 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
24892
24893 /**
24894  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
24895  */
24896 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
24897
24898 /**
24899  * The node_id of the non-target end of the route
24900  */
24901 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
24902
24903 /**
24904  * The node_id of the non-target end of the route
24905  */
24906 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24907
24908 /**
24909  * The short_channel_id of this channel
24910  */
24911 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
24912
24913 /**
24914  * The short_channel_id of this channel
24915  */
24916 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
24917
24918 /**
24919  * The fees which must be paid to use this channel
24920  */
24921 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
24922
24923 /**
24924  * The fees which must be paid to use this channel
24925  */
24926 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
24927
24928 /**
24929  * The difference in CLTV values between this node and the next node.
24930  */
24931 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
24932
24933 /**
24934  * The difference in CLTV values between this node and the next node.
24935  */
24936 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
24937
24938 /**
24939  * The minimum value, in msat, which must be relayed to the next hop.
24940  */
24941 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
24942
24943 /**
24944  * The minimum value, in msat, which must be relayed to the next hop.
24945  */
24946 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24947
24948 /**
24949  * The maximum value in msat available for routing with a single HTLC.
24950  */
24951 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
24952
24953 /**
24954  * The maximum value in msat available for routing with a single HTLC.
24955  */
24956 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24957
24958 /**
24959  * Constructs a new RouteHintHop given each field
24960  */
24961 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);
24962
24963 /**
24964  * Creates a copy of the RouteHintHop
24965  */
24966 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
24967
24968 /**
24969  * Checks if two RouteHintHops contain equal inner contents.
24970  */
24971 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
24972
24973 /**
24974  * Checks if two RouteHintHops contain equal inner contents.
24975  * This ignores pointers and is_owned flags and looks at the values in fields.
24976  * Two objects with NULL inner values will be considered "equal" here.
24977  */
24978 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
24979
24980 /**
24981  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
24982  */
24983 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
24984
24985 /**
24986  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
24987  */
24988 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
24989
24990 /**
24991  * Finds a route from us (payer) to the given target node (payee).
24992  *
24993  * If the payee provided features in their invoice, they should be provided via `params.payee`.
24994  * Without this, MPP will only be used if the payee's features are available in the network graph.
24995  *
24996  * Private routing paths between a public node and the target may be included in `params.payee`.
24997  *
24998  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
24999  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
25000  * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
25001  *
25002  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
25003  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
25004  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
25005  *
25006  * # Note
25007  *
25008  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
25009  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
25010  * function.
25011  *
25012  * # Panics
25013  *
25014  * Panics if first_hops contains channels without short_channel_ids;
25015  * [`ChannelManager::list_usable_channels`] will never include such channels.
25016  *
25017  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
25018  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
25019  *
25020  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
25021  */
25022 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);
25023
25024 /**
25025  * Calls the free function if one is set
25026  */
25027 void Score_free(struct LDKScore this_ptr);
25028
25029 /**
25030  * Calls the free function if one is set
25031  */
25032 void LockableScore_free(struct LDKLockableScore this_ptr);
25033
25034 /**
25035  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
25036  */
25037 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
25038
25039 /**
25040  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
25041  */
25042 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
25043
25044 /**
25045  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
25046  */
25047 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
25048
25049 /**
25050  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
25051  */
25052 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
25053
25054 /**
25055  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
25056  */
25057 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser);
25058
25059 /**
25060  * Creates a new scorer using `penalty_msat`.
25061  */
25062 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
25063
25064 /**
25065  * Constructs a new Score which calls the relevant methods on this_arg.
25066  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
25067  */
25068 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
25069
25070 /**
25071  * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
25072  */
25073 void Scorer_free(struct LDKScorer this_obj);
25074
25075 /**
25076  * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
25077  */
25078 void ScoringParameters_free(struct LDKScoringParameters this_obj);
25079
25080 /**
25081  * A fixed penalty in msats to apply to each channel.
25082  *
25083  * Default value: 500 msat
25084  */
25085 uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25086
25087 /**
25088  * A fixed penalty in msats to apply to each channel.
25089  *
25090  * Default value: 500 msat
25091  */
25092 void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25093
25094 /**
25095  * A penalty in msats to apply to a channel upon failing to relay a payment.
25096  *
25097  * This accumulates for each failure but may be reduced over time based on
25098  * [`failure_penalty_half_life`] or when successfully routing through a channel.
25099  *
25100  * Default value: 1,024,000 msat
25101  *
25102  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
25103  */
25104 uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25105
25106 /**
25107  * A penalty in msats to apply to a channel upon failing to relay a payment.
25108  *
25109  * This accumulates for each failure but may be reduced over time based on
25110  * [`failure_penalty_half_life`] or when successfully routing through a channel.
25111  *
25112  * Default value: 1,024,000 msat
25113  *
25114  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
25115  */
25116 void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25117
25118 /**
25119  * When the amount being sent over a channel is this many 1024ths of the total channel
25120  * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
25121  *
25122  * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
25123  *
25124  * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
25125  */
25126 uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25127
25128 /**
25129  * When the amount being sent over a channel is this many 1024ths of the total channel
25130  * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
25131  *
25132  * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
25133  *
25134  * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
25135  */
25136 void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val);
25137
25138 /**
25139  * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
25140  * over the channel exceeds [`overuse_penalty_start_1024th`] by.
25141  *
25142  * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
25143  *                to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
25144  *
25145  * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
25146  */
25147 uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25148
25149 /**
25150  * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
25151  * over the channel exceeds [`overuse_penalty_start_1024th`] by.
25152  *
25153  * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
25154  *                to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
25155  *
25156  * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
25157  */
25158 void ScoringParameters_set_overuse_penalty_msat_per_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25159
25160 /**
25161  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
25162  * cut in half.
25163  *
25164  * Successfully routing through a channel will immediately cut the penalty in half as well.
25165  *
25166  * Default value: 1 hour
25167  *
25168  * # Note
25169  *
25170  * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
25171  * never decay.
25172  *
25173  * [`failure_penalty_msat`]: Self::failure_penalty_msat
25174  */
25175 uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
25176
25177 /**
25178  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
25179  * cut in half.
25180  *
25181  * Successfully routing through a channel will immediately cut the penalty in half as well.
25182  *
25183  * Default value: 1 hour
25184  *
25185  * # Note
25186  *
25187  * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
25188  * never decay.
25189  *
25190  * [`failure_penalty_msat`]: Self::failure_penalty_msat
25191  */
25192 void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25193
25194 /**
25195  * Constructs a new ScoringParameters given each field
25196  */
25197 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);
25198
25199 /**
25200  * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
25201  */
25202 struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj);
25203
25204 /**
25205  * Read a ScoringParameters from a byte array, created by ScoringParameters_write
25206  */
25207 struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser);
25208
25209 /**
25210  * Creates a new scorer using the given scoring parameters.
25211  */
25212 MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
25213
25214 /**
25215  * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
25216  */
25217 MUST_USE_RES struct LDKScorer Scorer_default(void);
25218
25219 /**
25220  * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
25221  */
25222 MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
25223
25224 /**
25225  * Constructs a new Score which calls the relevant methods on this_arg.
25226  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
25227  */
25228 struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
25229
25230 /**
25231  * Serialize the Scorer object into a byte array which can be read by Scorer_read
25232  */
25233 struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj);
25234
25235 /**
25236  * Read a Scorer from a byte array, created by Scorer_write
25237  */
25238 struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
25239
25240 /**
25241  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
25242  */
25243 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
25244
25245 /**
25246  * A multiplier used to determine the amount in msats willing to be paid to avoid routing
25247  * through a channel, as per multiplying by the negative `log10` of the channel's success
25248  * probability for a payment.
25249  *
25250  * The success probability is determined by the effective channel capacity, the payment amount,
25251  * and knowledge learned from prior successful and unsuccessful payments. The lower bound of
25252  * the success probability is 0.01, effectively limiting the penalty to the range
25253  * `0..=2*liquidity_penalty_multiplier_msat`. The knowledge learned is decayed over time based
25254  * on [`liquidity_offset_half_life`].
25255  *
25256  * Default value: 10,000 msat
25257  *
25258  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
25259  */
25260 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
25261
25262 /**
25263  * A multiplier used to determine the amount in msats willing to be paid to avoid routing
25264  * through a channel, as per multiplying by the negative `log10` of the channel's success
25265  * probability for a payment.
25266  *
25267  * The success probability is determined by the effective channel capacity, the payment amount,
25268  * and knowledge learned from prior successful and unsuccessful payments. The lower bound of
25269  * the success probability is 0.01, effectively limiting the penalty to the range
25270  * `0..=2*liquidity_penalty_multiplier_msat`. The knowledge learned is decayed over time based
25271  * on [`liquidity_offset_half_life`].
25272  *
25273  * Default value: 10,000 msat
25274  *
25275  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
25276  */
25277 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25278
25279 /**
25280  * The time required to elapse before any knowledge learned about channel liquidity balances is
25281  * cut in half.
25282  *
25283  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
25284  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
25285  * the certainty of the channel liquidity balance.
25286  *
25287  * Default value: 1 hour
25288  *
25289  * # Note
25290  *
25291  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
25292  * liquidity knowledge will never decay except when the bounds cross.
25293  */
25294 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
25295
25296 /**
25297  * The time required to elapse before any knowledge learned about channel liquidity balances is
25298  * cut in half.
25299  *
25300  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
25301  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
25302  * the certainty of the channel liquidity balance.
25303  *
25304  * Default value: 1 hour
25305  *
25306  * # Note
25307  *
25308  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
25309  * liquidity knowledge will never decay except when the bounds cross.
25310  */
25311 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
25312
25313 /**
25314  * Constructs a new ProbabilisticScoringParameters given each field
25315  */
25316 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg);
25317
25318 /**
25319  * Creates a copy of the ProbabilisticScoringParameters
25320  */
25321 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
25322
25323 /**
25324  * Serialize the ProbabilisticScoringParameters object into a byte array which can be read by ProbabilisticScoringParameters_read
25325  */
25326 struct LDKCVec_u8Z ProbabilisticScoringParameters_write(const struct LDKProbabilisticScoringParameters *NONNULL_PTR obj);
25327
25328 /**
25329  * Read a ProbabilisticScoringParameters from a byte array, created by ProbabilisticScoringParameters_write
25330  */
25331 struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ ProbabilisticScoringParameters_read(struct LDKu8slice ser);
25332
25333 /**
25334  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
25335  */
25336 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
25337
25338 /**
25339  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
25340  */
25341 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
25342
25343 /**
25344  * Initialize a new FilesystemPersister and set the path to the individual channels'
25345  * files.
25346  */
25347 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
25348
25349 /**
25350  * Get the directory which was provided when this persister was initialized.
25351  */
25352 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
25353
25354 /**
25355  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
25356  * initialization, within a file called \"manager\".
25357  */
25358 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
25359
25360 /**
25361  * Read `ChannelMonitor`s from disk.
25362  */
25363 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
25364
25365 /**
25366  * Constructs a new Persist which calls the relevant methods on this_arg.
25367  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
25368  */
25369 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
25370
25371 /**
25372  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
25373  */
25374 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
25375
25376 /**
25377  * Calls the free function if one is set
25378  */
25379 void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
25380
25381 /**
25382  * Start a background thread that takes care of responsibilities enumerated in the [top-level
25383  * documentation].
25384  *
25385  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
25386  * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
25387  * either [`join`] or [`stop`].
25388  *
25389  * # Data Persistence
25390  *
25391  * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
25392  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
25393  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
25394  * provided implementation.
25395  *
25396  * Typically, users should either implement [`ChannelManagerPersister`] to never return an
25397  * error or call [`join`] and handle any error that may arise. For the latter case,
25398  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
25399  *
25400  * # Event Handling
25401  *
25402  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
25403  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
25404  * functionality implemented by other handlers.
25405  * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
25406  *
25407  * [top-level documentation]: BackgroundProcessor
25408  * [`join`]: Self::join
25409  * [`stop`]: Self::stop
25410  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
25411  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
25412  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
25413  * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
25414  *
25415  * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
25416  */
25417 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
25418
25419 /**
25420  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
25421  * [`ChannelManager`].
25422  *
25423  * # Panics
25424  *
25425  * This function panics if the background thread has panicked such as while persisting or
25426  * handling events.
25427  *
25428  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
25429  */
25430 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
25431
25432 /**
25433  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
25434  * [`ChannelManager`].
25435  *
25436  * # Panics
25437  *
25438  * This function panics if the background thread has panicked such as while persisting or
25439  * handling events.
25440  *
25441  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
25442  */
25443 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
25444
25445 /**
25446  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
25447  */
25448 void Invoice_free(struct LDKInvoice this_obj);
25449
25450 /**
25451  * Checks if two Invoices contain equal inner contents.
25452  * This ignores pointers and is_owned flags and looks at the values in fields.
25453  * Two objects with NULL inner values will be considered "equal" here.
25454  */
25455 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
25456
25457 /**
25458  * Creates a copy of the Invoice
25459  */
25460 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
25461
25462 /**
25463  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
25464  */
25465 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
25466
25467 /**
25468  * Checks if two SignedRawInvoices contain equal inner contents.
25469  * This ignores pointers and is_owned flags and looks at the values in fields.
25470  * Two objects with NULL inner values will be considered "equal" here.
25471  */
25472 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
25473
25474 /**
25475  * Creates a copy of the SignedRawInvoice
25476  */
25477 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
25478
25479 /**
25480  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
25481  */
25482 void RawInvoice_free(struct LDKRawInvoice this_obj);
25483
25484 /**
25485  * data part
25486  */
25487 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
25488
25489 /**
25490  * data part
25491  */
25492 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
25493
25494 /**
25495  * Checks if two RawInvoices contain equal inner contents.
25496  * This ignores pointers and is_owned flags and looks at the values in fields.
25497  * Two objects with NULL inner values will be considered "equal" here.
25498  */
25499 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
25500
25501 /**
25502  * Creates a copy of the RawInvoice
25503  */
25504 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
25505
25506 /**
25507  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
25508  */
25509 void RawDataPart_free(struct LDKRawDataPart this_obj);
25510
25511 /**
25512  * generation time of the invoice
25513  */
25514 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
25515
25516 /**
25517  * generation time of the invoice
25518  */
25519 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
25520
25521 /**
25522  * Checks if two RawDataParts contain equal inner contents.
25523  * This ignores pointers and is_owned flags and looks at the values in fields.
25524  * Two objects with NULL inner values will be considered "equal" here.
25525  */
25526 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
25527
25528 /**
25529  * Creates a copy of the RawDataPart
25530  */
25531 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
25532
25533 /**
25534  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
25535  */
25536 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
25537
25538 /**
25539  * Checks if two PositiveTimestamps contain equal inner contents.
25540  * This ignores pointers and is_owned flags and looks at the values in fields.
25541  * Two objects with NULL inner values will be considered "equal" here.
25542  */
25543 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
25544
25545 /**
25546  * Creates a copy of the PositiveTimestamp
25547  */
25548 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
25549
25550 /**
25551  * Creates a copy of the SiPrefix
25552  */
25553 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
25554
25555 /**
25556  * Utility method to constructs a new Milli-variant SiPrefix
25557  */
25558 enum LDKSiPrefix SiPrefix_milli(void);
25559
25560 /**
25561  * Utility method to constructs a new Micro-variant SiPrefix
25562  */
25563 enum LDKSiPrefix SiPrefix_micro(void);
25564
25565 /**
25566  * Utility method to constructs a new Nano-variant SiPrefix
25567  */
25568 enum LDKSiPrefix SiPrefix_nano(void);
25569
25570 /**
25571  * Utility method to constructs a new Pico-variant SiPrefix
25572  */
25573 enum LDKSiPrefix SiPrefix_pico(void);
25574
25575 /**
25576  * Checks if two SiPrefixs contain equal inner contents.
25577  * This ignores pointers and is_owned flags and looks at the values in fields.
25578  */
25579 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
25580
25581 /**
25582  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
25583  * This is effectively 10^12 * the prefix multiplier
25584  */
25585 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
25586
25587 /**
25588  * Creates a copy of the Currency
25589  */
25590 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
25591
25592 /**
25593  * Utility method to constructs a new Bitcoin-variant Currency
25594  */
25595 enum LDKCurrency Currency_bitcoin(void);
25596
25597 /**
25598  * Utility method to constructs a new BitcoinTestnet-variant Currency
25599  */
25600 enum LDKCurrency Currency_bitcoin_testnet(void);
25601
25602 /**
25603  * Utility method to constructs a new Regtest-variant Currency
25604  */
25605 enum LDKCurrency Currency_regtest(void);
25606
25607 /**
25608  * Utility method to constructs a new Simnet-variant Currency
25609  */
25610 enum LDKCurrency Currency_simnet(void);
25611
25612 /**
25613  * Utility method to constructs a new Signet-variant Currency
25614  */
25615 enum LDKCurrency Currency_signet(void);
25616
25617 /**
25618  * Checks if two Currencys contain equal inner contents.
25619  */
25620 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
25621
25622 /**
25623  * Checks if two Currencys contain equal inner contents.
25624  * This ignores pointers and is_owned flags and looks at the values in fields.
25625  */
25626 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
25627
25628 /**
25629  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
25630  */
25631 void Sha256_free(struct LDKSha256 this_obj);
25632
25633 /**
25634  * Creates a copy of the Sha256
25635  */
25636 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
25637
25638 /**
25639  * Checks if two Sha256s contain equal inner contents.
25640  */
25641 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
25642
25643 /**
25644  * Checks if two Sha256s contain equal inner contents.
25645  * This ignores pointers and is_owned flags and looks at the values in fields.
25646  * Two objects with NULL inner values will be considered "equal" here.
25647  */
25648 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
25649
25650 /**
25651  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
25652  */
25653 void Description_free(struct LDKDescription this_obj);
25654
25655 /**
25656  * Creates a copy of the Description
25657  */
25658 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
25659
25660 /**
25661  * Checks if two Descriptions contain equal inner contents.
25662  */
25663 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
25664
25665 /**
25666  * Checks if two Descriptions contain equal inner contents.
25667  * This ignores pointers and is_owned flags and looks at the values in fields.
25668  * Two objects with NULL inner values will be considered "equal" here.
25669  */
25670 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
25671
25672 /**
25673  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
25674  */
25675 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
25676
25677 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
25678
25679 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25680
25681 /**
25682  * Constructs a new PayeePubKey given each field
25683  */
25684 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
25685
25686 /**
25687  * Creates a copy of the PayeePubKey
25688  */
25689 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
25690
25691 /**
25692  * Checks if two PayeePubKeys contain equal inner contents.
25693  */
25694 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
25695
25696 /**
25697  * Checks if two PayeePubKeys contain equal inner contents.
25698  * This ignores pointers and is_owned flags and looks at the values in fields.
25699  * Two objects with NULL inner values will be considered "equal" here.
25700  */
25701 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
25702
25703 /**
25704  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
25705  */
25706 void ExpiryTime_free(struct LDKExpiryTime this_obj);
25707
25708 /**
25709  * Creates a copy of the ExpiryTime
25710  */
25711 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
25712
25713 /**
25714  * Checks if two ExpiryTimes contain equal inner contents.
25715  */
25716 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
25717
25718 /**
25719  * Checks if two ExpiryTimes contain equal inner contents.
25720  * This ignores pointers and is_owned flags and looks at the values in fields.
25721  * Two objects with NULL inner values will be considered "equal" here.
25722  */
25723 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
25724
25725 /**
25726  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
25727  */
25728 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
25729
25730 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
25731
25732 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
25733
25734 /**
25735  * Constructs a new MinFinalCltvExpiry given each field
25736  */
25737 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
25738
25739 /**
25740  * Creates a copy of the MinFinalCltvExpiry
25741  */
25742 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
25743
25744 /**
25745  * Checks if two MinFinalCltvExpirys contain equal inner contents.
25746  */
25747 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
25748
25749 /**
25750  * Checks if two MinFinalCltvExpirys contain equal inner contents.
25751  * This ignores pointers and is_owned flags and looks at the values in fields.
25752  * Two objects with NULL inner values will be considered "equal" here.
25753  */
25754 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
25755
25756 /**
25757  * Frees any resources used by the Fallback
25758  */
25759 void Fallback_free(struct LDKFallback this_ptr);
25760
25761 /**
25762  * Creates a copy of the Fallback
25763  */
25764 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
25765
25766 /**
25767  * Utility method to constructs a new SegWitProgram-variant Fallback
25768  */
25769 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
25770
25771 /**
25772  * Utility method to constructs a new PubKeyHash-variant Fallback
25773  */
25774 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
25775
25776 /**
25777  * Utility method to constructs a new ScriptHash-variant Fallback
25778  */
25779 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
25780
25781 /**
25782  * Checks if two Fallbacks contain equal inner contents.
25783  */
25784 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
25785
25786 /**
25787  * Checks if two Fallbacks contain equal inner contents.
25788  * This ignores pointers and is_owned flags and looks at the values in fields.
25789  */
25790 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
25791
25792 /**
25793  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
25794  */
25795 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
25796
25797 /**
25798  * Creates a copy of the InvoiceSignature
25799  */
25800 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
25801
25802 /**
25803  * Checks if two InvoiceSignatures contain equal inner contents.
25804  * This ignores pointers and is_owned flags and looks at the values in fields.
25805  * Two objects with NULL inner values will be considered "equal" here.
25806  */
25807 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
25808
25809 /**
25810  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
25811  */
25812 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
25813
25814 /**
25815  * Creates a copy of the PrivateRoute
25816  */
25817 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
25818
25819 /**
25820  * Checks if two PrivateRoutes contain equal inner contents.
25821  */
25822 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
25823
25824 /**
25825  * Checks if two PrivateRoutes contain equal inner contents.
25826  * This ignores pointers and is_owned flags and looks at the values in fields.
25827  * Two objects with NULL inner values will be considered "equal" here.
25828  */
25829 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
25830
25831 /**
25832  * Disassembles the `SignedRawInvoice` into its three parts:
25833  *  1. raw invoice
25834  *  2. hash of the raw invoice
25835  *  3. signature
25836  */
25837 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
25838
25839 /**
25840  * The `RawInvoice` which was signed.
25841  */
25842 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
25843
25844 /**
25845  * The hash of the `RawInvoice` that was signed.
25846  */
25847 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
25848
25849 /**
25850  * InvoiceSignature for the invoice.
25851  */
25852 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
25853
25854 /**
25855  * Recovers the public key used for signing the invoice from the recoverable signature.
25856  */
25857 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
25858
25859 /**
25860  * Checks if the signature is valid for the included payee public key or if none exists if it's
25861  * valid for the recovered signature (which should always be true?).
25862  */
25863 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
25864
25865 /**
25866  * Calculate the hash of the encoded `RawInvoice`
25867  */
25868 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25869
25870 /**
25871  *
25872  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25873  */
25874 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25875
25876 /**
25877  *
25878  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25879  */
25880 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25881
25882 /**
25883  *
25884  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25885  */
25886 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25887
25888 /**
25889  *
25890  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25891  */
25892 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25893
25894 /**
25895  *
25896  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25897  */
25898 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25899
25900 /**
25901  *
25902  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25903  */
25904 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25905
25906 /**
25907  *
25908  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25909  */
25910 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25911
25912 /**
25913  *
25914  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25915  */
25916 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25917
25918 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25919
25920 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25921
25922 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
25923
25924 /**
25925  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
25926  *
25927  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
25928  */
25929 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
25930
25931 /**
25932  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
25933  * the range `0..=MAX_TIMESTAMP`.
25934  *
25935  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
25936  */
25937 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
25938
25939 /**
25940  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
25941  * `0..=MAX_TIMESTAMP`.
25942  *
25943  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
25944  */
25945 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
25946
25947 /**
25948  * Returns the Unix timestamp representing the stored time
25949  */
25950 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
25951
25952 /**
25953  * Returns the duration of the stored time since the Unix epoch
25954  */
25955 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
25956
25957 /**
25958  * Returns the [`SystemTime`] representing the stored time
25959  */
25960 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
25961
25962 /**
25963  * Transform the `Invoice` into it's unchecked version
25964  */
25965 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
25966
25967 /**
25968  * Check that the invoice is signed correctly and that key recovery works
25969  */
25970 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
25971
25972 /**
25973  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
25974  * ```
25975  * use lightning_invoice::*;
25976  *
25977  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
25978  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
25979  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
25980  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
25981  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
25982  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
25983  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
25984  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
25985  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
25986  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
25987  * j5r6drg6k6zcqj0fcwg\";
25988  *
25989  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
25990  *
25991  * assert!(Invoice::from_signed(signed).is_ok());
25992  * ```
25993  */
25994 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
25995
25996 /**
25997  * Returns the `Invoice`'s timestamp (should equal its creation time)
25998  */
25999 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
26000
26001 /**
26002  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
26003  */
26004 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
26005
26006 /**
26007  * Returns the hash to which we will receive the preimage on completion of the payment
26008  */
26009 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
26010
26011 /**
26012  * Get the payee's public key if one was included in the invoice
26013  *
26014  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26015  */
26016 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
26017
26018 /**
26019  * Get the payment secret if one was included in the invoice
26020  */
26021 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
26022
26023 /**
26024  * Get the invoice features if they were included in the invoice
26025  *
26026  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26027  */
26028 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
26029
26030 /**
26031  * Recover the payee's public key (only to be used if none was included in the invoice)
26032  */
26033 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
26034
26035 /**
26036  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
26037  */
26038 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
26039
26040 /**
26041  * Returns whether the invoice has expired.
26042  */
26043 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
26044
26045 /**
26046  * Returns whether the expiry time would pass at the given point in time.
26047  * `at_time` is the timestamp as a duration since the Unix epoch.
26048  */
26049 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
26050
26051 /**
26052  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
26053  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
26054  */
26055 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
26056
26057 /**
26058  * Returns a list of all routes included in the invoice
26059  */
26060 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
26061
26062 /**
26063  * Returns a list of all routes included in the invoice as the underlying hints
26064  */
26065 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
26066
26067 /**
26068  * Returns the currency for which the invoice was issued
26069  */
26070 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
26071
26072 /**
26073  * Returns the amount if specified in the invoice as millisatoshis.
26074  */
26075 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
26076
26077 /**
26078  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
26079  * returns `CreationError::DescriptionTooLong` otherwise
26080  *
26081  * Please note that single characters may use more than one byte due to UTF8 encoding.
26082  */
26083 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
26084
26085 /**
26086  * Returns the underlying description `String`
26087  */
26088 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
26089
26090 /**
26091  * Construct an `ExpiryTime` from seconds.
26092  */
26093 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
26094
26095 /**
26096  * Construct an `ExpiryTime` from a `Duration`.
26097  */
26098 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
26099
26100 /**
26101  * Returns the expiry time in seconds
26102  */
26103 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
26104
26105 /**
26106  * Returns a reference to the underlying `Duration` (=expiry time)
26107  */
26108 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
26109
26110 /**
26111  * Creates a new (partial) route from a list of hops
26112  */
26113 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
26114
26115 /**
26116  * Returns the underlying list of hops
26117  */
26118 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
26119
26120 /**
26121  * Creates a copy of the CreationError
26122  */
26123 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
26124
26125 /**
26126  * Utility method to constructs a new DescriptionTooLong-variant CreationError
26127  */
26128 enum LDKCreationError CreationError_description_too_long(void);
26129
26130 /**
26131  * Utility method to constructs a new RouteTooLong-variant CreationError
26132  */
26133 enum LDKCreationError CreationError_route_too_long(void);
26134
26135 /**
26136  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
26137  */
26138 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
26139
26140 /**
26141  * Utility method to constructs a new InvalidAmount-variant CreationError
26142  */
26143 enum LDKCreationError CreationError_invalid_amount(void);
26144
26145 /**
26146  * Utility method to constructs a new MissingRouteHints-variant CreationError
26147  */
26148 enum LDKCreationError CreationError_missing_route_hints(void);
26149
26150 /**
26151  * Checks if two CreationErrors contain equal inner contents.
26152  * This ignores pointers and is_owned flags and looks at the values in fields.
26153  */
26154 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
26155
26156 /**
26157  * Get the string representation of a CreationError object
26158  */
26159 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
26160
26161 /**
26162  * Creates a copy of the SemanticError
26163  */
26164 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
26165
26166 /**
26167  * Utility method to constructs a new NoPaymentHash-variant SemanticError
26168  */
26169 enum LDKSemanticError SemanticError_no_payment_hash(void);
26170
26171 /**
26172  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
26173  */
26174 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
26175
26176 /**
26177  * Utility method to constructs a new NoDescription-variant SemanticError
26178  */
26179 enum LDKSemanticError SemanticError_no_description(void);
26180
26181 /**
26182  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
26183  */
26184 enum LDKSemanticError SemanticError_multiple_descriptions(void);
26185
26186 /**
26187  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
26188  */
26189 enum LDKSemanticError SemanticError_no_payment_secret(void);
26190
26191 /**
26192  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
26193  */
26194 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
26195
26196 /**
26197  * Utility method to constructs a new InvalidFeatures-variant SemanticError
26198  */
26199 enum LDKSemanticError SemanticError_invalid_features(void);
26200
26201 /**
26202  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
26203  */
26204 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
26205
26206 /**
26207  * Utility method to constructs a new InvalidSignature-variant SemanticError
26208  */
26209 enum LDKSemanticError SemanticError_invalid_signature(void);
26210
26211 /**
26212  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
26213  */
26214 enum LDKSemanticError SemanticError_imprecise_amount(void);
26215
26216 /**
26217  * Checks if two SemanticErrors contain equal inner contents.
26218  * This ignores pointers and is_owned flags and looks at the values in fields.
26219  */
26220 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
26221
26222 /**
26223  * Get the string representation of a SemanticError object
26224  */
26225 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
26226
26227 /**
26228  * Frees any resources used by the SignOrCreationError
26229  */
26230 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
26231
26232 /**
26233  * Creates a copy of the SignOrCreationError
26234  */
26235 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
26236
26237 /**
26238  * Utility method to constructs a new SignError-variant SignOrCreationError
26239  */
26240 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
26241
26242 /**
26243  * Utility method to constructs a new CreationError-variant SignOrCreationError
26244  */
26245 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
26246
26247 /**
26248  * Checks if two SignOrCreationErrors contain equal inner contents.
26249  * This ignores pointers and is_owned flags and looks at the values in fields.
26250  */
26251 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
26252
26253 /**
26254  * Get the string representation of a SignOrCreationError object
26255  */
26256 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
26257
26258 /**
26259  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
26260  */
26261 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
26262
26263 /**
26264  * Calls the free function if one is set
26265  */
26266 void Payer_free(struct LDKPayer this_ptr);
26267
26268 /**
26269  * Calls the free function if one is set
26270  */
26271 void Router_free(struct LDKRouter this_ptr);
26272
26273 /**
26274  * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
26275  */
26276 void RetryAttempts_free(struct LDKRetryAttempts this_obj);
26277
26278 uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
26279
26280 void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
26281
26282 /**
26283  * Constructs a new RetryAttempts given each field
26284  */
26285 MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
26286
26287 /**
26288  * Creates a copy of the RetryAttempts
26289  */
26290 struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
26291
26292 /**
26293  * Checks if two RetryAttemptss contain equal inner contents.
26294  * This ignores pointers and is_owned flags and looks at the values in fields.
26295  * Two objects with NULL inner values will be considered "equal" here.
26296  */
26297 bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
26298
26299 /**
26300  * Checks if two RetryAttemptss contain equal inner contents.
26301  */
26302 uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
26303
26304 /**
26305  * Frees any resources used by the PaymentError
26306  */
26307 void PaymentError_free(struct LDKPaymentError this_ptr);
26308
26309 /**
26310  * Creates a copy of the PaymentError
26311  */
26312 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
26313
26314 /**
26315  * Utility method to constructs a new Invoice-variant PaymentError
26316  */
26317 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
26318
26319 /**
26320  * Utility method to constructs a new Routing-variant PaymentError
26321  */
26322 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
26323
26324 /**
26325  * Utility method to constructs a new Sending-variant PaymentError
26326  */
26327 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
26328
26329 /**
26330  * Creates an invoice payer that retries failed payment paths.
26331  *
26332  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
26333  * `retry_attempts` has been exceeded for a given [`Invoice`].
26334  */
26335 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);
26336
26337 /**
26338  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
26339  *
26340  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
26341  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
26342  * for you.
26343  */
26344 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
26345
26346 /**
26347  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
26348  * case a retry is needed.
26349  *
26350  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
26351  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
26352  * for you.
26353  */
26354 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);
26355
26356 /**
26357  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
26358  * case a retry is needed.
26359  *
26360  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
26361  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
26362  */
26363 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);
26364
26365 /**
26366  * Removes the payment cached by the given payment hash.
26367  *
26368  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
26369  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
26370  */
26371 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
26372
26373 /**
26374  * Constructs a new EventHandler which calls the relevant methods on this_arg.
26375  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
26376  */
26377 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
26378
26379 /**
26380  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
26381  * See [`PhantomKeysManager`] for more information on phantom node payments.
26382  *
26383  * `phantom_route_hints` parameter:
26384  * * Contains channel info for all nodes participating in the phantom invoice
26385  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
26386  *   participating node
26387  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
26388  *   updated when a channel becomes disabled or closes
26389  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
26390  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
26391  *   down
26392  *
26393  * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
26394  * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
26395  * participating node.
26396  *
26397  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
26398  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
26399  * requirement).
26400  *
26401  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
26402  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
26403  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
26404  */
26405 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);
26406
26407 /**
26408  * Utility to construct an invoice. Generally, unless you want to do something like a custom
26409  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
26410  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
26411  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
26412  * that the payment secret is valid when the invoice is paid.
26413  */
26414 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);
26415
26416 /**
26417  * See [`create_invoice_from_channelmanager`]
26418  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
26419  * available and the current time is supplied by the caller.
26420  */
26421 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);
26422
26423 /**
26424  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
26425  */
26426 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
26427
26428 /**
26429  * Creates a new router using the given [`NetworkGraph`] and  [`Logger`].
26430  */
26431 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
26432
26433 /**
26434  * Constructs a new Router which calls the relevant methods on this_arg.
26435  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
26436  */
26437 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
26438
26439 /**
26440  * Constructs a new Payer which calls the relevant methods on this_arg.
26441  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
26442  */
26443 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
26444
26445 /**
26446  * Read a SiPrefix object from a string
26447  */
26448 struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s);
26449
26450 /**
26451  * Read a Invoice object from a string
26452  */
26453 struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s);
26454
26455 /**
26456  * Read a SignedRawInvoice object from a string
26457  */
26458 struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s);
26459
26460 /**
26461  * Get the string representation of a Invoice object
26462  */
26463 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
26464
26465 /**
26466  * Get the string representation of a SignedRawInvoice object
26467  */
26468 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
26469
26470 /**
26471  * Get the string representation of a Currency object
26472  */
26473 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
26474
26475 /**
26476  * Get the string representation of a SiPrefix object
26477  */
26478 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
26479
26480 #endif /* LDK_C_BINDINGS_H */
26481
26482 #include "ldk_ver.h"