5a1ea3cf9428760df98636cde15f9487a4cfc78c
[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  * Represents an error returned from the bech32 library during validation of some bech32 data
464  */
465 typedef enum LDKBech32Error_Tag {
466    /**
467     * String does not contain the separator character
468     */
469    LDKBech32Error_MissingSeparator,
470    /**
471     * The checksum does not match the rest of the data
472     */
473    LDKBech32Error_InvalidChecksum,
474    /**
475     * The data or human-readable part is too long or too short
476     */
477    LDKBech32Error_InvalidLength,
478    /**
479     * Some part of the string contains an invalid character
480     */
481    LDKBech32Error_InvalidChar,
482    /**
483     * Some part of the data has an invalid value
484     */
485    LDKBech32Error_InvalidData,
486    /**
487     * The bit conversion failed due to a padding issue
488     */
489    LDKBech32Error_InvalidPadding,
490    /**
491     * The whole string must be of one case
492     */
493    LDKBech32Error_MixedCase,
494    /**
495     * Must be last for serialization purposes
496     */
497    LDKBech32Error_Sentinel,
498 } LDKBech32Error_Tag;
499
500 typedef struct LDKBech32Error {
501    LDKBech32Error_Tag tag;
502    union {
503       struct {
504          uint32_t invalid_char;
505       };
506       struct {
507          uint8_t invalid_data;
508       };
509    };
510 } LDKBech32Error;
511
512 /**
513  * A serialized transaction, in (pointer, length) form.
514  *
515  * This type optionally owns its own memory, and thus the semantics around access change based on
516  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
517  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
518  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
519  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
520  * you would be invalid.
521  *
522  * Note that, while it may change in the future, because transactions on the Rust side are stored
523  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
524  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
525  * `data_is_owned` either set or unset at your discretion.
526  */
527 typedef struct LDKTransaction {
528    /**
529     * The serialized transaction data.
530     *
531     * This is non-const for your convenience, an object passed to Rust is never written to.
532     */
533    uint8_t *data;
534    /**
535     * The length of the serialized transaction
536     */
537    uintptr_t datalen;
538    /**
539     * Whether the data pointed to by `data` should be freed or not.
540     */
541    bool data_is_owned;
542 } LDKTransaction;
543
544 /**
545  * A dynamically-allocated array of u8s of arbitrary size.
546  * This corresponds to std::vector in C++
547  */
548 typedef struct LDKCVec_u8Z {
549    /**
550     * The elements in the array.
551     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
552     */
553    uint8_t *data;
554    /**
555     * The number of elements pointed to by `data`.
556     */
557    uintptr_t datalen;
558 } LDKCVec_u8Z;
559
560 /**
561  * A transaction output including a scriptPubKey and value.
562  * This type *does* own its own memory, so must be free'd appropriately.
563  */
564 typedef struct LDKTxOut {
565    /**
566     * The script_pubkey in this output
567     */
568    struct LDKCVec_u8Z script_pubkey;
569    /**
570     * The value, in satoshis, of this output
571     */
572    uint64_t value;
573 } LDKTxOut;
574
575 /**
576  * The contents of CResult_NoneNoneZ
577  */
578 typedef union LDKCResult_NoneNoneZPtr {
579    /**
580     * Note that this value is always NULL, as there are no contents in the OK variant
581     */
582    void *result;
583    /**
584     * Note that this value is always NULL, as there are no contents in the Err variant
585     */
586    void *err;
587 } LDKCResult_NoneNoneZPtr;
588
589 /**
590  * A CResult_NoneNoneZ represents the result of a fallible operation,
591  * containing a () on success and a () on failure.
592  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
593  */
594 typedef struct LDKCResult_NoneNoneZ {
595    /**
596     * The contents of this CResult_NoneNoneZ, accessible via either
597     * `err` or `result` depending on the state of `result_ok`.
598     */
599    union LDKCResult_NoneNoneZPtr contents;
600    /**
601     * Whether this CResult_NoneNoneZ represents a success state.
602     */
603    bool result_ok;
604 } LDKCResult_NoneNoneZ;
605
606
607
608 /**
609  * Implements the per-commitment secret storage scheme from
610  * [BOLT 3](https://github.com/lightningnetwork/lightning-rfc/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
611  *
612  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
613  * or so.
614  */
615 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
616    /**
617     * A pointer to the opaque Rust object.
618     * Nearly everywhere, inner must be non-null, however in places where
619     * the Rust equivalent takes an Option, it may be set to null to indicate None.
620     */
621    LDKnativeCounterpartyCommitmentSecrets *inner;
622    /**
623     * Indicates that this is the only struct which contains the same pointer.
624     * Rust functions which take ownership of an object provided via an argument require
625     * this to be true and invalidate the object pointed to by inner.
626     */
627    bool is_owned;
628 } LDKCounterpartyCommitmentSecrets;
629
630
631
632 /**
633  * An error in decoding a message or struct.
634  */
635 typedef struct MUST_USE_STRUCT LDKDecodeError {
636    /**
637     * A pointer to the opaque Rust object.
638     * Nearly everywhere, inner must be non-null, however in places where
639     * the Rust equivalent takes an Option, it may be set to null to indicate None.
640     */
641    LDKnativeDecodeError *inner;
642    /**
643     * Indicates that this is the only struct which contains the same pointer.
644     * Rust functions which take ownership of an object provided via an argument require
645     * this to be true and invalidate the object pointed to by inner.
646     */
647    bool is_owned;
648 } LDKDecodeError;
649
650 /**
651  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
652  */
653 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
654    /**
655     * A pointer to the contents in the success state.
656     * Reading from this pointer when `result_ok` is not set is undefined.
657     */
658    struct LDKCounterpartyCommitmentSecrets *result;
659    /**
660     * A pointer to the contents in the error state.
661     * Reading from this pointer when `result_ok` is set is undefined.
662     */
663    struct LDKDecodeError *err;
664 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
665
666 /**
667  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
668  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
669  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
670  */
671 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
672    /**
673     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
674     * `err` or `result` depending on the state of `result_ok`.
675     */
676    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
677    /**
678     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
679     */
680    bool result_ok;
681 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
682
683 /**
684  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
685  */
686 typedef struct LDKSecretKey {
687    /**
688     * The bytes of the secret key
689     */
690    uint8_t bytes[32];
691 } LDKSecretKey;
692
693 /**
694  * The contents of CResult_SecretKeyErrorZ
695  */
696 typedef union LDKCResult_SecretKeyErrorZPtr {
697    /**
698     * A pointer to the contents in the success state.
699     * Reading from this pointer when `result_ok` is not set is undefined.
700     */
701    struct LDKSecretKey *result;
702    /**
703     * A pointer to the contents in the error state.
704     * Reading from this pointer when `result_ok` is set is undefined.
705     */
706    enum LDKSecp256k1Error *err;
707 } LDKCResult_SecretKeyErrorZPtr;
708
709 /**
710  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
711  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
712  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
713  */
714 typedef struct LDKCResult_SecretKeyErrorZ {
715    /**
716     * The contents of this CResult_SecretKeyErrorZ, accessible via either
717     * `err` or `result` depending on the state of `result_ok`.
718     */
719    union LDKCResult_SecretKeyErrorZPtr contents;
720    /**
721     * Whether this CResult_SecretKeyErrorZ represents a success state.
722     */
723    bool result_ok;
724 } LDKCResult_SecretKeyErrorZ;
725
726 /**
727  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
728  */
729 typedef struct LDKPublicKey {
730    /**
731     * The bytes of the public key
732     */
733    uint8_t compressed_form[33];
734 } LDKPublicKey;
735
736 /**
737  * The contents of CResult_PublicKeyErrorZ
738  */
739 typedef union LDKCResult_PublicKeyErrorZPtr {
740    /**
741     * A pointer to the contents in the success state.
742     * Reading from this pointer when `result_ok` is not set is undefined.
743     */
744    struct LDKPublicKey *result;
745    /**
746     * A pointer to the contents in the error state.
747     * Reading from this pointer when `result_ok` is set is undefined.
748     */
749    enum LDKSecp256k1Error *err;
750 } LDKCResult_PublicKeyErrorZPtr;
751
752 /**
753  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
754  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
755  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
756  */
757 typedef struct LDKCResult_PublicKeyErrorZ {
758    /**
759     * The contents of this CResult_PublicKeyErrorZ, accessible via either
760     * `err` or `result` depending on the state of `result_ok`.
761     */
762    union LDKCResult_PublicKeyErrorZPtr contents;
763    /**
764     * Whether this CResult_PublicKeyErrorZ represents a success state.
765     */
766    bool result_ok;
767 } LDKCResult_PublicKeyErrorZ;
768
769
770
771 /**
772  * The set of public keys which are used in the creation of one commitment transaction.
773  * These are derived from the channel base keys and per-commitment data.
774  *
775  * A broadcaster key is provided from potential broadcaster of the computed transaction.
776  * A countersignatory key is coming from a protocol participant unable to broadcast the
777  * transaction.
778  *
779  * These keys are assumed to be good, either because the code derived them from
780  * channel basepoints via the new function, or they were obtained via
781  * CommitmentTransaction.trust().keys() because we trusted the source of the
782  * pre-calculated keys.
783  */
784 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
785    /**
786     * A pointer to the opaque Rust object.
787     * Nearly everywhere, inner must be non-null, however in places where
788     * the Rust equivalent takes an Option, it may be set to null to indicate None.
789     */
790    LDKnativeTxCreationKeys *inner;
791    /**
792     * Indicates that this is the only struct which contains the same pointer.
793     * Rust functions which take ownership of an object provided via an argument require
794     * this to be true and invalidate the object pointed to by inner.
795     */
796    bool is_owned;
797 } LDKTxCreationKeys;
798
799 /**
800  * The contents of CResult_TxCreationKeysDecodeErrorZ
801  */
802 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
803    /**
804     * A pointer to the contents in the success state.
805     * Reading from this pointer when `result_ok` is not set is undefined.
806     */
807    struct LDKTxCreationKeys *result;
808    /**
809     * A pointer to the contents in the error state.
810     * Reading from this pointer when `result_ok` is set is undefined.
811     */
812    struct LDKDecodeError *err;
813 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
814
815 /**
816  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
817  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
818  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
819  */
820 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
821    /**
822     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
823     * `err` or `result` depending on the state of `result_ok`.
824     */
825    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
826    /**
827     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
828     */
829    bool result_ok;
830 } LDKCResult_TxCreationKeysDecodeErrorZ;
831
832
833
834 /**
835  * One counterparty's public keys which do not change over the life of a channel.
836  */
837 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
838    /**
839     * A pointer to the opaque Rust object.
840     * Nearly everywhere, inner must be non-null, however in places where
841     * the Rust equivalent takes an Option, it may be set to null to indicate None.
842     */
843    LDKnativeChannelPublicKeys *inner;
844    /**
845     * Indicates that this is the only struct which contains the same pointer.
846     * Rust functions which take ownership of an object provided via an argument require
847     * this to be true and invalidate the object pointed to by inner.
848     */
849    bool is_owned;
850 } LDKChannelPublicKeys;
851
852 /**
853  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
854  */
855 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
856    /**
857     * A pointer to the contents in the success state.
858     * Reading from this pointer when `result_ok` is not set is undefined.
859     */
860    struct LDKChannelPublicKeys *result;
861    /**
862     * A pointer to the contents in the error state.
863     * Reading from this pointer when `result_ok` is set is undefined.
864     */
865    struct LDKDecodeError *err;
866 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
867
868 /**
869  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
870  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
871  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
872  */
873 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
874    /**
875     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
876     * `err` or `result` depending on the state of `result_ok`.
877     */
878    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
879    /**
880     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
881     */
882    bool result_ok;
883 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
884
885 /**
886  * The contents of CResult_TxCreationKeysErrorZ
887  */
888 typedef union LDKCResult_TxCreationKeysErrorZPtr {
889    /**
890     * A pointer to the contents in the success state.
891     * Reading from this pointer when `result_ok` is not set is undefined.
892     */
893    struct LDKTxCreationKeys *result;
894    /**
895     * A pointer to the contents in the error state.
896     * Reading from this pointer when `result_ok` is set is undefined.
897     */
898    enum LDKSecp256k1Error *err;
899 } LDKCResult_TxCreationKeysErrorZPtr;
900
901 /**
902  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
903  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
904  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
905  */
906 typedef struct LDKCResult_TxCreationKeysErrorZ {
907    /**
908     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
909     * `err` or `result` depending on the state of `result_ok`.
910     */
911    union LDKCResult_TxCreationKeysErrorZPtr contents;
912    /**
913     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
914     */
915    bool result_ok;
916 } LDKCResult_TxCreationKeysErrorZ;
917
918 /**
919  * An enum which can either contain a u32 or not
920  */
921 typedef enum LDKCOption_u32Z_Tag {
922    /**
923     * When we're in this state, this COption_u32Z contains a u32
924     */
925    LDKCOption_u32Z_Some,
926    /**
927     * When we're in this state, this COption_u32Z contains nothing
928     */
929    LDKCOption_u32Z_None,
930    /**
931     * Must be last for serialization purposes
932     */
933    LDKCOption_u32Z_Sentinel,
934 } LDKCOption_u32Z_Tag;
935
936 typedef struct LDKCOption_u32Z {
937    LDKCOption_u32Z_Tag tag;
938    union {
939       struct {
940          uint32_t some;
941       };
942    };
943 } LDKCOption_u32Z;
944
945
946
947 /**
948  * Information about an HTLC as it appears in a commitment transaction
949  */
950 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
951    /**
952     * A pointer to the opaque Rust object.
953     * Nearly everywhere, inner must be non-null, however in places where
954     * the Rust equivalent takes an Option, it may be set to null to indicate None.
955     */
956    LDKnativeHTLCOutputInCommitment *inner;
957    /**
958     * Indicates that this is the only struct which contains the same pointer.
959     * Rust functions which take ownership of an object provided via an argument require
960     * this to be true and invalidate the object pointed to by inner.
961     */
962    bool is_owned;
963 } LDKHTLCOutputInCommitment;
964
965 /**
966  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
967  */
968 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
969    /**
970     * A pointer to the contents in the success state.
971     * Reading from this pointer when `result_ok` is not set is undefined.
972     */
973    struct LDKHTLCOutputInCommitment *result;
974    /**
975     * A pointer to the contents in the error state.
976     * Reading from this pointer when `result_ok` is set is undefined.
977     */
978    struct LDKDecodeError *err;
979 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
980
981 /**
982  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
983  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
984  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
985  */
986 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
987    /**
988     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
989     * `err` or `result` depending on the state of `result_ok`.
990     */
991    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
992    /**
993     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
994     */
995    bool result_ok;
996 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
997
998
999
1000 /**
1001  * Late-bound per-channel counterparty data used to build transactions.
1002  */
1003 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
1004    /**
1005     * A pointer to the opaque Rust object.
1006     * Nearly everywhere, inner must be non-null, however in places where
1007     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1008     */
1009    LDKnativeCounterpartyChannelTransactionParameters *inner;
1010    /**
1011     * Indicates that this is the only struct which contains the same pointer.
1012     * Rust functions which take ownership of an object provided via an argument require
1013     * this to be true and invalidate the object pointed to by inner.
1014     */
1015    bool is_owned;
1016 } LDKCounterpartyChannelTransactionParameters;
1017
1018 /**
1019  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1020  */
1021 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1022    /**
1023     * A pointer to the contents in the success state.
1024     * Reading from this pointer when `result_ok` is not set is undefined.
1025     */
1026    struct LDKCounterpartyChannelTransactionParameters *result;
1027    /**
1028     * A pointer to the contents in the error state.
1029     * Reading from this pointer when `result_ok` is set is undefined.
1030     */
1031    struct LDKDecodeError *err;
1032 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
1033
1034 /**
1035  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1036  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1037  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1038  */
1039 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1040    /**
1041     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1042     * `err` or `result` depending on the state of `result_ok`.
1043     */
1044    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
1045    /**
1046     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1047     */
1048    bool result_ok;
1049 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
1050
1051
1052
1053 /**
1054  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1055  * The fields are organized by holder/counterparty.
1056  *
1057  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1058  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1059  */
1060 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1061    /**
1062     * A pointer to the opaque Rust object.
1063     * Nearly everywhere, inner must be non-null, however in places where
1064     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1065     */
1066    LDKnativeChannelTransactionParameters *inner;
1067    /**
1068     * Indicates that this is the only struct which contains the same pointer.
1069     * Rust functions which take ownership of an object provided via an argument require
1070     * this to be true and invalidate the object pointed to by inner.
1071     */
1072    bool is_owned;
1073 } LDKChannelTransactionParameters;
1074
1075 /**
1076  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1077  */
1078 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
1079    /**
1080     * A pointer to the contents in the success state.
1081     * Reading from this pointer when `result_ok` is not set is undefined.
1082     */
1083    struct LDKChannelTransactionParameters *result;
1084    /**
1085     * A pointer to the contents in the error state.
1086     * Reading from this pointer when `result_ok` is set is undefined.
1087     */
1088    struct LDKDecodeError *err;
1089 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
1090
1091 /**
1092  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1093  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1094  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1095  */
1096 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1097    /**
1098     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1099     * `err` or `result` depending on the state of `result_ok`.
1100     */
1101    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1102    /**
1103     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1104     */
1105    bool result_ok;
1106 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1107
1108 /**
1109  * Represents a secp256k1 signature serialized as two 32-byte numbers
1110  */
1111 typedef struct LDKSignature {
1112    /**
1113     * The bytes of the signature in "compact" form
1114     */
1115    uint8_t compact_form[64];
1116 } LDKSignature;
1117
1118 /**
1119  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1120  * This corresponds to std::vector in C++
1121  */
1122 typedef struct LDKCVec_SignatureZ {
1123    /**
1124     * The elements in the array.
1125     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1126     */
1127    struct LDKSignature *data;
1128    /**
1129     * The number of elements pointed to by `data`.
1130     */
1131    uintptr_t datalen;
1132 } LDKCVec_SignatureZ;
1133
1134
1135
1136 /**
1137  * Information needed to build and sign a holder's commitment transaction.
1138  *
1139  * The transaction is only signed once we are ready to broadcast.
1140  */
1141 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1142    /**
1143     * A pointer to the opaque Rust object.
1144     * Nearly everywhere, inner must be non-null, however in places where
1145     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1146     */
1147    LDKnativeHolderCommitmentTransaction *inner;
1148    /**
1149     * Indicates that this is the only struct which contains the same pointer.
1150     * Rust functions which take ownership of an object provided via an argument require
1151     * this to be true and invalidate the object pointed to by inner.
1152     */
1153    bool is_owned;
1154 } LDKHolderCommitmentTransaction;
1155
1156 /**
1157  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1158  */
1159 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1160    /**
1161     * A pointer to the contents in the success state.
1162     * Reading from this pointer when `result_ok` is not set is undefined.
1163     */
1164    struct LDKHolderCommitmentTransaction *result;
1165    /**
1166     * A pointer to the contents in the error state.
1167     * Reading from this pointer when `result_ok` is set is undefined.
1168     */
1169    struct LDKDecodeError *err;
1170 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1171
1172 /**
1173  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1174  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1175  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1176  */
1177 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1178    /**
1179     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1180     * `err` or `result` depending on the state of `result_ok`.
1181     */
1182    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1183    /**
1184     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1185     */
1186    bool result_ok;
1187 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1188
1189
1190
1191 /**
1192  * A pre-built Bitcoin commitment transaction and its txid.
1193  */
1194 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1195    /**
1196     * A pointer to the opaque Rust object.
1197     * Nearly everywhere, inner must be non-null, however in places where
1198     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1199     */
1200    LDKnativeBuiltCommitmentTransaction *inner;
1201    /**
1202     * Indicates that this is the only struct which contains the same pointer.
1203     * Rust functions which take ownership of an object provided via an argument require
1204     * this to be true and invalidate the object pointed to by inner.
1205     */
1206    bool is_owned;
1207 } LDKBuiltCommitmentTransaction;
1208
1209 /**
1210  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1211  */
1212 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1213    /**
1214     * A pointer to the contents in the success state.
1215     * Reading from this pointer when `result_ok` is not set is undefined.
1216     */
1217    struct LDKBuiltCommitmentTransaction *result;
1218    /**
1219     * A pointer to the contents in the error state.
1220     * Reading from this pointer when `result_ok` is set is undefined.
1221     */
1222    struct LDKDecodeError *err;
1223 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1224
1225 /**
1226  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1227  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1228  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1229  */
1230 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1231    /**
1232     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1233     * `err` or `result` depending on the state of `result_ok`.
1234     */
1235    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1236    /**
1237     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1238     */
1239    bool result_ok;
1240 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1241
1242
1243
1244 /**
1245  * A wrapper on ClosingTransaction indicating that the built bitcoin
1246  * transaction is trusted.
1247  *
1248  * See trust() and verify() functions on CommitmentTransaction.
1249  *
1250  * This structure implements Deref.
1251  */
1252 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1253    /**
1254     * A pointer to the opaque Rust object.
1255     * Nearly everywhere, inner must be non-null, however in places where
1256     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1257     */
1258    LDKnativeTrustedClosingTransaction *inner;
1259    /**
1260     * Indicates that this is the only struct which contains the same pointer.
1261     * Rust functions which take ownership of an object provided via an argument require
1262     * this to be true and invalidate the object pointed to by inner.
1263     */
1264    bool is_owned;
1265 } LDKTrustedClosingTransaction;
1266
1267 /**
1268  * The contents of CResult_TrustedClosingTransactionNoneZ
1269  */
1270 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1271    /**
1272     * A pointer to the contents in the success state.
1273     * Reading from this pointer when `result_ok` is not set is undefined.
1274     */
1275    struct LDKTrustedClosingTransaction *result;
1276    /**
1277     * Note that this value is always NULL, as there are no contents in the Err variant
1278     */
1279    void *err;
1280 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1281
1282 /**
1283  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1284  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1285  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1286  */
1287 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1288    /**
1289     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1290     * `err` or `result` depending on the state of `result_ok`.
1291     */
1292    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1293    /**
1294     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1295     */
1296    bool result_ok;
1297 } LDKCResult_TrustedClosingTransactionNoneZ;
1298
1299
1300
1301 /**
1302  * This class tracks the per-transaction information needed to build a commitment transaction and will
1303  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1304  * and for transactions we sign for the counterparty.
1305  *
1306  * This class can be used inside a signer implementation to generate a signature given the relevant
1307  * secret key.
1308  */
1309 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1310    /**
1311     * A pointer to the opaque Rust object.
1312     * Nearly everywhere, inner must be non-null, however in places where
1313     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1314     */
1315    LDKnativeCommitmentTransaction *inner;
1316    /**
1317     * Indicates that this is the only struct which contains the same pointer.
1318     * Rust functions which take ownership of an object provided via an argument require
1319     * this to be true and invalidate the object pointed to by inner.
1320     */
1321    bool is_owned;
1322 } LDKCommitmentTransaction;
1323
1324 /**
1325  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1326  */
1327 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1328    /**
1329     * A pointer to the contents in the success state.
1330     * Reading from this pointer when `result_ok` is not set is undefined.
1331     */
1332    struct LDKCommitmentTransaction *result;
1333    /**
1334     * A pointer to the contents in the error state.
1335     * Reading from this pointer when `result_ok` is set is undefined.
1336     */
1337    struct LDKDecodeError *err;
1338 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1339
1340 /**
1341  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1342  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1343  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1344  */
1345 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1346    /**
1347     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1348     * `err` or `result` depending on the state of `result_ok`.
1349     */
1350    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1351    /**
1352     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1353     */
1354    bool result_ok;
1355 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1356
1357
1358
1359 /**
1360  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1361  * transaction and the transaction creation keys) are trusted.
1362  *
1363  * See trust() and verify() functions on CommitmentTransaction.
1364  *
1365  * This structure implements Deref.
1366  */
1367 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1368    /**
1369     * A pointer to the opaque Rust object.
1370     * Nearly everywhere, inner must be non-null, however in places where
1371     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1372     */
1373    LDKnativeTrustedCommitmentTransaction *inner;
1374    /**
1375     * Indicates that this is the only struct which contains the same pointer.
1376     * Rust functions which take ownership of an object provided via an argument require
1377     * this to be true and invalidate the object pointed to by inner.
1378     */
1379    bool is_owned;
1380 } LDKTrustedCommitmentTransaction;
1381
1382 /**
1383  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1384  */
1385 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1386    /**
1387     * A pointer to the contents in the success state.
1388     * Reading from this pointer when `result_ok` is not set is undefined.
1389     */
1390    struct LDKTrustedCommitmentTransaction *result;
1391    /**
1392     * Note that this value is always NULL, as there are no contents in the Err variant
1393     */
1394    void *err;
1395 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1396
1397 /**
1398  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1399  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1400  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1401  */
1402 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1403    /**
1404     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1405     * `err` or `result` depending on the state of `result_ok`.
1406     */
1407    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1408    /**
1409     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1410     */
1411    bool result_ok;
1412 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1413
1414 /**
1415  * The contents of CResult_CVec_SignatureZNoneZ
1416  */
1417 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1418    /**
1419     * A pointer to the contents in the success state.
1420     * Reading from this pointer when `result_ok` is not set is undefined.
1421     */
1422    struct LDKCVec_SignatureZ *result;
1423    /**
1424     * Note that this value is always NULL, as there are no contents in the Err variant
1425     */
1426    void *err;
1427 } LDKCResult_CVec_SignatureZNoneZPtr;
1428
1429 /**
1430  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1431  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1432  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1433  */
1434 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1435    /**
1436     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1437     * `err` or `result` depending on the state of `result_ok`.
1438     */
1439    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1440    /**
1441     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1442     */
1443    bool result_ok;
1444 } LDKCResult_CVec_SignatureZNoneZ;
1445
1446
1447
1448 /**
1449  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1450  *
1451  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
1452  */
1453 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1454    /**
1455     * A pointer to the opaque Rust object.
1456     * Nearly everywhere, inner must be non-null, however in places where
1457     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1458     */
1459    LDKnativeShutdownScript *inner;
1460    /**
1461     * Indicates that this is the only struct which contains the same pointer.
1462     * Rust functions which take ownership of an object provided via an argument require
1463     * this to be true and invalidate the object pointed to by inner.
1464     */
1465    bool is_owned;
1466 } LDKShutdownScript;
1467
1468 /**
1469  * The contents of CResult_ShutdownScriptDecodeErrorZ
1470  */
1471 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1472    /**
1473     * A pointer to the contents in the success state.
1474     * Reading from this pointer when `result_ok` is not set is undefined.
1475     */
1476    struct LDKShutdownScript *result;
1477    /**
1478     * A pointer to the contents in the error state.
1479     * Reading from this pointer when `result_ok` is set is undefined.
1480     */
1481    struct LDKDecodeError *err;
1482 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1483
1484 /**
1485  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1486  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1487  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1488  */
1489 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1490    /**
1491     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1492     * `err` or `result` depending on the state of `result_ok`.
1493     */
1494    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1495    /**
1496     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1497     */
1498    bool result_ok;
1499 } LDKCResult_ShutdownScriptDecodeErrorZ;
1500
1501
1502
1503 /**
1504  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1505  */
1506 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1507    /**
1508     * A pointer to the opaque Rust object.
1509     * Nearly everywhere, inner must be non-null, however in places where
1510     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1511     */
1512    LDKnativeInvalidShutdownScript *inner;
1513    /**
1514     * Indicates that this is the only struct which contains the same pointer.
1515     * Rust functions which take ownership of an object provided via an argument require
1516     * this to be true and invalidate the object pointed to by inner.
1517     */
1518    bool is_owned;
1519 } LDKInvalidShutdownScript;
1520
1521 /**
1522  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1523  */
1524 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1525    /**
1526     * A pointer to the contents in the success state.
1527     * Reading from this pointer when `result_ok` is not set is undefined.
1528     */
1529    struct LDKShutdownScript *result;
1530    /**
1531     * A pointer to the contents in the error state.
1532     * Reading from this pointer when `result_ok` is set is undefined.
1533     */
1534    struct LDKInvalidShutdownScript *err;
1535 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1536
1537 /**
1538  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1539  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1540  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1541  */
1542 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1543    /**
1544     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1545     * `err` or `result` depending on the state of `result_ok`.
1546     */
1547    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1548    /**
1549     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1550     */
1551    bool result_ok;
1552 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1553
1554 /**
1555  * The contents of CResult_NoneErrorZ
1556  */
1557 typedef union LDKCResult_NoneErrorZPtr {
1558    /**
1559     * Note that this value is always NULL, as there are no contents in the OK variant
1560     */
1561    void *result;
1562    /**
1563     * A pointer to the contents in the error state.
1564     * Reading from this pointer when `result_ok` is set is undefined.
1565     */
1566    enum LDKIOError *err;
1567 } LDKCResult_NoneErrorZPtr;
1568
1569 /**
1570  * A CResult_NoneErrorZ represents the result of a fallible operation,
1571  * containing a () on success and a crate::c_types::IOError on failure.
1572  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1573  */
1574 typedef struct LDKCResult_NoneErrorZ {
1575    /**
1576     * The contents of this CResult_NoneErrorZ, accessible via either
1577     * `err` or `result` depending on the state of `result_ok`.
1578     */
1579    union LDKCResult_NoneErrorZPtr contents;
1580    /**
1581     * Whether this CResult_NoneErrorZ represents a success state.
1582     */
1583    bool result_ok;
1584 } LDKCResult_NoneErrorZ;
1585
1586
1587
1588 /**
1589  * A hop in a route
1590  */
1591 typedef struct MUST_USE_STRUCT LDKRouteHop {
1592    /**
1593     * A pointer to the opaque Rust object.
1594     * Nearly everywhere, inner must be non-null, however in places where
1595     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1596     */
1597    LDKnativeRouteHop *inner;
1598    /**
1599     * Indicates that this is the only struct which contains the same pointer.
1600     * Rust functions which take ownership of an object provided via an argument require
1601     * this to be true and invalidate the object pointed to by inner.
1602     */
1603    bool is_owned;
1604 } LDKRouteHop;
1605
1606 /**
1607  * The contents of CResult_RouteHopDecodeErrorZ
1608  */
1609 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1610    /**
1611     * A pointer to the contents in the success state.
1612     * Reading from this pointer when `result_ok` is not set is undefined.
1613     */
1614    struct LDKRouteHop *result;
1615    /**
1616     * A pointer to the contents in the error state.
1617     * Reading from this pointer when `result_ok` is set is undefined.
1618     */
1619    struct LDKDecodeError *err;
1620 } LDKCResult_RouteHopDecodeErrorZPtr;
1621
1622 /**
1623  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1624  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1625  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1626  */
1627 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1628    /**
1629     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1630     * `err` or `result` depending on the state of `result_ok`.
1631     */
1632    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1633    /**
1634     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1635     */
1636    bool result_ok;
1637 } LDKCResult_RouteHopDecodeErrorZ;
1638
1639 /**
1640  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1641  * This corresponds to std::vector in C++
1642  */
1643 typedef struct LDKCVec_RouteHopZ {
1644    /**
1645     * The elements in the array.
1646     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1647     */
1648    struct LDKRouteHop *data;
1649    /**
1650     * The number of elements pointed to by `data`.
1651     */
1652    uintptr_t datalen;
1653 } LDKCVec_RouteHopZ;
1654
1655 /**
1656  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1657  * This corresponds to std::vector in C++
1658  */
1659 typedef struct LDKCVec_CVec_RouteHopZZ {
1660    /**
1661     * The elements in the array.
1662     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1663     */
1664    struct LDKCVec_RouteHopZ *data;
1665    /**
1666     * The number of elements pointed to by `data`.
1667     */
1668    uintptr_t datalen;
1669 } LDKCVec_CVec_RouteHopZZ;
1670
1671
1672
1673 /**
1674  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1675  * it can take multiple paths. Each path is composed of one or more hops through the network.
1676  */
1677 typedef struct MUST_USE_STRUCT LDKRoute {
1678    /**
1679     * A pointer to the opaque Rust object.
1680     * Nearly everywhere, inner must be non-null, however in places where
1681     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1682     */
1683    LDKnativeRoute *inner;
1684    /**
1685     * Indicates that this is the only struct which contains the same pointer.
1686     * Rust functions which take ownership of an object provided via an argument require
1687     * this to be true and invalidate the object pointed to by inner.
1688     */
1689    bool is_owned;
1690 } LDKRoute;
1691
1692 /**
1693  * The contents of CResult_RouteDecodeErrorZ
1694  */
1695 typedef union LDKCResult_RouteDecodeErrorZPtr {
1696    /**
1697     * A pointer to the contents in the success state.
1698     * Reading from this pointer when `result_ok` is not set is undefined.
1699     */
1700    struct LDKRoute *result;
1701    /**
1702     * A pointer to the contents in the error state.
1703     * Reading from this pointer when `result_ok` is set is undefined.
1704     */
1705    struct LDKDecodeError *err;
1706 } LDKCResult_RouteDecodeErrorZPtr;
1707
1708 /**
1709  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1710  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1711  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1712  */
1713 typedef struct LDKCResult_RouteDecodeErrorZ {
1714    /**
1715     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1716     * `err` or `result` depending on the state of `result_ok`.
1717     */
1718    union LDKCResult_RouteDecodeErrorZPtr contents;
1719    /**
1720     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1721     */
1722    bool result_ok;
1723 } LDKCResult_RouteDecodeErrorZ;
1724
1725
1726
1727 /**
1728  * Parameters needed to find a [`Route`].
1729  *
1730  * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed
1731  * payment path.
1732  *
1733  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
1734  */
1735 typedef struct MUST_USE_STRUCT LDKRouteParameters {
1736    /**
1737     * A pointer to the opaque Rust object.
1738     * Nearly everywhere, inner must be non-null, however in places where
1739     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1740     */
1741    LDKnativeRouteParameters *inner;
1742    /**
1743     * Indicates that this is the only struct which contains the same pointer.
1744     * Rust functions which take ownership of an object provided via an argument require
1745     * this to be true and invalidate the object pointed to by inner.
1746     */
1747    bool is_owned;
1748 } LDKRouteParameters;
1749
1750 /**
1751  * The contents of CResult_RouteParametersDecodeErrorZ
1752  */
1753 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
1754    /**
1755     * A pointer to the contents in the success state.
1756     * Reading from this pointer when `result_ok` is not set is undefined.
1757     */
1758    struct LDKRouteParameters *result;
1759    /**
1760     * A pointer to the contents in the error state.
1761     * Reading from this pointer when `result_ok` is set is undefined.
1762     */
1763    struct LDKDecodeError *err;
1764 } LDKCResult_RouteParametersDecodeErrorZPtr;
1765
1766 /**
1767  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1768  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1769  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1770  */
1771 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
1772    /**
1773     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1774     * `err` or `result` depending on the state of `result_ok`.
1775     */
1776    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
1777    /**
1778     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1779     */
1780    bool result_ok;
1781 } LDKCResult_RouteParametersDecodeErrorZ;
1782
1783
1784
1785 /**
1786  * A list of hops along a payment path terminating with a channel to the recipient.
1787  */
1788 typedef struct MUST_USE_STRUCT LDKRouteHint {
1789    /**
1790     * A pointer to the opaque Rust object.
1791     * Nearly everywhere, inner must be non-null, however in places where
1792     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1793     */
1794    LDKnativeRouteHint *inner;
1795    /**
1796     * Indicates that this is the only struct which contains the same pointer.
1797     * Rust functions which take ownership of an object provided via an argument require
1798     * this to be true and invalidate the object pointed to by inner.
1799     */
1800    bool is_owned;
1801 } LDKRouteHint;
1802
1803 /**
1804  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1805  * This corresponds to std::vector in C++
1806  */
1807 typedef struct LDKCVec_RouteHintZ {
1808    /**
1809     * The elements in the array.
1810     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1811     */
1812    struct LDKRouteHint *data;
1813    /**
1814     * The number of elements pointed to by `data`.
1815     */
1816    uintptr_t datalen;
1817 } LDKCVec_RouteHintZ;
1818
1819 /**
1820  * An enum which can either contain a u64 or not
1821  */
1822 typedef enum LDKCOption_u64Z_Tag {
1823    /**
1824     * When we're in this state, this COption_u64Z contains a u64
1825     */
1826    LDKCOption_u64Z_Some,
1827    /**
1828     * When we're in this state, this COption_u64Z contains nothing
1829     */
1830    LDKCOption_u64Z_None,
1831    /**
1832     * Must be last for serialization purposes
1833     */
1834    LDKCOption_u64Z_Sentinel,
1835 } LDKCOption_u64Z_Tag;
1836
1837 typedef struct LDKCOption_u64Z {
1838    LDKCOption_u64Z_Tag tag;
1839    union {
1840       struct {
1841          uint64_t some;
1842       };
1843    };
1844 } LDKCOption_u64Z;
1845
1846
1847
1848 /**
1849  * The recipient of a payment.
1850  */
1851 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
1852    /**
1853     * A pointer to the opaque Rust object.
1854     * Nearly everywhere, inner must be non-null, however in places where
1855     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1856     */
1857    LDKnativePaymentParameters *inner;
1858    /**
1859     * Indicates that this is the only struct which contains the same pointer.
1860     * Rust functions which take ownership of an object provided via an argument require
1861     * this to be true and invalidate the object pointed to by inner.
1862     */
1863    bool is_owned;
1864 } LDKPaymentParameters;
1865
1866 /**
1867  * The contents of CResult_PaymentParametersDecodeErrorZ
1868  */
1869 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
1870    /**
1871     * A pointer to the contents in the success state.
1872     * Reading from this pointer when `result_ok` is not set is undefined.
1873     */
1874    struct LDKPaymentParameters *result;
1875    /**
1876     * A pointer to the contents in the error state.
1877     * Reading from this pointer when `result_ok` is set is undefined.
1878     */
1879    struct LDKDecodeError *err;
1880 } LDKCResult_PaymentParametersDecodeErrorZPtr;
1881
1882 /**
1883  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
1884  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1885  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1886  */
1887 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
1888    /**
1889     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
1890     * `err` or `result` depending on the state of `result_ok`.
1891     */
1892    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
1893    /**
1894     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
1895     */
1896    bool result_ok;
1897 } LDKCResult_PaymentParametersDecodeErrorZ;
1898
1899
1900
1901 /**
1902  * A channel descriptor for a hop along a payment path.
1903  */
1904 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1905    /**
1906     * A pointer to the opaque Rust object.
1907     * Nearly everywhere, inner must be non-null, however in places where
1908     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1909     */
1910    LDKnativeRouteHintHop *inner;
1911    /**
1912     * Indicates that this is the only struct which contains the same pointer.
1913     * Rust functions which take ownership of an object provided via an argument require
1914     * this to be true and invalidate the object pointed to by inner.
1915     */
1916    bool is_owned;
1917 } LDKRouteHintHop;
1918
1919 /**
1920  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1921  * This corresponds to std::vector in C++
1922  */
1923 typedef struct LDKCVec_RouteHintHopZ {
1924    /**
1925     * The elements in the array.
1926     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1927     */
1928    struct LDKRouteHintHop *data;
1929    /**
1930     * The number of elements pointed to by `data`.
1931     */
1932    uintptr_t datalen;
1933 } LDKCVec_RouteHintHopZ;
1934
1935 /**
1936  * The contents of CResult_RouteHintDecodeErrorZ
1937  */
1938 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
1939    /**
1940     * A pointer to the contents in the success state.
1941     * Reading from this pointer when `result_ok` is not set is undefined.
1942     */
1943    struct LDKRouteHint *result;
1944    /**
1945     * A pointer to the contents in the error state.
1946     * Reading from this pointer when `result_ok` is set is undefined.
1947     */
1948    struct LDKDecodeError *err;
1949 } LDKCResult_RouteHintDecodeErrorZPtr;
1950
1951 /**
1952  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
1953  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
1954  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1955  */
1956 typedef struct LDKCResult_RouteHintDecodeErrorZ {
1957    /**
1958     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
1959     * `err` or `result` depending on the state of `result_ok`.
1960     */
1961    union LDKCResult_RouteHintDecodeErrorZPtr contents;
1962    /**
1963     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
1964     */
1965    bool result_ok;
1966 } LDKCResult_RouteHintDecodeErrorZ;
1967
1968 /**
1969  * The contents of CResult_RouteHintHopDecodeErrorZ
1970  */
1971 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
1972    /**
1973     * A pointer to the contents in the success state.
1974     * Reading from this pointer when `result_ok` is not set is undefined.
1975     */
1976    struct LDKRouteHintHop *result;
1977    /**
1978     * A pointer to the contents in the error state.
1979     * Reading from this pointer when `result_ok` is set is undefined.
1980     */
1981    struct LDKDecodeError *err;
1982 } LDKCResult_RouteHintHopDecodeErrorZPtr;
1983
1984 /**
1985  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
1986  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1987  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1988  */
1989 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
1990    /**
1991     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
1992     * `err` or `result` depending on the state of `result_ok`.
1993     */
1994    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
1995    /**
1996     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
1997     */
1998    bool result_ok;
1999 } LDKCResult_RouteHintHopDecodeErrorZ;
2000
2001
2002
2003 /**
2004  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2005  */
2006 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2007    /**
2008     * A pointer to the opaque Rust object.
2009     * Nearly everywhere, inner must be non-null, however in places where
2010     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2011     */
2012    LDKnativeChannelDetails *inner;
2013    /**
2014     * Indicates that this is the only struct which contains the same pointer.
2015     * Rust functions which take ownership of an object provided via an argument require
2016     * this to be true and invalidate the object pointed to by inner.
2017     */
2018    bool is_owned;
2019 } LDKChannelDetails;
2020
2021 /**
2022  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2023  * This corresponds to std::vector in C++
2024  */
2025 typedef struct LDKCVec_ChannelDetailsZ {
2026    /**
2027     * The elements in the array.
2028     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2029     */
2030    struct LDKChannelDetails *data;
2031    /**
2032     * The number of elements pointed to by `data`.
2033     */
2034    uintptr_t datalen;
2035 } LDKCVec_ChannelDetailsZ;
2036
2037
2038
2039 /**
2040  * An Err type for failure to process messages.
2041  */
2042 typedef struct MUST_USE_STRUCT LDKLightningError {
2043    /**
2044     * A pointer to the opaque Rust object.
2045     * Nearly everywhere, inner must be non-null, however in places where
2046     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2047     */
2048    LDKnativeLightningError *inner;
2049    /**
2050     * Indicates that this is the only struct which contains the same pointer.
2051     * Rust functions which take ownership of an object provided via an argument require
2052     * this to be true and invalidate the object pointed to by inner.
2053     */
2054    bool is_owned;
2055 } LDKLightningError;
2056
2057 /**
2058  * The contents of CResult_RouteLightningErrorZ
2059  */
2060 typedef union LDKCResult_RouteLightningErrorZPtr {
2061    /**
2062     * A pointer to the contents in the success state.
2063     * Reading from this pointer when `result_ok` is not set is undefined.
2064     */
2065    struct LDKRoute *result;
2066    /**
2067     * A pointer to the contents in the error state.
2068     * Reading from this pointer when `result_ok` is set is undefined.
2069     */
2070    struct LDKLightningError *err;
2071 } LDKCResult_RouteLightningErrorZPtr;
2072
2073 /**
2074  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2075  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2076  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2077  */
2078 typedef struct LDKCResult_RouteLightningErrorZ {
2079    /**
2080     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2081     * `err` or `result` depending on the state of `result_ok`.
2082     */
2083    union LDKCResult_RouteLightningErrorZPtr contents;
2084    /**
2085     * Whether this CResult_RouteLightningErrorZ represents a success state.
2086     */
2087    bool result_ok;
2088 } LDKCResult_RouteLightningErrorZ;
2089
2090 /**
2091  * The contents of CResult_TxOutAccessErrorZ
2092  */
2093 typedef union LDKCResult_TxOutAccessErrorZPtr {
2094    /**
2095     * A pointer to the contents in the success state.
2096     * Reading from this pointer when `result_ok` is not set is undefined.
2097     */
2098    struct LDKTxOut *result;
2099    /**
2100     * A pointer to the contents in the error state.
2101     * Reading from this pointer when `result_ok` is set is undefined.
2102     */
2103    enum LDKAccessError *err;
2104 } LDKCResult_TxOutAccessErrorZPtr;
2105
2106 /**
2107  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
2108  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
2109  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2110  */
2111 typedef struct LDKCResult_TxOutAccessErrorZ {
2112    /**
2113     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
2114     * `err` or `result` depending on the state of `result_ok`.
2115     */
2116    union LDKCResult_TxOutAccessErrorZPtr contents;
2117    /**
2118     * Whether this CResult_TxOutAccessErrorZ represents a success state.
2119     */
2120    bool result_ok;
2121 } LDKCResult_TxOutAccessErrorZ;
2122
2123 /**
2124  * A tuple of 2 elements. See the individual fields for the types contained.
2125  */
2126 typedef struct LDKC2Tuple_usizeTransactionZ {
2127    /**
2128     * The element at position 0
2129     */
2130    uintptr_t a;
2131    /**
2132     * The element at position 1
2133     */
2134    struct LDKTransaction b;
2135 } LDKC2Tuple_usizeTransactionZ;
2136
2137 /**
2138  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
2139  * This corresponds to std::vector in C++
2140  */
2141 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
2142    /**
2143     * The elements in the array.
2144     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2145     */
2146    struct LDKC2Tuple_usizeTransactionZ *data;
2147    /**
2148     * The number of elements pointed to by `data`.
2149     */
2150    uintptr_t datalen;
2151 } LDKCVec_C2Tuple_usizeTransactionZZ;
2152
2153 /**
2154  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
2155  * look up the corresponding function in rust-lightning's docs.
2156  */
2157 typedef struct LDKThirtyTwoBytes {
2158    /**
2159     * The thirty-two bytes
2160     */
2161    uint8_t data[32];
2162 } LDKThirtyTwoBytes;
2163
2164 /**
2165  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
2166  * This corresponds to std::vector in C++
2167  */
2168 typedef struct LDKCVec_TxidZ {
2169    /**
2170     * The elements in the array.
2171     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2172     */
2173    struct LDKThirtyTwoBytes *data;
2174    /**
2175     * The number of elements pointed to by `data`.
2176     */
2177    uintptr_t datalen;
2178 } LDKCVec_TxidZ;
2179
2180 /**
2181  * The contents of CResult_NoneChannelMonitorUpdateErrZ
2182  */
2183 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
2184    /**
2185     * Note that this value is always NULL, as there are no contents in the OK variant
2186     */
2187    void *result;
2188    /**
2189     * A pointer to the contents in the error state.
2190     * Reading from this pointer when `result_ok` is set is undefined.
2191     */
2192    enum LDKChannelMonitorUpdateErr *err;
2193 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
2194
2195 /**
2196  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
2197  * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
2198  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2199  */
2200 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
2201    /**
2202     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
2203     * `err` or `result` depending on the state of `result_ok`.
2204     */
2205    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
2206    /**
2207     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
2208     */
2209    bool result_ok;
2210 } LDKCResult_NoneChannelMonitorUpdateErrZ;
2211
2212
2213
2214 /**
2215  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
2216  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
2217  * preimage claim backward will lead to loss of funds.
2218  */
2219 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
2220    /**
2221     * A pointer to the opaque Rust object.
2222     * Nearly everywhere, inner must be non-null, however in places where
2223     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2224     */
2225    LDKnativeHTLCUpdate *inner;
2226    /**
2227     * Indicates that this is the only struct which contains the same pointer.
2228     * Rust functions which take ownership of an object provided via an argument require
2229     * this to be true and invalidate the object pointed to by inner.
2230     */
2231    bool is_owned;
2232 } LDKHTLCUpdate;
2233
2234
2235
2236 /**
2237  * A reference to a transaction output.
2238  *
2239  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2240  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2241  */
2242 typedef struct MUST_USE_STRUCT LDKOutPoint {
2243    /**
2244     * A pointer to the opaque Rust object.
2245     * Nearly everywhere, inner must be non-null, however in places where
2246     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2247     */
2248    LDKnativeOutPoint *inner;
2249    /**
2250     * Indicates that this is the only struct which contains the same pointer.
2251     * Rust functions which take ownership of an object provided via an argument require
2252     * this to be true and invalidate the object pointed to by inner.
2253     */
2254    bool is_owned;
2255 } LDKOutPoint;
2256
2257 /**
2258  * An event to be processed by the ChannelManager.
2259  */
2260 typedef enum LDKMonitorEvent_Tag {
2261    /**
2262     * A monitor event containing an HTLCUpdate.
2263     */
2264    LDKMonitorEvent_HTLCEvent,
2265    /**
2266     * A monitor event that the Channel's commitment transaction was confirmed.
2267     */
2268    LDKMonitorEvent_CommitmentTxConfirmed,
2269    /**
2270     * Indicates a [`ChannelMonitor`] update has completed. See
2271     * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
2272     *
2273     * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
2274     */
2275    LDKMonitorEvent_UpdateCompleted,
2276    /**
2277     * Indicates a [`ChannelMonitor`] update has failed. See
2278     * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
2279     *
2280     * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
2281     */
2282    LDKMonitorEvent_UpdateFailed,
2283    /**
2284     * Must be last for serialization purposes
2285     */
2286    LDKMonitorEvent_Sentinel,
2287 } LDKMonitorEvent_Tag;
2288
2289 typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
2290    /**
2291     * The funding outpoint of the [`ChannelMonitor`] that was updated
2292     */
2293    struct LDKOutPoint funding_txo;
2294    /**
2295     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
2296     * [`ChannelMonitor::get_latest_update_id`].
2297     *
2298     * Note that this should only be set to a given update's ID if all previous updates for the
2299     * same [`ChannelMonitor`] have been applied and persisted.
2300     */
2301    uint64_t monitor_update_id;
2302 } LDKMonitorEvent_LDKUpdateCompleted_Body;
2303
2304 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
2305    LDKMonitorEvent_Tag tag;
2306    union {
2307       struct {
2308          struct LDKHTLCUpdate htlc_event;
2309       };
2310       struct {
2311          struct LDKOutPoint commitment_tx_confirmed;
2312       };
2313       LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
2314       struct {
2315          struct LDKOutPoint update_failed;
2316       };
2317    };
2318 } LDKMonitorEvent;
2319
2320 /**
2321  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
2322  * This corresponds to std::vector in C++
2323  */
2324 typedef struct LDKCVec_MonitorEventZ {
2325    /**
2326     * The elements in the array.
2327     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2328     */
2329    struct LDKMonitorEvent *data;
2330    /**
2331     * The number of elements pointed to by `data`.
2332     */
2333    uintptr_t datalen;
2334 } LDKCVec_MonitorEventZ;
2335
2336 /**
2337  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
2338  */
2339 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
2340    /**
2341     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
2342     */
2343    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
2344    /**
2345     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
2346     */
2347    LDKCOption_C2Tuple_usizeTransactionZZ_None,
2348    /**
2349     * Must be last for serialization purposes
2350     */
2351    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
2352 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
2353
2354 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
2355    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
2356    union {
2357       struct {
2358          struct LDKC2Tuple_usizeTransactionZ some;
2359       };
2360    };
2361 } LDKCOption_C2Tuple_usizeTransactionZZ;
2362
2363 /**
2364  * The reason the channel was closed. See individual variants more details.
2365  */
2366 typedef enum LDKClosureReason_Tag {
2367    /**
2368     * Closure generated from receiving a peer error message.
2369     *
2370     * Our counterparty may have broadcasted their latest commitment state, and we have
2371     * as well.
2372     */
2373    LDKClosureReason_CounterpartyForceClosed,
2374    /**
2375     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2376     *
2377     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2378     */
2379    LDKClosureReason_HolderForceClosed,
2380    /**
2381     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2382     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2383     */
2384    LDKClosureReason_CooperativeClosure,
2385    /**
2386     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2387     * commitment transaction came from our counterparty, but it may also have come from
2388     * a copy of our own `ChannelMonitor`.
2389     */
2390    LDKClosureReason_CommitmentTxConfirmed,
2391    /**
2392     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2393     */
2394    LDKClosureReason_FundingTimedOut,
2395    /**
2396     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2397     */
2398    LDKClosureReason_ProcessingError,
2399    /**
2400     * The `PeerManager` informed us that we've disconnected from the peer. We close channels
2401     * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the
2402     * peer again in the future or if the peer disconnected before we finished negotiating
2403     * the channel open. The first case may be caused by incompatible features which our
2404     * counterparty, or we, require.
2405     */
2406    LDKClosureReason_DisconnectedPeer,
2407    /**
2408     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
2409     * the ChannelManager deserialized.
2410     */
2411    LDKClosureReason_OutdatedChannelManager,
2412    /**
2413     * Must be last for serialization purposes
2414     */
2415    LDKClosureReason_Sentinel,
2416 } LDKClosureReason_Tag;
2417
2418 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2419    /**
2420     * The error which the peer sent us.
2421     *
2422     * The string should be sanitized before it is used (e.g emitted to logs
2423     * or printed to stdout). Otherwise, a well crafted error message may exploit
2424     * a security vulnerability in the terminal emulator or the logging subsystem.
2425     */
2426    struct LDKStr peer_msg;
2427 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2428
2429 typedef struct LDKClosureReason_LDKProcessingError_Body {
2430    /**
2431     * A developer-readable error message which we generated.
2432     */
2433    struct LDKStr err;
2434 } LDKClosureReason_LDKProcessingError_Body;
2435
2436 typedef struct MUST_USE_STRUCT LDKClosureReason {
2437    LDKClosureReason_Tag tag;
2438    union {
2439       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2440       LDKClosureReason_LDKProcessingError_Body processing_error;
2441    };
2442 } LDKClosureReason;
2443
2444 /**
2445  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2446  */
2447 typedef enum LDKCOption_ClosureReasonZ_Tag {
2448    /**
2449     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2450     */
2451    LDKCOption_ClosureReasonZ_Some,
2452    /**
2453     * When we're in this state, this COption_ClosureReasonZ contains nothing
2454     */
2455    LDKCOption_ClosureReasonZ_None,
2456    /**
2457     * Must be last for serialization purposes
2458     */
2459    LDKCOption_ClosureReasonZ_Sentinel,
2460 } LDKCOption_ClosureReasonZ_Tag;
2461
2462 typedef struct LDKCOption_ClosureReasonZ {
2463    LDKCOption_ClosureReasonZ_Tag tag;
2464    union {
2465       struct {
2466          struct LDKClosureReason some;
2467       };
2468    };
2469 } LDKCOption_ClosureReasonZ;
2470
2471 /**
2472  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2473  */
2474 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2475    /**
2476     * A pointer to the contents in the success state.
2477     * Reading from this pointer when `result_ok` is not set is undefined.
2478     */
2479    struct LDKCOption_ClosureReasonZ *result;
2480    /**
2481     * A pointer to the contents in the error state.
2482     * Reading from this pointer when `result_ok` is set is undefined.
2483     */
2484    struct LDKDecodeError *err;
2485 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2486
2487 /**
2488  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2489  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2490  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2491  */
2492 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2493    /**
2494     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2495     * `err` or `result` depending on the state of `result_ok`.
2496     */
2497    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2498    /**
2499     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2500     */
2501    bool result_ok;
2502 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2503
2504
2505
2506 /**
2507  * A channel_update message to be sent or received from a peer
2508  */
2509 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2510    /**
2511     * A pointer to the opaque Rust object.
2512     * Nearly everywhere, inner must be non-null, however in places where
2513     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2514     */
2515    LDKnativeChannelUpdate *inner;
2516    /**
2517     * Indicates that this is the only struct which contains the same pointer.
2518     * Rust functions which take ownership of an object provided via an argument require
2519     * this to be true and invalidate the object pointed to by inner.
2520     */
2521    bool is_owned;
2522 } LDKChannelUpdate;
2523
2524 /**
2525  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2526  * return packet by a node along the route. See [BOLT #4] for details.
2527  *
2528  * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
2529  */
2530 typedef enum LDKNetworkUpdate_Tag {
2531    /**
2532     * An error indicating a `channel_update` messages should be applied via
2533     * [`NetworkGraph::update_channel`].
2534     */
2535    LDKNetworkUpdate_ChannelUpdateMessage,
2536    /**
2537     * An error indicating only that a channel has been closed, which should be applied via
2538     * [`NetworkGraph::close_channel_from_update`].
2539     */
2540    LDKNetworkUpdate_ChannelClosed,
2541    /**
2542     * An error indicating only that a node has failed, which should be applied via
2543     * [`NetworkGraph::fail_node`].
2544     */
2545    LDKNetworkUpdate_NodeFailure,
2546    /**
2547     * Must be last for serialization purposes
2548     */
2549    LDKNetworkUpdate_Sentinel,
2550 } LDKNetworkUpdate_Tag;
2551
2552 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2553    /**
2554     * The update to apply via [`NetworkGraph::update_channel`].
2555     */
2556    struct LDKChannelUpdate msg;
2557 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2558
2559 typedef struct LDKNetworkUpdate_LDKChannelClosed_Body {
2560    /**
2561     * The short channel id of the closed channel.
2562     */
2563    uint64_t short_channel_id;
2564    /**
2565     * Whether the channel should be permanently removed or temporarily disabled until a new
2566     * `channel_update` message is received.
2567     */
2568    bool is_permanent;
2569 } LDKNetworkUpdate_LDKChannelClosed_Body;
2570
2571 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2572    /**
2573     * The node id of the failed node.
2574     */
2575    struct LDKPublicKey node_id;
2576    /**
2577     * Whether the node should be permanently removed from consideration or can be restored
2578     * when a new `channel_update` message is received.
2579     */
2580    bool is_permanent;
2581 } LDKNetworkUpdate_LDKNodeFailure_Body;
2582
2583 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2584    LDKNetworkUpdate_Tag tag;
2585    union {
2586       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2587       LDKNetworkUpdate_LDKChannelClosed_Body channel_closed;
2588       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2589    };
2590 } LDKNetworkUpdate;
2591
2592 /**
2593  * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
2594  */
2595 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2596    /**
2597     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate
2598     */
2599    LDKCOption_NetworkUpdateZ_Some,
2600    /**
2601     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2602     */
2603    LDKCOption_NetworkUpdateZ_None,
2604    /**
2605     * Must be last for serialization purposes
2606     */
2607    LDKCOption_NetworkUpdateZ_Sentinel,
2608 } LDKCOption_NetworkUpdateZ_Tag;
2609
2610 typedef struct LDKCOption_NetworkUpdateZ {
2611    LDKCOption_NetworkUpdateZ_Tag tag;
2612    union {
2613       struct {
2614          struct LDKNetworkUpdate some;
2615       };
2616    };
2617 } LDKCOption_NetworkUpdateZ;
2618
2619
2620
2621 /**
2622  * Information about a spendable output to a P2WSH script. See
2623  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2624  */
2625 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2626    /**
2627     * A pointer to the opaque Rust object.
2628     * Nearly everywhere, inner must be non-null, however in places where
2629     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2630     */
2631    LDKnativeDelayedPaymentOutputDescriptor *inner;
2632    /**
2633     * Indicates that this is the only struct which contains the same pointer.
2634     * Rust functions which take ownership of an object provided via an argument require
2635     * this to be true and invalidate the object pointed to by inner.
2636     */
2637    bool is_owned;
2638 } LDKDelayedPaymentOutputDescriptor;
2639
2640
2641
2642 /**
2643  * Information about a spendable output to our \"payment key\". See
2644  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2645  */
2646 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2647    /**
2648     * A pointer to the opaque Rust object.
2649     * Nearly everywhere, inner must be non-null, however in places where
2650     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2651     */
2652    LDKnativeStaticPaymentOutputDescriptor *inner;
2653    /**
2654     * Indicates that this is the only struct which contains the same pointer.
2655     * Rust functions which take ownership of an object provided via an argument require
2656     * this to be true and invalidate the object pointed to by inner.
2657     */
2658    bool is_owned;
2659 } LDKStaticPaymentOutputDescriptor;
2660
2661 /**
2662  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2663  * claim at any point in the future) an event is generated which you must track and be able to
2664  * spend on-chain. The information needed to do this is provided in this enum, including the
2665  * outpoint describing which txid and output index is available, the full output which exists at
2666  * that txid/index, and any keys or other information required to sign.
2667  */
2668 typedef enum LDKSpendableOutputDescriptor_Tag {
2669    /**
2670     * An output to a script which was provided via KeysInterface directly, either from
2671     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2672     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2673     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2674     * on-chain using the payment preimage or after it has timed out.
2675     */
2676    LDKSpendableOutputDescriptor_StaticOutput,
2677    /**
2678     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2679     *
2680     * The witness in the spending input should be:
2681     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2682     *
2683     * Note that the nSequence field in the spending input must be set to to_self_delay
2684     * (which means the transaction is not broadcastable until at least to_self_delay
2685     * blocks after the outpoint confirms).
2686     *
2687     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2688     * it is an output from an old state which we broadcast (which should never happen).
2689     *
2690     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2691     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2692     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2693     * chan_utils::derive_private_key. The public key can be generated without the secret key
2694     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2695     * Sign::pubkeys().
2696     *
2697     * To derive the revocation_pubkey provided here (which is used in the witness
2698     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2699     * call to Sign::ready_channel) and the provided per_commitment point
2700     * to chan_utils::derive_public_revocation_key.
2701     *
2702     * The witness script which is hashed and included in the output script_pubkey may be
2703     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2704     * (derived as above), and the to_self_delay contained here to
2705     * chan_utils::get_revokeable_redeemscript.
2706     */
2707    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2708    /**
2709     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2710     * corresponds to the public key in Sign::pubkeys().payment_point).
2711     * The witness in the spending input, is, thus, simply:
2712     * <BIP 143 signature> <payment key>
2713     *
2714     * These are generally the result of our counterparty having broadcast the current state,
2715     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2716     */
2717    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2718    /**
2719     * Must be last for serialization purposes
2720     */
2721    LDKSpendableOutputDescriptor_Sentinel,
2722 } LDKSpendableOutputDescriptor_Tag;
2723
2724 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2725    /**
2726     * The outpoint which is spendable
2727     */
2728    struct LDKOutPoint outpoint;
2729    /**
2730     * The output which is referenced by the given outpoint.
2731     */
2732    struct LDKTxOut output;
2733 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2734
2735 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2736    LDKSpendableOutputDescriptor_Tag tag;
2737    union {
2738       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2739       struct {
2740          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2741       };
2742       struct {
2743          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2744       };
2745    };
2746 } LDKSpendableOutputDescriptor;
2747
2748 /**
2749  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2750  * This corresponds to std::vector in C++
2751  */
2752 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2753    /**
2754     * The elements in the array.
2755     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2756     */
2757    struct LDKSpendableOutputDescriptor *data;
2758    /**
2759     * The number of elements pointed to by `data`.
2760     */
2761    uintptr_t datalen;
2762 } LDKCVec_SpendableOutputDescriptorZ;
2763
2764 /**
2765  * Some information provided on receipt of payment depends on whether the payment received is a
2766  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2767  */
2768 typedef enum LDKPaymentPurpose_Tag {
2769    /**
2770     * Information for receiving a payment that we generated an invoice for.
2771     */
2772    LDKPaymentPurpose_InvoicePayment,
2773    /**
2774     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2775     * (the payee) providing a preimage.
2776     */
2777    LDKPaymentPurpose_SpontaneousPayment,
2778    /**
2779     * Must be last for serialization purposes
2780     */
2781    LDKPaymentPurpose_Sentinel,
2782 } LDKPaymentPurpose_Tag;
2783
2784 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2785    /**
2786     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2787     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2788     * [`ChannelManager::claim_funds`].
2789     *
2790     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2791     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2792     *
2793     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2794     */
2795    struct LDKThirtyTwoBytes payment_preimage;
2796    /**
2797     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2798     * number of deanonymization attacks during the routing process.
2799     * It is provided here for your reference, however its accuracy is enforced directly by
2800     * [`ChannelManager`] using the values you previously provided to
2801     * [`ChannelManager::create_inbound_payment`] or
2802     * [`ChannelManager::create_inbound_payment_for_hash`].
2803     *
2804     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2805     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2806     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2807     */
2808    struct LDKThirtyTwoBytes payment_secret;
2809 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2810
2811 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2812    LDKPaymentPurpose_Tag tag;
2813    union {
2814       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2815       struct {
2816          struct LDKThirtyTwoBytes spontaneous_payment;
2817       };
2818    };
2819 } LDKPaymentPurpose;
2820
2821
2822
2823 /**
2824  * Features used within the channel_type field in an OpenChannel message.
2825  *
2826  * A channel is always of some known \"type\", describing the transaction formats used and the exact
2827  * semantics of our interaction with our peer.
2828  *
2829  * Note that because a channel is a specific type which is proposed by the opener and accepted by
2830  * the counterparty, only required features are allowed here.
2831  *
2832  * This is serialized differently from other feature types - it is not prefixed by a length, and
2833  * thus must only appear inside a TLV where its length is known in advance.
2834  */
2835 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
2836    /**
2837     * A pointer to the opaque Rust object.
2838     * Nearly everywhere, inner must be non-null, however in places where
2839     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2840     */
2841    LDKnativeChannelTypeFeatures *inner;
2842    /**
2843     * Indicates that this is the only struct which contains the same pointer.
2844     * Rust functions which take ownership of an object provided via an argument require
2845     * this to be true and invalidate the object pointed to by inner.
2846     */
2847    bool is_owned;
2848 } LDKChannelTypeFeatures;
2849
2850 /**
2851  * An Event which you should probably take some action in response to.
2852  *
2853  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2854  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2855  * written as it makes no sense to respond to it after reconnecting to peers).
2856  */
2857 typedef enum LDKEvent_Tag {
2858    /**
2859     * Used to indicate that the client should generate a funding transaction with the given
2860     * parameters and then call [`ChannelManager::funding_transaction_generated`].
2861     * Generated in [`ChannelManager`] message handling.
2862     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2863     * counterparty can steal your funds!
2864     *
2865     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2866     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2867     */
2868    LDKEvent_FundingGenerationReady,
2869    /**
2870     * Indicates we've received money! Just gotta dig out that payment preimage and feed it to
2871     * [`ChannelManager::claim_funds`] to get it....
2872     * Note that if the preimage is not known, you should call
2873     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
2874     * network congestion.
2875     * If you fail to call either [`ChannelManager::claim_funds`] or
2876     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
2877     * automatically failed.
2878     *
2879     * # Note
2880     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2881     * `PaymentReceived` events may be generated for the same payment.
2882     *
2883     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2884     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
2885     */
2886    LDKEvent_PaymentReceived,
2887    /**
2888     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
2889     * and we got back the payment preimage for it).
2890     *
2891     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
2892     * event. In this situation, you SHOULD treat this payment as having succeeded.
2893     */
2894    LDKEvent_PaymentSent,
2895    /**
2896     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
2897     * something. You may wish to retry with a different route.
2898     *
2899     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
2900     * [`Event::PaymentFailed`] and [`all_paths_failed`].
2901     *
2902     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
2903     */
2904    LDKEvent_PaymentPathFailed,
2905    /**
2906     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
2907     * provide failure information for each MPP part in the payment.
2908     *
2909     * This event is provided once there are no further pending HTLCs for the payment and the
2910     * payment is no longer retryable, either due to a several-block timeout or because
2911     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
2912     *
2913     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2914     */
2915    LDKEvent_PaymentFailed,
2916    /**
2917     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
2918     * a time in the future.
2919     *
2920     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
2921     */
2922    LDKEvent_PendingHTLCsForwardable,
2923    /**
2924     * Used to indicate that an output which you should know how to spend was confirmed on chain
2925     * and is now spendable.
2926     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2927     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2928     * somewhere and spend them when you create on-chain transactions.
2929     */
2930    LDKEvent_SpendableOutputs,
2931    /**
2932     * This event is generated when a payment has been successfully forwarded through us and a
2933     * forwarding fee earned.
2934     */
2935    LDKEvent_PaymentForwarded,
2936    /**
2937     * Used to indicate that a channel with the given `channel_id` is in the process of closure.
2938     */
2939    LDKEvent_ChannelClosed,
2940    /**
2941     * Used to indicate to the user that they can abandon the funding transaction and recycle the
2942     * inputs for another purpose.
2943     */
2944    LDKEvent_DiscardFunding,
2945    /**
2946     * Indicates that a path for an outbound payment was successful.
2947     *
2948     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
2949     * [`Event::PaymentSent`] for obtaining the payment preimage.
2950     */
2951    LDKEvent_PaymentPathSuccessful,
2952    /**
2953     * Indicates a request to open a new channel by a peer.
2954     *
2955     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
2956     * request, call [`ChannelManager::force_close_channel`].
2957     *
2958     * The event is only triggered when a new open channel request is received and the
2959     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
2960     *
2961     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
2962     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
2963     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
2964     */
2965    LDKEvent_OpenChannelRequest,
2966    /**
2967     * Must be last for serialization purposes
2968     */
2969    LDKEvent_Sentinel,
2970 } LDKEvent_Tag;
2971
2972 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2973    /**
2974     * The random channel_id we picked which you'll need to pass into
2975     * ChannelManager::funding_transaction_generated.
2976     */
2977    struct LDKThirtyTwoBytes temporary_channel_id;
2978    /**
2979     * The value, in satoshis, that the output should have.
2980     */
2981    uint64_t channel_value_satoshis;
2982    /**
2983     * The script which should be used in the transaction output.
2984     */
2985    struct LDKCVec_u8Z output_script;
2986    /**
2987     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2988     * an inbound channel.
2989     *
2990     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2991     */
2992    uint64_t user_channel_id;
2993 } LDKEvent_LDKFundingGenerationReady_Body;
2994
2995 typedef struct LDKEvent_LDKPaymentReceived_Body {
2996    /**
2997     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
2998     * not stop you from registering duplicate payment hashes for inbound payments.
2999     */
3000    struct LDKThirtyTwoBytes payment_hash;
3001    /**
3002     * The value, in thousandths of a satoshi, that this payment is for.
3003     */
3004    uint64_t amt;
3005    /**
3006     * Information for claiming this received payment, based on whether the purpose of the
3007     * payment is to pay an invoice or to send a spontaneous payment.
3008     */
3009    struct LDKPaymentPurpose purpose;
3010 } LDKEvent_LDKPaymentReceived_Body;
3011
3012 typedef struct LDKEvent_LDKPaymentSent_Body {
3013    /**
3014     * The id returned by [`ChannelManager::send_payment`] and used with
3015     * [`ChannelManager::retry_payment`].
3016     *
3017     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3018     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3019     *
3020     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3021     */
3022    struct LDKThirtyTwoBytes payment_id;
3023    /**
3024     * The preimage to the hash given to ChannelManager::send_payment.
3025     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
3026     * store it somehow!
3027     */
3028    struct LDKThirtyTwoBytes payment_preimage;
3029    /**
3030     * The hash that was given to [`ChannelManager::send_payment`].
3031     *
3032     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3033     */
3034    struct LDKThirtyTwoBytes payment_hash;
3035    /**
3036     * The total fee which was spent at intermediate hops in this payment, across all paths.
3037     *
3038     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
3039     * overpayment to the recipient node.
3040     *
3041     * If the recipient or an intermediate node misbehaves and gives us free money, this may
3042     * overstate the amount paid, though this is unlikely.
3043     *
3044     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
3045     */
3046    struct LDKCOption_u64Z fee_paid_msat;
3047 } LDKEvent_LDKPaymentSent_Body;
3048
3049 typedef struct LDKEvent_LDKPaymentPathFailed_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     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3059     */
3060    struct LDKThirtyTwoBytes payment_id;
3061    /**
3062     * The hash that was given to [`ChannelManager::send_payment`].
3063     *
3064     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3065     */
3066    struct LDKThirtyTwoBytes payment_hash;
3067    /**
3068     * Indicates the payment was rejected for some reason by the recipient. This implies that
3069     * the payment has failed, not just the route in question. If this is not set, you may
3070     * retry the payment via a different route.
3071     */
3072    bool rejected_by_dest;
3073    /**
3074     * Any failure information conveyed via the Onion return packet by a node along the failed
3075     * payment route.
3076     *
3077     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
3078     * account the update. [`NetGraphMsgHandler`] is capable of doing this.
3079     *
3080     * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
3081     * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
3082     */
3083    struct LDKCOption_NetworkUpdateZ network_update;
3084    /**
3085     * For both single-path and multi-path payments, this is set if all paths of the payment have
3086     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
3087     * larger MPP payment were still in flight when this event was generated.
3088     *
3089     * Note that if you are retrying individual MPP parts, using this value to determine if a
3090     * payment has fully failed is race-y. Because multiple failures can happen prior to events
3091     * being processed, you may retry in response to a first failure, with a second failure
3092     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
3093     * you will see `all_paths_failed` set even though the retry of the first failure still
3094     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3095     *
3096     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3097     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3098     *
3099     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3100     *
3101     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3102     */
3103    bool all_paths_failed;
3104    /**
3105     * The payment path that failed.
3106     */
3107    struct LDKCVec_RouteHopZ path;
3108    /**
3109     * The channel responsible for the failed payment path.
3110     *
3111     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3112     * retried. May be `None` for older [`Event`] serializations.
3113     */
3114    struct LDKCOption_u64Z short_channel_id;
3115    /**
3116     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3117     *
3118     * See [`find_route`] for details.
3119     *
3120     * [`Route`]: crate::routing::router::Route
3121     * [`find_route`]: crate::routing::router::find_route
3122     *
3123     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3124     */
3125    struct LDKRouteParameters retry;
3126 } LDKEvent_LDKPaymentPathFailed_Body;
3127
3128 typedef struct LDKEvent_LDKPaymentFailed_Body {
3129    /**
3130     * The id returned by [`ChannelManager::send_payment`] and used with
3131     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3132     *
3133     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3134     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3135     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3136     */
3137    struct LDKThirtyTwoBytes payment_id;
3138    /**
3139     * The hash that was given to [`ChannelManager::send_payment`].
3140     *
3141     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3142     */
3143    struct LDKThirtyTwoBytes payment_hash;
3144 } LDKEvent_LDKPaymentFailed_Body;
3145
3146 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3147    /**
3148     * The minimum amount of time that should be waited prior to calling
3149     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3150     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3151     * now + 5*time_forwardable).
3152     */
3153    uint64_t time_forwardable;
3154 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3155
3156 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3157    /**
3158     * The outputs which you should store as spendable by you.
3159     */
3160    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3161 } LDKEvent_LDKSpendableOutputs_Body;
3162
3163 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3164    /**
3165     * The fee, in milli-satoshis, which was earned as a result of the payment.
3166     *
3167     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3168     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3169     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3170     * claimed the full value in millisatoshis from the source. In this case,
3171     * `claim_from_onchain_tx` will be set.
3172     *
3173     * If the channel which sent us the payment has been force-closed, we will claim the funds
3174     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3175     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3176     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3177     * `None`.
3178     */
3179    struct LDKCOption_u64Z fee_earned_msat;
3180    /**
3181     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3182     * transaction.
3183     */
3184    bool claim_from_onchain_tx;
3185 } LDKEvent_LDKPaymentForwarded_Body;
3186
3187 typedef struct LDKEvent_LDKChannelClosed_Body {
3188    /**
3189     * The channel_id of the channel which has been closed. Note that on-chain transactions
3190     * resolving the channel are likely still awaiting confirmation.
3191     */
3192    struct LDKThirtyTwoBytes channel_id;
3193    /**
3194     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
3195     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
3196     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
3197     * `user_channel_id` will be 0 for an inbound channel.
3198     * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
3199     *
3200     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3201     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3202     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3203     */
3204    uint64_t user_channel_id;
3205    /**
3206     * The reason the channel was closed.
3207     */
3208    struct LDKClosureReason reason;
3209 } LDKEvent_LDKChannelClosed_Body;
3210
3211 typedef struct LDKEvent_LDKDiscardFunding_Body {
3212    /**
3213     * The channel_id of the channel which has been closed.
3214     */
3215    struct LDKThirtyTwoBytes channel_id;
3216    /**
3217     * The full transaction received from the user
3218     */
3219    struct LDKTransaction transaction;
3220 } LDKEvent_LDKDiscardFunding_Body;
3221
3222 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3223    /**
3224     * The id returned by [`ChannelManager::send_payment`] and used with
3225     * [`ChannelManager::retry_payment`].
3226     *
3227     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3228     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3229     */
3230    struct LDKThirtyTwoBytes payment_id;
3231    /**
3232     * The hash that was given to [`ChannelManager::send_payment`].
3233     *
3234     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3235     *
3236     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3237     */
3238    struct LDKThirtyTwoBytes payment_hash;
3239    /**
3240     * The payment path that was successful.
3241     *
3242     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
3243     */
3244    struct LDKCVec_RouteHopZ path;
3245 } LDKEvent_LDKPaymentPathSuccessful_Body;
3246
3247 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3248    /**
3249     * The temporary channel ID of the channel requested to be opened.
3250     *
3251     * When responding to the request, the `temporary_channel_id` should be passed
3252     * back to the ChannelManager with [`ChannelManager::accept_inbound_channel`] to accept,
3253     * or to [`ChannelManager::force_close_channel`] to reject.
3254     *
3255     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3256     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
3257     */
3258    struct LDKThirtyTwoBytes temporary_channel_id;
3259    /**
3260     * The node_id of the counterparty requesting to open the channel.
3261     */
3262    struct LDKPublicKey counterparty_node_id;
3263    /**
3264     * The channel value of the requested channel.
3265     */
3266    uint64_t funding_satoshis;
3267    /**
3268     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3269     */
3270    uint64_t push_msat;
3271    /**
3272     * The features that this channel will operate with. If you reject the channel, a
3273     * well-behaved counterparty may automatically re-attempt the channel with a new set of
3274     * feature flags.
3275     *
3276     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
3277     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3278     * 0.0.106.
3279     *
3280     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3281     */
3282    struct LDKChannelTypeFeatures channel_type;
3283 } LDKEvent_LDKOpenChannelRequest_Body;
3284
3285 typedef struct MUST_USE_STRUCT LDKEvent {
3286    LDKEvent_Tag tag;
3287    union {
3288       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3289       LDKEvent_LDKPaymentReceived_Body payment_received;
3290       LDKEvent_LDKPaymentSent_Body payment_sent;
3291       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3292       LDKEvent_LDKPaymentFailed_Body payment_failed;
3293       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3294       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3295       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3296       LDKEvent_LDKChannelClosed_Body channel_closed;
3297       LDKEvent_LDKDiscardFunding_Body discard_funding;
3298       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3299       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
3300    };
3301 } LDKEvent;
3302
3303 /**
3304  * An enum which can either contain a crate::lightning::util::events::Event or not
3305  */
3306 typedef enum LDKCOption_EventZ_Tag {
3307    /**
3308     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3309     */
3310    LDKCOption_EventZ_Some,
3311    /**
3312     * When we're in this state, this COption_EventZ contains nothing
3313     */
3314    LDKCOption_EventZ_None,
3315    /**
3316     * Must be last for serialization purposes
3317     */
3318    LDKCOption_EventZ_Sentinel,
3319 } LDKCOption_EventZ_Tag;
3320
3321 typedef struct LDKCOption_EventZ {
3322    LDKCOption_EventZ_Tag tag;
3323    union {
3324       struct {
3325          struct LDKEvent some;
3326       };
3327    };
3328 } LDKCOption_EventZ;
3329
3330 /**
3331  * The contents of CResult_COption_EventZDecodeErrorZ
3332  */
3333 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
3334    /**
3335     * A pointer to the contents in the success state.
3336     * Reading from this pointer when `result_ok` is not set is undefined.
3337     */
3338    struct LDKCOption_EventZ *result;
3339    /**
3340     * A pointer to the contents in the error state.
3341     * Reading from this pointer when `result_ok` is set is undefined.
3342     */
3343    struct LDKDecodeError *err;
3344 } LDKCResult_COption_EventZDecodeErrorZPtr;
3345
3346 /**
3347  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3348  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3349  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3350  */
3351 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3352    /**
3353     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3354     * `err` or `result` depending on the state of `result_ok`.
3355     */
3356    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3357    /**
3358     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3359     */
3360    bool result_ok;
3361 } LDKCResult_COption_EventZDecodeErrorZ;
3362
3363
3364
3365 /**
3366  * An accept_channel message to be sent or received from a peer
3367  */
3368 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3369    /**
3370     * A pointer to the opaque Rust object.
3371     * Nearly everywhere, inner must be non-null, however in places where
3372     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3373     */
3374    LDKnativeAcceptChannel *inner;
3375    /**
3376     * Indicates that this is the only struct which contains the same pointer.
3377     * Rust functions which take ownership of an object provided via an argument require
3378     * this to be true and invalidate the object pointed to by inner.
3379     */
3380    bool is_owned;
3381 } LDKAcceptChannel;
3382
3383
3384
3385 /**
3386  * An open_channel message to be sent or received from a peer
3387  */
3388 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3389    /**
3390     * A pointer to the opaque Rust object.
3391     * Nearly everywhere, inner must be non-null, however in places where
3392     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3393     */
3394    LDKnativeOpenChannel *inner;
3395    /**
3396     * Indicates that this is the only struct which contains the same pointer.
3397     * Rust functions which take ownership of an object provided via an argument require
3398     * this to be true and invalidate the object pointed to by inner.
3399     */
3400    bool is_owned;
3401 } LDKOpenChannel;
3402
3403
3404
3405 /**
3406  * A funding_created message to be sent or received from a peer
3407  */
3408 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3409    /**
3410     * A pointer to the opaque Rust object.
3411     * Nearly everywhere, inner must be non-null, however in places where
3412     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3413     */
3414    LDKnativeFundingCreated *inner;
3415    /**
3416     * Indicates that this is the only struct which contains the same pointer.
3417     * Rust functions which take ownership of an object provided via an argument require
3418     * this to be true and invalidate the object pointed to by inner.
3419     */
3420    bool is_owned;
3421 } LDKFundingCreated;
3422
3423
3424
3425 /**
3426  * A funding_signed message to be sent or received from a peer
3427  */
3428 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3429    /**
3430     * A pointer to the opaque Rust object.
3431     * Nearly everywhere, inner must be non-null, however in places where
3432     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3433     */
3434    LDKnativeFundingSigned *inner;
3435    /**
3436     * Indicates that this is the only struct which contains the same pointer.
3437     * Rust functions which take ownership of an object provided via an argument require
3438     * this to be true and invalidate the object pointed to by inner.
3439     */
3440    bool is_owned;
3441 } LDKFundingSigned;
3442
3443
3444
3445 /**
3446  * A funding_locked message to be sent or received from a peer
3447  */
3448 typedef struct MUST_USE_STRUCT LDKFundingLocked {
3449    /**
3450     * A pointer to the opaque Rust object.
3451     * Nearly everywhere, inner must be non-null, however in places where
3452     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3453     */
3454    LDKnativeFundingLocked *inner;
3455    /**
3456     * Indicates that this is the only struct which contains the same pointer.
3457     * Rust functions which take ownership of an object provided via an argument require
3458     * this to be true and invalidate the object pointed to by inner.
3459     */
3460    bool is_owned;
3461 } LDKFundingLocked;
3462
3463
3464
3465 /**
3466  * An announcement_signatures message to be sent or received from a peer
3467  */
3468 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3469    /**
3470     * A pointer to the opaque Rust object.
3471     * Nearly everywhere, inner must be non-null, however in places where
3472     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3473     */
3474    LDKnativeAnnouncementSignatures *inner;
3475    /**
3476     * Indicates that this is the only struct which contains the same pointer.
3477     * Rust functions which take ownership of an object provided via an argument require
3478     * this to be true and invalidate the object pointed to by inner.
3479     */
3480    bool is_owned;
3481 } LDKAnnouncementSignatures;
3482
3483
3484
3485 /**
3486  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3487  * transaction updates if they were pending.
3488  */
3489 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3490    /**
3491     * A pointer to the opaque Rust object.
3492     * Nearly everywhere, inner must be non-null, however in places where
3493     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3494     */
3495    LDKnativeCommitmentUpdate *inner;
3496    /**
3497     * Indicates that this is the only struct which contains the same pointer.
3498     * Rust functions which take ownership of an object provided via an argument require
3499     * this to be true and invalidate the object pointed to by inner.
3500     */
3501    bool is_owned;
3502 } LDKCommitmentUpdate;
3503
3504
3505
3506 /**
3507  * A revoke_and_ack message to be sent or received from a peer
3508  */
3509 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3510    /**
3511     * A pointer to the opaque Rust object.
3512     * Nearly everywhere, inner must be non-null, however in places where
3513     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3514     */
3515    LDKnativeRevokeAndACK *inner;
3516    /**
3517     * Indicates that this is the only struct which contains the same pointer.
3518     * Rust functions which take ownership of an object provided via an argument require
3519     * this to be true and invalidate the object pointed to by inner.
3520     */
3521    bool is_owned;
3522 } LDKRevokeAndACK;
3523
3524
3525
3526 /**
3527  * A closing_signed message to be sent or received from a peer
3528  */
3529 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3530    /**
3531     * A pointer to the opaque Rust object.
3532     * Nearly everywhere, inner must be non-null, however in places where
3533     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3534     */
3535    LDKnativeClosingSigned *inner;
3536    /**
3537     * Indicates that this is the only struct which contains the same pointer.
3538     * Rust functions which take ownership of an object provided via an argument require
3539     * this to be true and invalidate the object pointed to by inner.
3540     */
3541    bool is_owned;
3542 } LDKClosingSigned;
3543
3544
3545
3546 /**
3547  * A shutdown message to be sent or received from a peer
3548  */
3549 typedef struct MUST_USE_STRUCT LDKShutdown {
3550    /**
3551     * A pointer to the opaque Rust object.
3552     * Nearly everywhere, inner must be non-null, however in places where
3553     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3554     */
3555    LDKnativeShutdown *inner;
3556    /**
3557     * Indicates that this is the only struct which contains the same pointer.
3558     * Rust functions which take ownership of an object provided via an argument require
3559     * this to be true and invalidate the object pointed to by inner.
3560     */
3561    bool is_owned;
3562 } LDKShutdown;
3563
3564
3565
3566 /**
3567  * A channel_reestablish message to be sent or received from a peer
3568  */
3569 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3570    /**
3571     * A pointer to the opaque Rust object.
3572     * Nearly everywhere, inner must be non-null, however in places where
3573     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3574     */
3575    LDKnativeChannelReestablish *inner;
3576    /**
3577     * Indicates that this is the only struct which contains the same pointer.
3578     * Rust functions which take ownership of an object provided via an argument require
3579     * this to be true and invalidate the object pointed to by inner.
3580     */
3581    bool is_owned;
3582 } LDKChannelReestablish;
3583
3584
3585
3586 /**
3587  * A channel_announcement message to be sent or received from a peer
3588  */
3589 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3590    /**
3591     * A pointer to the opaque Rust object.
3592     * Nearly everywhere, inner must be non-null, however in places where
3593     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3594     */
3595    LDKnativeChannelAnnouncement *inner;
3596    /**
3597     * Indicates that this is the only struct which contains the same pointer.
3598     * Rust functions which take ownership of an object provided via an argument require
3599     * this to be true and invalidate the object pointed to by inner.
3600     */
3601    bool is_owned;
3602 } LDKChannelAnnouncement;
3603
3604
3605
3606 /**
3607  * A node_announcement message to be sent or received from a peer
3608  */
3609 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3610    /**
3611     * A pointer to the opaque Rust object.
3612     * Nearly everywhere, inner must be non-null, however in places where
3613     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3614     */
3615    LDKnativeNodeAnnouncement *inner;
3616    /**
3617     * Indicates that this is the only struct which contains the same pointer.
3618     * Rust functions which take ownership of an object provided via an argument require
3619     * this to be true and invalidate the object pointed to by inner.
3620     */
3621    bool is_owned;
3622 } LDKNodeAnnouncement;
3623
3624
3625
3626 /**
3627  * An error message to be sent or received from a peer
3628  */
3629 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3630    /**
3631     * A pointer to the opaque Rust object.
3632     * Nearly everywhere, inner must be non-null, however in places where
3633     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3634     */
3635    LDKnativeErrorMessage *inner;
3636    /**
3637     * Indicates that this is the only struct which contains the same pointer.
3638     * Rust functions which take ownership of an object provided via an argument require
3639     * this to be true and invalidate the object pointed to by inner.
3640     */
3641    bool is_owned;
3642 } LDKErrorMessage;
3643
3644
3645
3646 /**
3647  * A warning message to be sent or received from a peer
3648  */
3649 typedef struct MUST_USE_STRUCT LDKWarningMessage {
3650    /**
3651     * A pointer to the opaque Rust object.
3652     * Nearly everywhere, inner must be non-null, however in places where
3653     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3654     */
3655    LDKnativeWarningMessage *inner;
3656    /**
3657     * Indicates that this is the only struct which contains the same pointer.
3658     * Rust functions which take ownership of an object provided via an argument require
3659     * this to be true and invalidate the object pointed to by inner.
3660     */
3661    bool is_owned;
3662 } LDKWarningMessage;
3663
3664 /**
3665  * Used to put an error message in a LightningError
3666  */
3667 typedef enum LDKErrorAction_Tag {
3668    /**
3669     * The peer took some action which made us think they were useless. Disconnect them.
3670     */
3671    LDKErrorAction_DisconnectPeer,
3672    /**
3673     * The peer did something harmless that we weren't able to process, just log and ignore
3674     */
3675    LDKErrorAction_IgnoreError,
3676    /**
3677     * The peer did something harmless that we weren't able to meaningfully process.
3678     * If the error is logged, log it at the given level.
3679     */
3680    LDKErrorAction_IgnoreAndLog,
3681    /**
3682     * The peer provided us with a gossip message which we'd already seen. In most cases this
3683     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
3684     * our own channel announcements.
3685     */
3686    LDKErrorAction_IgnoreDuplicateGossip,
3687    /**
3688     * The peer did something incorrect. Tell them.
3689     */
3690    LDKErrorAction_SendErrorMessage,
3691    /**
3692     * The peer did something incorrect. Tell them without closing any channels.
3693     */
3694    LDKErrorAction_SendWarningMessage,
3695    /**
3696     * Must be last for serialization purposes
3697     */
3698    LDKErrorAction_Sentinel,
3699 } LDKErrorAction_Tag;
3700
3701 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3702    /**
3703     * An error message which we should make an effort to send before we disconnect.
3704     *
3705     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3706     */
3707    struct LDKErrorMessage msg;
3708 } LDKErrorAction_LDKDisconnectPeer_Body;
3709
3710 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3711    /**
3712     * The message to send.
3713     */
3714    struct LDKErrorMessage msg;
3715 } LDKErrorAction_LDKSendErrorMessage_Body;
3716
3717 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
3718    /**
3719     * The message to send.
3720     */
3721    struct LDKWarningMessage msg;
3722    /**
3723     * The peer may have done something harmless that we weren't able to meaningfully process,
3724     * though we should still tell them about it.
3725     * If this event is logged, log it at the given level.
3726     */
3727    enum LDKLevel log_level;
3728 } LDKErrorAction_LDKSendWarningMessage_Body;
3729
3730 typedef struct MUST_USE_STRUCT LDKErrorAction {
3731    LDKErrorAction_Tag tag;
3732    union {
3733       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3734       struct {
3735          enum LDKLevel ignore_and_log;
3736       };
3737       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3738       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
3739    };
3740 } LDKErrorAction;
3741
3742
3743
3744 /**
3745  * A query_channel_range message is used to query a peer for channel
3746  * UTXOs in a range of blocks. The recipient of a query makes a best
3747  * effort to reply to the query using one or more reply_channel_range
3748  * messages.
3749  */
3750 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3751    /**
3752     * A pointer to the opaque Rust object.
3753     * Nearly everywhere, inner must be non-null, however in places where
3754     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3755     */
3756    LDKnativeQueryChannelRange *inner;
3757    /**
3758     * Indicates that this is the only struct which contains the same pointer.
3759     * Rust functions which take ownership of an object provided via an argument require
3760     * this to be true and invalidate the object pointed to by inner.
3761     */
3762    bool is_owned;
3763 } LDKQueryChannelRange;
3764
3765
3766
3767 /**
3768  * A query_short_channel_ids message is used to query a peer for
3769  * routing gossip messages related to one or more short_channel_ids.
3770  * The query recipient will reply with the latest, if available,
3771  * channel_announcement, channel_update and node_announcement messages
3772  * it maintains for the requested short_channel_ids followed by a
3773  * reply_short_channel_ids_end message. The short_channel_ids sent in
3774  * this query are encoded. We only support encoding_type=0 uncompressed
3775  * serialization and do not support encoding_type=1 zlib serialization.
3776  */
3777 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3778    /**
3779     * A pointer to the opaque Rust object.
3780     * Nearly everywhere, inner must be non-null, however in places where
3781     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3782     */
3783    LDKnativeQueryShortChannelIds *inner;
3784    /**
3785     * Indicates that this is the only struct which contains the same pointer.
3786     * Rust functions which take ownership of an object provided via an argument require
3787     * this to be true and invalidate the object pointed to by inner.
3788     */
3789    bool is_owned;
3790 } LDKQueryShortChannelIds;
3791
3792
3793
3794 /**
3795  * A reply_channel_range message is a reply to a query_channel_range
3796  * message. Multiple reply_channel_range messages can be sent in reply
3797  * to a single query_channel_range message. The query recipient makes a
3798  * best effort to respond based on their local network view which may
3799  * not be a perfect view of the network. The short_channel_ids in the
3800  * reply are encoded. We only support encoding_type=0 uncompressed
3801  * serialization and do not support encoding_type=1 zlib serialization.
3802  */
3803 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3804    /**
3805     * A pointer to the opaque Rust object.
3806     * Nearly everywhere, inner must be non-null, however in places where
3807     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3808     */
3809    LDKnativeReplyChannelRange *inner;
3810    /**
3811     * Indicates that this is the only struct which contains the same pointer.
3812     * Rust functions which take ownership of an object provided via an argument require
3813     * this to be true and invalidate the object pointed to by inner.
3814     */
3815    bool is_owned;
3816 } LDKReplyChannelRange;
3817
3818
3819
3820 /**
3821  * A gossip_timestamp_filter message is used by a node to request
3822  * gossip relay for messages in the requested time range when the
3823  * gossip_queries feature has been negotiated.
3824  */
3825 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
3826    /**
3827     * A pointer to the opaque Rust object.
3828     * Nearly everywhere, inner must be non-null, however in places where
3829     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3830     */
3831    LDKnativeGossipTimestampFilter *inner;
3832    /**
3833     * Indicates that this is the only struct which contains the same pointer.
3834     * Rust functions which take ownership of an object provided via an argument require
3835     * this to be true and invalidate the object pointed to by inner.
3836     */
3837    bool is_owned;
3838 } LDKGossipTimestampFilter;
3839
3840 /**
3841  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3842  * broadcast to most peers).
3843  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3844  */
3845 typedef enum LDKMessageSendEvent_Tag {
3846    /**
3847     * Used to indicate that we've accepted a channel open and should send the accept_channel
3848     * message provided to the given peer.
3849     */
3850    LDKMessageSendEvent_SendAcceptChannel,
3851    /**
3852     * Used to indicate that we've initiated a channel open and should send the open_channel
3853     * message provided to the given peer.
3854     */
3855    LDKMessageSendEvent_SendOpenChannel,
3856    /**
3857     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3858     */
3859    LDKMessageSendEvent_SendFundingCreated,
3860    /**
3861     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3862     */
3863    LDKMessageSendEvent_SendFundingSigned,
3864    /**
3865     * Used to indicate that a funding_locked message should be sent to the peer with the given node_id.
3866     */
3867    LDKMessageSendEvent_SendFundingLocked,
3868    /**
3869     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3870     */
3871    LDKMessageSendEvent_SendAnnouncementSignatures,
3872    /**
3873     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3874     * message should be sent to the peer with the given node_id.
3875     */
3876    LDKMessageSendEvent_UpdateHTLCs,
3877    /**
3878     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3879     */
3880    LDKMessageSendEvent_SendRevokeAndACK,
3881    /**
3882     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3883     */
3884    LDKMessageSendEvent_SendClosingSigned,
3885    /**
3886     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3887     */
3888    LDKMessageSendEvent_SendShutdown,
3889    /**
3890     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3891     */
3892    LDKMessageSendEvent_SendChannelReestablish,
3893    /**
3894     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3895     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3896     *
3897     * Note that after doing so, you very likely (unless you did so very recently) want to call
3898     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3899     * This ensures that any nodes which see our channel_announcement also have a relevant
3900     * node_announcement, including relevant feature flags which may be important for routing
3901     * through or to us.
3902     */
3903    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3904    /**
3905     * Used to indicate that a node_announcement should be broadcast to all peers.
3906     */
3907    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3908    /**
3909     * Used to indicate that a channel_update should be broadcast to all peers.
3910     */
3911    LDKMessageSendEvent_BroadcastChannelUpdate,
3912    /**
3913     * Used to indicate that a channel_update should be sent to a single peer.
3914     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
3915     * private channel and we shouldn't be informing all of our peers of channel parameters.
3916     */
3917    LDKMessageSendEvent_SendChannelUpdate,
3918    /**
3919     * Broadcast an error downstream to be handled
3920     */
3921    LDKMessageSendEvent_HandleError,
3922    /**
3923     * Query a peer for channels with funding transaction UTXOs in a block range.
3924     */
3925    LDKMessageSendEvent_SendChannelRangeQuery,
3926    /**
3927     * Request routing gossip messages from a peer for a list of channels identified by
3928     * their short_channel_ids.
3929     */
3930    LDKMessageSendEvent_SendShortIdsQuery,
3931    /**
3932     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3933     * emitted during processing of the query.
3934     */
3935    LDKMessageSendEvent_SendReplyChannelRange,
3936    /**
3937     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
3938     * enable receiving gossip messages from the peer.
3939     */
3940    LDKMessageSendEvent_SendGossipTimestampFilter,
3941    /**
3942     * Must be last for serialization purposes
3943     */
3944    LDKMessageSendEvent_Sentinel,
3945 } LDKMessageSendEvent_Tag;
3946
3947 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3948    /**
3949     * The node_id of the node which should receive this message
3950     */
3951    struct LDKPublicKey node_id;
3952    /**
3953     * The message which should be sent.
3954     */
3955    struct LDKAcceptChannel msg;
3956 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3957
3958 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3959    /**
3960     * The node_id of the node which should receive this message
3961     */
3962    struct LDKPublicKey node_id;
3963    /**
3964     * The message which should be sent.
3965     */
3966    struct LDKOpenChannel msg;
3967 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3968
3969 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3970    /**
3971     * The node_id of the node which should receive this message
3972     */
3973    struct LDKPublicKey node_id;
3974    /**
3975     * The message which should be sent.
3976     */
3977    struct LDKFundingCreated msg;
3978 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3979
3980 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3981    /**
3982     * The node_id of the node which should receive this message
3983     */
3984    struct LDKPublicKey node_id;
3985    /**
3986     * The message which should be sent.
3987     */
3988    struct LDKFundingSigned msg;
3989 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3990
3991 typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body {
3992    /**
3993     * The node_id of the node which should receive these message(s)
3994     */
3995    struct LDKPublicKey node_id;
3996    /**
3997     * The funding_locked message which should be sent.
3998     */
3999    struct LDKFundingLocked msg;
4000 } LDKMessageSendEvent_LDKSendFundingLocked_Body;
4001
4002 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
4003    /**
4004     * The node_id of the node which should receive these message(s)
4005     */
4006    struct LDKPublicKey node_id;
4007    /**
4008     * The announcement_signatures message which should be sent.
4009     */
4010    struct LDKAnnouncementSignatures msg;
4011 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
4012
4013 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
4014    /**
4015     * The node_id of the node which should receive these message(s)
4016     */
4017    struct LDKPublicKey node_id;
4018    /**
4019     * The update messages which should be sent. ALL messages in the struct should be sent!
4020     */
4021    struct LDKCommitmentUpdate updates;
4022 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
4023
4024 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
4025    /**
4026     * The node_id of the node which should receive this message
4027     */
4028    struct LDKPublicKey node_id;
4029    /**
4030     * The message which should be sent.
4031     */
4032    struct LDKRevokeAndACK msg;
4033 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
4034
4035 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
4036    /**
4037     * The node_id of the node which should receive this message
4038     */
4039    struct LDKPublicKey node_id;
4040    /**
4041     * The message which should be sent.
4042     */
4043    struct LDKClosingSigned msg;
4044 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
4045
4046 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4047    /**
4048     * The node_id of the node which should receive this message
4049     */
4050    struct LDKPublicKey node_id;
4051    /**
4052     * The message which should be sent.
4053     */
4054    struct LDKShutdown msg;
4055 } LDKMessageSendEvent_LDKSendShutdown_Body;
4056
4057 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4058    /**
4059     * The node_id of the node which should receive this message
4060     */
4061    struct LDKPublicKey node_id;
4062    /**
4063     * The message which should be sent.
4064     */
4065    struct LDKChannelReestablish msg;
4066 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4067
4068 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4069    /**
4070     * The channel_announcement which should be sent.
4071     */
4072    struct LDKChannelAnnouncement msg;
4073    /**
4074     * The followup channel_update which should be sent.
4075     */
4076    struct LDKChannelUpdate update_msg;
4077 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4078
4079 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
4080    /**
4081     * The node_announcement which should be sent.
4082     */
4083    struct LDKNodeAnnouncement msg;
4084 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
4085
4086 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4087    /**
4088     * The channel_update which should be sent.
4089     */
4090    struct LDKChannelUpdate msg;
4091 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4092
4093 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
4094    /**
4095     * The node_id of the node which should receive this message
4096     */
4097    struct LDKPublicKey node_id;
4098    /**
4099     * The channel_update which should be sent.
4100     */
4101    struct LDKChannelUpdate msg;
4102 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
4103
4104 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4105    /**
4106     * The node_id of the node which should receive this message
4107     */
4108    struct LDKPublicKey node_id;
4109    /**
4110     * The action which should be taken.
4111     */
4112    struct LDKErrorAction action;
4113 } LDKMessageSendEvent_LDKHandleError_Body;
4114
4115 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4116    /**
4117     * The node_id of this message recipient
4118     */
4119    struct LDKPublicKey node_id;
4120    /**
4121     * The query_channel_range which should be sent.
4122     */
4123    struct LDKQueryChannelRange msg;
4124 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4125
4126 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4127    /**
4128     * The node_id of this message recipient
4129     */
4130    struct LDKPublicKey node_id;
4131    /**
4132     * The query_short_channel_ids which should be sent.
4133     */
4134    struct LDKQueryShortChannelIds msg;
4135 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4136
4137 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4138    /**
4139     * The node_id of this message recipient
4140     */
4141    struct LDKPublicKey node_id;
4142    /**
4143     * The reply_channel_range which should be sent.
4144     */
4145    struct LDKReplyChannelRange msg;
4146 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4147
4148 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
4149    /**
4150     * The node_id of this message recipient
4151     */
4152    struct LDKPublicKey node_id;
4153    /**
4154     * The gossip_timestamp_filter which should be sent.
4155     */
4156    struct LDKGossipTimestampFilter msg;
4157 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
4158
4159 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4160    LDKMessageSendEvent_Tag tag;
4161    union {
4162       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4163       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4164       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4165       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4166       LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked;
4167       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4168       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4169       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4170       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4171       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4172       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4173       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4174       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4175       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4176       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4177       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4178       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4179       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4180       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4181       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
4182    };
4183 } LDKMessageSendEvent;
4184
4185 /**
4186  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4187  * This corresponds to std::vector in C++
4188  */
4189 typedef struct LDKCVec_MessageSendEventZ {
4190    /**
4191     * The elements in the array.
4192     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4193     */
4194    struct LDKMessageSendEvent *data;
4195    /**
4196     * The number of elements pointed to by `data`.
4197     */
4198    uintptr_t datalen;
4199 } LDKCVec_MessageSendEventZ;
4200
4201
4202
4203 /**
4204  * [`Score`] implementation that uses a fixed penalty.
4205  */
4206 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
4207    /**
4208     * A pointer to the opaque Rust object.
4209     * Nearly everywhere, inner must be non-null, however in places where
4210     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4211     */
4212    LDKnativeFixedPenaltyScorer *inner;
4213    /**
4214     * Indicates that this is the only struct which contains the same pointer.
4215     * Rust functions which take ownership of an object provided via an argument require
4216     * this to be true and invalidate the object pointed to by inner.
4217     */
4218    bool is_owned;
4219 } LDKFixedPenaltyScorer;
4220
4221 /**
4222  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4223  */
4224 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
4225    /**
4226     * A pointer to the contents in the success state.
4227     * Reading from this pointer when `result_ok` is not set is undefined.
4228     */
4229    struct LDKFixedPenaltyScorer *result;
4230    /**
4231     * A pointer to the contents in the error state.
4232     * Reading from this pointer when `result_ok` is set is undefined.
4233     */
4234    struct LDKDecodeError *err;
4235 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
4236
4237 /**
4238  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4239  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4240  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4241  */
4242 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
4243    /**
4244     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4245     * `err` or `result` depending on the state of `result_ok`.
4246     */
4247    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
4248    /**
4249     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4250     */
4251    bool result_ok;
4252 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
4253
4254
4255
4256 /**
4257  * Parameters for configuring [`Scorer`].
4258  */
4259 typedef struct MUST_USE_STRUCT LDKScoringParameters {
4260    /**
4261     * A pointer to the opaque Rust object.
4262     * Nearly everywhere, inner must be non-null, however in places where
4263     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4264     */
4265    LDKnativeScoringParameters *inner;
4266    /**
4267     * Indicates that this is the only struct which contains the same pointer.
4268     * Rust functions which take ownership of an object provided via an argument require
4269     * this to be true and invalidate the object pointed to by inner.
4270     */
4271    bool is_owned;
4272 } LDKScoringParameters;
4273
4274 /**
4275  * The contents of CResult_ScoringParametersDecodeErrorZ
4276  */
4277 typedef union LDKCResult_ScoringParametersDecodeErrorZPtr {
4278    /**
4279     * A pointer to the contents in the success state.
4280     * Reading from this pointer when `result_ok` is not set is undefined.
4281     */
4282    struct LDKScoringParameters *result;
4283    /**
4284     * A pointer to the contents in the error state.
4285     * Reading from this pointer when `result_ok` is set is undefined.
4286     */
4287    struct LDKDecodeError *err;
4288 } LDKCResult_ScoringParametersDecodeErrorZPtr;
4289
4290 /**
4291  * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation,
4292  * containing a crate::lightning::routing::scoring::ScoringParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
4293  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4294  */
4295 typedef struct LDKCResult_ScoringParametersDecodeErrorZ {
4296    /**
4297     * The contents of this CResult_ScoringParametersDecodeErrorZ, accessible via either
4298     * `err` or `result` depending on the state of `result_ok`.
4299     */
4300    union LDKCResult_ScoringParametersDecodeErrorZPtr contents;
4301    /**
4302     * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state.
4303     */
4304    bool result_ok;
4305 } LDKCResult_ScoringParametersDecodeErrorZ;
4306
4307
4308
4309 /**
4310  * [`Score`] implementation that provides reasonable default behavior.
4311  *
4312  * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with
4313  * slightly higher fees are available. Will further penalize channels that fail to relay payments.
4314  *
4315  * See [module-level documentation] for usage and [`ScoringParameters`] for customization.
4316  *
4317  * # Note
4318  *
4319  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4320  * behavior.
4321  *
4322  * [module-level documentation]: crate::routing::scoring
4323  */
4324 typedef struct MUST_USE_STRUCT LDKScorer {
4325    /**
4326     * A pointer to the opaque Rust object.
4327     * Nearly everywhere, inner must be non-null, however in places where
4328     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4329     */
4330    LDKnativeScorer *inner;
4331    /**
4332     * Indicates that this is the only struct which contains the same pointer.
4333     * Rust functions which take ownership of an object provided via an argument require
4334     * this to be true and invalidate the object pointed to by inner.
4335     */
4336    bool is_owned;
4337 } LDKScorer;
4338
4339 /**
4340  * The contents of CResult_ScorerDecodeErrorZ
4341  */
4342 typedef union LDKCResult_ScorerDecodeErrorZPtr {
4343    /**
4344     * A pointer to the contents in the success state.
4345     * Reading from this pointer when `result_ok` is not set is undefined.
4346     */
4347    struct LDKScorer *result;
4348    /**
4349     * A pointer to the contents in the error state.
4350     * Reading from this pointer when `result_ok` is set is undefined.
4351     */
4352    struct LDKDecodeError *err;
4353 } LDKCResult_ScorerDecodeErrorZPtr;
4354
4355 /**
4356  * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation,
4357  * containing a crate::lightning::routing::scoring::Scorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4358  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4359  */
4360 typedef struct LDKCResult_ScorerDecodeErrorZ {
4361    /**
4362     * The contents of this CResult_ScorerDecodeErrorZ, accessible via either
4363     * `err` or `result` depending on the state of `result_ok`.
4364     */
4365    union LDKCResult_ScorerDecodeErrorZPtr contents;
4366    /**
4367     * Whether this CResult_ScorerDecodeErrorZ represents a success state.
4368     */
4369    bool result_ok;
4370 } LDKCResult_ScorerDecodeErrorZ;
4371
4372
4373
4374 /**
4375  * Represents the network as nodes and channels between them
4376  */
4377 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4378    /**
4379     * A pointer to the opaque Rust object.
4380     * Nearly everywhere, inner must be non-null, however in places where
4381     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4382     */
4383    LDKnativeNetworkGraph *inner;
4384    /**
4385     * Indicates that this is the only struct which contains the same pointer.
4386     * Rust functions which take ownership of an object provided via an argument require
4387     * this to be true and invalidate the object pointed to by inner.
4388     */
4389    bool is_owned;
4390 } LDKNetworkGraph;
4391
4392
4393
4394 /**
4395  * [`Score`] implementation using channel success probability distributions.
4396  *
4397  * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
4398  * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
4399  * distributions are defined based on knowledge learned from successful and unsuccessful attempts.
4400  * Then the negative `log10` of the success probability is used to determine the cost of routing a
4401  * specific HTLC amount through a channel.
4402  *
4403  * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
4404  * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
4405  * [`ProbabilisticScoringParameters`] for details.
4406  *
4407  * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
4408  * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
4409  * volume are more likely to experience failed payment paths, which would need to be retried.
4410  *
4411  * # Note
4412  *
4413  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4414  * behavior.
4415  *
4416  * [1]: https://arxiv.org/abs/2107.05322
4417  */
4418 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
4419    /**
4420     * A pointer to the opaque Rust object.
4421     * Nearly everywhere, inner must be non-null, however in places where
4422     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4423     */
4424    LDKnativeProbabilisticScorer *inner;
4425    /**
4426     * Indicates that this is the only struct which contains the same pointer.
4427     * Rust functions which take ownership of an object provided via an argument require
4428     * this to be true and invalidate the object pointed to by inner.
4429     */
4430    bool is_owned;
4431 } LDKProbabilisticScorer;
4432
4433 /**
4434  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
4435  */
4436 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
4437    /**
4438     * A pointer to the contents in the success state.
4439     * Reading from this pointer when `result_ok` is not set is undefined.
4440     */
4441    struct LDKProbabilisticScorer *result;
4442    /**
4443     * A pointer to the contents in the error state.
4444     * Reading from this pointer when `result_ok` is set is undefined.
4445     */
4446    struct LDKDecodeError *err;
4447 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
4448
4449 /**
4450  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4451  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4452  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4453  */
4454 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
4455    /**
4456     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4457     * `err` or `result` depending on the state of `result_ok`.
4458     */
4459    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
4460    /**
4461     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4462     */
4463    bool result_ok;
4464 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
4465
4466
4467
4468 /**
4469  * Features used within an `init` message.
4470  */
4471 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4472    /**
4473     * A pointer to the opaque Rust object.
4474     * Nearly everywhere, inner must be non-null, however in places where
4475     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4476     */
4477    LDKnativeInitFeatures *inner;
4478    /**
4479     * Indicates that this is the only struct which contains the same pointer.
4480     * Rust functions which take ownership of an object provided via an argument require
4481     * this to be true and invalidate the object pointed to by inner.
4482     */
4483    bool is_owned;
4484 } LDKInitFeatures;
4485
4486 /**
4487  * The contents of CResult_InitFeaturesDecodeErrorZ
4488  */
4489 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4490    /**
4491     * A pointer to the contents in the success state.
4492     * Reading from this pointer when `result_ok` is not set is undefined.
4493     */
4494    struct LDKInitFeatures *result;
4495    /**
4496     * A pointer to the contents in the error state.
4497     * Reading from this pointer when `result_ok` is set is undefined.
4498     */
4499    struct LDKDecodeError *err;
4500 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4501
4502 /**
4503  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4504  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4505  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4506  */
4507 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4508    /**
4509     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4510     * `err` or `result` depending on the state of `result_ok`.
4511     */
4512    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4513    /**
4514     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4515     */
4516    bool result_ok;
4517 } LDKCResult_InitFeaturesDecodeErrorZ;
4518
4519
4520
4521 /**
4522  * Features used within a `channel_announcement` message.
4523  */
4524 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4525    /**
4526     * A pointer to the opaque Rust object.
4527     * Nearly everywhere, inner must be non-null, however in places where
4528     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4529     */
4530    LDKnativeChannelFeatures *inner;
4531    /**
4532     * Indicates that this is the only struct which contains the same pointer.
4533     * Rust functions which take ownership of an object provided via an argument require
4534     * this to be true and invalidate the object pointed to by inner.
4535     */
4536    bool is_owned;
4537 } LDKChannelFeatures;
4538
4539 /**
4540  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4541  */
4542 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4543    /**
4544     * A pointer to the contents in the success state.
4545     * Reading from this pointer when `result_ok` is not set is undefined.
4546     */
4547    struct LDKChannelFeatures *result;
4548    /**
4549     * A pointer to the contents in the error state.
4550     * Reading from this pointer when `result_ok` is set is undefined.
4551     */
4552    struct LDKDecodeError *err;
4553 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4554
4555 /**
4556  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4557  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4558  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4559  */
4560 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4561    /**
4562     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4563     * `err` or `result` depending on the state of `result_ok`.
4564     */
4565    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4566    /**
4567     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4568     */
4569    bool result_ok;
4570 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4571
4572
4573
4574 /**
4575  * Features used within a `node_announcement` message.
4576  */
4577 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4578    /**
4579     * A pointer to the opaque Rust object.
4580     * Nearly everywhere, inner must be non-null, however in places where
4581     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4582     */
4583    LDKnativeNodeFeatures *inner;
4584    /**
4585     * Indicates that this is the only struct which contains the same pointer.
4586     * Rust functions which take ownership of an object provided via an argument require
4587     * this to be true and invalidate the object pointed to by inner.
4588     */
4589    bool is_owned;
4590 } LDKNodeFeatures;
4591
4592 /**
4593  * The contents of CResult_NodeFeaturesDecodeErrorZ
4594  */
4595 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4596    /**
4597     * A pointer to the contents in the success state.
4598     * Reading from this pointer when `result_ok` is not set is undefined.
4599     */
4600    struct LDKNodeFeatures *result;
4601    /**
4602     * A pointer to the contents in the error state.
4603     * Reading from this pointer when `result_ok` is set is undefined.
4604     */
4605    struct LDKDecodeError *err;
4606 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4607
4608 /**
4609  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4610  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4611  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4612  */
4613 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4614    /**
4615     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4616     * `err` or `result` depending on the state of `result_ok`.
4617     */
4618    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4619    /**
4620     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4621     */
4622    bool result_ok;
4623 } LDKCResult_NodeFeaturesDecodeErrorZ;
4624
4625
4626
4627 /**
4628  * Features used within an invoice.
4629  */
4630 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4631    /**
4632     * A pointer to the opaque Rust object.
4633     * Nearly everywhere, inner must be non-null, however in places where
4634     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4635     */
4636    LDKnativeInvoiceFeatures *inner;
4637    /**
4638     * Indicates that this is the only struct which contains the same pointer.
4639     * Rust functions which take ownership of an object provided via an argument require
4640     * this to be true and invalidate the object pointed to by inner.
4641     */
4642    bool is_owned;
4643 } LDKInvoiceFeatures;
4644
4645 /**
4646  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4647  */
4648 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4649    /**
4650     * A pointer to the contents in the success state.
4651     * Reading from this pointer when `result_ok` is not set is undefined.
4652     */
4653    struct LDKInvoiceFeatures *result;
4654    /**
4655     * A pointer to the contents in the error state.
4656     * Reading from this pointer when `result_ok` is set is undefined.
4657     */
4658    struct LDKDecodeError *err;
4659 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4660
4661 /**
4662  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4663  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4664  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4665  */
4666 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4667    /**
4668     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4669     * `err` or `result` depending on the state of `result_ok`.
4670     */
4671    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4672    /**
4673     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4674     */
4675    bool result_ok;
4676 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4677
4678 /**
4679  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4680  */
4681 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
4682    /**
4683     * A pointer to the contents in the success state.
4684     * Reading from this pointer when `result_ok` is not set is undefined.
4685     */
4686    struct LDKChannelTypeFeatures *result;
4687    /**
4688     * A pointer to the contents in the error state.
4689     * Reading from this pointer when `result_ok` is set is undefined.
4690     */
4691    struct LDKDecodeError *err;
4692 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
4693
4694 /**
4695  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4696  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4697  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4698  */
4699 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
4700    /**
4701     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4702     * `err` or `result` depending on the state of `result_ok`.
4703     */
4704    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
4705    /**
4706     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4707     */
4708    bool result_ok;
4709 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
4710
4711 /**
4712  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
4713  */
4714 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
4715    /**
4716     * A pointer to the contents in the success state.
4717     * Reading from this pointer when `result_ok` is not set is undefined.
4718     */
4719    struct LDKDelayedPaymentOutputDescriptor *result;
4720    /**
4721     * A pointer to the contents in the error state.
4722     * Reading from this pointer when `result_ok` is set is undefined.
4723     */
4724    struct LDKDecodeError *err;
4725 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
4726
4727 /**
4728  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4729  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4730  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4731  */
4732 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
4733    /**
4734     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
4735     * `err` or `result` depending on the state of `result_ok`.
4736     */
4737    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
4738    /**
4739     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
4740     */
4741    bool result_ok;
4742 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
4743
4744 /**
4745  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
4746  */
4747 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
4748    /**
4749     * A pointer to the contents in the success state.
4750     * Reading from this pointer when `result_ok` is not set is undefined.
4751     */
4752    struct LDKStaticPaymentOutputDescriptor *result;
4753    /**
4754     * A pointer to the contents in the error state.
4755     * Reading from this pointer when `result_ok` is set is undefined.
4756     */
4757    struct LDKDecodeError *err;
4758 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
4759
4760 /**
4761  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4762  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4763  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4764  */
4765 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
4766    /**
4767     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
4768     * `err` or `result` depending on the state of `result_ok`.
4769     */
4770    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
4771    /**
4772     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
4773     */
4774    bool result_ok;
4775 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
4776
4777 /**
4778  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
4779  */
4780 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
4781    /**
4782     * A pointer to the contents in the success state.
4783     * Reading from this pointer when `result_ok` is not set is undefined.
4784     */
4785    struct LDKSpendableOutputDescriptor *result;
4786    /**
4787     * A pointer to the contents in the error state.
4788     * Reading from this pointer when `result_ok` is set is undefined.
4789     */
4790    struct LDKDecodeError *err;
4791 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
4792
4793 /**
4794  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
4795  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
4796  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4797  */
4798 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
4799    /**
4800     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
4801     * `err` or `result` depending on the state of `result_ok`.
4802     */
4803    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
4804    /**
4805     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
4806     */
4807    bool result_ok;
4808 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
4809
4810 /**
4811  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4812  * This corresponds to std::vector in C++
4813  */
4814 typedef struct LDKCVec_PaymentPreimageZ {
4815    /**
4816     * The elements in the array.
4817     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4818     */
4819    struct LDKThirtyTwoBytes *data;
4820    /**
4821     * The number of elements pointed to by `data`.
4822     */
4823    uintptr_t datalen;
4824 } LDKCVec_PaymentPreimageZ;
4825
4826 /**
4827  * A tuple of 2 elements. See the individual fields for the types contained.
4828  */
4829 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
4830    /**
4831     * The element at position 0
4832     */
4833    struct LDKSignature a;
4834    /**
4835     * The element at position 1
4836     */
4837    struct LDKCVec_SignatureZ b;
4838 } LDKC2Tuple_SignatureCVec_SignatureZZ;
4839
4840 /**
4841  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
4842  */
4843 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
4844    /**
4845     * A pointer to the contents in the success state.
4846     * Reading from this pointer when `result_ok` is not set is undefined.
4847     */
4848    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
4849    /**
4850     * Note that this value is always NULL, as there are no contents in the Err variant
4851     */
4852    void *err;
4853 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
4854
4855 /**
4856  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
4857  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
4858  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4859  */
4860 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
4861    /**
4862     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
4863     * `err` or `result` depending on the state of `result_ok`.
4864     */
4865    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
4866    /**
4867     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
4868     */
4869    bool result_ok;
4870 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
4871
4872 /**
4873  * The contents of CResult_SignatureNoneZ
4874  */
4875 typedef union LDKCResult_SignatureNoneZPtr {
4876    /**
4877     * A pointer to the contents in the success state.
4878     * Reading from this pointer when `result_ok` is not set is undefined.
4879     */
4880    struct LDKSignature *result;
4881    /**
4882     * Note that this value is always NULL, as there are no contents in the Err variant
4883     */
4884    void *err;
4885 } LDKCResult_SignatureNoneZPtr;
4886
4887 /**
4888  * A CResult_SignatureNoneZ represents the result of a fallible operation,
4889  * containing a crate::c_types::Signature on success and a () on failure.
4890  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4891  */
4892 typedef struct LDKCResult_SignatureNoneZ {
4893    /**
4894     * The contents of this CResult_SignatureNoneZ, accessible via either
4895     * `err` or `result` depending on the state of `result_ok`.
4896     */
4897    union LDKCResult_SignatureNoneZPtr contents;
4898    /**
4899     * Whether this CResult_SignatureNoneZ represents a success state.
4900     */
4901    bool result_ok;
4902 } LDKCResult_SignatureNoneZ;
4903
4904 /**
4905  * A tuple of 2 elements. See the individual fields for the types contained.
4906  */
4907 typedef struct LDKC2Tuple_SignatureSignatureZ {
4908    /**
4909     * The element at position 0
4910     */
4911    struct LDKSignature a;
4912    /**
4913     * The element at position 1
4914     */
4915    struct LDKSignature b;
4916 } LDKC2Tuple_SignatureSignatureZ;
4917
4918 /**
4919  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
4920  */
4921 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
4922    /**
4923     * A pointer to the contents in the success state.
4924     * Reading from this pointer when `result_ok` is not set is undefined.
4925     */
4926    struct LDKC2Tuple_SignatureSignatureZ *result;
4927    /**
4928     * Note that this value is always NULL, as there are no contents in the Err variant
4929     */
4930    void *err;
4931 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
4932
4933 /**
4934  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
4935  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
4936  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4937  */
4938 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
4939    /**
4940     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
4941     * `err` or `result` depending on the state of `result_ok`.
4942     */
4943    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
4944    /**
4945     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
4946     */
4947    bool result_ok;
4948 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
4949
4950 /**
4951  * The contents of CResult_SecretKeyNoneZ
4952  */
4953 typedef union LDKCResult_SecretKeyNoneZPtr {
4954    /**
4955     * A pointer to the contents in the success state.
4956     * Reading from this pointer when `result_ok` is not set is undefined.
4957     */
4958    struct LDKSecretKey *result;
4959    /**
4960     * Note that this value is always NULL, as there are no contents in the Err variant
4961     */
4962    void *err;
4963 } LDKCResult_SecretKeyNoneZPtr;
4964
4965 /**
4966  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
4967  * containing a crate::c_types::SecretKey on success and a () on failure.
4968  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4969  */
4970 typedef struct LDKCResult_SecretKeyNoneZ {
4971    /**
4972     * The contents of this CResult_SecretKeyNoneZ, accessible via either
4973     * `err` or `result` depending on the state of `result_ok`.
4974     */
4975    union LDKCResult_SecretKeyNoneZPtr contents;
4976    /**
4977     * Whether this CResult_SecretKeyNoneZ represents a success state.
4978     */
4979    bool result_ok;
4980 } LDKCResult_SecretKeyNoneZ;
4981
4982
4983
4984 /**
4985  * This class tracks the per-transaction information needed to build a closing transaction and will
4986  * actually build it and sign.
4987  *
4988  * This class can be used inside a signer implementation to generate a signature given the relevant
4989  * secret key.
4990  */
4991 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
4992    /**
4993     * A pointer to the opaque Rust object.
4994     * Nearly everywhere, inner must be non-null, however in places where
4995     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4996     */
4997    LDKnativeClosingTransaction *inner;
4998    /**
4999     * Indicates that this is the only struct which contains the same pointer.
5000     * Rust functions which take ownership of an object provided via an argument require
5001     * this to be true and invalidate the object pointed to by inner.
5002     */
5003    bool is_owned;
5004 } LDKClosingTransaction;
5005
5006
5007
5008 /**
5009  * The unsigned part of a channel_announcement
5010  */
5011 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
5012    /**
5013     * A pointer to the opaque Rust object.
5014     * Nearly everywhere, inner must be non-null, however in places where
5015     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5016     */
5017    LDKnativeUnsignedChannelAnnouncement *inner;
5018    /**
5019     * Indicates that this is the only struct which contains the same pointer.
5020     * Rust functions which take ownership of an object provided via an argument require
5021     * this to be true and invalidate the object pointed to by inner.
5022     */
5023    bool is_owned;
5024 } LDKUnsignedChannelAnnouncement;
5025
5026 /**
5027  * A trait to sign lightning channel transactions as described in BOLT 3.
5028  *
5029  * Signing services could be implemented on a hardware wallet. In this case,
5030  * the current Sign would be a front-end on top of a communication
5031  * channel connected to your secure device and lightning key material wouldn't
5032  * reside on a hot server. Nevertheless, a this deployment would still need
5033  * to trust the ChannelManager to avoid loss of funds as this latest component
5034  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
5035  *
5036  * A more secure iteration would be to use hashlock (or payment points) to pair
5037  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
5038  * at the price of more state and computation on the hardware wallet side. In the future,
5039  * we are looking forward to design such interface.
5040  *
5041  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
5042  * to act, as liveness and breach reply correctness are always going to be hard requirements
5043  * of LN security model, orthogonal of key management issues.
5044  */
5045 typedef struct LDKBaseSign {
5046    /**
5047     * An opaque pointer which is passed to your function implementations as an argument.
5048     * This has no meaning in the LDK, and can be NULL or any other value.
5049     */
5050    void *this_arg;
5051    /**
5052     * Gets the per-commitment point for a specific commitment number
5053     *
5054     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
5055     */
5056    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
5057    /**
5058     * Gets the commitment secret for a specific commitment number as part of the revocation process
5059     *
5060     * An external signer implementation should error here if the commitment was already signed
5061     * and should refuse to sign it in the future.
5062     *
5063     * May be called more than once for the same index.
5064     *
5065     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
5066     */
5067    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
5068    /**
5069     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
5070     *
5071     * This is required in order for the signer to make sure that releasing a commitment
5072     * secret won't leave us without a broadcastable holder transaction.
5073     * Policy checks should be implemented in this function, including checking the amount
5074     * sent to us and checking the HTLCs.
5075     *
5076     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
5077     * A validating signer should ensure that an HTLC output is removed only when the matching
5078     * preimage is provided, or when the value to holder is restored.
5079     *
5080     * NOTE: all the relevant preimages will be provided, but there may also be additional
5081     * irrelevant or duplicate preimages.
5082     */
5083    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
5084    /**
5085     * Gets the holder's channel public keys and basepoints
5086     */
5087    struct LDKChannelPublicKeys pubkeys;
5088    /**
5089     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
5090     * Note that this takes a pointer to this object, not the this_ptr like other methods do
5091     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
5092     */
5093    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
5094    /**
5095     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
5096     * some SpendableOutputDescriptor types. This should be sufficient to identify this
5097     * Sign object uniquely and lookup or re-derive its keys.
5098     */
5099    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
5100    /**
5101     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
5102     *
5103     * Note that if signing fails or is rejected, the channel will be force-closed.
5104     *
5105     * Policy checks should be implemented in this function, including checking the amount
5106     * sent to us and checking the HTLCs.
5107     *
5108     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
5109     * A validating signer should ensure that an HTLC output is removed only when the matching
5110     * preimage is provided, or when the value to holder is restored.
5111     *
5112     * NOTE: all the relevant preimages will be provided, but there may also be additional
5113     * irrelevant or duplicate preimages.
5114     */
5115    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
5116    /**
5117     * Validate the counterparty's revocation.
5118     *
5119     * This is required in order for the signer to make sure that the state has moved
5120     * forward and it is safe to sign the next counterparty commitment.
5121     */
5122    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
5123    /**
5124     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
5125     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
5126     * latest commitment_tx when we initiate a force-close.
5127     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
5128     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
5129     * the latest.
5130     * This may be called multiple times for the same transaction.
5131     *
5132     * An external signer implementation should check that the commitment has not been revoked.
5133     *
5134     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
5135     */
5136    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
5137    /**
5138     * Create a signature for the given input in a transaction spending an HTLC transaction output
5139     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
5140     *
5141     * A justice transaction may claim multiple outputs at the same time if timelocks are
5142     * similar, but only a signature for the input at index `input` should be signed for here.
5143     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
5144     * to an upcoming timelock expiration.
5145     *
5146     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5147     *
5148     * per_commitment_key is revocation secret which was provided by our counterparty when they
5149     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
5150     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
5151     * so).
5152     */
5153    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]);
5154    /**
5155     * Create a signature for the given input in a transaction spending a commitment transaction
5156     * HTLC output when our counterparty broadcasts an old state.
5157     *
5158     * A justice transaction may claim multiple outputs at the same time if timelocks are
5159     * similar, but only a signature for the input at index `input` should be signed for here.
5160     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
5161     * to an upcoming timelock expiration.
5162     *
5163     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5164     *
5165     * per_commitment_key is revocation secret which was provided by our counterparty when they
5166     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
5167     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
5168     * so).
5169     *
5170     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
5171     * (which is committed to in the BIP 143 signatures).
5172     */
5173    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);
5174    /**
5175     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
5176     * transaction, either offered or received.
5177     *
5178     * Such a transaction may claim multiples offered outputs at same time if we know the
5179     * preimage for each when we create it, but only the input at index `input` should be
5180     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
5181     * needed with regards to an upcoming timelock expiration.
5182     *
5183     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
5184     * outputs.
5185     *
5186     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5187     *
5188     * Per_commitment_point is the dynamic point corresponding to the channel state
5189     * detected onchain. It has been generated by our counterparty and is used to derive
5190     * channel state keys, which are then included in the witness script and committed to in the
5191     * BIP 143 signature.
5192     */
5193    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);
5194    /**
5195     * Create a signature for a (proposed) closing transaction.
5196     *
5197     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
5198     * chosen to forgo their output as dust.
5199     */
5200    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
5201    /**
5202     * Signs a channel announcement message with our funding key and our node secret key (aka
5203     * node_id or network_key), proving it comes from one of the channel participants.
5204     *
5205     * The first returned signature should be from our node secret key, the second from our
5206     * funding key.
5207     *
5208     * Note that if this fails or is rejected, the channel will not be publicly announced and
5209     * our counterparty may (though likely will not) close the channel on us for violating the
5210     * protocol.
5211     */
5212    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
5213    /**
5214     * Set the counterparty static channel data, including basepoints,
5215     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
5216     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
5217     * they MUST NOT be allowed to change to different values once set.
5218     *
5219     * channel_parameters.is_populated() MUST be true.
5220     *
5221     * We bind holder_selected_contest_delay late here for API convenience.
5222     *
5223     * Will be called before any signatures are applied.
5224     */
5225    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
5226    /**
5227     * Frees any resources associated with this object given its this_arg pointer.
5228     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5229     */
5230    void (*free)(void *this_arg);
5231 } LDKBaseSign;
5232
5233 /**
5234  * A cloneable signer.
5235  *
5236  * Although we require signers to be cloneable, it may be useful for developers to be able to use
5237  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
5238  * which implies Sized, into this derived trait.
5239  */
5240 typedef struct LDKSign {
5241    /**
5242     * An opaque pointer which is passed to your function implementations as an argument.
5243     * This has no meaning in the LDK, and can be NULL or any other value.
5244     */
5245    void *this_arg;
5246    /**
5247     * Implementation of BaseSign for this object.
5248     */
5249    struct LDKBaseSign BaseSign;
5250    /**
5251     * Serialize the object into a byte array
5252     */
5253    struct LDKCVec_u8Z (*write)(const void *this_arg);
5254    /**
5255     * Called, if set, after this Sign has been cloned into a duplicate object.
5256     * The new Sign is provided, and should be mutated as needed to perform a
5257     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
5258     */
5259    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
5260    /**
5261     * Frees any resources associated with this object given its this_arg pointer.
5262     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5263     */
5264    void (*free)(void *this_arg);
5265 } LDKSign;
5266
5267 /**
5268  * The contents of CResult_SignDecodeErrorZ
5269  */
5270 typedef union LDKCResult_SignDecodeErrorZPtr {
5271    /**
5272     * A pointer to the contents in the success state.
5273     * Reading from this pointer when `result_ok` is not set is undefined.
5274     */
5275    struct LDKSign *result;
5276    /**
5277     * A pointer to the contents in the error state.
5278     * Reading from this pointer when `result_ok` is set is undefined.
5279     */
5280    struct LDKDecodeError *err;
5281 } LDKCResult_SignDecodeErrorZPtr;
5282
5283 /**
5284  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
5285  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
5286  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5287  */
5288 typedef struct LDKCResult_SignDecodeErrorZ {
5289    /**
5290     * The contents of this CResult_SignDecodeErrorZ, accessible via either
5291     * `err` or `result` depending on the state of `result_ok`.
5292     */
5293    union LDKCResult_SignDecodeErrorZPtr contents;
5294    /**
5295     * Whether this CResult_SignDecodeErrorZ represents a success state.
5296     */
5297    bool result_ok;
5298 } LDKCResult_SignDecodeErrorZ;
5299
5300 /**
5301  * Integer in the range `0..32`
5302  */
5303 typedef struct LDKu5 {
5304    uint8_t _0;
5305 } LDKu5;
5306
5307 /**
5308  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
5309  * This corresponds to std::vector in C++
5310  */
5311 typedef struct LDKCVec_u5Z {
5312    /**
5313     * The elements in the array.
5314     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5315     */
5316    struct LDKu5 *data;
5317    /**
5318     * The number of elements pointed to by `data`.
5319     */
5320    uintptr_t datalen;
5321 } LDKCVec_u5Z;
5322
5323 /**
5324  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
5325  * allows recovering the exact public key which created the signature given the message.
5326  */
5327 typedef struct LDKRecoverableSignature {
5328    /**
5329     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
5330     * recovery.
5331     */
5332    uint8_t serialized_form[68];
5333 } LDKRecoverableSignature;
5334
5335 /**
5336  * The contents of CResult_RecoverableSignatureNoneZ
5337  */
5338 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
5339    /**
5340     * A pointer to the contents in the success state.
5341     * Reading from this pointer when `result_ok` is not set is undefined.
5342     */
5343    struct LDKRecoverableSignature *result;
5344    /**
5345     * Note that this value is always NULL, as there are no contents in the Err variant
5346     */
5347    void *err;
5348 } LDKCResult_RecoverableSignatureNoneZPtr;
5349
5350 /**
5351  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
5352  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
5353  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5354  */
5355 typedef struct LDKCResult_RecoverableSignatureNoneZ {
5356    /**
5357     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
5358     * `err` or `result` depending on the state of `result_ok`.
5359     */
5360    union LDKCResult_RecoverableSignatureNoneZPtr contents;
5361    /**
5362     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
5363     */
5364    bool result_ok;
5365 } LDKCResult_RecoverableSignatureNoneZ;
5366
5367 /**
5368  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
5369  * This corresponds to std::vector in C++
5370  */
5371 typedef struct LDKCVec_CVec_u8ZZ {
5372    /**
5373     * The elements in the array.
5374     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5375     */
5376    struct LDKCVec_u8Z *data;
5377    /**
5378     * The number of elements pointed to by `data`.
5379     */
5380    uintptr_t datalen;
5381 } LDKCVec_CVec_u8ZZ;
5382
5383 /**
5384  * The contents of CResult_CVec_CVec_u8ZZNoneZ
5385  */
5386 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
5387    /**
5388     * A pointer to the contents in the success state.
5389     * Reading from this pointer when `result_ok` is not set is undefined.
5390     */
5391    struct LDKCVec_CVec_u8ZZ *result;
5392    /**
5393     * Note that this value is always NULL, as there are no contents in the Err variant
5394     */
5395    void *err;
5396 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
5397
5398 /**
5399  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
5400  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
5401  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5402  */
5403 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
5404    /**
5405     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
5406     * `err` or `result` depending on the state of `result_ok`.
5407     */
5408    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
5409    /**
5410     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
5411     */
5412    bool result_ok;
5413 } LDKCResult_CVec_CVec_u8ZZNoneZ;
5414
5415
5416
5417 /**
5418  * A simple implementation of Sign that just keeps the private keys in memory.
5419  *
5420  * This implementation performs no policy checks and is insufficient by itself as
5421  * a secure external signer.
5422  */
5423 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
5424    /**
5425     * A pointer to the opaque Rust object.
5426     * Nearly everywhere, inner must be non-null, however in places where
5427     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5428     */
5429    LDKnativeInMemorySigner *inner;
5430    /**
5431     * Indicates that this is the only struct which contains the same pointer.
5432     * Rust functions which take ownership of an object provided via an argument require
5433     * this to be true and invalidate the object pointed to by inner.
5434     */
5435    bool is_owned;
5436 } LDKInMemorySigner;
5437
5438 /**
5439  * The contents of CResult_InMemorySignerDecodeErrorZ
5440  */
5441 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
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 LDKInMemorySigner *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    struct LDKDecodeError *err;
5452 } LDKCResult_InMemorySignerDecodeErrorZPtr;
5453
5454 /**
5455  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
5456  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
5457  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5458  */
5459 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
5460    /**
5461     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
5462     * `err` or `result` depending on the state of `result_ok`.
5463     */
5464    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
5465    /**
5466     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
5467     */
5468    bool result_ok;
5469 } LDKCResult_InMemorySignerDecodeErrorZ;
5470
5471 /**
5472  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
5473  * This corresponds to std::vector in C++
5474  */
5475 typedef struct LDKCVec_TxOutZ {
5476    /**
5477     * The elements in the array.
5478     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5479     */
5480    struct LDKTxOut *data;
5481    /**
5482     * The number of elements pointed to by `data`.
5483     */
5484    uintptr_t datalen;
5485 } LDKCVec_TxOutZ;
5486
5487 /**
5488  * The contents of CResult_TransactionNoneZ
5489  */
5490 typedef union LDKCResult_TransactionNoneZPtr {
5491    /**
5492     * A pointer to the contents in the success state.
5493     * Reading from this pointer when `result_ok` is not set is undefined.
5494     */
5495    struct LDKTransaction *result;
5496    /**
5497     * Note that this value is always NULL, as there are no contents in the Err variant
5498     */
5499    void *err;
5500 } LDKCResult_TransactionNoneZPtr;
5501
5502 /**
5503  * A CResult_TransactionNoneZ represents the result of a fallible operation,
5504  * containing a crate::c_types::Transaction on success and a () on failure.
5505  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5506  */
5507 typedef struct LDKCResult_TransactionNoneZ {
5508    /**
5509     * The contents of this CResult_TransactionNoneZ, accessible via either
5510     * `err` or `result` depending on the state of `result_ok`.
5511     */
5512    union LDKCResult_TransactionNoneZPtr contents;
5513    /**
5514     * Whether this CResult_TransactionNoneZ represents a success state.
5515     */
5516    bool result_ok;
5517 } LDKCResult_TransactionNoneZ;
5518
5519
5520
5521 /**
5522  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
5523  * on-chain transactions to ensure no loss of funds occurs.
5524  *
5525  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
5526  * information and are actively monitoring the chain.
5527  *
5528  * Pending Events or updated HTLCs which have not yet been read out by
5529  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
5530  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
5531  * gotten are fully handled before re-serializing the new state.
5532  *
5533  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
5534  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
5535  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
5536  * returned block hash and the the current chain and then reconnecting blocks to get to the
5537  * best chain) upon deserializing the object!
5538  */
5539 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
5540    /**
5541     * A pointer to the opaque Rust object.
5542     * Nearly everywhere, inner must be non-null, however in places where
5543     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5544     */
5545    LDKnativeChannelMonitor *inner;
5546    /**
5547     * Indicates that this is the only struct which contains the same pointer.
5548     * Rust functions which take ownership of an object provided via an argument require
5549     * this to be true and invalidate the object pointed to by inner.
5550     */
5551    bool is_owned;
5552 } LDKChannelMonitor;
5553
5554 /**
5555  * A tuple of 2 elements. See the individual fields for the types contained.
5556  */
5557 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
5558    /**
5559     * The element at position 0
5560     */
5561    struct LDKThirtyTwoBytes a;
5562    /**
5563     * The element at position 1
5564     */
5565    struct LDKChannelMonitor b;
5566 } LDKC2Tuple_BlockHashChannelMonitorZ;
5567
5568 /**
5569  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
5570  * This corresponds to std::vector in C++
5571  */
5572 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
5573    /**
5574     * The elements in the array.
5575     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5576     */
5577    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
5578    /**
5579     * The number of elements pointed to by `data`.
5580     */
5581    uintptr_t datalen;
5582 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
5583
5584 /**
5585  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
5586  */
5587 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
5588    /**
5589     * A pointer to the contents in the success state.
5590     * Reading from this pointer when `result_ok` is not set is undefined.
5591     */
5592    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
5593    /**
5594     * A pointer to the contents in the error state.
5595     * Reading from this pointer when `result_ok` is set is undefined.
5596     */
5597    enum LDKIOError *err;
5598 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
5599
5600 /**
5601  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
5602  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
5603  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5604  */
5605 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
5606    /**
5607     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
5608     * `err` or `result` depending on the state of `result_ok`.
5609     */
5610    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
5611    /**
5612     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
5613     */
5614    bool result_ok;
5615 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
5616
5617 /**
5618  * An enum which can either contain a u16 or not
5619  */
5620 typedef enum LDKCOption_u16Z_Tag {
5621    /**
5622     * When we're in this state, this COption_u16Z contains a u16
5623     */
5624    LDKCOption_u16Z_Some,
5625    /**
5626     * When we're in this state, this COption_u16Z contains nothing
5627     */
5628    LDKCOption_u16Z_None,
5629    /**
5630     * Must be last for serialization purposes
5631     */
5632    LDKCOption_u16Z_Sentinel,
5633 } LDKCOption_u16Z_Tag;
5634
5635 typedef struct LDKCOption_u16Z {
5636    LDKCOption_u16Z_Tag tag;
5637    union {
5638       struct {
5639          uint16_t some;
5640       };
5641    };
5642 } LDKCOption_u16Z;
5643
5644 /**
5645  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
5646  * too-high values)
5647  */
5648 typedef enum LDKAPIError_Tag {
5649    /**
5650     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
5651     * are documented, but generally indicates some precondition of a function was violated.
5652     */
5653    LDKAPIError_APIMisuseError,
5654    /**
5655     * Due to a high feerate, we were unable to complete the request.
5656     * For example, this may be returned if the feerate implies we cannot open a channel at the
5657     * requested value, but opening a larger channel would succeed.
5658     */
5659    LDKAPIError_FeeRateTooHigh,
5660    /**
5661     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
5662     * too-many-hops, etc).
5663     */
5664    LDKAPIError_RouteError,
5665    /**
5666     * We were unable to complete the request as the Channel required to do so is unable to
5667     * complete the request (or was not found). This can take many forms, including disconnected
5668     * peer, channel at capacity, channel shutting down, etc.
5669     */
5670    LDKAPIError_ChannelUnavailable,
5671    /**
5672     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
5673     * attempted action to fail.
5674     */
5675    LDKAPIError_MonitorUpdateFailed,
5676    /**
5677     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
5678     * with the channel counterparty as negotiated in [`InitFeatures`].
5679     *
5680     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
5681     * a channel or cooperatively close one with this peer (and will have to force-close instead).
5682     *
5683     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
5684     * [`InitFeatures`]: crate::ln::features::InitFeatures
5685     */
5686    LDKAPIError_IncompatibleShutdownScript,
5687    /**
5688     * Must be last for serialization purposes
5689     */
5690    LDKAPIError_Sentinel,
5691 } LDKAPIError_Tag;
5692
5693 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
5694    /**
5695     * A human-readable error message
5696     */
5697    struct LDKStr err;
5698 } LDKAPIError_LDKAPIMisuseError_Body;
5699
5700 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
5701    /**
5702     * A human-readable error message
5703     */
5704    struct LDKStr err;
5705    /**
5706     * The feerate which was too high.
5707     */
5708    uint32_t feerate;
5709 } LDKAPIError_LDKFeeRateTooHigh_Body;
5710
5711 typedef struct LDKAPIError_LDKRouteError_Body {
5712    /**
5713     * A human-readable error message
5714     */
5715    struct LDKStr err;
5716 } LDKAPIError_LDKRouteError_Body;
5717
5718 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
5719    /**
5720     * A human-readable error message
5721     */
5722    struct LDKStr err;
5723 } LDKAPIError_LDKChannelUnavailable_Body;
5724
5725 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
5726    /**
5727     * The incompatible shutdown script.
5728     */
5729    struct LDKShutdownScript script;
5730 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
5731
5732 typedef struct MUST_USE_STRUCT LDKAPIError {
5733    LDKAPIError_Tag tag;
5734    union {
5735       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
5736       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
5737       LDKAPIError_LDKRouteError_Body route_error;
5738       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
5739       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
5740    };
5741 } LDKAPIError;
5742
5743 /**
5744  * The contents of CResult_NoneAPIErrorZ
5745  */
5746 typedef union LDKCResult_NoneAPIErrorZPtr {
5747    /**
5748     * Note that this value is always NULL, as there are no contents in the OK variant
5749     */
5750    void *result;
5751    /**
5752     * A pointer to the contents in the error state.
5753     * Reading from this pointer when `result_ok` is set is undefined.
5754     */
5755    struct LDKAPIError *err;
5756 } LDKCResult_NoneAPIErrorZPtr;
5757
5758 /**
5759  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
5760  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
5761  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5762  */
5763 typedef struct LDKCResult_NoneAPIErrorZ {
5764    /**
5765     * The contents of this CResult_NoneAPIErrorZ, accessible via either
5766     * `err` or `result` depending on the state of `result_ok`.
5767     */
5768    union LDKCResult_NoneAPIErrorZPtr contents;
5769    /**
5770     * Whether this CResult_NoneAPIErrorZ represents a success state.
5771     */
5772    bool result_ok;
5773 } LDKCResult_NoneAPIErrorZ;
5774
5775 /**
5776  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
5777  * This corresponds to std::vector in C++
5778  */
5779 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
5780    /**
5781     * The elements in the array.
5782     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5783     */
5784    struct LDKCResult_NoneAPIErrorZ *data;
5785    /**
5786     * The number of elements pointed to by `data`.
5787     */
5788    uintptr_t datalen;
5789 } LDKCVec_CResult_NoneAPIErrorZZ;
5790
5791 /**
5792  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
5793  * This corresponds to std::vector in C++
5794  */
5795 typedef struct LDKCVec_APIErrorZ {
5796    /**
5797     * The elements in the array.
5798     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5799     */
5800    struct LDKAPIError *data;
5801    /**
5802     * The number of elements pointed to by `data`.
5803     */
5804    uintptr_t datalen;
5805 } LDKCVec_APIErrorZ;
5806
5807 /**
5808  * The contents of CResult__u832APIErrorZ
5809  */
5810 typedef union LDKCResult__u832APIErrorZPtr {
5811    /**
5812     * A pointer to the contents in the success state.
5813     * Reading from this pointer when `result_ok` is not set is undefined.
5814     */
5815    struct LDKThirtyTwoBytes *result;
5816    /**
5817     * A pointer to the contents in the error state.
5818     * Reading from this pointer when `result_ok` is set is undefined.
5819     */
5820    struct LDKAPIError *err;
5821 } LDKCResult__u832APIErrorZPtr;
5822
5823 /**
5824  * A CResult__u832APIErrorZ represents the result of a fallible operation,
5825  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
5826  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5827  */
5828 typedef struct LDKCResult__u832APIErrorZ {
5829    /**
5830     * The contents of this CResult__u832APIErrorZ, accessible via either
5831     * `err` or `result` depending on the state of `result_ok`.
5832     */
5833    union LDKCResult__u832APIErrorZPtr contents;
5834    /**
5835     * Whether this CResult__u832APIErrorZ represents a success state.
5836     */
5837    bool result_ok;
5838 } LDKCResult__u832APIErrorZ;
5839
5840 /**
5841  * If a payment fails to send, it can be in one of several states. This enum is returned as the
5842  * Err() type describing which state the payment is in, see the description of individual enum
5843  * states for more.
5844  */
5845 typedef enum LDKPaymentSendFailure_Tag {
5846    /**
5847     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
5848     * send the payment at all. No channel state has been changed or messages sent to peers, and
5849     * once you've changed the parameter at error, you can freely retry the payment in full.
5850     */
5851    LDKPaymentSendFailure_ParameterError,
5852    /**
5853     * A parameter in a single path which was passed to send_payment was invalid, preventing us
5854     * from attempting to send the payment at all. No channel state has been changed or messages
5855     * sent to peers, and once you've changed the parameter at error, you can freely retry the
5856     * payment in full.
5857     *
5858     * The results here are ordered the same as the paths in the route object which was passed to
5859     * send_payment.
5860     */
5861    LDKPaymentSendFailure_PathParameterError,
5862    /**
5863     * All paths which were attempted failed to send, with no channel state change taking place.
5864     * You can freely retry the payment in full (though you probably want to do so over different
5865     * paths than the ones selected).
5866     */
5867    LDKPaymentSendFailure_AllFailedRetrySafe,
5868    /**
5869     * Some paths which were attempted failed to send, though possibly not all. At least some
5870     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
5871     * in over-/re-payment.
5872     *
5873     * The results here are ordered the same as the paths in the route object which was passed to
5874     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
5875     * retried (though there is currently no API with which to do so).
5876     *
5877     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
5878     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
5879     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
5880     * with the latest update_id.
5881     */
5882    LDKPaymentSendFailure_PartialFailure,
5883    /**
5884     * Must be last for serialization purposes
5885     */
5886    LDKPaymentSendFailure_Sentinel,
5887 } LDKPaymentSendFailure_Tag;
5888
5889 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
5890    /**
5891     * The errors themselves, in the same order as the route hops.
5892     */
5893    struct LDKCVec_CResult_NoneAPIErrorZZ results;
5894    /**
5895     * If some paths failed without irrevocably committing to the new HTLC(s), this will
5896     * contain a [`RouteParameters`] object which can be used to calculate a new route that
5897     * will pay all remaining unpaid balance.
5898     *
5899     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
5900     */
5901    struct LDKRouteParameters failed_paths_retry;
5902    /**
5903     * The payment id for the payment, which is now at least partially pending.
5904     */
5905    struct LDKThirtyTwoBytes payment_id;
5906 } LDKPaymentSendFailure_LDKPartialFailure_Body;
5907
5908 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
5909    LDKPaymentSendFailure_Tag tag;
5910    union {
5911       struct {
5912          struct LDKAPIError parameter_error;
5913       };
5914       struct {
5915          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
5916       };
5917       struct {
5918          struct LDKCVec_APIErrorZ all_failed_retry_safe;
5919       };
5920       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
5921    };
5922 } LDKPaymentSendFailure;
5923
5924 /**
5925  * The contents of CResult_PaymentIdPaymentSendFailureZ
5926  */
5927 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
5928    /**
5929     * A pointer to the contents in the success state.
5930     * Reading from this pointer when `result_ok` is not set is undefined.
5931     */
5932    struct LDKThirtyTwoBytes *result;
5933    /**
5934     * A pointer to the contents in the error state.
5935     * Reading from this pointer when `result_ok` is set is undefined.
5936     */
5937    struct LDKPaymentSendFailure *err;
5938 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
5939
5940 /**
5941  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
5942  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5943  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5944  */
5945 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
5946    /**
5947     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
5948     * `err` or `result` depending on the state of `result_ok`.
5949     */
5950    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
5951    /**
5952     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
5953     */
5954    bool result_ok;
5955 } LDKCResult_PaymentIdPaymentSendFailureZ;
5956
5957 /**
5958  * The contents of CResult_NonePaymentSendFailureZ
5959  */
5960 typedef union LDKCResult_NonePaymentSendFailureZPtr {
5961    /**
5962     * Note that this value is always NULL, as there are no contents in the OK variant
5963     */
5964    void *result;
5965    /**
5966     * A pointer to the contents in the error state.
5967     * Reading from this pointer when `result_ok` is set is undefined.
5968     */
5969    struct LDKPaymentSendFailure *err;
5970 } LDKCResult_NonePaymentSendFailureZPtr;
5971
5972 /**
5973  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
5974  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
5975  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5976  */
5977 typedef struct LDKCResult_NonePaymentSendFailureZ {
5978    /**
5979     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
5980     * `err` or `result` depending on the state of `result_ok`.
5981     */
5982    union LDKCResult_NonePaymentSendFailureZPtr contents;
5983    /**
5984     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
5985     */
5986    bool result_ok;
5987 } LDKCResult_NonePaymentSendFailureZ;
5988
5989 /**
5990  * A tuple of 2 elements. See the individual fields for the types contained.
5991  */
5992 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
5993    /**
5994     * The element at position 0
5995     */
5996    struct LDKThirtyTwoBytes a;
5997    /**
5998     * The element at position 1
5999     */
6000    struct LDKThirtyTwoBytes b;
6001 } LDKC2Tuple_PaymentHashPaymentIdZ;
6002
6003 /**
6004  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6005  */
6006 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6007    /**
6008     * A pointer to the contents in the success state.
6009     * Reading from this pointer when `result_ok` is not set is undefined.
6010     */
6011    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
6012    /**
6013     * A pointer to the contents in the error state.
6014     * Reading from this pointer when `result_ok` is set is undefined.
6015     */
6016    struct LDKPaymentSendFailure *err;
6017 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
6018
6019 /**
6020  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6021  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6022  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6023  */
6024 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6025    /**
6026     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6027     * `err` or `result` depending on the state of `result_ok`.
6028     */
6029    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
6030    /**
6031     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6032     */
6033    bool result_ok;
6034 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
6035
6036 /**
6037  * A 4-byte byte array.
6038  */
6039 typedef struct LDKFourBytes {
6040    /**
6041     * The four bytes
6042     */
6043    uint8_t data[4];
6044 } LDKFourBytes;
6045
6046 /**
6047  * A 16-byte byte array.
6048  */
6049 typedef struct LDKSixteenBytes {
6050    /**
6051     * The sixteen bytes
6052     */
6053    uint8_t data[16];
6054 } LDKSixteenBytes;
6055
6056 /**
6057  * A 12-byte byte array.
6058  */
6059 typedef struct LDKTwelveBytes {
6060    /**
6061     * The twelve bytes
6062     */
6063    uint8_t data[12];
6064 } LDKTwelveBytes;
6065
6066 /**
6067  * An address which can be used to connect to a remote peer
6068  */
6069 typedef enum LDKNetAddress_Tag {
6070    /**
6071     * An IPv4 address/port on which the peer is listening.
6072     */
6073    LDKNetAddress_IPv4,
6074    /**
6075     * An IPv6 address/port on which the peer is listening.
6076     */
6077    LDKNetAddress_IPv6,
6078    /**
6079     * An old-style Tor onion address/port on which the peer is listening.
6080     *
6081     * This field is deprecated and the Tor network generally no longer supports V2 Onion
6082     * addresses. Thus, the details are not parsed here.
6083     */
6084    LDKNetAddress_OnionV2,
6085    /**
6086     * A new-style Tor onion address/port on which the peer is listening.
6087     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
6088     * wrap as base32 and append \".onion\".
6089     */
6090    LDKNetAddress_OnionV3,
6091    /**
6092     * Must be last for serialization purposes
6093     */
6094    LDKNetAddress_Sentinel,
6095 } LDKNetAddress_Tag;
6096
6097 typedef struct LDKNetAddress_LDKIPv4_Body {
6098    /**
6099     * The 4-byte IPv4 address
6100     */
6101    struct LDKFourBytes addr;
6102    /**
6103     * The port on which the node is listening
6104     */
6105    uint16_t port;
6106 } LDKNetAddress_LDKIPv4_Body;
6107
6108 typedef struct LDKNetAddress_LDKIPv6_Body {
6109    /**
6110     * The 16-byte IPv6 address
6111     */
6112    struct LDKSixteenBytes addr;
6113    /**
6114     * The port on which the node is listening
6115     */
6116    uint16_t port;
6117 } LDKNetAddress_LDKIPv6_Body;
6118
6119 typedef struct LDKNetAddress_LDKOnionV3_Body {
6120    /**
6121     * The ed25519 long-term public key of the peer
6122     */
6123    struct LDKThirtyTwoBytes ed25519_pubkey;
6124    /**
6125     * The checksum of the pubkey and version, as included in the onion address
6126     */
6127    uint16_t checksum;
6128    /**
6129     * The version byte, as defined by the Tor Onion v3 spec.
6130     */
6131    uint8_t version;
6132    /**
6133     * The port on which the node is listening
6134     */
6135    uint16_t port;
6136 } LDKNetAddress_LDKOnionV3_Body;
6137
6138 typedef struct MUST_USE_STRUCT LDKNetAddress {
6139    LDKNetAddress_Tag tag;
6140    union {
6141       LDKNetAddress_LDKIPv4_Body i_pv4;
6142       LDKNetAddress_LDKIPv6_Body i_pv6;
6143       struct {
6144          struct LDKTwelveBytes onion_v2;
6145       };
6146       LDKNetAddress_LDKOnionV3_Body onion_v3;
6147    };
6148 } LDKNetAddress;
6149
6150 /**
6151  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
6152  * This corresponds to std::vector in C++
6153  */
6154 typedef struct LDKCVec_NetAddressZ {
6155    /**
6156     * The elements in the array.
6157     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6158     */
6159    struct LDKNetAddress *data;
6160    /**
6161     * The number of elements pointed to by `data`.
6162     */
6163    uintptr_t datalen;
6164 } LDKCVec_NetAddressZ;
6165
6166 /**
6167  * A tuple of 2 elements. See the individual fields for the types contained.
6168  */
6169 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
6170    /**
6171     * The element at position 0
6172     */
6173    struct LDKThirtyTwoBytes a;
6174    /**
6175     * The element at position 1
6176     */
6177    struct LDKThirtyTwoBytes b;
6178 } LDKC2Tuple_PaymentHashPaymentSecretZ;
6179
6180 /**
6181  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6182  */
6183 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6184    /**
6185     * A pointer to the contents in the success state.
6186     * Reading from this pointer when `result_ok` is not set is undefined.
6187     */
6188    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
6189    /**
6190     * Note that this value is always NULL, as there are no contents in the Err variant
6191     */
6192    void *err;
6193 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
6194
6195 /**
6196  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6197  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6198  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6199  */
6200 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6201    /**
6202     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6203     * `err` or `result` depending on the state of `result_ok`.
6204     */
6205    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
6206    /**
6207     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6208     */
6209    bool result_ok;
6210 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
6211
6212 /**
6213  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6214  */
6215 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6216    /**
6217     * A pointer to the contents in the success state.
6218     * Reading from this pointer when `result_ok` is not set is undefined.
6219     */
6220    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
6221    /**
6222     * A pointer to the contents in the error state.
6223     * Reading from this pointer when `result_ok` is set is undefined.
6224     */
6225    struct LDKAPIError *err;
6226 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
6227
6228 /**
6229  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6230  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6231  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6232  */
6233 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6234    /**
6235     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6236     * `err` or `result` depending on the state of `result_ok`.
6237     */
6238    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
6239    /**
6240     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6241     */
6242    bool result_ok;
6243 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
6244
6245 /**
6246  * The contents of CResult_PaymentSecretNoneZ
6247  */
6248 typedef union LDKCResult_PaymentSecretNoneZPtr {
6249    /**
6250     * A pointer to the contents in the success state.
6251     * Reading from this pointer when `result_ok` is not set is undefined.
6252     */
6253    struct LDKThirtyTwoBytes *result;
6254    /**
6255     * Note that this value is always NULL, as there are no contents in the Err variant
6256     */
6257    void *err;
6258 } LDKCResult_PaymentSecretNoneZPtr;
6259
6260 /**
6261  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6262  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6263  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6264  */
6265 typedef struct LDKCResult_PaymentSecretNoneZ {
6266    /**
6267     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
6268     * `err` or `result` depending on the state of `result_ok`.
6269     */
6270    union LDKCResult_PaymentSecretNoneZPtr contents;
6271    /**
6272     * Whether this CResult_PaymentSecretNoneZ represents a success state.
6273     */
6274    bool result_ok;
6275 } LDKCResult_PaymentSecretNoneZ;
6276
6277 /**
6278  * The contents of CResult_PaymentSecretAPIErrorZ
6279  */
6280 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
6281    /**
6282     * A pointer to the contents in the success state.
6283     * Reading from this pointer when `result_ok` is not set is undefined.
6284     */
6285    struct LDKThirtyTwoBytes *result;
6286    /**
6287     * A pointer to the contents in the error state.
6288     * Reading from this pointer when `result_ok` is set is undefined.
6289     */
6290    struct LDKAPIError *err;
6291 } LDKCResult_PaymentSecretAPIErrorZPtr;
6292
6293 /**
6294  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6295  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6296  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6297  */
6298 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
6299    /**
6300     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6301     * `err` or `result` depending on the state of `result_ok`.
6302     */
6303    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
6304    /**
6305     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6306     */
6307    bool result_ok;
6308 } LDKCResult_PaymentSecretAPIErrorZ;
6309
6310 /**
6311  * The contents of CResult_PaymentPreimageAPIErrorZ
6312  */
6313 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
6314    /**
6315     * A pointer to the contents in the success state.
6316     * Reading from this pointer when `result_ok` is not set is undefined.
6317     */
6318    struct LDKThirtyTwoBytes *result;
6319    /**
6320     * A pointer to the contents in the error state.
6321     * Reading from this pointer when `result_ok` is set is undefined.
6322     */
6323    struct LDKAPIError *err;
6324 } LDKCResult_PaymentPreimageAPIErrorZPtr;
6325
6326 /**
6327  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
6328  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6329  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6330  */
6331 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
6332    /**
6333     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
6334     * `err` or `result` depending on the state of `result_ok`.
6335     */
6336    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
6337    /**
6338     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
6339     */
6340    bool result_ok;
6341 } LDKCResult_PaymentPreimageAPIErrorZ;
6342
6343
6344
6345 /**
6346  * Information needed for constructing an invoice route hint for this channel.
6347  */
6348 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
6349    /**
6350     * A pointer to the opaque Rust object.
6351     * Nearly everywhere, inner must be non-null, however in places where
6352     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6353     */
6354    LDKnativeCounterpartyForwardingInfo *inner;
6355    /**
6356     * Indicates that this is the only struct which contains the same pointer.
6357     * Rust functions which take ownership of an object provided via an argument require
6358     * this to be true and invalidate the object pointed to by inner.
6359     */
6360    bool is_owned;
6361 } LDKCounterpartyForwardingInfo;
6362
6363 /**
6364  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
6365  */
6366 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
6367    /**
6368     * A pointer to the contents in the success state.
6369     * Reading from this pointer when `result_ok` is not set is undefined.
6370     */
6371    struct LDKCounterpartyForwardingInfo *result;
6372    /**
6373     * A pointer to the contents in the error state.
6374     * Reading from this pointer when `result_ok` is set is undefined.
6375     */
6376    struct LDKDecodeError *err;
6377 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
6378
6379 /**
6380  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
6381  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
6382  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6383  */
6384 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
6385    /**
6386     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
6387     * `err` or `result` depending on the state of `result_ok`.
6388     */
6389    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
6390    /**
6391     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
6392     */
6393    bool result_ok;
6394 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
6395
6396
6397
6398 /**
6399  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
6400  * to better separate parameters.
6401  */
6402 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
6403    /**
6404     * A pointer to the opaque Rust object.
6405     * Nearly everywhere, inner must be non-null, however in places where
6406     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6407     */
6408    LDKnativeChannelCounterparty *inner;
6409    /**
6410     * Indicates that this is the only struct which contains the same pointer.
6411     * Rust functions which take ownership of an object provided via an argument require
6412     * this to be true and invalidate the object pointed to by inner.
6413     */
6414    bool is_owned;
6415 } LDKChannelCounterparty;
6416
6417 /**
6418  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
6419  */
6420 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
6421    /**
6422     * A pointer to the contents in the success state.
6423     * Reading from this pointer when `result_ok` is not set is undefined.
6424     */
6425    struct LDKChannelCounterparty *result;
6426    /**
6427     * A pointer to the contents in the error state.
6428     * Reading from this pointer when `result_ok` is set is undefined.
6429     */
6430    struct LDKDecodeError *err;
6431 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
6432
6433 /**
6434  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
6435  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
6436  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6437  */
6438 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
6439    /**
6440     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
6441     * `err` or `result` depending on the state of `result_ok`.
6442     */
6443    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
6444    /**
6445     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
6446     */
6447    bool result_ok;
6448 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
6449
6450 /**
6451  * The contents of CResult_ChannelDetailsDecodeErrorZ
6452  */
6453 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
6454    /**
6455     * A pointer to the contents in the success state.
6456     * Reading from this pointer when `result_ok` is not set is undefined.
6457     */
6458    struct LDKChannelDetails *result;
6459    /**
6460     * A pointer to the contents in the error state.
6461     * Reading from this pointer when `result_ok` is set is undefined.
6462     */
6463    struct LDKDecodeError *err;
6464 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
6465
6466 /**
6467  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
6468  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
6469  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6470  */
6471 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
6472    /**
6473     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
6474     * `err` or `result` depending on the state of `result_ok`.
6475     */
6476    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
6477    /**
6478     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
6479     */
6480    bool result_ok;
6481 } LDKCResult_ChannelDetailsDecodeErrorZ;
6482
6483
6484
6485 /**
6486  * Route hints used in constructing invoices for [phantom node payents].
6487  *
6488  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
6489  */
6490 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
6491    /**
6492     * A pointer to the opaque Rust object.
6493     * Nearly everywhere, inner must be non-null, however in places where
6494     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6495     */
6496    LDKnativePhantomRouteHints *inner;
6497    /**
6498     * Indicates that this is the only struct which contains the same pointer.
6499     * Rust functions which take ownership of an object provided via an argument require
6500     * this to be true and invalidate the object pointed to by inner.
6501     */
6502    bool is_owned;
6503 } LDKPhantomRouteHints;
6504
6505 /**
6506  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
6507  */
6508 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
6509    /**
6510     * A pointer to the contents in the success state.
6511     * Reading from this pointer when `result_ok` is not set is undefined.
6512     */
6513    struct LDKPhantomRouteHints *result;
6514    /**
6515     * A pointer to the contents in the error state.
6516     * Reading from this pointer when `result_ok` is set is undefined.
6517     */
6518    struct LDKDecodeError *err;
6519 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
6520
6521 /**
6522  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
6523  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
6524  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6525  */
6526 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
6527    /**
6528     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
6529     * `err` or `result` depending on the state of `result_ok`.
6530     */
6531    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
6532    /**
6533     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
6534     */
6535    bool result_ok;
6536 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
6537
6538 /**
6539  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
6540  * This corresponds to std::vector in C++
6541  */
6542 typedef struct LDKCVec_ChannelMonitorZ {
6543    /**
6544     * The elements in the array.
6545     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6546     */
6547    struct LDKChannelMonitor *data;
6548    /**
6549     * The number of elements pointed to by `data`.
6550     */
6551    uintptr_t datalen;
6552 } LDKCVec_ChannelMonitorZ;
6553
6554
6555
6556 /**
6557  * An update generated by the underlying Channel itself which contains some new information the
6558  * ChannelMonitor should be made aware of.
6559  */
6560 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
6561    /**
6562     * A pointer to the opaque Rust object.
6563     * Nearly everywhere, inner must be non-null, however in places where
6564     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6565     */
6566    LDKnativeChannelMonitorUpdate *inner;
6567    /**
6568     * Indicates that this is the only struct which contains the same pointer.
6569     * Rust functions which take ownership of an object provided via an argument require
6570     * this to be true and invalidate the object pointed to by inner.
6571     */
6572    bool is_owned;
6573 } LDKChannelMonitorUpdate;
6574
6575 /**
6576  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
6577  * blocks are connected and disconnected.
6578  *
6579  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
6580  * responsible for maintaining a set of monitors such that they can be updated accordingly as
6581  * channel state changes and HTLCs are resolved. See method documentation for specific
6582  * requirements.
6583  *
6584  * Implementations **must** ensure that updates are successfully applied and persisted upon method
6585  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
6586  * without taking any further action such as persisting the current state.
6587  *
6588  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
6589  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
6590  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
6591  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
6592  * multiple instances.
6593  *
6594  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
6595  */
6596 typedef struct LDKWatch {
6597    /**
6598     * An opaque pointer which is passed to your function implementations as an argument.
6599     * This has no meaning in the LDK, and can be NULL or any other value.
6600     */
6601    void *this_arg;
6602    /**
6603     * Watches a channel identified by `funding_txo` using `monitor`.
6604     *
6605     * Implementations are responsible for watching the chain for the funding transaction along
6606     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
6607     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
6608     *
6609     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
6610     * the given `funding_txo` has previously been registered via `watch_channel`.
6611     *
6612     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
6613     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
6614     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
6615     */
6616    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
6617    /**
6618     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
6619     *
6620     * Implementations must call [`update_monitor`] with the given update. See
6621     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
6622     *
6623     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
6624     */
6625    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
6626    /**
6627     * Returns any monitor events since the last call. Subsequent calls must only return new
6628     * events.
6629     *
6630     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
6631     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
6632     * to disk.
6633     *
6634     * For details on asynchronous [`ChannelMonitor`] updating and returning
6635     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
6636     */
6637    struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
6638    /**
6639     * Frees any resources associated with this object given its this_arg pointer.
6640     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6641     */
6642    void (*free)(void *this_arg);
6643 } LDKWatch;
6644
6645 /**
6646  * An interface to send a transaction to the Bitcoin network.
6647  */
6648 typedef struct LDKBroadcasterInterface {
6649    /**
6650     * An opaque pointer which is passed to your function implementations as an argument.
6651     * This has no meaning in the LDK, and can be NULL or any other value.
6652     */
6653    void *this_arg;
6654    /**
6655     * Sends a transaction out to (hopefully) be mined.
6656     */
6657    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
6658    /**
6659     * Frees any resources associated with this object given its this_arg pointer.
6660     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6661     */
6662    void (*free)(void *this_arg);
6663 } LDKBroadcasterInterface;
6664
6665 /**
6666  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
6667  * own the memory pointed to by data.
6668  */
6669 typedef struct LDKu8slice {
6670    /**
6671     * A pointer to the byte buffer
6672     */
6673    const uint8_t *data;
6674    /**
6675     * The number of bytes pointed to by `data`.
6676     */
6677    uintptr_t datalen;
6678 } LDKu8slice;
6679
6680 /**
6681  * A trait to describe an object which can get user secrets and key material.
6682  */
6683 typedef struct LDKKeysInterface {
6684    /**
6685     * An opaque pointer which is passed to your function implementations as an argument.
6686     * This has no meaning in the LDK, and can be NULL or any other value.
6687     */
6688    void *this_arg;
6689    /**
6690     * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`].
6691     *
6692     * This method must return the same value each time it is called with a given `Recipient`
6693     * parameter.
6694     */
6695    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
6696    /**
6697     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
6698     *
6699     * This method should return a different value each time it is called, to avoid linking
6700     * on-chain funds across channels as controlled to the same user.
6701     */
6702    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
6703    /**
6704     * Get a script pubkey which we will send funds to when closing a channel.
6705     *
6706     * This method should return a different value each time it is called, to avoid linking
6707     * on-chain funds across channels as controlled to the same user.
6708     */
6709    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
6710    /**
6711     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
6712     * restarted with some stale data!
6713     *
6714     * This method must return a different value each time it is called.
6715     */
6716    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
6717    /**
6718     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
6719     * onion packets and for temporary channel IDs. There is no requirement that these be
6720     * persisted anywhere, though they must be unique across restarts.
6721     *
6722     * This method must return a different value each time it is called.
6723     */
6724    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
6725    /**
6726     * Reads a `Signer` for this `KeysInterface` from the given input stream.
6727     * This is only called during deserialization of other objects which contain
6728     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
6729     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
6730     * contain no versioning scheme. You may wish to include your own version prefix and ensure
6731     * you've read all of the provided bytes to ensure no corruption occurred.
6732     */
6733    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
6734    /**
6735     * Sign an invoice.
6736     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
6737     * this trait to parse the invoice and make sure they're signing what they expect, rather than
6738     * blindly signing the hash.
6739     * The hrp is ascii bytes, while the invoice data is base32.
6740     *
6741     * The secret key used to sign the invoice is dependent on the [`Recipient`].
6742     */
6743    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
6744    /**
6745     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
6746     *
6747     * If the implementor of this trait supports [phantom node payments], then every node that is
6748     * intended to be included in the phantom invoice route hints must return the same value from
6749     * this method.
6750     *
6751     * This method must return the same value each time it is called.
6752     *
6753     * [phantom node payments]: PhantomKeysManager
6754     */
6755    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
6756    /**
6757     * Frees any resources associated with this object given its this_arg pointer.
6758     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6759     */
6760    void (*free)(void *this_arg);
6761 } LDKKeysInterface;
6762
6763 /**
6764  * A trait which should be implemented to provide feerate information on a number of time
6765  * horizons.
6766  *
6767  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
6768  * called from inside the library in response to chain events, P2P events, or timer events).
6769  */
6770 typedef struct LDKFeeEstimator {
6771    /**
6772     * An opaque pointer which is passed to your function implementations as an argument.
6773     * This has no meaning in the LDK, and can be NULL or any other value.
6774     */
6775    void *this_arg;
6776    /**
6777     * Gets estimated satoshis of fee required per 1000 Weight-Units.
6778     *
6779     * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
6780     * round-downs don't put us below 1 satoshi-per-byte).
6781     *
6782     * This method can be implemented with the following unit conversions:
6783     *  * max(satoshis-per-byte * 250, 253)
6784     *  * max(satoshis-per-kbyte / 4, 253)
6785     */
6786    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
6787    /**
6788     * Frees any resources associated with this object given its this_arg pointer.
6789     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6790     */
6791    void (*free)(void *this_arg);
6792 } LDKFeeEstimator;
6793
6794
6795
6796 /**
6797  * A Record, unit of logging output with Metadata to enable filtering
6798  * Module_path, file, line to inform on log's source
6799  */
6800 typedef struct MUST_USE_STRUCT LDKRecord {
6801    /**
6802     * A pointer to the opaque Rust object.
6803     * Nearly everywhere, inner must be non-null, however in places where
6804     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6805     */
6806    LDKnativeRecord *inner;
6807    /**
6808     * Indicates that this is the only struct which contains the same pointer.
6809     * Rust functions which take ownership of an object provided via an argument require
6810     * this to be true and invalidate the object pointed to by inner.
6811     */
6812    bool is_owned;
6813 } LDKRecord;
6814
6815 /**
6816  * A trait encapsulating the operations required of a logger
6817  */
6818 typedef struct LDKLogger {
6819    /**
6820     * An opaque pointer which is passed to your function implementations as an argument.
6821     * This has no meaning in the LDK, and can be NULL or any other value.
6822     */
6823    void *this_arg;
6824    /**
6825     * Logs the `Record`
6826     */
6827    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
6828    /**
6829     * Frees any resources associated with this object given its this_arg pointer.
6830     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6831     */
6832    void (*free)(void *this_arg);
6833 } LDKLogger;
6834
6835
6836
6837 /**
6838  * Manager which keeps track of a number of channels and sends messages to the appropriate
6839  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
6840  *
6841  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
6842  * to individual Channels.
6843  *
6844  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
6845  * all peers during write/read (though does not modify this instance, only the instance being
6846  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
6847  * called funding_transaction_generated for outbound channels).
6848  *
6849  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
6850  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
6851  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
6852  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
6853  * the serialization process). If the deserialized version is out-of-date compared to the
6854  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
6855  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
6856  *
6857  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
6858  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6859  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
6860  * block_connected() to step towards your best block) upon deserialization before using the
6861  * object!
6862  *
6863  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
6864  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
6865  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
6866  * offline for a full minute. In order to track this, you must call
6867  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
6868  *
6869  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
6870  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
6871  * essentially you should default to using a SimpleRefChannelManager, and use a
6872  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
6873  * you're using lightning-net-tokio.
6874  */
6875 typedef struct MUST_USE_STRUCT LDKChannelManager {
6876    /**
6877     * A pointer to the opaque Rust object.
6878     * Nearly everywhere, inner must be non-null, however in places where
6879     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6880     */
6881    LDKnativeChannelManager *inner;
6882    /**
6883     * Indicates that this is the only struct which contains the same pointer.
6884     * Rust functions which take ownership of an object provided via an argument require
6885     * this to be true and invalidate the object pointed to by inner.
6886     */
6887    bool is_owned;
6888 } LDKChannelManager;
6889
6890 /**
6891  * A tuple of 2 elements. See the individual fields for the types contained.
6892  */
6893 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
6894    /**
6895     * The element at position 0
6896     */
6897    struct LDKThirtyTwoBytes a;
6898    /**
6899     * The element at position 1
6900     */
6901    struct LDKChannelManager b;
6902 } LDKC2Tuple_BlockHashChannelManagerZ;
6903
6904 /**
6905  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
6906  */
6907 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
6908    /**
6909     * A pointer to the contents in the success state.
6910     * Reading from this pointer when `result_ok` is not set is undefined.
6911     */
6912    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
6913    /**
6914     * A pointer to the contents in the error state.
6915     * Reading from this pointer when `result_ok` is set is undefined.
6916     */
6917    struct LDKDecodeError *err;
6918 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
6919
6920 /**
6921  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
6922  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
6923  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6924  */
6925 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
6926    /**
6927     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
6928     * `err` or `result` depending on the state of `result_ok`.
6929     */
6930    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
6931    /**
6932     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
6933     */
6934    bool result_ok;
6935 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
6936
6937
6938
6939 /**
6940  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
6941  * with our counterparty.
6942  */
6943 typedef struct MUST_USE_STRUCT LDKChannelConfig {
6944    /**
6945     * A pointer to the opaque Rust object.
6946     * Nearly everywhere, inner must be non-null, however in places where
6947     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6948     */
6949    LDKnativeChannelConfig *inner;
6950    /**
6951     * Indicates that this is the only struct which contains the same pointer.
6952     * Rust functions which take ownership of an object provided via an argument require
6953     * this to be true and invalidate the object pointed to by inner.
6954     */
6955    bool is_owned;
6956 } LDKChannelConfig;
6957
6958 /**
6959  * The contents of CResult_ChannelConfigDecodeErrorZ
6960  */
6961 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
6962    /**
6963     * A pointer to the contents in the success state.
6964     * Reading from this pointer when `result_ok` is not set is undefined.
6965     */
6966    struct LDKChannelConfig *result;
6967    /**
6968     * A pointer to the contents in the error state.
6969     * Reading from this pointer when `result_ok` is set is undefined.
6970     */
6971    struct LDKDecodeError *err;
6972 } LDKCResult_ChannelConfigDecodeErrorZPtr;
6973
6974 /**
6975  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
6976  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
6977  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6978  */
6979 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
6980    /**
6981     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
6982     * `err` or `result` depending on the state of `result_ok`.
6983     */
6984    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
6985    /**
6986     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
6987     */
6988    bool result_ok;
6989 } LDKCResult_ChannelConfigDecodeErrorZ;
6990
6991 /**
6992  * The contents of CResult_OutPointDecodeErrorZ
6993  */
6994 typedef union LDKCResult_OutPointDecodeErrorZPtr {
6995    /**
6996     * A pointer to the contents in the success state.
6997     * Reading from this pointer when `result_ok` is not set is undefined.
6998     */
6999    struct LDKOutPoint *result;
7000    /**
7001     * A pointer to the contents in the error state.
7002     * Reading from this pointer when `result_ok` is set is undefined.
7003     */
7004    struct LDKDecodeError *err;
7005 } LDKCResult_OutPointDecodeErrorZPtr;
7006
7007 /**
7008  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7009  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7010  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7011  */
7012 typedef struct LDKCResult_OutPointDecodeErrorZ {
7013    /**
7014     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7015     * `err` or `result` depending on the state of `result_ok`.
7016     */
7017    union LDKCResult_OutPointDecodeErrorZPtr contents;
7018    /**
7019     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
7020     */
7021    bool result_ok;
7022 } LDKCResult_OutPointDecodeErrorZ;
7023
7024 /**
7025  * Defines a type identifier for sending messages over the wire.
7026  *
7027  * Messages implementing this trait specify a type and must be [`Writeable`].
7028  */
7029 typedef struct LDKType {
7030    /**
7031     * An opaque pointer which is passed to your function implementations as an argument.
7032     * This has no meaning in the LDK, and can be NULL or any other value.
7033     */
7034    void *this_arg;
7035    /**
7036     * Returns the type identifying the message payload.
7037     */
7038    uint16_t (*type_id)(const void *this_arg);
7039    /**
7040     * Return a human-readable "debug" string describing this object
7041     */
7042    struct LDKStr (*debug_str)(const void *this_arg);
7043    /**
7044     * Serialize the object into a byte array
7045     */
7046    struct LDKCVec_u8Z (*write)(const void *this_arg);
7047    /**
7048     * Frees any resources associated with this object given its this_arg pointer.
7049     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7050     */
7051    void (*free)(void *this_arg);
7052 } LDKType;
7053
7054 /**
7055  * An enum which can either contain a crate::lightning::ln::wire::Type or not
7056  */
7057 typedef enum LDKCOption_TypeZ_Tag {
7058    /**
7059     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7060     */
7061    LDKCOption_TypeZ_Some,
7062    /**
7063     * When we're in this state, this COption_TypeZ contains nothing
7064     */
7065    LDKCOption_TypeZ_None,
7066    /**
7067     * Must be last for serialization purposes
7068     */
7069    LDKCOption_TypeZ_Sentinel,
7070 } LDKCOption_TypeZ_Tag;
7071
7072 typedef struct LDKCOption_TypeZ {
7073    LDKCOption_TypeZ_Tag tag;
7074    union {
7075       struct {
7076          struct LDKType some;
7077       };
7078    };
7079 } LDKCOption_TypeZ;
7080
7081 /**
7082  * The contents of CResult_COption_TypeZDecodeErrorZ
7083  */
7084 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
7085    /**
7086     * A pointer to the contents in the success state.
7087     * Reading from this pointer when `result_ok` is not set is undefined.
7088     */
7089    struct LDKCOption_TypeZ *result;
7090    /**
7091     * A pointer to the contents in the error state.
7092     * Reading from this pointer when `result_ok` is set is undefined.
7093     */
7094    struct LDKDecodeError *err;
7095 } LDKCResult_COption_TypeZDecodeErrorZPtr;
7096
7097 /**
7098  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7099  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7100  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7101  */
7102 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
7103    /**
7104     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7105     * `err` or `result` depending on the state of `result_ok`.
7106     */
7107    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
7108    /**
7109     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7110     */
7111    bool result_ok;
7112 } LDKCResult_COption_TypeZDecodeErrorZ;
7113
7114 /**
7115  * An error that may occur when making a payment.
7116  */
7117 typedef enum LDKPaymentError_Tag {
7118    /**
7119     * An error resulting from the provided [`Invoice`] or payment hash.
7120     */
7121    LDKPaymentError_Invoice,
7122    /**
7123     * An error occurring when finding a route.
7124     */
7125    LDKPaymentError_Routing,
7126    /**
7127     * An error occurring when sending a payment.
7128     */
7129    LDKPaymentError_Sending,
7130    /**
7131     * Must be last for serialization purposes
7132     */
7133    LDKPaymentError_Sentinel,
7134 } LDKPaymentError_Tag;
7135
7136 typedef struct MUST_USE_STRUCT LDKPaymentError {
7137    LDKPaymentError_Tag tag;
7138    union {
7139       struct {
7140          struct LDKStr invoice;
7141       };
7142       struct {
7143          struct LDKLightningError routing;
7144       };
7145       struct {
7146          struct LDKPaymentSendFailure sending;
7147       };
7148    };
7149 } LDKPaymentError;
7150
7151 /**
7152  * The contents of CResult_PaymentIdPaymentErrorZ
7153  */
7154 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
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 LDKThirtyTwoBytes *result;
7160    /**
7161     * A pointer to the contents in the error state.
7162     * Reading from this pointer when `result_ok` is set is undefined.
7163     */
7164    struct LDKPaymentError *err;
7165 } LDKCResult_PaymentIdPaymentErrorZPtr;
7166
7167 /**
7168  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
7169  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7170  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7171  */
7172 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
7173    /**
7174     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7175     * `err` or `result` depending on the state of `result_ok`.
7176     */
7177    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
7178    /**
7179     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7180     */
7181    bool result_ok;
7182 } LDKCResult_PaymentIdPaymentErrorZ;
7183
7184 /**
7185  * Sub-errors which don't have specific information in them use this type.
7186  */
7187 typedef struct LDKError {
7188    /**
7189     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
7190     */
7191    uint8_t _dummy;
7192 } LDKError;
7193
7194 /**
7195  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
7196  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
7197  */
7198 typedef enum LDKParseError_Tag {
7199    LDKParseError_Bech32Error,
7200    LDKParseError_ParseAmountError,
7201    LDKParseError_MalformedSignature,
7202    LDKParseError_BadPrefix,
7203    LDKParseError_UnknownCurrency,
7204    LDKParseError_UnknownSiPrefix,
7205    LDKParseError_MalformedHRP,
7206    LDKParseError_TooShortDataPart,
7207    LDKParseError_UnexpectedEndOfTaggedFields,
7208    LDKParseError_DescriptionDecodeError,
7209    LDKParseError_PaddingError,
7210    LDKParseError_IntegerOverflowError,
7211    LDKParseError_InvalidSegWitProgramLength,
7212    LDKParseError_InvalidPubKeyHashLength,
7213    LDKParseError_InvalidScriptHashLength,
7214    LDKParseError_InvalidRecoveryId,
7215    LDKParseError_InvalidSliceLength,
7216    /**
7217     * Not an error, but used internally to signal that a part of the invoice should be ignored
7218     * according to BOLT11
7219     */
7220    LDKParseError_Skip,
7221    /**
7222     * Must be last for serialization purposes
7223     */
7224    LDKParseError_Sentinel,
7225 } LDKParseError_Tag;
7226
7227 typedef struct MUST_USE_STRUCT LDKParseError {
7228    LDKParseError_Tag tag;
7229    union {
7230       struct {
7231          struct LDKBech32Error bech32_error;
7232       };
7233       struct {
7234          struct LDKError parse_amount_error;
7235       };
7236       struct {
7237          enum LDKSecp256k1Error malformed_signature;
7238       };
7239       struct {
7240          struct LDKError description_decode_error;
7241       };
7242       struct {
7243          struct LDKStr invalid_slice_length;
7244       };
7245    };
7246 } LDKParseError;
7247
7248 /**
7249  * The contents of CResult_SiPrefixParseErrorZ
7250  */
7251 typedef union LDKCResult_SiPrefixParseErrorZPtr {
7252    /**
7253     * A pointer to the contents in the success state.
7254     * Reading from this pointer when `result_ok` is not set is undefined.
7255     */
7256    enum LDKSiPrefix *result;
7257    /**
7258     * A pointer to the contents in the error state.
7259     * Reading from this pointer when `result_ok` is set is undefined.
7260     */
7261    struct LDKParseError *err;
7262 } LDKCResult_SiPrefixParseErrorZPtr;
7263
7264 /**
7265  * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
7266  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
7267  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7268  */
7269 typedef struct LDKCResult_SiPrefixParseErrorZ {
7270    /**
7271     * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
7272     * `err` or `result` depending on the state of `result_ok`.
7273     */
7274    union LDKCResult_SiPrefixParseErrorZPtr contents;
7275    /**
7276     * Whether this CResult_SiPrefixParseErrorZ represents a success state.
7277     */
7278    bool result_ok;
7279 } LDKCResult_SiPrefixParseErrorZ;
7280
7281
7282
7283 /**
7284  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
7285  *
7286  * There are three ways to construct an `Invoice`:
7287  *  1. using `InvoiceBuilder`
7288  *  2. using `Invoice::from_signed(SignedRawInvoice)`
7289  *  3. using `str::parse::<Invoice>(&str)`
7290  */
7291 typedef struct MUST_USE_STRUCT LDKInvoice {
7292    /**
7293     * A pointer to the opaque Rust object.
7294     * Nearly everywhere, inner must be non-null, however in places where
7295     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7296     */
7297    LDKnativeInvoice *inner;
7298    /**
7299     * Indicates that this is the only struct which contains the same pointer.
7300     * Rust functions which take ownership of an object provided via an argument require
7301     * this to be true and invalidate the object pointed to by inner.
7302     */
7303    bool is_owned;
7304 } LDKInvoice;
7305
7306 /**
7307  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
7308  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
7309  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
7310  */
7311 typedef enum LDKParseOrSemanticError_Tag {
7312    /**
7313     * The invoice couldn't be decoded
7314     */
7315    LDKParseOrSemanticError_ParseError,
7316    /**
7317     * The invoice could be decoded but violates the BOLT11 standard
7318     */
7319    LDKParseOrSemanticError_SemanticError,
7320    /**
7321     * Must be last for serialization purposes
7322     */
7323    LDKParseOrSemanticError_Sentinel,
7324 } LDKParseOrSemanticError_Tag;
7325
7326 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
7327    LDKParseOrSemanticError_Tag tag;
7328    union {
7329       struct {
7330          struct LDKParseError parse_error;
7331       };
7332       struct {
7333          enum LDKSemanticError semantic_error;
7334       };
7335    };
7336 } LDKParseOrSemanticError;
7337
7338 /**
7339  * The contents of CResult_InvoiceParseOrSemanticErrorZ
7340  */
7341 typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
7342    /**
7343     * A pointer to the contents in the success state.
7344     * Reading from this pointer when `result_ok` is not set is undefined.
7345     */
7346    struct LDKInvoice *result;
7347    /**
7348     * A pointer to the contents in the error state.
7349     * Reading from this pointer when `result_ok` is set is undefined.
7350     */
7351    struct LDKParseOrSemanticError *err;
7352 } LDKCResult_InvoiceParseOrSemanticErrorZPtr;
7353
7354 /**
7355  * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
7356  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
7357  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7358  */
7359 typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
7360    /**
7361     * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
7362     * `err` or `result` depending on the state of `result_ok`.
7363     */
7364    union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
7365    /**
7366     * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
7367     */
7368    bool result_ok;
7369 } LDKCResult_InvoiceParseOrSemanticErrorZ;
7370
7371
7372
7373 /**
7374  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
7375  * invalid.
7376  *
7377  * # Invariants
7378  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
7379  */
7380 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
7381    /**
7382     * A pointer to the opaque Rust object.
7383     * Nearly everywhere, inner must be non-null, however in places where
7384     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7385     */
7386    LDKnativeSignedRawInvoice *inner;
7387    /**
7388     * Indicates that this is the only struct which contains the same pointer.
7389     * Rust functions which take ownership of an object provided via an argument require
7390     * this to be true and invalidate the object pointed to by inner.
7391     */
7392    bool is_owned;
7393 } LDKSignedRawInvoice;
7394
7395 /**
7396  * The contents of CResult_SignedRawInvoiceParseErrorZ
7397  */
7398 typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
7399    /**
7400     * A pointer to the contents in the success state.
7401     * Reading from this pointer when `result_ok` is not set is undefined.
7402     */
7403    struct LDKSignedRawInvoice *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    struct LDKParseError *err;
7409 } LDKCResult_SignedRawInvoiceParseErrorZPtr;
7410
7411 /**
7412  * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
7413  * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
7414  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7415  */
7416 typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
7417    /**
7418     * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
7419     * `err` or `result` depending on the state of `result_ok`.
7420     */
7421    union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
7422    /**
7423     * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
7424     */
7425    bool result_ok;
7426 } LDKCResult_SignedRawInvoiceParseErrorZ;
7427
7428
7429
7430 /**
7431  * Represents an syntactically correct Invoice for a payment on the lightning network,
7432  * but without the signature information.
7433  * De- and encoding should not lead to information loss but may lead to different hashes.
7434  *
7435  * For methods without docs see the corresponding methods in `Invoice`.
7436  */
7437 typedef struct MUST_USE_STRUCT LDKRawInvoice {
7438    /**
7439     * A pointer to the opaque Rust object.
7440     * Nearly everywhere, inner must be non-null, however in places where
7441     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7442     */
7443    LDKnativeRawInvoice *inner;
7444    /**
7445     * Indicates that this is the only struct which contains the same pointer.
7446     * Rust functions which take ownership of an object provided via an argument require
7447     * this to be true and invalidate the object pointed to by inner.
7448     */
7449    bool is_owned;
7450 } LDKRawInvoice;
7451
7452
7453
7454 /**
7455  * Recoverable signature
7456  */
7457 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
7458    /**
7459     * A pointer to the opaque Rust object.
7460     * Nearly everywhere, inner must be non-null, however in places where
7461     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7462     */
7463    LDKnativeInvoiceSignature *inner;
7464    /**
7465     * Indicates that this is the only struct which contains the same pointer.
7466     * Rust functions which take ownership of an object provided via an argument require
7467     * this to be true and invalidate the object pointed to by inner.
7468     */
7469    bool is_owned;
7470 } LDKInvoiceSignature;
7471
7472 /**
7473  * A tuple of 3 elements. See the individual fields for the types contained.
7474  */
7475 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
7476    /**
7477     * The element at position 0
7478     */
7479    struct LDKRawInvoice a;
7480    /**
7481     * The element at position 1
7482     */
7483    struct LDKThirtyTwoBytes b;
7484    /**
7485     * The element at position 2
7486     */
7487    struct LDKInvoiceSignature c;
7488 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
7489
7490
7491
7492 /**
7493  * Payee public key
7494  */
7495 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
7496    /**
7497     * A pointer to the opaque Rust object.
7498     * Nearly everywhere, inner must be non-null, however in places where
7499     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7500     */
7501    LDKnativePayeePubKey *inner;
7502    /**
7503     * Indicates that this is the only struct which contains the same pointer.
7504     * Rust functions which take ownership of an object provided via an argument require
7505     * this to be true and invalidate the object pointed to by inner.
7506     */
7507    bool is_owned;
7508 } LDKPayeePubKey;
7509
7510 /**
7511  * The contents of CResult_PayeePubKeyErrorZ
7512  */
7513 typedef union LDKCResult_PayeePubKeyErrorZPtr {
7514    /**
7515     * A pointer to the contents in the success state.
7516     * Reading from this pointer when `result_ok` is not set is undefined.
7517     */
7518    struct LDKPayeePubKey *result;
7519    /**
7520     * A pointer to the contents in the error state.
7521     * Reading from this pointer when `result_ok` is set is undefined.
7522     */
7523    enum LDKSecp256k1Error *err;
7524 } LDKCResult_PayeePubKeyErrorZPtr;
7525
7526 /**
7527  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
7528  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
7529  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7530  */
7531 typedef struct LDKCResult_PayeePubKeyErrorZ {
7532    /**
7533     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
7534     * `err` or `result` depending on the state of `result_ok`.
7535     */
7536    union LDKCResult_PayeePubKeyErrorZPtr contents;
7537    /**
7538     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
7539     */
7540    bool result_ok;
7541 } LDKCResult_PayeePubKeyErrorZ;
7542
7543
7544
7545 /**
7546  * Private routing information
7547  *
7548  * # Invariants
7549  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
7550  *
7551  */
7552 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
7553    /**
7554     * A pointer to the opaque Rust object.
7555     * Nearly everywhere, inner must be non-null, however in places where
7556     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7557     */
7558    LDKnativePrivateRoute *inner;
7559    /**
7560     * Indicates that this is the only struct which contains the same pointer.
7561     * Rust functions which take ownership of an object provided via an argument require
7562     * this to be true and invalidate the object pointed to by inner.
7563     */
7564    bool is_owned;
7565 } LDKPrivateRoute;
7566
7567 /**
7568  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
7569  * This corresponds to std::vector in C++
7570  */
7571 typedef struct LDKCVec_PrivateRouteZ {
7572    /**
7573     * The elements in the array.
7574     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7575     */
7576    struct LDKPrivateRoute *data;
7577    /**
7578     * The number of elements pointed to by `data`.
7579     */
7580    uintptr_t datalen;
7581 } LDKCVec_PrivateRouteZ;
7582
7583
7584
7585 /**
7586  * A timestamp that refers to a date after 1 January 1970.
7587  *
7588  * # Invariants
7589  *
7590  * The Unix timestamp representing the stored time has to be positive and no greater than
7591  * [`MAX_TIMESTAMP`].
7592  */
7593 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
7594    /**
7595     * A pointer to the opaque Rust object.
7596     * Nearly everywhere, inner must be non-null, however in places where
7597     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7598     */
7599    LDKnativePositiveTimestamp *inner;
7600    /**
7601     * Indicates that this is the only struct which contains the same pointer.
7602     * Rust functions which take ownership of an object provided via an argument require
7603     * this to be true and invalidate the object pointed to by inner.
7604     */
7605    bool is_owned;
7606 } LDKPositiveTimestamp;
7607
7608 /**
7609  * The contents of CResult_PositiveTimestampCreationErrorZ
7610  */
7611 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
7612    /**
7613     * A pointer to the contents in the success state.
7614     * Reading from this pointer when `result_ok` is not set is undefined.
7615     */
7616    struct LDKPositiveTimestamp *result;
7617    /**
7618     * A pointer to the contents in the error state.
7619     * Reading from this pointer when `result_ok` is set is undefined.
7620     */
7621    enum LDKCreationError *err;
7622 } LDKCResult_PositiveTimestampCreationErrorZPtr;
7623
7624 /**
7625  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
7626  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
7627  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7628  */
7629 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
7630    /**
7631     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
7632     * `err` or `result` depending on the state of `result_ok`.
7633     */
7634    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
7635    /**
7636     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
7637     */
7638    bool result_ok;
7639 } LDKCResult_PositiveTimestampCreationErrorZ;
7640
7641 /**
7642  * The contents of CResult_NoneSemanticErrorZ
7643  */
7644 typedef union LDKCResult_NoneSemanticErrorZPtr {
7645    /**
7646     * Note that this value is always NULL, as there are no contents in the OK variant
7647     */
7648    void *result;
7649    /**
7650     * A pointer to the contents in the error state.
7651     * Reading from this pointer when `result_ok` is set is undefined.
7652     */
7653    enum LDKSemanticError *err;
7654 } LDKCResult_NoneSemanticErrorZPtr;
7655
7656 /**
7657  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
7658  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
7659  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7660  */
7661 typedef struct LDKCResult_NoneSemanticErrorZ {
7662    /**
7663     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
7664     * `err` or `result` depending on the state of `result_ok`.
7665     */
7666    union LDKCResult_NoneSemanticErrorZPtr contents;
7667    /**
7668     * Whether this CResult_NoneSemanticErrorZ represents a success state.
7669     */
7670    bool result_ok;
7671 } LDKCResult_NoneSemanticErrorZ;
7672
7673 /**
7674  * The contents of CResult_InvoiceSemanticErrorZ
7675  */
7676 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
7677    /**
7678     * A pointer to the contents in the success state.
7679     * Reading from this pointer when `result_ok` is not set is undefined.
7680     */
7681    struct LDKInvoice *result;
7682    /**
7683     * A pointer to the contents in the error state.
7684     * Reading from this pointer when `result_ok` is set is undefined.
7685     */
7686    enum LDKSemanticError *err;
7687 } LDKCResult_InvoiceSemanticErrorZPtr;
7688
7689 /**
7690  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
7691  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
7692  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7693  */
7694 typedef struct LDKCResult_InvoiceSemanticErrorZ {
7695    /**
7696     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
7697     * `err` or `result` depending on the state of `result_ok`.
7698     */
7699    union LDKCResult_InvoiceSemanticErrorZPtr contents;
7700    /**
7701     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
7702     */
7703    bool result_ok;
7704 } LDKCResult_InvoiceSemanticErrorZ;
7705
7706
7707
7708 /**
7709  * Description string
7710  *
7711  * # Invariants
7712  * The description can be at most 639 __bytes__ long
7713  */
7714 typedef struct MUST_USE_STRUCT LDKDescription {
7715    /**
7716     * A pointer to the opaque Rust object.
7717     * Nearly everywhere, inner must be non-null, however in places where
7718     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7719     */
7720    LDKnativeDescription *inner;
7721    /**
7722     * Indicates that this is the only struct which contains the same pointer.
7723     * Rust functions which take ownership of an object provided via an argument require
7724     * this to be true and invalidate the object pointed to by inner.
7725     */
7726    bool is_owned;
7727 } LDKDescription;
7728
7729 /**
7730  * The contents of CResult_DescriptionCreationErrorZ
7731  */
7732 typedef union LDKCResult_DescriptionCreationErrorZPtr {
7733    /**
7734     * A pointer to the contents in the success state.
7735     * Reading from this pointer when `result_ok` is not set is undefined.
7736     */
7737    struct LDKDescription *result;
7738    /**
7739     * A pointer to the contents in the error state.
7740     * Reading from this pointer when `result_ok` is set is undefined.
7741     */
7742    enum LDKCreationError *err;
7743 } LDKCResult_DescriptionCreationErrorZPtr;
7744
7745 /**
7746  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
7747  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
7748  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7749  */
7750 typedef struct LDKCResult_DescriptionCreationErrorZ {
7751    /**
7752     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
7753     * `err` or `result` depending on the state of `result_ok`.
7754     */
7755    union LDKCResult_DescriptionCreationErrorZPtr contents;
7756    /**
7757     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
7758     */
7759    bool result_ok;
7760 } LDKCResult_DescriptionCreationErrorZ;
7761
7762 /**
7763  * The contents of CResult_PrivateRouteCreationErrorZ
7764  */
7765 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
7766    /**
7767     * A pointer to the contents in the success state.
7768     * Reading from this pointer when `result_ok` is not set is undefined.
7769     */
7770    struct LDKPrivateRoute *result;
7771    /**
7772     * A pointer to the contents in the error state.
7773     * Reading from this pointer when `result_ok` is set is undefined.
7774     */
7775    enum LDKCreationError *err;
7776 } LDKCResult_PrivateRouteCreationErrorZPtr;
7777
7778 /**
7779  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
7780  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
7781  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7782  */
7783 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
7784    /**
7785     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
7786     * `err` or `result` depending on the state of `result_ok`.
7787     */
7788    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
7789    /**
7790     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
7791     */
7792    bool result_ok;
7793 } LDKCResult_PrivateRouteCreationErrorZ;
7794
7795 /**
7796  * The contents of CResult_StringErrorZ
7797  */
7798 typedef union LDKCResult_StringErrorZPtr {
7799    /**
7800     * A pointer to the contents in the success state.
7801     * Reading from this pointer when `result_ok` is not set is undefined.
7802     */
7803    struct LDKStr *result;
7804    /**
7805     * A pointer to the contents in the error state.
7806     * Reading from this pointer when `result_ok` is set is undefined.
7807     */
7808    enum LDKSecp256k1Error *err;
7809 } LDKCResult_StringErrorZPtr;
7810
7811 /**
7812  * A CResult_StringErrorZ represents the result of a fallible operation,
7813  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
7814  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7815  */
7816 typedef struct LDKCResult_StringErrorZ {
7817    /**
7818     * The contents of this CResult_StringErrorZ, accessible via either
7819     * `err` or `result` depending on the state of `result_ok`.
7820     */
7821    union LDKCResult_StringErrorZPtr contents;
7822    /**
7823     * Whether this CResult_StringErrorZ represents a success state.
7824     */
7825    bool result_ok;
7826 } LDKCResult_StringErrorZ;
7827
7828 /**
7829  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
7830  */
7831 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
7832    /**
7833     * A pointer to the contents in the success state.
7834     * Reading from this pointer when `result_ok` is not set is undefined.
7835     */
7836    struct LDKChannelMonitorUpdate *result;
7837    /**
7838     * A pointer to the contents in the error state.
7839     * Reading from this pointer when `result_ok` is set is undefined.
7840     */
7841    struct LDKDecodeError *err;
7842 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
7843
7844 /**
7845  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
7846  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7847  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7848  */
7849 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
7850    /**
7851     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
7852     * `err` or `result` depending on the state of `result_ok`.
7853     */
7854    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
7855    /**
7856     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
7857     */
7858    bool result_ok;
7859 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
7860
7861 /**
7862  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
7863  */
7864 typedef enum LDKCOption_MonitorEventZ_Tag {
7865    /**
7866     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
7867     */
7868    LDKCOption_MonitorEventZ_Some,
7869    /**
7870     * When we're in this state, this COption_MonitorEventZ contains nothing
7871     */
7872    LDKCOption_MonitorEventZ_None,
7873    /**
7874     * Must be last for serialization purposes
7875     */
7876    LDKCOption_MonitorEventZ_Sentinel,
7877 } LDKCOption_MonitorEventZ_Tag;
7878
7879 typedef struct LDKCOption_MonitorEventZ {
7880    LDKCOption_MonitorEventZ_Tag tag;
7881    union {
7882       struct {
7883          struct LDKMonitorEvent some;
7884       };
7885    };
7886 } LDKCOption_MonitorEventZ;
7887
7888 /**
7889  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
7890  */
7891 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
7892    /**
7893     * A pointer to the contents in the success state.
7894     * Reading from this pointer when `result_ok` is not set is undefined.
7895     */
7896    struct LDKCOption_MonitorEventZ *result;
7897    /**
7898     * A pointer to the contents in the error state.
7899     * Reading from this pointer when `result_ok` is set is undefined.
7900     */
7901    struct LDKDecodeError *err;
7902 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
7903
7904 /**
7905  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
7906  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7907  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7908  */
7909 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
7910    /**
7911     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
7912     * `err` or `result` depending on the state of `result_ok`.
7913     */
7914    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
7915    /**
7916     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
7917     */
7918    bool result_ok;
7919 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
7920
7921 /**
7922  * The contents of CResult_HTLCUpdateDecodeErrorZ
7923  */
7924 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
7925    /**
7926     * A pointer to the contents in the success state.
7927     * Reading from this pointer when `result_ok` is not set is undefined.
7928     */
7929    struct LDKHTLCUpdate *result;
7930    /**
7931     * A pointer to the contents in the error state.
7932     * Reading from this pointer when `result_ok` is set is undefined.
7933     */
7934    struct LDKDecodeError *err;
7935 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
7936
7937 /**
7938  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
7939  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
7940  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7941  */
7942 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
7943    /**
7944     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
7945     * `err` or `result` depending on the state of `result_ok`.
7946     */
7947    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
7948    /**
7949     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
7950     */
7951    bool result_ok;
7952 } LDKCResult_HTLCUpdateDecodeErrorZ;
7953
7954 /**
7955  * A tuple of 2 elements. See the individual fields for the types contained.
7956  */
7957 typedef struct LDKC2Tuple_OutPointScriptZ {
7958    /**
7959     * The element at position 0
7960     */
7961    struct LDKOutPoint a;
7962    /**
7963     * The element at position 1
7964     */
7965    struct LDKCVec_u8Z b;
7966 } LDKC2Tuple_OutPointScriptZ;
7967
7968 /**
7969  * A tuple of 2 elements. See the individual fields for the types contained.
7970  */
7971 typedef struct LDKC2Tuple_u32ScriptZ {
7972    /**
7973     * The element at position 0
7974     */
7975    uint32_t a;
7976    /**
7977     * The element at position 1
7978     */
7979    struct LDKCVec_u8Z b;
7980 } LDKC2Tuple_u32ScriptZ;
7981
7982 /**
7983  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
7984  * This corresponds to std::vector in C++
7985  */
7986 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
7987    /**
7988     * The elements in the array.
7989     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7990     */
7991    struct LDKC2Tuple_u32ScriptZ *data;
7992    /**
7993     * The number of elements pointed to by `data`.
7994     */
7995    uintptr_t datalen;
7996 } LDKCVec_C2Tuple_u32ScriptZZ;
7997
7998 /**
7999  * A tuple of 2 elements. See the individual fields for the types contained.
8000  */
8001 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8002    /**
8003     * The element at position 0
8004     */
8005    struct LDKThirtyTwoBytes a;
8006    /**
8007     * The element at position 1
8008     */
8009    struct LDKCVec_C2Tuple_u32ScriptZZ b;
8010 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
8011
8012 /**
8013  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
8014  * This corresponds to std::vector in C++
8015  */
8016 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8017    /**
8018     * The elements in the array.
8019     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8020     */
8021    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
8022    /**
8023     * The number of elements pointed to by `data`.
8024     */
8025    uintptr_t datalen;
8026 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
8027
8028 /**
8029  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
8030  * This corresponds to std::vector in C++
8031  */
8032 typedef struct LDKCVec_EventZ {
8033    /**
8034     * The elements in the array.
8035     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8036     */
8037    struct LDKEvent *data;
8038    /**
8039     * The number of elements pointed to by `data`.
8040     */
8041    uintptr_t datalen;
8042 } LDKCVec_EventZ;
8043
8044 /**
8045  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8046  * This corresponds to std::vector in C++
8047  */
8048 typedef struct LDKCVec_TransactionZ {
8049    /**
8050     * The elements in the array.
8051     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8052     */
8053    struct LDKTransaction *data;
8054    /**
8055     * The number of elements pointed to by `data`.
8056     */
8057    uintptr_t datalen;
8058 } LDKCVec_TransactionZ;
8059
8060 /**
8061  * A tuple of 2 elements. See the individual fields for the types contained.
8062  */
8063 typedef struct LDKC2Tuple_u32TxOutZ {
8064    /**
8065     * The element at position 0
8066     */
8067    uint32_t a;
8068    /**
8069     * The element at position 1
8070     */
8071    struct LDKTxOut b;
8072 } LDKC2Tuple_u32TxOutZ;
8073
8074 /**
8075  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
8076  * This corresponds to std::vector in C++
8077  */
8078 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
8079    /**
8080     * The elements in the array.
8081     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8082     */
8083    struct LDKC2Tuple_u32TxOutZ *data;
8084    /**
8085     * The number of elements pointed to by `data`.
8086     */
8087    uintptr_t datalen;
8088 } LDKCVec_C2Tuple_u32TxOutZZ;
8089
8090 /**
8091  * A tuple of 2 elements. See the individual fields for the types contained.
8092  */
8093 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8094    /**
8095     * The element at position 0
8096     */
8097    struct LDKThirtyTwoBytes a;
8098    /**
8099     * The element at position 1
8100     */
8101    struct LDKCVec_C2Tuple_u32TxOutZZ b;
8102 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
8103
8104 /**
8105  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
8106  * This corresponds to std::vector in C++
8107  */
8108 typedef struct LDKCVec_TransactionOutputsZ {
8109    /**
8110     * The elements in the array.
8111     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8112     */
8113    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
8114    /**
8115     * The number of elements pointed to by `data`.
8116     */
8117    uintptr_t datalen;
8118 } LDKCVec_TransactionOutputsZ;
8119
8120 /**
8121  * Details about the balance(s) available for spending once the channel appears on chain.
8122  *
8123  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
8124  * be provided.
8125  */
8126 typedef enum LDKBalance_Tag {
8127    /**
8128     * The channel is not yet closed (or the commitment or closing transaction has not yet
8129     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
8130     * force-closed now.
8131     */
8132    LDKBalance_ClaimableOnChannelClose,
8133    /**
8134     * The channel has been closed, and the given balance is ours but awaiting confirmations until
8135     * we consider it spendable.
8136     */
8137    LDKBalance_ClaimableAwaitingConfirmations,
8138    /**
8139     * The channel has been closed, and the given balance should be ours but awaiting spending
8140     * transaction confirmation. If the spending transaction does not confirm in time, it is
8141     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
8142     *
8143     * Once the spending transaction confirms, before it has reached enough confirmations to be
8144     * considered safe from chain reorganizations, the balance will instead be provided via
8145     * [`Balance::ClaimableAwaitingConfirmations`].
8146     */
8147    LDKBalance_ContentiousClaimable,
8148    /**
8149     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
8150     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
8151     * likely to be claimed by our counterparty before we do.
8152     */
8153    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
8154    /**
8155     * Must be last for serialization purposes
8156     */
8157    LDKBalance_Sentinel,
8158 } LDKBalance_Tag;
8159
8160 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
8161    /**
8162     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8163     * required to do so.
8164     */
8165    uint64_t claimable_amount_satoshis;
8166 } LDKBalance_LDKClaimableOnChannelClose_Body;
8167
8168 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
8169    /**
8170     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
8171     * were spent in broadcasting the transaction.
8172     */
8173    uint64_t claimable_amount_satoshis;
8174    /**
8175     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
8176     * amount.
8177     */
8178    uint32_t confirmation_height;
8179 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
8180
8181 typedef struct LDKBalance_LDKContentiousClaimable_Body {
8182    /**
8183     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8184     * required to do so.
8185     */
8186    uint64_t claimable_amount_satoshis;
8187    /**
8188     * The height at which the counterparty may be able to claim the balance if we have not
8189     * done so.
8190     */
8191    uint32_t timeout_height;
8192 } LDKBalance_LDKContentiousClaimable_Body;
8193
8194 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
8195    /**
8196     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8197     * required to do so.
8198     */
8199    uint64_t claimable_amount_satoshis;
8200    /**
8201     * The height at which we will be able to claim the balance if our counterparty has not
8202     * done so.
8203     */
8204    uint32_t claimable_height;
8205 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
8206
8207 typedef struct MUST_USE_STRUCT LDKBalance {
8208    LDKBalance_Tag tag;
8209    union {
8210       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
8211       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
8212       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
8213       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
8214    };
8215 } LDKBalance;
8216
8217 /**
8218  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
8219  * This corresponds to std::vector in C++
8220  */
8221 typedef struct LDKCVec_BalanceZ {
8222    /**
8223     * The elements in the array.
8224     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8225     */
8226    struct LDKBalance *data;
8227    /**
8228     * The number of elements pointed to by `data`.
8229     */
8230    uintptr_t datalen;
8231 } LDKCVec_BalanceZ;
8232
8233 /**
8234  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
8235  */
8236 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
8237    /**
8238     * A pointer to the contents in the success state.
8239     * Reading from this pointer when `result_ok` is not set is undefined.
8240     */
8241    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
8242    /**
8243     * A pointer to the contents in the error state.
8244     * Reading from this pointer when `result_ok` is set is undefined.
8245     */
8246    struct LDKDecodeError *err;
8247 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
8248
8249 /**
8250  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
8251  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8252  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8253  */
8254 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8255    /**
8256     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
8257     * `err` or `result` depending on the state of `result_ok`.
8258     */
8259    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
8260    /**
8261     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
8262     */
8263    bool result_ok;
8264 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
8265
8266 /**
8267  * The contents of CResult_NoneLightningErrorZ
8268  */
8269 typedef union LDKCResult_NoneLightningErrorZPtr {
8270    /**
8271     * Note that this value is always NULL, as there are no contents in the OK variant
8272     */
8273    void *result;
8274    /**
8275     * A pointer to the contents in the error state.
8276     * Reading from this pointer when `result_ok` is set is undefined.
8277     */
8278    struct LDKLightningError *err;
8279 } LDKCResult_NoneLightningErrorZPtr;
8280
8281 /**
8282  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
8283  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
8284  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8285  */
8286 typedef struct LDKCResult_NoneLightningErrorZ {
8287    /**
8288     * The contents of this CResult_NoneLightningErrorZ, accessible via either
8289     * `err` or `result` depending on the state of `result_ok`.
8290     */
8291    union LDKCResult_NoneLightningErrorZPtr contents;
8292    /**
8293     * Whether this CResult_NoneLightningErrorZ represents a success state.
8294     */
8295    bool result_ok;
8296 } LDKCResult_NoneLightningErrorZ;
8297
8298 /**
8299  * A tuple of 2 elements. See the individual fields for the types contained.
8300  */
8301 typedef struct LDKC2Tuple_PublicKeyTypeZ {
8302    /**
8303     * The element at position 0
8304     */
8305    struct LDKPublicKey a;
8306    /**
8307     * The element at position 1
8308     */
8309    struct LDKType b;
8310 } LDKC2Tuple_PublicKeyTypeZ;
8311
8312 /**
8313  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
8314  * This corresponds to std::vector in C++
8315  */
8316 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
8317    /**
8318     * The elements in the array.
8319     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8320     */
8321    struct LDKC2Tuple_PublicKeyTypeZ *data;
8322    /**
8323     * The number of elements pointed to by `data`.
8324     */
8325    uintptr_t datalen;
8326 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
8327
8328 /**
8329  * The contents of CResult_boolLightningErrorZ
8330  */
8331 typedef union LDKCResult_boolLightningErrorZPtr {
8332    /**
8333     * A pointer to the contents in the success state.
8334     * Reading from this pointer when `result_ok` is not set is undefined.
8335     */
8336    bool *result;
8337    /**
8338     * A pointer to the contents in the error state.
8339     * Reading from this pointer when `result_ok` is set is undefined.
8340     */
8341    struct LDKLightningError *err;
8342 } LDKCResult_boolLightningErrorZPtr;
8343
8344 /**
8345  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
8346  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
8347  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8348  */
8349 typedef struct LDKCResult_boolLightningErrorZ {
8350    /**
8351     * The contents of this CResult_boolLightningErrorZ, accessible via either
8352     * `err` or `result` depending on the state of `result_ok`.
8353     */
8354    union LDKCResult_boolLightningErrorZPtr contents;
8355    /**
8356     * Whether this CResult_boolLightningErrorZ represents a success state.
8357     */
8358    bool result_ok;
8359 } LDKCResult_boolLightningErrorZ;
8360
8361 /**
8362  * A tuple of 3 elements. See the individual fields for the types contained.
8363  */
8364 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
8365    /**
8366     * The element at position 0
8367     */
8368    struct LDKChannelAnnouncement a;
8369    /**
8370     * The element at position 1
8371     */
8372    struct LDKChannelUpdate b;
8373    /**
8374     * The element at position 2
8375     */
8376    struct LDKChannelUpdate c;
8377 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
8378
8379 /**
8380  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
8381  * This corresponds to std::vector in C++
8382  */
8383 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
8384    /**
8385     * The elements in the array.
8386     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8387     */
8388    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
8389    /**
8390     * The number of elements pointed to by `data`.
8391     */
8392    uintptr_t datalen;
8393 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
8394
8395 /**
8396  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
8397  * This corresponds to std::vector in C++
8398  */
8399 typedef struct LDKCVec_NodeAnnouncementZ {
8400    /**
8401     * The elements in the array.
8402     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8403     */
8404    struct LDKNodeAnnouncement *data;
8405    /**
8406     * The number of elements pointed to by `data`.
8407     */
8408    uintptr_t datalen;
8409 } LDKCVec_NodeAnnouncementZ;
8410
8411 /**
8412  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
8413  * This corresponds to std::vector in C++
8414  */
8415 typedef struct LDKCVec_PublicKeyZ {
8416    /**
8417     * The elements in the array.
8418     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8419     */
8420    struct LDKPublicKey *data;
8421    /**
8422     * The number of elements pointed to by `data`.
8423     */
8424    uintptr_t datalen;
8425 } LDKCVec_PublicKeyZ;
8426
8427 /**
8428  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
8429  */
8430 typedef enum LDKCOption_NetAddressZ_Tag {
8431    /**
8432     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
8433     */
8434    LDKCOption_NetAddressZ_Some,
8435    /**
8436     * When we're in this state, this COption_NetAddressZ contains nothing
8437     */
8438    LDKCOption_NetAddressZ_None,
8439    /**
8440     * Must be last for serialization purposes
8441     */
8442    LDKCOption_NetAddressZ_Sentinel,
8443 } LDKCOption_NetAddressZ_Tag;
8444
8445 typedef struct LDKCOption_NetAddressZ {
8446    LDKCOption_NetAddressZ_Tag tag;
8447    union {
8448       struct {
8449          struct LDKNetAddress some;
8450       };
8451    };
8452 } LDKCOption_NetAddressZ;
8453
8454
8455
8456 /**
8457  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
8458  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
8459  * descriptor.
8460  */
8461 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
8462    /**
8463     * A pointer to the opaque Rust object.
8464     * Nearly everywhere, inner must be non-null, however in places where
8465     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8466     */
8467    LDKnativePeerHandleError *inner;
8468    /**
8469     * Indicates that this is the only struct which contains the same pointer.
8470     * Rust functions which take ownership of an object provided via an argument require
8471     * this to be true and invalidate the object pointed to by inner.
8472     */
8473    bool is_owned;
8474 } LDKPeerHandleError;
8475
8476 /**
8477  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
8478  */
8479 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
8480    /**
8481     * A pointer to the contents in the success state.
8482     * Reading from this pointer when `result_ok` is not set is undefined.
8483     */
8484    struct LDKCVec_u8Z *result;
8485    /**
8486     * A pointer to the contents in the error state.
8487     * Reading from this pointer when `result_ok` is set is undefined.
8488     */
8489    struct LDKPeerHandleError *err;
8490 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
8491
8492 /**
8493  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
8494  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8495  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8496  */
8497 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
8498    /**
8499     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
8500     * `err` or `result` depending on the state of `result_ok`.
8501     */
8502    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
8503    /**
8504     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
8505     */
8506    bool result_ok;
8507 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
8508
8509 /**
8510  * The contents of CResult_NonePeerHandleErrorZ
8511  */
8512 typedef union LDKCResult_NonePeerHandleErrorZPtr {
8513    /**
8514     * Note that this value is always NULL, as there are no contents in the OK variant
8515     */
8516    void *result;
8517    /**
8518     * A pointer to the contents in the error state.
8519     * Reading from this pointer when `result_ok` is set is undefined.
8520     */
8521    struct LDKPeerHandleError *err;
8522 } LDKCResult_NonePeerHandleErrorZPtr;
8523
8524 /**
8525  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
8526  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8527  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8528  */
8529 typedef struct LDKCResult_NonePeerHandleErrorZ {
8530    /**
8531     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
8532     * `err` or `result` depending on the state of `result_ok`.
8533     */
8534    union LDKCResult_NonePeerHandleErrorZPtr contents;
8535    /**
8536     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
8537     */
8538    bool result_ok;
8539 } LDKCResult_NonePeerHandleErrorZ;
8540
8541 /**
8542  * The contents of CResult_boolPeerHandleErrorZ
8543  */
8544 typedef union LDKCResult_boolPeerHandleErrorZPtr {
8545    /**
8546     * A pointer to the contents in the success state.
8547     * Reading from this pointer when `result_ok` is not set is undefined.
8548     */
8549    bool *result;
8550    /**
8551     * A pointer to the contents in the error state.
8552     * Reading from this pointer when `result_ok` is set is undefined.
8553     */
8554    struct LDKPeerHandleError *err;
8555 } LDKCResult_boolPeerHandleErrorZPtr;
8556
8557 /**
8558  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
8559  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
8560  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8561  */
8562 typedef struct LDKCResult_boolPeerHandleErrorZ {
8563    /**
8564     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
8565     * `err` or `result` depending on the state of `result_ok`.
8566     */
8567    union LDKCResult_boolPeerHandleErrorZPtr contents;
8568    /**
8569     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
8570     */
8571    bool result_ok;
8572 } LDKCResult_boolPeerHandleErrorZ;
8573
8574
8575
8576 /**
8577  * Represents the compressed public key of a node
8578  */
8579 typedef struct MUST_USE_STRUCT LDKNodeId {
8580    /**
8581     * A pointer to the opaque Rust object.
8582     * Nearly everywhere, inner must be non-null, however in places where
8583     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8584     */
8585    LDKnativeNodeId *inner;
8586    /**
8587     * Indicates that this is the only struct which contains the same pointer.
8588     * Rust functions which take ownership of an object provided via an argument require
8589     * this to be true and invalidate the object pointed to by inner.
8590     */
8591    bool is_owned;
8592 } LDKNodeId;
8593
8594 /**
8595  * The contents of CResult_NodeIdDecodeErrorZ
8596  */
8597 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
8598    /**
8599     * A pointer to the contents in the success state.
8600     * Reading from this pointer when `result_ok` is not set is undefined.
8601     */
8602    struct LDKNodeId *result;
8603    /**
8604     * A pointer to the contents in the error state.
8605     * Reading from this pointer when `result_ok` is set is undefined.
8606     */
8607    struct LDKDecodeError *err;
8608 } LDKCResult_NodeIdDecodeErrorZPtr;
8609
8610 /**
8611  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
8612  * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
8613  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8614  */
8615 typedef struct LDKCResult_NodeIdDecodeErrorZ {
8616    /**
8617     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
8618     * `err` or `result` depending on the state of `result_ok`.
8619     */
8620    union LDKCResult_NodeIdDecodeErrorZPtr contents;
8621    /**
8622     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
8623     */
8624    bool result_ok;
8625 } LDKCResult_NodeIdDecodeErrorZ;
8626
8627 /**
8628  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
8629  */
8630 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
8631    /**
8632     * A pointer to the contents in the success state.
8633     * Reading from this pointer when `result_ok` is not set is undefined.
8634     */
8635    struct LDKCOption_NetworkUpdateZ *result;
8636    /**
8637     * A pointer to the contents in the error state.
8638     * Reading from this pointer when `result_ok` is set is undefined.
8639     */
8640    struct LDKDecodeError *err;
8641 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
8642
8643 /**
8644  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
8645  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8646  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8647  */
8648 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
8649    /**
8650     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
8651     * `err` or `result` depending on the state of `result_ok`.
8652     */
8653    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
8654    /**
8655     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
8656     */
8657    bool result_ok;
8658 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
8659
8660 /**
8661  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
8662  * UTXOs.
8663  */
8664 typedef struct LDKAccess {
8665    /**
8666     * An opaque pointer which is passed to your function implementations as an argument.
8667     * This has no meaning in the LDK, and can be NULL or any other value.
8668     */
8669    void *this_arg;
8670    /**
8671     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
8672     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
8673     * is unknown.
8674     *
8675     * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
8676     */
8677    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
8678    /**
8679     * Frees any resources associated with this object given its this_arg pointer.
8680     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8681     */
8682    void (*free)(void *this_arg);
8683 } LDKAccess;
8684
8685 /**
8686  * An enum which can either contain a crate::lightning::chain::Access or not
8687  */
8688 typedef enum LDKCOption_AccessZ_Tag {
8689    /**
8690     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
8691     */
8692    LDKCOption_AccessZ_Some,
8693    /**
8694     * When we're in this state, this COption_AccessZ contains nothing
8695     */
8696    LDKCOption_AccessZ_None,
8697    /**
8698     * Must be last for serialization purposes
8699     */
8700    LDKCOption_AccessZ_Sentinel,
8701 } LDKCOption_AccessZ_Tag;
8702
8703 typedef struct LDKCOption_AccessZ {
8704    LDKCOption_AccessZ_Tag tag;
8705    union {
8706       struct {
8707          struct LDKAccess some;
8708       };
8709    };
8710 } LDKCOption_AccessZ;
8711
8712
8713
8714 /**
8715  * Details about one direction of a channel as received within a [`ChannelUpdate`].
8716  */
8717 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
8718    /**
8719     * A pointer to the opaque Rust object.
8720     * Nearly everywhere, inner must be non-null, however in places where
8721     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8722     */
8723    LDKnativeChannelUpdateInfo *inner;
8724    /**
8725     * Indicates that this is the only struct which contains the same pointer.
8726     * Rust functions which take ownership of an object provided via an argument require
8727     * this to be true and invalidate the object pointed to by inner.
8728     */
8729    bool is_owned;
8730 } LDKChannelUpdateInfo;
8731
8732 /**
8733  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
8734  */
8735 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
8736    /**
8737     * A pointer to the contents in the success state.
8738     * Reading from this pointer when `result_ok` is not set is undefined.
8739     */
8740    struct LDKChannelUpdateInfo *result;
8741    /**
8742     * A pointer to the contents in the error state.
8743     * Reading from this pointer when `result_ok` is set is undefined.
8744     */
8745    struct LDKDecodeError *err;
8746 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
8747
8748 /**
8749  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
8750  * containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8752  */
8753 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
8754    /**
8755     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
8756     * `err` or `result` depending on the state of `result_ok`.
8757     */
8758    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
8759    /**
8760     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
8761     */
8762    bool result_ok;
8763 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
8764
8765
8766
8767 /**
8768  * Details about a channel (both directions).
8769  * Received within a channel announcement.
8770  */
8771 typedef struct MUST_USE_STRUCT LDKChannelInfo {
8772    /**
8773     * A pointer to the opaque Rust object.
8774     * Nearly everywhere, inner must be non-null, however in places where
8775     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8776     */
8777    LDKnativeChannelInfo *inner;
8778    /**
8779     * Indicates that this is the only struct which contains the same pointer.
8780     * Rust functions which take ownership of an object provided via an argument require
8781     * this to be true and invalidate the object pointed to by inner.
8782     */
8783    bool is_owned;
8784 } LDKChannelInfo;
8785
8786 /**
8787  * The contents of CResult_ChannelInfoDecodeErrorZ
8788  */
8789 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
8790    /**
8791     * A pointer to the contents in the success state.
8792     * Reading from this pointer when `result_ok` is not set is undefined.
8793     */
8794    struct LDKChannelInfo *result;
8795    /**
8796     * A pointer to the contents in the error state.
8797     * Reading from this pointer when `result_ok` is set is undefined.
8798     */
8799    struct LDKDecodeError *err;
8800 } LDKCResult_ChannelInfoDecodeErrorZPtr;
8801
8802 /**
8803  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
8804  * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8805  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8806  */
8807 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
8808    /**
8809     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
8810     * `err` or `result` depending on the state of `result_ok`.
8811     */
8812    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
8813    /**
8814     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
8815     */
8816    bool result_ok;
8817 } LDKCResult_ChannelInfoDecodeErrorZ;
8818
8819
8820
8821 /**
8822  * Fees for routing via a given channel or a node
8823  */
8824 typedef struct MUST_USE_STRUCT LDKRoutingFees {
8825    /**
8826     * A pointer to the opaque Rust object.
8827     * Nearly everywhere, inner must be non-null, however in places where
8828     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8829     */
8830    LDKnativeRoutingFees *inner;
8831    /**
8832     * Indicates that this is the only struct which contains the same pointer.
8833     * Rust functions which take ownership of an object provided via an argument require
8834     * this to be true and invalidate the object pointed to by inner.
8835     */
8836    bool is_owned;
8837 } LDKRoutingFees;
8838
8839 /**
8840  * The contents of CResult_RoutingFeesDecodeErrorZ
8841  */
8842 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
8843    /**
8844     * A pointer to the contents in the success state.
8845     * Reading from this pointer when `result_ok` is not set is undefined.
8846     */
8847    struct LDKRoutingFees *result;
8848    /**
8849     * A pointer to the contents in the error state.
8850     * Reading from this pointer when `result_ok` is set is undefined.
8851     */
8852    struct LDKDecodeError *err;
8853 } LDKCResult_RoutingFeesDecodeErrorZPtr;
8854
8855 /**
8856  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
8857  * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
8858  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8859  */
8860 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
8861    /**
8862     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
8863     * `err` or `result` depending on the state of `result_ok`.
8864     */
8865    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
8866    /**
8867     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
8868     */
8869    bool result_ok;
8870 } LDKCResult_RoutingFeesDecodeErrorZ;
8871
8872
8873
8874 /**
8875  * Information received in the latest node_announcement from this node.
8876  */
8877 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
8878    /**
8879     * A pointer to the opaque Rust object.
8880     * Nearly everywhere, inner must be non-null, however in places where
8881     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8882     */
8883    LDKnativeNodeAnnouncementInfo *inner;
8884    /**
8885     * Indicates that this is the only struct which contains the same pointer.
8886     * Rust functions which take ownership of an object provided via an argument require
8887     * this to be true and invalidate the object pointed to by inner.
8888     */
8889    bool is_owned;
8890 } LDKNodeAnnouncementInfo;
8891
8892 /**
8893  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
8894  */
8895 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
8896    /**
8897     * A pointer to the contents in the success state.
8898     * Reading from this pointer when `result_ok` is not set is undefined.
8899     */
8900    struct LDKNodeAnnouncementInfo *result;
8901    /**
8902     * A pointer to the contents in the error state.
8903     * Reading from this pointer when `result_ok` is set is undefined.
8904     */
8905    struct LDKDecodeError *err;
8906 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
8907
8908 /**
8909  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
8910  * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8911  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8912  */
8913 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
8914    /**
8915     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
8916     * `err` or `result` depending on the state of `result_ok`.
8917     */
8918    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
8919    /**
8920     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
8921     */
8922    bool result_ok;
8923 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
8924
8925 /**
8926  * A dynamically-allocated array of u64s of arbitrary size.
8927  * This corresponds to std::vector in C++
8928  */
8929 typedef struct LDKCVec_u64Z {
8930    /**
8931     * The elements in the array.
8932     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8933     */
8934    uint64_t *data;
8935    /**
8936     * The number of elements pointed to by `data`.
8937     */
8938    uintptr_t datalen;
8939 } LDKCVec_u64Z;
8940
8941
8942
8943 /**
8944  * Details about a node in the network, known from the network announcement.
8945  */
8946 typedef struct MUST_USE_STRUCT LDKNodeInfo {
8947    /**
8948     * A pointer to the opaque Rust object.
8949     * Nearly everywhere, inner must be non-null, however in places where
8950     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8951     */
8952    LDKnativeNodeInfo *inner;
8953    /**
8954     * Indicates that this is the only struct which contains the same pointer.
8955     * Rust functions which take ownership of an object provided via an argument require
8956     * this to be true and invalidate the object pointed to by inner.
8957     */
8958    bool is_owned;
8959 } LDKNodeInfo;
8960
8961 /**
8962  * The contents of CResult_NodeInfoDecodeErrorZ
8963  */
8964 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
8965    /**
8966     * A pointer to the contents in the success state.
8967     * Reading from this pointer when `result_ok` is not set is undefined.
8968     */
8969    struct LDKNodeInfo *result;
8970    /**
8971     * A pointer to the contents in the error state.
8972     * Reading from this pointer when `result_ok` is set is undefined.
8973     */
8974    struct LDKDecodeError *err;
8975 } LDKCResult_NodeInfoDecodeErrorZPtr;
8976
8977 /**
8978  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
8979  * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
8980  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8981  */
8982 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
8983    /**
8984     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
8985     * `err` or `result` depending on the state of `result_ok`.
8986     */
8987    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
8988    /**
8989     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
8990     */
8991    bool result_ok;
8992 } LDKCResult_NodeInfoDecodeErrorZ;
8993
8994 /**
8995  * The contents of CResult_NetworkGraphDecodeErrorZ
8996  */
8997 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
8998    /**
8999     * A pointer to the contents in the success state.
9000     * Reading from this pointer when `result_ok` is not set is undefined.
9001     */
9002    struct LDKNetworkGraph *result;
9003    /**
9004     * A pointer to the contents in the error state.
9005     * Reading from this pointer when `result_ok` is set is undefined.
9006     */
9007    struct LDKDecodeError *err;
9008 } LDKCResult_NetworkGraphDecodeErrorZPtr;
9009
9010 /**
9011  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
9012  * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
9013  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9014  */
9015 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
9016    /**
9017     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
9018     * `err` or `result` depending on the state of `result_ok`.
9019     */
9020    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
9021    /**
9022     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
9023     */
9024    bool result_ok;
9025 } LDKCResult_NetworkGraphDecodeErrorZ;
9026
9027 /**
9028  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
9029  */
9030 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
9031    /**
9032     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
9033     */
9034    LDKCOption_CVec_NetAddressZZ_Some,
9035    /**
9036     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
9037     */
9038    LDKCOption_CVec_NetAddressZZ_None,
9039    /**
9040     * Must be last for serialization purposes
9041     */
9042    LDKCOption_CVec_NetAddressZZ_Sentinel,
9043 } LDKCOption_CVec_NetAddressZZ_Tag;
9044
9045 typedef struct LDKCOption_CVec_NetAddressZZ {
9046    LDKCOption_CVec_NetAddressZZ_Tag tag;
9047    union {
9048       struct {
9049          struct LDKCVec_NetAddressZ some;
9050       };
9051    };
9052 } LDKCOption_CVec_NetAddressZZ;
9053
9054 /**
9055  * The contents of CResult_NetAddressDecodeErrorZ
9056  */
9057 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
9058    /**
9059     * A pointer to the contents in the success state.
9060     * Reading from this pointer when `result_ok` is not set is undefined.
9061     */
9062    struct LDKNetAddress *result;
9063    /**
9064     * A pointer to the contents in the error state.
9065     * Reading from this pointer when `result_ok` is set is undefined.
9066     */
9067    struct LDKDecodeError *err;
9068 } LDKCResult_NetAddressDecodeErrorZPtr;
9069
9070 /**
9071  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9072  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9073  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9074  */
9075 typedef struct LDKCResult_NetAddressDecodeErrorZ {
9076    /**
9077     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9078     * `err` or `result` depending on the state of `result_ok`.
9079     */
9080    union LDKCResult_NetAddressDecodeErrorZPtr contents;
9081    /**
9082     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9083     */
9084    bool result_ok;
9085 } LDKCResult_NetAddressDecodeErrorZ;
9086
9087
9088
9089 /**
9090  * An update_add_htlc message to be sent or received from a peer
9091  */
9092 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
9093    /**
9094     * A pointer to the opaque Rust object.
9095     * Nearly everywhere, inner must be non-null, however in places where
9096     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9097     */
9098    LDKnativeUpdateAddHTLC *inner;
9099    /**
9100     * Indicates that this is the only struct which contains the same pointer.
9101     * Rust functions which take ownership of an object provided via an argument require
9102     * this to be true and invalidate the object pointed to by inner.
9103     */
9104    bool is_owned;
9105 } LDKUpdateAddHTLC;
9106
9107 /**
9108  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9109  * This corresponds to std::vector in C++
9110  */
9111 typedef struct LDKCVec_UpdateAddHTLCZ {
9112    /**
9113     * The elements in the array.
9114     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9115     */
9116    struct LDKUpdateAddHTLC *data;
9117    /**
9118     * The number of elements pointed to by `data`.
9119     */
9120    uintptr_t datalen;
9121 } LDKCVec_UpdateAddHTLCZ;
9122
9123
9124
9125 /**
9126  * An update_fulfill_htlc message to be sent or received from a peer
9127  */
9128 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
9129    /**
9130     * A pointer to the opaque Rust object.
9131     * Nearly everywhere, inner must be non-null, however in places where
9132     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9133     */
9134    LDKnativeUpdateFulfillHTLC *inner;
9135    /**
9136     * Indicates that this is the only struct which contains the same pointer.
9137     * Rust functions which take ownership of an object provided via an argument require
9138     * this to be true and invalidate the object pointed to by inner.
9139     */
9140    bool is_owned;
9141 } LDKUpdateFulfillHTLC;
9142
9143 /**
9144  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9145  * This corresponds to std::vector in C++
9146  */
9147 typedef struct LDKCVec_UpdateFulfillHTLCZ {
9148    /**
9149     * The elements in the array.
9150     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9151     */
9152    struct LDKUpdateFulfillHTLC *data;
9153    /**
9154     * The number of elements pointed to by `data`.
9155     */
9156    uintptr_t datalen;
9157 } LDKCVec_UpdateFulfillHTLCZ;
9158
9159
9160
9161 /**
9162  * An update_fail_htlc message to be sent or received from a peer
9163  */
9164 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
9165    /**
9166     * A pointer to the opaque Rust object.
9167     * Nearly everywhere, inner must be non-null, however in places where
9168     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9169     */
9170    LDKnativeUpdateFailHTLC *inner;
9171    /**
9172     * Indicates that this is the only struct which contains the same pointer.
9173     * Rust functions which take ownership of an object provided via an argument require
9174     * this to be true and invalidate the object pointed to by inner.
9175     */
9176    bool is_owned;
9177 } LDKUpdateFailHTLC;
9178
9179 /**
9180  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9181  * This corresponds to std::vector in C++
9182  */
9183 typedef struct LDKCVec_UpdateFailHTLCZ {
9184    /**
9185     * The elements in the array.
9186     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9187     */
9188    struct LDKUpdateFailHTLC *data;
9189    /**
9190     * The number of elements pointed to by `data`.
9191     */
9192    uintptr_t datalen;
9193 } LDKCVec_UpdateFailHTLCZ;
9194
9195
9196
9197 /**
9198  * An update_fail_malformed_htlc message to be sent or received from a peer
9199  */
9200 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
9201    /**
9202     * A pointer to the opaque Rust object.
9203     * Nearly everywhere, inner must be non-null, however in places where
9204     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9205     */
9206    LDKnativeUpdateFailMalformedHTLC *inner;
9207    /**
9208     * Indicates that this is the only struct which contains the same pointer.
9209     * Rust functions which take ownership of an object provided via an argument require
9210     * this to be true and invalidate the object pointed to by inner.
9211     */
9212    bool is_owned;
9213 } LDKUpdateFailMalformedHTLC;
9214
9215 /**
9216  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9217  * This corresponds to std::vector in C++
9218  */
9219 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
9220    /**
9221     * The elements in the array.
9222     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9223     */
9224    struct LDKUpdateFailMalformedHTLC *data;
9225    /**
9226     * The number of elements pointed to by `data`.
9227     */
9228    uintptr_t datalen;
9229 } LDKCVec_UpdateFailMalformedHTLCZ;
9230
9231 /**
9232  * The contents of CResult_AcceptChannelDecodeErrorZ
9233  */
9234 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
9235    /**
9236     * A pointer to the contents in the success state.
9237     * Reading from this pointer when `result_ok` is not set is undefined.
9238     */
9239    struct LDKAcceptChannel *result;
9240    /**
9241     * A pointer to the contents in the error state.
9242     * Reading from this pointer when `result_ok` is set is undefined.
9243     */
9244    struct LDKDecodeError *err;
9245 } LDKCResult_AcceptChannelDecodeErrorZPtr;
9246
9247 /**
9248  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9249  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9250  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9251  */
9252 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
9253    /**
9254     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9255     * `err` or `result` depending on the state of `result_ok`.
9256     */
9257    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
9258    /**
9259     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9260     */
9261    bool result_ok;
9262 } LDKCResult_AcceptChannelDecodeErrorZ;
9263
9264 /**
9265  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9266  */
9267 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
9268    /**
9269     * A pointer to the contents in the success state.
9270     * Reading from this pointer when `result_ok` is not set is undefined.
9271     */
9272    struct LDKAnnouncementSignatures *result;
9273    /**
9274     * A pointer to the contents in the error state.
9275     * Reading from this pointer when `result_ok` is set is undefined.
9276     */
9277    struct LDKDecodeError *err;
9278 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
9279
9280 /**
9281  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9282  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9283  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9284  */
9285 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
9286    /**
9287     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9288     * `err` or `result` depending on the state of `result_ok`.
9289     */
9290    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
9291    /**
9292     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9293     */
9294    bool result_ok;
9295 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
9296
9297 /**
9298  * The contents of CResult_ChannelReestablishDecodeErrorZ
9299  */
9300 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
9301    /**
9302     * A pointer to the contents in the success state.
9303     * Reading from this pointer when `result_ok` is not set is undefined.
9304     */
9305    struct LDKChannelReestablish *result;
9306    /**
9307     * A pointer to the contents in the error state.
9308     * Reading from this pointer when `result_ok` is set is undefined.
9309     */
9310    struct LDKDecodeError *err;
9311 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
9312
9313 /**
9314  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9315  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9316  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9317  */
9318 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
9319    /**
9320     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9321     * `err` or `result` depending on the state of `result_ok`.
9322     */
9323    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
9324    /**
9325     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9326     */
9327    bool result_ok;
9328 } LDKCResult_ChannelReestablishDecodeErrorZ;
9329
9330 /**
9331  * The contents of CResult_ClosingSignedDecodeErrorZ
9332  */
9333 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
9334    /**
9335     * A pointer to the contents in the success state.
9336     * Reading from this pointer when `result_ok` is not set is undefined.
9337     */
9338    struct LDKClosingSigned *result;
9339    /**
9340     * A pointer to the contents in the error state.
9341     * Reading from this pointer when `result_ok` is set is undefined.
9342     */
9343    struct LDKDecodeError *err;
9344 } LDKCResult_ClosingSignedDecodeErrorZPtr;
9345
9346 /**
9347  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9348  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9349  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9350  */
9351 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
9352    /**
9353     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9354     * `err` or `result` depending on the state of `result_ok`.
9355     */
9356    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
9357    /**
9358     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9359     */
9360    bool result_ok;
9361 } LDKCResult_ClosingSignedDecodeErrorZ;
9362
9363
9364
9365 /**
9366  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
9367  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
9368  * to use.
9369  */
9370 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
9371    /**
9372     * A pointer to the opaque Rust object.
9373     * Nearly everywhere, inner must be non-null, however in places where
9374     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9375     */
9376    LDKnativeClosingSignedFeeRange *inner;
9377    /**
9378     * Indicates that this is the only struct which contains the same pointer.
9379     * Rust functions which take ownership of an object provided via an argument require
9380     * this to be true and invalidate the object pointed to by inner.
9381     */
9382    bool is_owned;
9383 } LDKClosingSignedFeeRange;
9384
9385 /**
9386  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9387  */
9388 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9389    /**
9390     * A pointer to the contents in the success state.
9391     * Reading from this pointer when `result_ok` is not set is undefined.
9392     */
9393    struct LDKClosingSignedFeeRange *result;
9394    /**
9395     * A pointer to the contents in the error state.
9396     * Reading from this pointer when `result_ok` is set is undefined.
9397     */
9398    struct LDKDecodeError *err;
9399 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
9400
9401 /**
9402  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9403  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9404  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9405  */
9406 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
9407    /**
9408     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9409     * `err` or `result` depending on the state of `result_ok`.
9410     */
9411    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
9412    /**
9413     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9414     */
9415    bool result_ok;
9416 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
9417
9418
9419
9420 /**
9421  * A commitment_signed message to be sent or received from a peer
9422  */
9423 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
9424    /**
9425     * A pointer to the opaque Rust object.
9426     * Nearly everywhere, inner must be non-null, however in places where
9427     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9428     */
9429    LDKnativeCommitmentSigned *inner;
9430    /**
9431     * Indicates that this is the only struct which contains the same pointer.
9432     * Rust functions which take ownership of an object provided via an argument require
9433     * this to be true and invalidate the object pointed to by inner.
9434     */
9435    bool is_owned;
9436 } LDKCommitmentSigned;
9437
9438 /**
9439  * The contents of CResult_CommitmentSignedDecodeErrorZ
9440  */
9441 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
9442    /**
9443     * A pointer to the contents in the success state.
9444     * Reading from this pointer when `result_ok` is not set is undefined.
9445     */
9446    struct LDKCommitmentSigned *result;
9447    /**
9448     * A pointer to the contents in the error state.
9449     * Reading from this pointer when `result_ok` is set is undefined.
9450     */
9451    struct LDKDecodeError *err;
9452 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
9453
9454 /**
9455  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9456  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9457  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9458  */
9459 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
9460    /**
9461     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9462     * `err` or `result` depending on the state of `result_ok`.
9463     */
9464    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
9465    /**
9466     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9467     */
9468    bool result_ok;
9469 } LDKCResult_CommitmentSignedDecodeErrorZ;
9470
9471 /**
9472  * The contents of CResult_FundingCreatedDecodeErrorZ
9473  */
9474 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
9475    /**
9476     * A pointer to the contents in the success state.
9477     * Reading from this pointer when `result_ok` is not set is undefined.
9478     */
9479    struct LDKFundingCreated *result;
9480    /**
9481     * A pointer to the contents in the error state.
9482     * Reading from this pointer when `result_ok` is set is undefined.
9483     */
9484    struct LDKDecodeError *err;
9485 } LDKCResult_FundingCreatedDecodeErrorZPtr;
9486
9487 /**
9488  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9489  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9490  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9491  */
9492 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
9493    /**
9494     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9495     * `err` or `result` depending on the state of `result_ok`.
9496     */
9497    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
9498    /**
9499     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9500     */
9501    bool result_ok;
9502 } LDKCResult_FundingCreatedDecodeErrorZ;
9503
9504 /**
9505  * The contents of CResult_FundingSignedDecodeErrorZ
9506  */
9507 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
9508    /**
9509     * A pointer to the contents in the success state.
9510     * Reading from this pointer when `result_ok` is not set is undefined.
9511     */
9512    struct LDKFundingSigned *result;
9513    /**
9514     * A pointer to the contents in the error state.
9515     * Reading from this pointer when `result_ok` is set is undefined.
9516     */
9517    struct LDKDecodeError *err;
9518 } LDKCResult_FundingSignedDecodeErrorZPtr;
9519
9520 /**
9521  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9522  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9523  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9524  */
9525 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
9526    /**
9527     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9528     * `err` or `result` depending on the state of `result_ok`.
9529     */
9530    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
9531    /**
9532     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9533     */
9534    bool result_ok;
9535 } LDKCResult_FundingSignedDecodeErrorZ;
9536
9537 /**
9538  * The contents of CResult_FundingLockedDecodeErrorZ
9539  */
9540 typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
9541    /**
9542     * A pointer to the contents in the success state.
9543     * Reading from this pointer when `result_ok` is not set is undefined.
9544     */
9545    struct LDKFundingLocked *result;
9546    /**
9547     * A pointer to the contents in the error state.
9548     * Reading from this pointer when `result_ok` is set is undefined.
9549     */
9550    struct LDKDecodeError *err;
9551 } LDKCResult_FundingLockedDecodeErrorZPtr;
9552
9553 /**
9554  * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
9555  * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure.
9556  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9557  */
9558 typedef struct LDKCResult_FundingLockedDecodeErrorZ {
9559    /**
9560     * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
9561     * `err` or `result` depending on the state of `result_ok`.
9562     */
9563    union LDKCResult_FundingLockedDecodeErrorZPtr contents;
9564    /**
9565     * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
9566     */
9567    bool result_ok;
9568 } LDKCResult_FundingLockedDecodeErrorZ;
9569
9570
9571
9572 /**
9573  * An init message to be sent or received from a peer
9574  */
9575 typedef struct MUST_USE_STRUCT LDKInit {
9576    /**
9577     * A pointer to the opaque Rust object.
9578     * Nearly everywhere, inner must be non-null, however in places where
9579     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9580     */
9581    LDKnativeInit *inner;
9582    /**
9583     * Indicates that this is the only struct which contains the same pointer.
9584     * Rust functions which take ownership of an object provided via an argument require
9585     * this to be true and invalidate the object pointed to by inner.
9586     */
9587    bool is_owned;
9588 } LDKInit;
9589
9590 /**
9591  * The contents of CResult_InitDecodeErrorZ
9592  */
9593 typedef union LDKCResult_InitDecodeErrorZPtr {
9594    /**
9595     * A pointer to the contents in the success state.
9596     * Reading from this pointer when `result_ok` is not set is undefined.
9597     */
9598    struct LDKInit *result;
9599    /**
9600     * A pointer to the contents in the error state.
9601     * Reading from this pointer when `result_ok` is set is undefined.
9602     */
9603    struct LDKDecodeError *err;
9604 } LDKCResult_InitDecodeErrorZPtr;
9605
9606 /**
9607  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9608  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9609  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9610  */
9611 typedef struct LDKCResult_InitDecodeErrorZ {
9612    /**
9613     * The contents of this CResult_InitDecodeErrorZ, accessible via either
9614     * `err` or `result` depending on the state of `result_ok`.
9615     */
9616    union LDKCResult_InitDecodeErrorZPtr contents;
9617    /**
9618     * Whether this CResult_InitDecodeErrorZ represents a success state.
9619     */
9620    bool result_ok;
9621 } LDKCResult_InitDecodeErrorZ;
9622
9623 /**
9624  * The contents of CResult_OpenChannelDecodeErrorZ
9625  */
9626 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
9627    /**
9628     * A pointer to the contents in the success state.
9629     * Reading from this pointer when `result_ok` is not set is undefined.
9630     */
9631    struct LDKOpenChannel *result;
9632    /**
9633     * A pointer to the contents in the error state.
9634     * Reading from this pointer when `result_ok` is set is undefined.
9635     */
9636    struct LDKDecodeError *err;
9637 } LDKCResult_OpenChannelDecodeErrorZPtr;
9638
9639 /**
9640  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9641  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9642  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9643  */
9644 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
9645    /**
9646     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9647     * `err` or `result` depending on the state of `result_ok`.
9648     */
9649    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
9650    /**
9651     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9652     */
9653    bool result_ok;
9654 } LDKCResult_OpenChannelDecodeErrorZ;
9655
9656 /**
9657  * The contents of CResult_RevokeAndACKDecodeErrorZ
9658  */
9659 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
9660    /**
9661     * A pointer to the contents in the success state.
9662     * Reading from this pointer when `result_ok` is not set is undefined.
9663     */
9664    struct LDKRevokeAndACK *result;
9665    /**
9666     * A pointer to the contents in the error state.
9667     * Reading from this pointer when `result_ok` is set is undefined.
9668     */
9669    struct LDKDecodeError *err;
9670 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
9671
9672 /**
9673  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9674  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9675  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9676  */
9677 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
9678    /**
9679     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9680     * `err` or `result` depending on the state of `result_ok`.
9681     */
9682    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
9683    /**
9684     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9685     */
9686    bool result_ok;
9687 } LDKCResult_RevokeAndACKDecodeErrorZ;
9688
9689 /**
9690  * The contents of CResult_ShutdownDecodeErrorZ
9691  */
9692 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
9693    /**
9694     * A pointer to the contents in the success state.
9695     * Reading from this pointer when `result_ok` is not set is undefined.
9696     */
9697    struct LDKShutdown *result;
9698    /**
9699     * A pointer to the contents in the error state.
9700     * Reading from this pointer when `result_ok` is set is undefined.
9701     */
9702    struct LDKDecodeError *err;
9703 } LDKCResult_ShutdownDecodeErrorZPtr;
9704
9705 /**
9706  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9707  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9708  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9709  */
9710 typedef struct LDKCResult_ShutdownDecodeErrorZ {
9711    /**
9712     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9713     * `err` or `result` depending on the state of `result_ok`.
9714     */
9715    union LDKCResult_ShutdownDecodeErrorZPtr contents;
9716    /**
9717     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9718     */
9719    bool result_ok;
9720 } LDKCResult_ShutdownDecodeErrorZ;
9721
9722 /**
9723  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
9724  */
9725 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
9726    /**
9727     * A pointer to the contents in the success state.
9728     * Reading from this pointer when `result_ok` is not set is undefined.
9729     */
9730    struct LDKUpdateFailHTLC *result;
9731    /**
9732     * A pointer to the contents in the error state.
9733     * Reading from this pointer when `result_ok` is set is undefined.
9734     */
9735    struct LDKDecodeError *err;
9736 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
9737
9738 /**
9739  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9740  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9741  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9742  */
9743 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
9744    /**
9745     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9746     * `err` or `result` depending on the state of `result_ok`.
9747     */
9748    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
9749    /**
9750     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9751     */
9752    bool result_ok;
9753 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
9754
9755 /**
9756  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9757  */
9758 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9759    /**
9760     * A pointer to the contents in the success state.
9761     * Reading from this pointer when `result_ok` is not set is undefined.
9762     */
9763    struct LDKUpdateFailMalformedHTLC *result;
9764    /**
9765     * A pointer to the contents in the error state.
9766     * Reading from this pointer when `result_ok` is set is undefined.
9767     */
9768    struct LDKDecodeError *err;
9769 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
9770
9771 /**
9772  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9773  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9774  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9775  */
9776 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
9777    /**
9778     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9779     * `err` or `result` depending on the state of `result_ok`.
9780     */
9781    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
9782    /**
9783     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9784     */
9785    bool result_ok;
9786 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
9787
9788
9789
9790 /**
9791  * An update_fee message to be sent or received from a peer
9792  */
9793 typedef struct MUST_USE_STRUCT LDKUpdateFee {
9794    /**
9795     * A pointer to the opaque Rust object.
9796     * Nearly everywhere, inner must be non-null, however in places where
9797     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9798     */
9799    LDKnativeUpdateFee *inner;
9800    /**
9801     * Indicates that this is the only struct which contains the same pointer.
9802     * Rust functions which take ownership of an object provided via an argument require
9803     * this to be true and invalidate the object pointed to by inner.
9804     */
9805    bool is_owned;
9806 } LDKUpdateFee;
9807
9808 /**
9809  * The contents of CResult_UpdateFeeDecodeErrorZ
9810  */
9811 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
9812    /**
9813     * A pointer to the contents in the success state.
9814     * Reading from this pointer when `result_ok` is not set is undefined.
9815     */
9816    struct LDKUpdateFee *result;
9817    /**
9818     * A pointer to the contents in the error state.
9819     * Reading from this pointer when `result_ok` is set is undefined.
9820     */
9821    struct LDKDecodeError *err;
9822 } LDKCResult_UpdateFeeDecodeErrorZPtr;
9823
9824 /**
9825  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9826  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9827  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9828  */
9829 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
9830    /**
9831     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9832     * `err` or `result` depending on the state of `result_ok`.
9833     */
9834    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
9835    /**
9836     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9837     */
9838    bool result_ok;
9839 } LDKCResult_UpdateFeeDecodeErrorZ;
9840
9841 /**
9842  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9843  */
9844 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
9845    /**
9846     * A pointer to the contents in the success state.
9847     * Reading from this pointer when `result_ok` is not set is undefined.
9848     */
9849    struct LDKUpdateFulfillHTLC *result;
9850    /**
9851     * A pointer to the contents in the error state.
9852     * Reading from this pointer when `result_ok` is set is undefined.
9853     */
9854    struct LDKDecodeError *err;
9855 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
9856
9857 /**
9858  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9859  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9860  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9861  */
9862 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
9863    /**
9864     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9865     * `err` or `result` depending on the state of `result_ok`.
9866     */
9867    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
9868    /**
9869     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9870     */
9871    bool result_ok;
9872 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
9873
9874 /**
9875  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
9876  */
9877 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
9878    /**
9879     * A pointer to the contents in the success state.
9880     * Reading from this pointer when `result_ok` is not set is undefined.
9881     */
9882    struct LDKUpdateAddHTLC *result;
9883    /**
9884     * A pointer to the contents in the error state.
9885     * Reading from this pointer when `result_ok` is set is undefined.
9886     */
9887    struct LDKDecodeError *err;
9888 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
9889
9890 /**
9891  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9892  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9893  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9894  */
9895 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
9896    /**
9897     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9898     * `err` or `result` depending on the state of `result_ok`.
9899     */
9900    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
9901    /**
9902     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9903     */
9904    bool result_ok;
9905 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
9906
9907
9908
9909 /**
9910  * A ping message to be sent or received from a peer
9911  */
9912 typedef struct MUST_USE_STRUCT LDKPing {
9913    /**
9914     * A pointer to the opaque Rust object.
9915     * Nearly everywhere, inner must be non-null, however in places where
9916     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9917     */
9918    LDKnativePing *inner;
9919    /**
9920     * Indicates that this is the only struct which contains the same pointer.
9921     * Rust functions which take ownership of an object provided via an argument require
9922     * this to be true and invalidate the object pointed to by inner.
9923     */
9924    bool is_owned;
9925 } LDKPing;
9926
9927 /**
9928  * The contents of CResult_PingDecodeErrorZ
9929  */
9930 typedef union LDKCResult_PingDecodeErrorZPtr {
9931    /**
9932     * A pointer to the contents in the success state.
9933     * Reading from this pointer when `result_ok` is not set is undefined.
9934     */
9935    struct LDKPing *result;
9936    /**
9937     * A pointer to the contents in the error state.
9938     * Reading from this pointer when `result_ok` is set is undefined.
9939     */
9940    struct LDKDecodeError *err;
9941 } LDKCResult_PingDecodeErrorZPtr;
9942
9943 /**
9944  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
9945  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
9946  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9947  */
9948 typedef struct LDKCResult_PingDecodeErrorZ {
9949    /**
9950     * The contents of this CResult_PingDecodeErrorZ, accessible via either
9951     * `err` or `result` depending on the state of `result_ok`.
9952     */
9953    union LDKCResult_PingDecodeErrorZPtr contents;
9954    /**
9955     * Whether this CResult_PingDecodeErrorZ represents a success state.
9956     */
9957    bool result_ok;
9958 } LDKCResult_PingDecodeErrorZ;
9959
9960
9961
9962 /**
9963  * A pong message to be sent or received from a peer
9964  */
9965 typedef struct MUST_USE_STRUCT LDKPong {
9966    /**
9967     * A pointer to the opaque Rust object.
9968     * Nearly everywhere, inner must be non-null, however in places where
9969     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9970     */
9971    LDKnativePong *inner;
9972    /**
9973     * Indicates that this is the only struct which contains the same pointer.
9974     * Rust functions which take ownership of an object provided via an argument require
9975     * this to be true and invalidate the object pointed to by inner.
9976     */
9977    bool is_owned;
9978 } LDKPong;
9979
9980 /**
9981  * The contents of CResult_PongDecodeErrorZ
9982  */
9983 typedef union LDKCResult_PongDecodeErrorZPtr {
9984    /**
9985     * A pointer to the contents in the success state.
9986     * Reading from this pointer when `result_ok` is not set is undefined.
9987     */
9988    struct LDKPong *result;
9989    /**
9990     * A pointer to the contents in the error state.
9991     * Reading from this pointer when `result_ok` is set is undefined.
9992     */
9993    struct LDKDecodeError *err;
9994 } LDKCResult_PongDecodeErrorZPtr;
9995
9996 /**
9997  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
9998  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
9999  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10000  */
10001 typedef struct LDKCResult_PongDecodeErrorZ {
10002    /**
10003     * The contents of this CResult_PongDecodeErrorZ, accessible via either
10004     * `err` or `result` depending on the state of `result_ok`.
10005     */
10006    union LDKCResult_PongDecodeErrorZPtr contents;
10007    /**
10008     * Whether this CResult_PongDecodeErrorZ represents a success state.
10009     */
10010    bool result_ok;
10011 } LDKCResult_PongDecodeErrorZ;
10012
10013 /**
10014  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
10015  */
10016 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10017    /**
10018     * A pointer to the contents in the success state.
10019     * Reading from this pointer when `result_ok` is not set is undefined.
10020     */
10021    struct LDKUnsignedChannelAnnouncement *result;
10022    /**
10023     * A pointer to the contents in the error state.
10024     * Reading from this pointer when `result_ok` is set is undefined.
10025     */
10026    struct LDKDecodeError *err;
10027 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
10028
10029 /**
10030  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10031  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10032  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10033  */
10034 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
10035    /**
10036     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10037     * `err` or `result` depending on the state of `result_ok`.
10038     */
10039    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
10040    /**
10041     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10042     */
10043    bool result_ok;
10044 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
10045
10046 /**
10047  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
10048  */
10049 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
10050    /**
10051     * A pointer to the contents in the success state.
10052     * Reading from this pointer when `result_ok` is not set is undefined.
10053     */
10054    struct LDKChannelAnnouncement *result;
10055    /**
10056     * A pointer to the contents in the error state.
10057     * Reading from this pointer when `result_ok` is set is undefined.
10058     */
10059    struct LDKDecodeError *err;
10060 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
10061
10062 /**
10063  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10064  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10065  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10066  */
10067 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
10068    /**
10069     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10070     * `err` or `result` depending on the state of `result_ok`.
10071     */
10072    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
10073    /**
10074     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10075     */
10076    bool result_ok;
10077 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
10078
10079
10080
10081 /**
10082  * The unsigned part of a channel_update
10083  */
10084 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
10085    /**
10086     * A pointer to the opaque Rust object.
10087     * Nearly everywhere, inner must be non-null, however in places where
10088     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10089     */
10090    LDKnativeUnsignedChannelUpdate *inner;
10091    /**
10092     * Indicates that this is the only struct which contains the same pointer.
10093     * Rust functions which take ownership of an object provided via an argument require
10094     * this to be true and invalidate the object pointed to by inner.
10095     */
10096    bool is_owned;
10097 } LDKUnsignedChannelUpdate;
10098
10099 /**
10100  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10101  */
10102 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
10103    /**
10104     * A pointer to the contents in the success state.
10105     * Reading from this pointer when `result_ok` is not set is undefined.
10106     */
10107    struct LDKUnsignedChannelUpdate *result;
10108    /**
10109     * A pointer to the contents in the error state.
10110     * Reading from this pointer when `result_ok` is set is undefined.
10111     */
10112    struct LDKDecodeError *err;
10113 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
10114
10115 /**
10116  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10117  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10118  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10119  */
10120 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
10121    /**
10122     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10123     * `err` or `result` depending on the state of `result_ok`.
10124     */
10125    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
10126    /**
10127     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10128     */
10129    bool result_ok;
10130 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
10131
10132 /**
10133  * The contents of CResult_ChannelUpdateDecodeErrorZ
10134  */
10135 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
10136    /**
10137     * A pointer to the contents in the success state.
10138     * Reading from this pointer when `result_ok` is not set is undefined.
10139     */
10140    struct LDKChannelUpdate *result;
10141    /**
10142     * A pointer to the contents in the error state.
10143     * Reading from this pointer when `result_ok` is set is undefined.
10144     */
10145    struct LDKDecodeError *err;
10146 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
10147
10148 /**
10149  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10150  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10151  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10152  */
10153 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
10154    /**
10155     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10156     * `err` or `result` depending on the state of `result_ok`.
10157     */
10158    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
10159    /**
10160     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10161     */
10162    bool result_ok;
10163 } LDKCResult_ChannelUpdateDecodeErrorZ;
10164
10165 /**
10166  * The contents of CResult_ErrorMessageDecodeErrorZ
10167  */
10168 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
10169    /**
10170     * A pointer to the contents in the success state.
10171     * Reading from this pointer when `result_ok` is not set is undefined.
10172     */
10173    struct LDKErrorMessage *result;
10174    /**
10175     * A pointer to the contents in the error state.
10176     * Reading from this pointer when `result_ok` is set is undefined.
10177     */
10178    struct LDKDecodeError *err;
10179 } LDKCResult_ErrorMessageDecodeErrorZPtr;
10180
10181 /**
10182  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10183  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10184  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10185  */
10186 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
10187    /**
10188     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10189     * `err` or `result` depending on the state of `result_ok`.
10190     */
10191    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
10192    /**
10193     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10194     */
10195    bool result_ok;
10196 } LDKCResult_ErrorMessageDecodeErrorZ;
10197
10198 /**
10199  * The contents of CResult_WarningMessageDecodeErrorZ
10200  */
10201 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
10202    /**
10203     * A pointer to the contents in the success state.
10204     * Reading from this pointer when `result_ok` is not set is undefined.
10205     */
10206    struct LDKWarningMessage *result;
10207    /**
10208     * A pointer to the contents in the error state.
10209     * Reading from this pointer when `result_ok` is set is undefined.
10210     */
10211    struct LDKDecodeError *err;
10212 } LDKCResult_WarningMessageDecodeErrorZPtr;
10213
10214 /**
10215  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
10216  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10217  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10218  */
10219 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
10220    /**
10221     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
10222     * `err` or `result` depending on the state of `result_ok`.
10223     */
10224    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
10225    /**
10226     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
10227     */
10228    bool result_ok;
10229 } LDKCResult_WarningMessageDecodeErrorZ;
10230
10231
10232
10233 /**
10234  * The unsigned part of a node_announcement
10235  */
10236 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
10237    /**
10238     * A pointer to the opaque Rust object.
10239     * Nearly everywhere, inner must be non-null, however in places where
10240     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10241     */
10242    LDKnativeUnsignedNodeAnnouncement *inner;
10243    /**
10244     * Indicates that this is the only struct which contains the same pointer.
10245     * Rust functions which take ownership of an object provided via an argument require
10246     * this to be true and invalidate the object pointed to by inner.
10247     */
10248    bool is_owned;
10249 } LDKUnsignedNodeAnnouncement;
10250
10251 /**
10252  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10253  */
10254 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10255    /**
10256     * A pointer to the contents in the success state.
10257     * Reading from this pointer when `result_ok` is not set is undefined.
10258     */
10259    struct LDKUnsignedNodeAnnouncement *result;
10260    /**
10261     * A pointer to the contents in the error state.
10262     * Reading from this pointer when `result_ok` is set is undefined.
10263     */
10264    struct LDKDecodeError *err;
10265 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
10266
10267 /**
10268  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10269  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10270  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10271  */
10272 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
10273    /**
10274     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10275     * `err` or `result` depending on the state of `result_ok`.
10276     */
10277    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
10278    /**
10279     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10280     */
10281    bool result_ok;
10282 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
10283
10284 /**
10285  * The contents of CResult_NodeAnnouncementDecodeErrorZ
10286  */
10287 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
10288    /**
10289     * A pointer to the contents in the success state.
10290     * Reading from this pointer when `result_ok` is not set is undefined.
10291     */
10292    struct LDKNodeAnnouncement *result;
10293    /**
10294     * A pointer to the contents in the error state.
10295     * Reading from this pointer when `result_ok` is set is undefined.
10296     */
10297    struct LDKDecodeError *err;
10298 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
10299
10300 /**
10301  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10302  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10303  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10304  */
10305 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
10306    /**
10307     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10308     * `err` or `result` depending on the state of `result_ok`.
10309     */
10310    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
10311    /**
10312     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10313     */
10314    bool result_ok;
10315 } LDKCResult_NodeAnnouncementDecodeErrorZ;
10316
10317 /**
10318  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10319  */
10320 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
10321    /**
10322     * A pointer to the contents in the success state.
10323     * Reading from this pointer when `result_ok` is not set is undefined.
10324     */
10325    struct LDKQueryShortChannelIds *result;
10326    /**
10327     * A pointer to the contents in the error state.
10328     * Reading from this pointer when `result_ok` is set is undefined.
10329     */
10330    struct LDKDecodeError *err;
10331 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
10332
10333 /**
10334  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10335  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10336  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10337  */
10338 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
10339    /**
10340     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10341     * `err` or `result` depending on the state of `result_ok`.
10342     */
10343    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
10344    /**
10345     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10346     */
10347    bool result_ok;
10348 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
10349
10350
10351
10352 /**
10353  * A reply_short_channel_ids_end message is sent as a reply to a
10354  * query_short_channel_ids message. The query recipient makes a best
10355  * effort to respond based on their local network view which may not be
10356  * a perfect view of the network.
10357  */
10358 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
10359    /**
10360     * A pointer to the opaque Rust object.
10361     * Nearly everywhere, inner must be non-null, however in places where
10362     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10363     */
10364    LDKnativeReplyShortChannelIdsEnd *inner;
10365    /**
10366     * Indicates that this is the only struct which contains the same pointer.
10367     * Rust functions which take ownership of an object provided via an argument require
10368     * this to be true and invalidate the object pointed to by inner.
10369     */
10370    bool is_owned;
10371 } LDKReplyShortChannelIdsEnd;
10372
10373 /**
10374  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10375  */
10376 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10377    /**
10378     * A pointer to the contents in the success state.
10379     * Reading from this pointer when `result_ok` is not set is undefined.
10380     */
10381    struct LDKReplyShortChannelIdsEnd *result;
10382    /**
10383     * A pointer to the contents in the error state.
10384     * Reading from this pointer when `result_ok` is set is undefined.
10385     */
10386    struct LDKDecodeError *err;
10387 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
10388
10389 /**
10390  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10391  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10392  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10393  */
10394 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
10395    /**
10396     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10397     * `err` or `result` depending on the state of `result_ok`.
10398     */
10399    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
10400    /**
10401     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10402     */
10403    bool result_ok;
10404 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
10405
10406 /**
10407  * The contents of CResult_QueryChannelRangeDecodeErrorZ
10408  */
10409 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
10410    /**
10411     * A pointer to the contents in the success state.
10412     * Reading from this pointer when `result_ok` is not set is undefined.
10413     */
10414    struct LDKQueryChannelRange *result;
10415    /**
10416     * A pointer to the contents in the error state.
10417     * Reading from this pointer when `result_ok` is set is undefined.
10418     */
10419    struct LDKDecodeError *err;
10420 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
10421
10422 /**
10423  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10424  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10425  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10426  */
10427 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
10428    /**
10429     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10430     * `err` or `result` depending on the state of `result_ok`.
10431     */
10432    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
10433    /**
10434     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10435     */
10436    bool result_ok;
10437 } LDKCResult_QueryChannelRangeDecodeErrorZ;
10438
10439 /**
10440  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
10441  */
10442 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
10443    /**
10444     * A pointer to the contents in the success state.
10445     * Reading from this pointer when `result_ok` is not set is undefined.
10446     */
10447    struct LDKReplyChannelRange *result;
10448    /**
10449     * A pointer to the contents in the error state.
10450     * Reading from this pointer when `result_ok` is set is undefined.
10451     */
10452    struct LDKDecodeError *err;
10453 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
10454
10455 /**
10456  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10457  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10458  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10459  */
10460 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
10461    /**
10462     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10463     * `err` or `result` depending on the state of `result_ok`.
10464     */
10465    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
10466    /**
10467     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10468     */
10469    bool result_ok;
10470 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
10471
10472 /**
10473  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
10474  */
10475 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
10476    /**
10477     * A pointer to the contents in the success state.
10478     * Reading from this pointer when `result_ok` is not set is undefined.
10479     */
10480    struct LDKGossipTimestampFilter *result;
10481    /**
10482     * A pointer to the contents in the error state.
10483     * Reading from this pointer when `result_ok` is set is undefined.
10484     */
10485    struct LDKDecodeError *err;
10486 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
10487
10488 /**
10489  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10490  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10491  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10492  */
10493 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
10494    /**
10495     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10496     * `err` or `result` depending on the state of `result_ok`.
10497     */
10498    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
10499    /**
10500     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10501     */
10502    bool result_ok;
10503 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
10504
10505 /**
10506  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
10507  * This corresponds to std::vector in C++
10508  */
10509 typedef struct LDKCVec_PhantomRouteHintsZ {
10510    /**
10511     * The elements in the array.
10512     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10513     */
10514    struct LDKPhantomRouteHints *data;
10515    /**
10516     * The number of elements pointed to by `data`.
10517     */
10518    uintptr_t datalen;
10519 } LDKCVec_PhantomRouteHintsZ;
10520
10521 /**
10522  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
10523  * may occur.
10524  */
10525 typedef enum LDKSignOrCreationError_Tag {
10526    /**
10527     * An error occurred during signing
10528     */
10529    LDKSignOrCreationError_SignError,
10530    /**
10531     * An error occurred while building the transaction
10532     */
10533    LDKSignOrCreationError_CreationError,
10534    /**
10535     * Must be last for serialization purposes
10536     */
10537    LDKSignOrCreationError_Sentinel,
10538 } LDKSignOrCreationError_Tag;
10539
10540 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
10541    LDKSignOrCreationError_Tag tag;
10542    union {
10543       struct {
10544          enum LDKCreationError creation_error;
10545       };
10546    };
10547 } LDKSignOrCreationError;
10548
10549 /**
10550  * The contents of CResult_InvoiceSignOrCreationErrorZ
10551  */
10552 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
10553    /**
10554     * A pointer to the contents in the success state.
10555     * Reading from this pointer when `result_ok` is not set is undefined.
10556     */
10557    struct LDKInvoice *result;
10558    /**
10559     * A pointer to the contents in the error state.
10560     * Reading from this pointer when `result_ok` is set is undefined.
10561     */
10562    struct LDKSignOrCreationError *err;
10563 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
10564
10565 /**
10566  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10567  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10568  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10569  */
10570 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
10571    /**
10572     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
10573     * `err` or `result` depending on the state of `result_ok`.
10574     */
10575    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
10576    /**
10577     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
10578     */
10579    bool result_ok;
10580 } LDKCResult_InvoiceSignOrCreationErrorZ;
10581
10582
10583
10584 /**
10585  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
10586  *
10587  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
10588  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
10589  * the return value of [`Filter::register_output`].
10590  *
10591  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
10592  * may have been spent there. See [`Filter::register_output`] for details.
10593  *
10594  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
10595  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
10596  */
10597 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
10598    /**
10599     * A pointer to the opaque Rust object.
10600     * Nearly everywhere, inner must be non-null, however in places where
10601     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10602     */
10603    LDKnativeWatchedOutput *inner;
10604    /**
10605     * Indicates that this is the only struct which contains the same pointer.
10606     * Rust functions which take ownership of an object provided via an argument require
10607     * this to be true and invalidate the object pointed to by inner.
10608     */
10609    bool is_owned;
10610 } LDKWatchedOutput;
10611
10612 /**
10613  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
10614  * channels.
10615  *
10616  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
10617  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
10618  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
10619  * receiving full blocks from a chain source, any further filtering is unnecessary.
10620  *
10621  * After an output has been registered, subsequent block retrievals from the chain source must not
10622  * exclude any transactions matching the new criteria nor any in-block descendants of such
10623  * transactions.
10624  *
10625  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
10626  * should not block on I/O. Implementations should instead queue the newly monitored data to be
10627  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
10628  * invocation that has called the `Filter` must return [`TemporaryFailure`].
10629  *
10630  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
10631  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
10632  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
10633  */
10634 typedef struct LDKFilter {
10635    /**
10636     * An opaque pointer which is passed to your function implementations as an argument.
10637     * This has no meaning in the LDK, and can be NULL or any other value.
10638     */
10639    void *this_arg;
10640    /**
10641     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
10642     * a spending condition.
10643     */
10644    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
10645    /**
10646     * Registers interest in spends of a transaction output.
10647     *
10648     * Optionally, when `output.block_hash` is set, should return any transaction spending the
10649     * output that is found in the corresponding block along with its index.
10650     *
10651     * This return value is useful for Electrum clients in order to supply in-block descendant
10652     * transactions which otherwise were not included. This is not necessary for other clients if
10653     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
10654     * full block).
10655     */
10656    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
10657    /**
10658     * Frees any resources associated with this object given its this_arg pointer.
10659     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10660     */
10661    void (*free)(void *this_arg);
10662 } LDKFilter;
10663
10664 /**
10665  * An enum which can either contain a crate::lightning::chain::Filter or not
10666  */
10667 typedef enum LDKCOption_FilterZ_Tag {
10668    /**
10669     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
10670     */
10671    LDKCOption_FilterZ_Some,
10672    /**
10673     * When we're in this state, this COption_FilterZ contains nothing
10674     */
10675    LDKCOption_FilterZ_None,
10676    /**
10677     * Must be last for serialization purposes
10678     */
10679    LDKCOption_FilterZ_Sentinel,
10680 } LDKCOption_FilterZ_Tag;
10681
10682 typedef struct LDKCOption_FilterZ {
10683    LDKCOption_FilterZ_Tag tag;
10684    union {
10685       struct {
10686          struct LDKFilter some;
10687       };
10688    };
10689 } LDKCOption_FilterZ;
10690
10691
10692
10693 /**
10694  * A read-only reference to a current ChannelMonitor.
10695  *
10696  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
10697  * released.
10698  */
10699 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
10700    /**
10701     * A pointer to the opaque Rust object.
10702     * Nearly everywhere, inner must be non-null, however in places where
10703     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10704     */
10705    LDKnativeLockedChannelMonitor *inner;
10706    /**
10707     * Indicates that this is the only struct which contains the same pointer.
10708     * Rust functions which take ownership of an object provided via an argument require
10709     * this to be true and invalidate the object pointed to by inner.
10710     */
10711    bool is_owned;
10712 } LDKLockedChannelMonitor;
10713
10714 /**
10715  * The contents of CResult_LockedChannelMonitorNoneZ
10716  */
10717 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
10718    /**
10719     * A pointer to the contents in the success state.
10720     * Reading from this pointer when `result_ok` is not set is undefined.
10721     */
10722    struct LDKLockedChannelMonitor *result;
10723    /**
10724     * Note that this value is always NULL, as there are no contents in the Err variant
10725     */
10726    void *err;
10727 } LDKCResult_LockedChannelMonitorNoneZPtr;
10728
10729 /**
10730  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
10731  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
10732  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10733  */
10734 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
10735    /**
10736     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
10737     * `err` or `result` depending on the state of `result_ok`.
10738     */
10739    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
10740    /**
10741     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
10742     */
10743    bool result_ok;
10744 } LDKCResult_LockedChannelMonitorNoneZ;
10745
10746 /**
10747  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
10748  * This corresponds to std::vector in C++
10749  */
10750 typedef struct LDKCVec_OutPointZ {
10751    /**
10752     * The elements in the array.
10753     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10754     */
10755    struct LDKOutPoint *data;
10756    /**
10757     * The number of elements pointed to by `data`.
10758     */
10759    uintptr_t datalen;
10760 } LDKCVec_OutPointZ;
10761
10762 /**
10763  * A trait indicating an object may generate message send events
10764  */
10765 typedef struct LDKMessageSendEventsProvider {
10766    /**
10767     * An opaque pointer which is passed to your function implementations as an argument.
10768     * This has no meaning in the LDK, and can be NULL or any other value.
10769     */
10770    void *this_arg;
10771    /**
10772     * Gets the list of pending events which were generated by previous actions, clearing the list
10773     * in the process.
10774     */
10775    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
10776    /**
10777     * Frees any resources associated with this object given its this_arg pointer.
10778     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10779     */
10780    void (*free)(void *this_arg);
10781 } LDKMessageSendEventsProvider;
10782
10783 /**
10784  * A trait implemented for objects handling events from [`EventsProvider`].
10785  */
10786 typedef struct LDKEventHandler {
10787    /**
10788     * An opaque pointer which is passed to your function implementations as an argument.
10789     * This has no meaning in the LDK, and can be NULL or any other value.
10790     */
10791    void *this_arg;
10792    /**
10793     * Handles the given [`Event`].
10794     *
10795     * See [`EventsProvider`] for details that must be considered when implementing this method.
10796     */
10797    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
10798    /**
10799     * Frees any resources associated with this object given its this_arg pointer.
10800     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10801     */
10802    void (*free)(void *this_arg);
10803 } LDKEventHandler;
10804
10805 /**
10806  * A trait indicating an object may generate events.
10807  *
10808  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
10809  *
10810  * # Requirements
10811  *
10812  * See [`process_pending_events`] for requirements around event processing.
10813  *
10814  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
10815  * event since the last invocation. The handler must either act upon the event immediately
10816  * or preserve it for later handling.
10817  *
10818  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
10819  * consult the provider's documentation on the implication of processing events and how a handler
10820  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
10821  * [`ChainMonitor::process_pending_events`]).
10822  *
10823  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
10824  * own type(s).
10825  *
10826  * [`process_pending_events`]: Self::process_pending_events
10827  * [`handle_event`]: EventHandler::handle_event
10828  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
10829  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
10830  */
10831 typedef struct LDKEventsProvider {
10832    /**
10833     * An opaque pointer which is passed to your function implementations as an argument.
10834     * This has no meaning in the LDK, and can be NULL or any other value.
10835     */
10836    void *this_arg;
10837    /**
10838     * Processes any events generated since the last call using the given event handler.
10839     *
10840     * Subsequent calls must only process new events. However, handlers must be capable of handling
10841     * duplicate events across process restarts. This may occur if the provider was recovered from
10842     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
10843     */
10844    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
10845    /**
10846     * Frees any resources associated with this object given its this_arg pointer.
10847     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10848     */
10849    void (*free)(void *this_arg);
10850 } LDKEventsProvider;
10851
10852
10853
10854 /**
10855  * Configuration we set when applicable.
10856  *
10857  * Default::default() provides sane defaults.
10858  */
10859 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
10860    /**
10861     * A pointer to the opaque Rust object.
10862     * Nearly everywhere, inner must be non-null, however in places where
10863     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10864     */
10865    LDKnativeChannelHandshakeConfig *inner;
10866    /**
10867     * Indicates that this is the only struct which contains the same pointer.
10868     * Rust functions which take ownership of an object provided via an argument require
10869     * this to be true and invalidate the object pointed to by inner.
10870     */
10871    bool is_owned;
10872 } LDKChannelHandshakeConfig;
10873
10874
10875
10876 /**
10877  * Optional channel limits which are applied during channel creation.
10878  *
10879  * These limits are only applied to our counterparty's limits, not our own.
10880  *
10881  * Use 0/<type>::max_value() as appropriate to skip checking.
10882  *
10883  * Provides sane defaults for most configurations.
10884  *
10885  * Most additional limits are disabled except those with which specify a default in individual
10886  * field documentation. Note that this may result in barely-usable channels, but since they
10887  * are applied mostly only to incoming channels that's not much of a problem.
10888  */
10889 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
10890    /**
10891     * A pointer to the opaque Rust object.
10892     * Nearly everywhere, inner must be non-null, however in places where
10893     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10894     */
10895    LDKnativeChannelHandshakeLimits *inner;
10896    /**
10897     * Indicates that this is the only struct which contains the same pointer.
10898     * Rust functions which take ownership of an object provided via an argument require
10899     * this to be true and invalidate the object pointed to by inner.
10900     */
10901    bool is_owned;
10902 } LDKChannelHandshakeLimits;
10903
10904
10905
10906 /**
10907  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
10908  *
10909  * Default::default() provides sane defaults for most configurations
10910  * (but currently with 0 relay fees!)
10911  */
10912 typedef struct MUST_USE_STRUCT LDKUserConfig {
10913    /**
10914     * A pointer to the opaque Rust object.
10915     * Nearly everywhere, inner must be non-null, however in places where
10916     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10917     */
10918    LDKnativeUserConfig *inner;
10919    /**
10920     * Indicates that this is the only struct which contains the same pointer.
10921     * Rust functions which take ownership of an object provided via an argument require
10922     * this to be true and invalidate the object pointed to by inner.
10923     */
10924    bool is_owned;
10925 } LDKUserConfig;
10926
10927
10928
10929 /**
10930  * The best known block as identified by its hash and height.
10931  */
10932 typedef struct MUST_USE_STRUCT LDKBestBlock {
10933    /**
10934     * A pointer to the opaque Rust object.
10935     * Nearly everywhere, inner must be non-null, however in places where
10936     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10937     */
10938    LDKnativeBestBlock *inner;
10939    /**
10940     * Indicates that this is the only struct which contains the same pointer.
10941     * Rust functions which take ownership of an object provided via an argument require
10942     * this to be true and invalidate the object pointed to by inner.
10943     */
10944    bool is_owned;
10945 } LDKBestBlock;
10946
10947 /**
10948  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
10949  * chain.
10950  *
10951  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
10952  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
10953  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
10954  * when needed.
10955  */
10956 typedef struct LDKListen {
10957    /**
10958     * An opaque pointer which is passed to your function implementations as an argument.
10959     * This has no meaning in the LDK, and can be NULL or any other value.
10960     */
10961    void *this_arg;
10962    /**
10963     * Notifies the listener that a block was added at the given height.
10964     */
10965    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
10966    /**
10967     * Notifies the listener that a block was removed at the given height.
10968     */
10969    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
10970    /**
10971     * Frees any resources associated with this object given its this_arg pointer.
10972     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10973     */
10974    void (*free)(void *this_arg);
10975 } LDKListen;
10976
10977 /**
10978  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
10979  * unconfirmed during a chain reorganization.
10980  *
10981  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
10982  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
10983  * related to registered transactions and outputs. Upon notification, it would pass along the
10984  * matching transactions using this interface.
10985  *
10986  * # Use
10987  *
10988  * The intended use is as follows:
10989  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
10990  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
10991  *   that has been reorganized out of the chain.
10992  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
10993  *
10994  * # Order
10995  *
10996  * Clients must call these methods in chain order. Specifically:
10997  * - Transactions confirmed in a block must be given before transactions confirmed in a later
10998  *   block.
10999  * - Dependent transactions within the same block must be given in topological order, possibly in
11000  *   separate calls.
11001  * - Unconfirmed transactions must be given after the original confirmations and before any
11002  *   reconfirmation.
11003  *
11004  * See individual method documentation for further details.
11005  *
11006  * [`transactions_confirmed`]: Self::transactions_confirmed
11007  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11008  * [`best_block_updated`]: Self::best_block_updated
11009  * [`get_relevant_txids`]: Self::get_relevant_txids
11010  */
11011 typedef struct LDKConfirm {
11012    /**
11013     * An opaque pointer which is passed to your function implementations as an argument.
11014     * This has no meaning in the LDK, and can be NULL or any other value.
11015     */
11016    void *this_arg;
11017    /**
11018     * Processes transactions confirmed in a block with a given header and height.
11019     *
11020     * Should be called for any transactions registered by [`Filter::register_tx`] or any
11021     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
11022     * appearing in the same block do not need to be included in the same call; instead, multiple
11023     * calls with additional transactions may be made so long as they are made in [chain order].
11024     *
11025     * May be called before or after [`best_block_updated`] for the corresponding block. However,
11026     * in the event of a chain reorganization, it must not be called with a `header` that is no
11027     * longer in the chain as of the last call to [`best_block_updated`].
11028     *
11029     * [chain order]: Confirm#Order
11030     * [`best_block_updated`]: Self::best_block_updated
11031     */
11032    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
11033    /**
11034     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
11035     *
11036     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
11037     * reorganized out of the best chain. Once called, the given transaction should not be returned
11038     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
11039     *
11040     * [`get_relevant_txids`]: Self::get_relevant_txids
11041     * [`transactions_confirmed`]: Self::transactions_confirmed
11042     */
11043    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
11044    /**
11045     * Processes an update to the best header connected at the given height.
11046     *
11047     * Should be called when a new header is available but may be skipped for intermediary blocks
11048     * if they become available at the same time.
11049     */
11050    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
11051    /**
11052     * Returns transactions that should be monitored for reorganization out of the chain.
11053     *
11054     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
11055     * confirmations to be safe from a chain reorganization. Should not include any transactions
11056     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
11057     *
11058     * May be called to determine the subset of transactions that must still be monitored for
11059     * reorganization. Will be idempotent between calls but may change as a result of calls to the
11060     * other interface methods. Thus, this is useful to determine which transactions may need to be
11061     * given to [`transaction_unconfirmed`].
11062     *
11063     * [`transactions_confirmed`]: Self::transactions_confirmed
11064     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11065     */
11066    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
11067    /**
11068     * Frees any resources associated with this object given its this_arg pointer.
11069     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11070     */
11071    void (*free)(void *this_arg);
11072 } LDKConfirm;
11073
11074
11075
11076 /**
11077  * An opaque identifier describing a specific [`Persist`] method call.
11078  */
11079 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
11080    /**
11081     * A pointer to the opaque Rust object.
11082     * Nearly everywhere, inner must be non-null, however in places where
11083     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11084     */
11085    LDKnativeMonitorUpdateId *inner;
11086    /**
11087     * Indicates that this is the only struct which contains the same pointer.
11088     * Rust functions which take ownership of an object provided via an argument require
11089     * this to be true and invalidate the object pointed to by inner.
11090     */
11091    bool is_owned;
11092 } LDKMonitorUpdateId;
11093
11094 /**
11095  * `Persist` defines behavior for persisting channel monitors: this could mean
11096  * writing once to disk, and/or uploading to one or more backup services.
11097  *
11098  * Each method can return three possible values:
11099  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
11100  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
11101  *  * If persistence happens asynchronously, implementations should first ensure the
11102  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
11103  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
11104  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
11105  *    called with the corresponding [`MonitorUpdateId`].
11106  *
11107  *    Note that unlike the direct [`chain::Watch`] interface,
11108  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
11109  *
11110  *  * If persistence fails for some reason, implementations should return
11111  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
11112  *    closed without broadcasting the latest state. See
11113  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
11114  */
11115 typedef struct LDKPersist {
11116    /**
11117     * An opaque pointer which is passed to your function implementations as an argument.
11118     * This has no meaning in the LDK, and can be NULL or any other value.
11119     */
11120    void *this_arg;
11121    /**
11122     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
11123     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
11124     *
11125     * The data can be stored any way you want, but the identifier provided by LDK is the
11126     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
11127     * and the stored channel data). Note that you **must** persist every new monitor to disk.
11128     *
11129     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11130     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11131     *
11132     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
11133     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11134     *
11135     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11136     * [`Writeable::write`]: crate::util::ser::Writeable::write
11137     */
11138    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
11139    /**
11140     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
11141     * update.
11142     *
11143     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
11144     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
11145     * details.
11146     *
11147     * During blockchain synchronization operations, this may be called with no
11148     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
11149     * Note that after the full [`ChannelMonitor`] is persisted any previous
11150     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
11151     * applied to the persisted [`ChannelMonitor`] as they were already applied.
11152     *
11153     * If an implementer chooses to persist the updates only, they need to make
11154     * sure that all the updates are applied to the `ChannelMonitors` *before*
11155     * the set of channel monitors is given to the `ChannelManager`
11156     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
11157     * applying a monitor update to a monitor. If full `ChannelMonitors` are
11158     * persisted, then there is no need to persist individual updates.
11159     *
11160     * Note that there could be a performance tradeoff between persisting complete
11161     * channel monitors on every update vs. persisting only updates and applying
11162     * them in batches. The size of each monitor grows `O(number of state updates)`
11163     * whereas updates are small and `O(1)`.
11164     *
11165     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11166     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11167     *
11168     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
11169     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
11170     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11171     *
11172     * [`Writeable::write`]: crate::util::ser::Writeable::write
11173     *
11174     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
11175     */
11176    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);
11177    /**
11178     * Frees any resources associated with this object given its this_arg pointer.
11179     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11180     */
11181    void (*free)(void *this_arg);
11182 } LDKPersist;
11183
11184
11185
11186 /**
11187  * An implementation of [`chain::Watch`] for monitoring channels.
11188  *
11189  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
11190  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
11191  * or used independently to monitor channels remotely. See the [module-level documentation] for
11192  * details.
11193  *
11194  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11195  * [module-level documentation]: crate::chain::chainmonitor
11196  */
11197 typedef struct MUST_USE_STRUCT LDKChainMonitor {
11198    /**
11199     * A pointer to the opaque Rust object.
11200     * Nearly everywhere, inner must be non-null, however in places where
11201     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11202     */
11203    LDKnativeChainMonitor *inner;
11204    /**
11205     * Indicates that this is the only struct which contains the same pointer.
11206     * Rust functions which take ownership of an object provided via an argument require
11207     * this to be true and invalidate the object pointed to by inner.
11208     */
11209    bool is_owned;
11210 } LDKChainMonitor;
11211
11212
11213
11214 /**
11215  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
11216  * and derives keys from that.
11217  *
11218  * Your node_id is seed/0'
11219  * ChannelMonitor closes may use seed/1'
11220  * Cooperative closes may use seed/2'
11221  * The two close keys may be needed to claim on-chain funds!
11222  *
11223  * This struct cannot be used for nodes that wish to support receiving phantom payments;
11224  * [`PhantomKeysManager`] must be used instead.
11225  *
11226  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
11227  * previously issued invoices and attempts to pay previous invoices will fail.
11228  */
11229 typedef struct MUST_USE_STRUCT LDKKeysManager {
11230    /**
11231     * A pointer to the opaque Rust object.
11232     * Nearly everywhere, inner must be non-null, however in places where
11233     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11234     */
11235    LDKnativeKeysManager *inner;
11236    /**
11237     * Indicates that this is the only struct which contains the same pointer.
11238     * Rust functions which take ownership of an object provided via an argument require
11239     * this to be true and invalidate the object pointed to by inner.
11240     */
11241    bool is_owned;
11242 } LDKKeysManager;
11243
11244
11245
11246 /**
11247  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
11248  * payments.
11249  *
11250  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
11251  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
11252  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
11253  * itself without ever needing to forward to this fake node.
11254  *
11255  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
11256  * provide some fault tolerance, because payers will automatically retry paying other provided
11257  * nodes in the case that one node goes down.
11258  *
11259  * Note that multi-path payments are not supported in phantom invoices for security reasons.
11260  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
11261  * invoices and attempts to pay previous invoices will fail.
11262  */
11263 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
11264    /**
11265     * A pointer to the opaque Rust object.
11266     * Nearly everywhere, inner must be non-null, however in places where
11267     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11268     */
11269    LDKnativePhantomKeysManager *inner;
11270    /**
11271     * Indicates that this is the only struct which contains the same pointer.
11272     * Rust functions which take ownership of an object provided via an argument require
11273     * this to be true and invalidate the object pointed to by inner.
11274     */
11275    bool is_owned;
11276 } LDKPhantomKeysManager;
11277
11278
11279
11280 /**
11281  * Chain-related parameters used to construct a new `ChannelManager`.
11282  *
11283  * Typically, the block-specific parameters are derived from the best block hash for the network,
11284  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
11285  * are not needed when deserializing a previously constructed `ChannelManager`.
11286  */
11287 typedef struct MUST_USE_STRUCT LDKChainParameters {
11288    /**
11289     * A pointer to the opaque Rust object.
11290     * Nearly everywhere, inner must be non-null, however in places where
11291     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11292     */
11293    LDKnativeChainParameters *inner;
11294    /**
11295     * Indicates that this is the only struct which contains the same pointer.
11296     * Rust functions which take ownership of an object provided via an argument require
11297     * this to be true and invalidate the object pointed to by inner.
11298     */
11299    bool is_owned;
11300 } LDKChainParameters;
11301
11302 /**
11303  * A 3-byte byte array.
11304  */
11305 typedef struct LDKThreeBytes {
11306    /**
11307     * The three bytes
11308     */
11309    uint8_t data[3];
11310 } LDKThreeBytes;
11311
11312 /**
11313  * A trait to describe an object which can receive channel messages.
11314  *
11315  * Messages MAY be called in parallel when they originate from different their_node_ids, however
11316  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
11317  */
11318 typedef struct LDKChannelMessageHandler {
11319    /**
11320     * An opaque pointer which is passed to your function implementations as an argument.
11321     * This has no meaning in the LDK, and can be NULL or any other value.
11322     */
11323    void *this_arg;
11324    /**
11325     * Handle an incoming open_channel message from the given peer.
11326     */
11327    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
11328    /**
11329     * Handle an incoming accept_channel message from the given peer.
11330     */
11331    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
11332    /**
11333     * Handle an incoming funding_created message from the given peer.
11334     */
11335    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
11336    /**
11337     * Handle an incoming funding_signed message from the given peer.
11338     */
11339    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
11340    /**
11341     * Handle an incoming funding_locked message from the given peer.
11342     */
11343    void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
11344    /**
11345     * Handle an incoming shutdown message from the given peer.
11346     */
11347    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);
11348    /**
11349     * Handle an incoming closing_signed message from the given peer.
11350     */
11351    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
11352    /**
11353     * Handle an incoming update_add_htlc message from the given peer.
11354     */
11355    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
11356    /**
11357     * Handle an incoming update_fulfill_htlc message from the given peer.
11358     */
11359    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
11360    /**
11361     * Handle an incoming update_fail_htlc message from the given peer.
11362     */
11363    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
11364    /**
11365     * Handle an incoming update_fail_malformed_htlc message from the given peer.
11366     */
11367    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
11368    /**
11369     * Handle an incoming commitment_signed message from the given peer.
11370     */
11371    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
11372    /**
11373     * Handle an incoming revoke_and_ack message from the given peer.
11374     */
11375    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
11376    /**
11377     * Handle an incoming update_fee message from the given peer.
11378     */
11379    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
11380    /**
11381     * Handle an incoming announcement_signatures message from the given peer.
11382     */
11383    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
11384    /**
11385     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
11386     * is believed to be possible in the future (eg they're sending us messages we don't
11387     * understand or indicate they require unknown feature bits), no_connection_possible is set
11388     * and any outstanding channels should be failed.
11389     */
11390    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
11391    /**
11392     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
11393     */
11394    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
11395    /**
11396     * Handle an incoming channel_reestablish message from the given peer.
11397     */
11398    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
11399    /**
11400     * Handle an incoming channel update from the given peer.
11401     */
11402    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
11403    /**
11404     * Handle an incoming error message from the given peer.
11405     */
11406    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
11407    /**
11408     * Implementation of MessageSendEventsProvider for this object.
11409     */
11410    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11411    /**
11412     * Frees any resources associated with this object given its this_arg pointer.
11413     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11414     */
11415    void (*free)(void *this_arg);
11416 } LDKChannelMessageHandler;
11417
11418
11419
11420 /**
11421  * Arguments for the creation of a ChannelManager that are not deserialized.
11422  *
11423  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
11424  * is:
11425  * 1) Deserialize all stored [`ChannelMonitor`]s.
11426  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
11427  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
11428  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
11429  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
11430  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
11431  *    same way you would handle a [`chain::Filter`] call using
11432  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
11433  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
11434  * 5) Disconnect/connect blocks on the [`ChannelManager`].
11435  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
11436  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
11437  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
11438  *    the next step.
11439  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
11440  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
11441  *
11442  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
11443  * call any other methods on the newly-deserialized [`ChannelManager`].
11444  *
11445  * Note that because some channels may be closed during deserialization, it is critical that you
11446  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
11447  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
11448  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
11449  * not force-close the same channels but consider them live), you may end up revoking a state for
11450  * which you've already broadcasted the transaction.
11451  *
11452  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
11453  */
11454 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
11455    /**
11456     * A pointer to the opaque Rust object.
11457     * Nearly everywhere, inner must be non-null, however in places where
11458     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11459     */
11460    LDKnativeChannelManagerReadArgs *inner;
11461    /**
11462     * Indicates that this is the only struct which contains the same pointer.
11463     * Rust functions which take ownership of an object provided via an argument require
11464     * this to be true and invalidate the object pointed to by inner.
11465     */
11466    bool is_owned;
11467 } LDKChannelManagerReadArgs;
11468
11469
11470
11471 /**
11472  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
11473  * This is used to convince the recipient that the channel is at a certain commitment
11474  * number even if they lost that data due to a local failure.  Of course, the peer may lie
11475  * and even later commitments may have been revoked.
11476  */
11477 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
11478    /**
11479     * A pointer to the opaque Rust object.
11480     * Nearly everywhere, inner must be non-null, however in places where
11481     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11482     */
11483    LDKnativeDataLossProtect *inner;
11484    /**
11485     * Indicates that this is the only struct which contains the same pointer.
11486     * Rust functions which take ownership of an object provided via an argument require
11487     * this to be true and invalidate the object pointed to by inner.
11488     */
11489    bool is_owned;
11490 } LDKDataLossProtect;
11491
11492 /**
11493  * A trait to describe an object which can receive routing messages.
11494  *
11495  * # Implementor DoS Warnings
11496  *
11497  * For `gossip_queries` messages there are potential DoS vectors when handling
11498  * inbound queries. Implementors using an on-disk network graph should be aware of
11499  * repeated disk I/O for queries accessing different parts of the network graph.
11500  */
11501 typedef struct LDKRoutingMessageHandler {
11502    /**
11503     * An opaque pointer which is passed to your function implementations as an argument.
11504     * This has no meaning in the LDK, and can be NULL or any other value.
11505     */
11506    void *this_arg;
11507    /**
11508     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
11509     * false or returning an Err otherwise.
11510     */
11511    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
11512    /**
11513     * Handle a channel_announcement message, returning true if it should be forwarded on, false
11514     * or returning an Err otherwise.
11515     */
11516    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
11517    /**
11518     * Handle an incoming channel_update message, returning true if it should be forwarded on,
11519     * false or returning an Err otherwise.
11520     */
11521    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
11522    /**
11523     * Gets a subset of the channel announcements and updates required to dump our routing table
11524     * to a remote node, starting at the short_channel_id indicated by starting_point and
11525     * including the batch_amount entries immediately higher in numerical value than starting_point.
11526     */
11527    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
11528    /**
11529     * Gets a subset of the node announcements required to dump our routing table to a remote node,
11530     * starting at the node *after* the provided publickey and including batch_amount entries
11531     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
11532     * If None is provided for starting_point, we start at the first node.
11533     *
11534     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
11535     */
11536    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
11537    /**
11538     * Called when a connection is established with a peer. This can be used to
11539     * perform routing table synchronization using a strategy defined by the
11540     * implementor.
11541     */
11542    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
11543    /**
11544     * Handles the reply of a query we initiated to learn about channels
11545     * for a given range of blocks. We can expect to receive one or more
11546     * replies to a single query.
11547     */
11548    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
11549    /**
11550     * Handles the reply of a query we initiated asking for routing gossip
11551     * messages for a list of channels. We should receive this message when
11552     * a node has completed its best effort to send us the pertaining routing
11553     * gossip messages.
11554     */
11555    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
11556    /**
11557     * Handles when a peer asks us to send a list of short_channel_ids
11558     * for the requested range of blocks.
11559     */
11560    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
11561    /**
11562     * Handles when a peer asks us to send routing gossip messages for a
11563     * list of short_channel_ids.
11564     */
11565    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
11566    /**
11567     * Implementation of MessageSendEventsProvider for this object.
11568     */
11569    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11570    /**
11571     * Frees any resources associated with this object given its this_arg pointer.
11572     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11573     */
11574    void (*free)(void *this_arg);
11575 } LDKRoutingMessageHandler;
11576
11577 /**
11578  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
11579  * decoders.
11580  */
11581 typedef struct LDKCustomMessageReader {
11582    /**
11583     * An opaque pointer which is passed to your function implementations as an argument.
11584     * This has no meaning in the LDK, and can be NULL or any other value.
11585     */
11586    void *this_arg;
11587    /**
11588     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
11589     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
11590     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
11591     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
11592     */
11593    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
11594    /**
11595     * Frees any resources associated with this object given its this_arg pointer.
11596     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11597     */
11598    void (*free)(void *this_arg);
11599 } LDKCustomMessageReader;
11600
11601 /**
11602  * Handler for BOLT1-compliant messages.
11603  */
11604 typedef struct LDKCustomMessageHandler {
11605    /**
11606     * An opaque pointer which is passed to your function implementations as an argument.
11607     * This has no meaning in the LDK, and can be NULL or any other value.
11608     */
11609    void *this_arg;
11610    /**
11611     * Called with the message type that was received and the buffer to be read.
11612     * Can return a `MessageHandlingError` if the message could not be handled.
11613     */
11614    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
11615    /**
11616     * Gets the list of pending messages which were generated by the custom message
11617     * handler, clearing the list in the process. The first tuple element must
11618     * correspond to the intended recipients node ids. If no connection to one of the
11619     * specified node does not exist, the message is simply not sent to it.
11620     */
11621    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
11622    /**
11623     * Implementation of CustomMessageReader for this object.
11624     */
11625    struct LDKCustomMessageReader CustomMessageReader;
11626    /**
11627     * Frees any resources associated with this object given its this_arg pointer.
11628     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11629     */
11630    void (*free)(void *this_arg);
11631 } LDKCustomMessageHandler;
11632
11633
11634
11635 /**
11636  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
11637  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
11638  */
11639 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
11640    /**
11641     * A pointer to the opaque Rust object.
11642     * Nearly everywhere, inner must be non-null, however in places where
11643     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11644     */
11645    LDKnativeIgnoringMessageHandler *inner;
11646    /**
11647     * Indicates that this is the only struct which contains the same pointer.
11648     * Rust functions which take ownership of an object provided via an argument require
11649     * this to be true and invalidate the object pointed to by inner.
11650     */
11651    bool is_owned;
11652 } LDKIgnoringMessageHandler;
11653
11654
11655
11656 /**
11657  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
11658  * You can provide one of these as the route_handler in a MessageHandler.
11659  */
11660 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
11661    /**
11662     * A pointer to the opaque Rust object.
11663     * Nearly everywhere, inner must be non-null, however in places where
11664     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11665     */
11666    LDKnativeErroringMessageHandler *inner;
11667    /**
11668     * Indicates that this is the only struct which contains the same pointer.
11669     * Rust functions which take ownership of an object provided via an argument require
11670     * this to be true and invalidate the object pointed to by inner.
11671     */
11672    bool is_owned;
11673 } LDKErroringMessageHandler;
11674
11675
11676
11677 /**
11678  * Provides references to trait impls which handle different types of messages.
11679  */
11680 typedef struct MUST_USE_STRUCT LDKMessageHandler {
11681    /**
11682     * A pointer to the opaque Rust object.
11683     * Nearly everywhere, inner must be non-null, however in places where
11684     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11685     */
11686    LDKnativeMessageHandler *inner;
11687    /**
11688     * Indicates that this is the only struct which contains the same pointer.
11689     * Rust functions which take ownership of an object provided via an argument require
11690     * this to be true and invalidate the object pointed to by inner.
11691     */
11692    bool is_owned;
11693 } LDKMessageHandler;
11694
11695 /**
11696  * Provides an object which can be used to send data to and which uniquely identifies a connection
11697  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
11698  * implement Hash to meet the PeerManager API.
11699  *
11700  * For efficiency, Clone should be relatively cheap for this type.
11701  *
11702  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
11703  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
11704  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
11705  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
11706  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
11707  * to simply use another value which is guaranteed to be globally unique instead.
11708  */
11709 typedef struct LDKSocketDescriptor {
11710    /**
11711     * An opaque pointer which is passed to your function implementations as an argument.
11712     * This has no meaning in the LDK, and can be NULL or any other value.
11713     */
11714    void *this_arg;
11715    /**
11716     * Attempts to send some data from the given slice to the peer.
11717     *
11718     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
11719     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
11720     * called and further write attempts may occur until that time.
11721     *
11722     * If the returned size is smaller than `data.len()`, a
11723     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
11724     * written. Additionally, until a `send_data` event completes fully, no further
11725     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
11726     * prevent denial-of-service issues, you should not read or buffer any data from the socket
11727     * until then.
11728     *
11729     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
11730     * (indicating that read events should be paused to prevent DoS in the send buffer),
11731     * `resume_read` may be set indicating that read events on this descriptor should resume. A
11732     * `resume_read` of false carries no meaning, and should not cause any action.
11733     */
11734    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
11735    /**
11736     * Disconnect the socket pointed to by this SocketDescriptor.
11737     *
11738     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
11739     * call (doing so is a noop).
11740     */
11741    void (*disconnect_socket)(void *this_arg);
11742    /**
11743     * Checks if two objects are equal given this object's this_arg pointer and another object.
11744     */
11745    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
11746    /**
11747     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
11748     * This is used, for example, for inclusion of this object in a hash map.
11749     */
11750    uint64_t (*hash)(const void *this_arg);
11751    /**
11752     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
11753     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
11754     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
11755     */
11756    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
11757    /**
11758     * Frees any resources associated with this object given its this_arg pointer.
11759     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11760     */
11761    void (*free)(void *this_arg);
11762 } LDKSocketDescriptor;
11763
11764
11765
11766 /**
11767  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
11768  * socket events into messages which it passes on to its [`MessageHandler`].
11769  *
11770  * Locks are taken internally, so you must never assume that reentrancy from a
11771  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
11772  *
11773  * Calls to [`read_event`] will decode relevant messages and pass them to the
11774  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
11775  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
11776  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
11777  * calls only after previous ones have returned.
11778  *
11779  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
11780  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
11781  * essentially you should default to using a SimpleRefPeerManager, and use a
11782  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
11783  * you're using lightning-net-tokio.
11784  *
11785  * [`read_event`]: PeerManager::read_event
11786  */
11787 typedef struct MUST_USE_STRUCT LDKPeerManager {
11788    /**
11789     * A pointer to the opaque Rust object.
11790     * Nearly everywhere, inner must be non-null, however in places where
11791     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11792     */
11793    LDKnativePeerManager *inner;
11794    /**
11795     * Indicates that this is the only struct which contains the same pointer.
11796     * Rust functions which take ownership of an object provided via an argument require
11797     * this to be true and invalidate the object pointed to by inner.
11798     */
11799    bool is_owned;
11800 } LDKPeerManager;
11801
11802
11803
11804 /**
11805  * Static channel fields used to build transactions given per-commitment fields, organized by
11806  * broadcaster/countersignatory.
11807  *
11808  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
11809  * as_holder_broadcastable and as_counterparty_broadcastable functions.
11810  */
11811 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
11812    /**
11813     * A pointer to the opaque Rust object.
11814     * Nearly everywhere, inner must be non-null, however in places where
11815     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11816     */
11817    LDKnativeDirectedChannelTransactionParameters *inner;
11818    /**
11819     * Indicates that this is the only struct which contains the same pointer.
11820     * Rust functions which take ownership of an object provided via an argument require
11821     * this to be true and invalidate the object pointed to by inner.
11822     */
11823    bool is_owned;
11824 } LDKDirectedChannelTransactionParameters;
11825
11826
11827
11828 /**
11829  * A read-only view of [`NetworkGraph`].
11830  */
11831 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
11832    /**
11833     * A pointer to the opaque Rust object.
11834     * Nearly everywhere, inner must be non-null, however in places where
11835     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11836     */
11837    LDKnativeReadOnlyNetworkGraph *inner;
11838    /**
11839     * Indicates that this is the only struct which contains the same pointer.
11840     * Rust functions which take ownership of an object provided via an argument require
11841     * this to be true and invalidate the object pointed to by inner.
11842     */
11843    bool is_owned;
11844 } LDKReadOnlyNetworkGraph;
11845
11846
11847
11848 /**
11849  * Receives and validates network updates from peers,
11850  * stores authentic and relevant data as a network graph.
11851  * This network graph is then used for routing payments.
11852  * Provides interface to help with initial routing sync by
11853  * serving historical announcements.
11854  *
11855  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
11856  * [`NetworkGraph`].
11857  */
11858 typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
11859    /**
11860     * A pointer to the opaque Rust object.
11861     * Nearly everywhere, inner must be non-null, however in places where
11862     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11863     */
11864    LDKnativeNetGraphMsgHandler *inner;
11865    /**
11866     * Indicates that this is the only struct which contains the same pointer.
11867     * Rust functions which take ownership of an object provided via an argument require
11868     * this to be true and invalidate the object pointed to by inner.
11869     */
11870    bool is_owned;
11871 } LDKNetGraphMsgHandler;
11872
11873
11874
11875 /**
11876  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
11877  * source node to a target node.
11878  */
11879 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
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    LDKnativeDirectedChannelInfo *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 } LDKDirectedChannelInfo;
11893
11894 /**
11895  * The effective capacity of a channel for routing purposes.
11896  *
11897  * While this may be smaller than the actual channel capacity, amounts greater than
11898  * [`Self::as_msat`] should not be routed through the channel.
11899  */
11900 typedef enum LDKEffectiveCapacity_Tag {
11901    /**
11902     * The available liquidity in the channel known from being a channel counterparty, and thus a
11903     * direct hop.
11904     */
11905    LDKEffectiveCapacity_ExactLiquidity,
11906    /**
11907     * The maximum HTLC amount in one direction as advertised on the gossip network.
11908     */
11909    LDKEffectiveCapacity_MaximumHTLC,
11910    /**
11911     * The total capacity of the channel as determined by the funding transaction.
11912     */
11913    LDKEffectiveCapacity_Total,
11914    /**
11915     * A capacity sufficient to route any payment, typically used for private channels provided by
11916     * an invoice.
11917     */
11918    LDKEffectiveCapacity_Infinite,
11919    /**
11920     * A capacity that is unknown possibly because either the chain state is unavailable to know
11921     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
11922     */
11923    LDKEffectiveCapacity_Unknown,
11924    /**
11925     * Must be last for serialization purposes
11926     */
11927    LDKEffectiveCapacity_Sentinel,
11928 } LDKEffectiveCapacity_Tag;
11929
11930 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
11931    /**
11932     * Either the inbound or outbound liquidity depending on the direction, denominated in
11933     * millisatoshi.
11934     */
11935    uint64_t liquidity_msat;
11936 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
11937
11938 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
11939    /**
11940     * The maximum HTLC amount denominated in millisatoshi.
11941     */
11942    uint64_t amount_msat;
11943 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
11944
11945 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
11946    /**
11947     * The funding amount denominated in millisatoshi.
11948     */
11949    uint64_t capacity_msat;
11950 } LDKEffectiveCapacity_LDKTotal_Body;
11951
11952 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
11953    LDKEffectiveCapacity_Tag tag;
11954    union {
11955       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
11956       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
11957       LDKEffectiveCapacity_LDKTotal_Body total;
11958    };
11959 } LDKEffectiveCapacity;
11960
11961 /**
11962  * An interface used to score payment channels for path finding.
11963  *
11964  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
11965  */
11966 typedef struct LDKScore {
11967    /**
11968     * An opaque pointer which is passed to your function implementations as an argument.
11969     * This has no meaning in the LDK, and can be NULL or any other value.
11970     */
11971    void *this_arg;
11972    /**
11973     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
11974     * given channel in the direction from `source` to `target`.
11975     *
11976     * The channel's capacity (less any other MPP parts that are also being considered for use in
11977     * the same payment) is given by `capacity_msat`. It may be determined from various sources
11978     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
11979     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
11980     * Thus, implementations should be overflow-safe.
11981     */
11982    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);
11983    /**
11984     * Handles updating channel penalties after failing to route through a channel.
11985     */
11986    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
11987    /**
11988     * Handles updating channel penalties after successfully routing along a path.
11989     */
11990    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
11991    /**
11992     * Serialize the object into a byte array
11993     */
11994    struct LDKCVec_u8Z (*write)(const void *this_arg);
11995    /**
11996     * Frees any resources associated with this object given its this_arg pointer.
11997     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11998     */
11999    void (*free)(void *this_arg);
12000 } LDKScore;
12001
12002 /**
12003  * A scorer that is accessed under a lock.
12004  *
12005  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
12006  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
12007  * implementations. Internal locking would be detrimental to route finding performance and could
12008  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
12009  *
12010  * [`find_route`]: crate::routing::router::find_route
12011  */
12012 typedef struct LDKLockableScore {
12013    /**
12014     * An opaque pointer which is passed to your function implementations as an argument.
12015     * This has no meaning in the LDK, and can be NULL or any other value.
12016     */
12017    void *this_arg;
12018    /**
12019     * Returns the locked scorer.
12020     */
12021    struct LDKScore (*lock)(const void *this_arg);
12022    /**
12023     * Frees any resources associated with this object given its this_arg pointer.
12024     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12025     */
12026    void (*free)(void *this_arg);
12027 } LDKLockableScore;
12028
12029
12030
12031 /**
12032  * A concrete implementation of [`LockableScore`] which supports multi-threading.
12033  */
12034 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
12035    /**
12036     * A pointer to the opaque Rust object.
12037     * Nearly everywhere, inner must be non-null, however in places where
12038     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12039     */
12040    LDKnativeMultiThreadedLockableScore *inner;
12041    /**
12042     * Indicates that this is the only struct which contains the same pointer.
12043     * Rust functions which take ownership of an object provided via an argument require
12044     * this to be true and invalidate the object pointed to by inner.
12045     */
12046    bool is_owned;
12047 } LDKMultiThreadedLockableScore;
12048
12049
12050
12051 /**
12052  * Parameters for configuring [`ProbabilisticScorer`].
12053  *
12054  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
12055  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
12056  */
12057 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
12058    /**
12059     * A pointer to the opaque Rust object.
12060     * Nearly everywhere, inner must be non-null, however in places where
12061     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12062     */
12063    LDKnativeProbabilisticScoringParameters *inner;
12064    /**
12065     * Indicates that this is the only struct which contains the same pointer.
12066     * Rust functions which take ownership of an object provided via an argument require
12067     * this to be true and invalidate the object pointed to by inner.
12068     */
12069    bool is_owned;
12070 } LDKProbabilisticScoringParameters;
12071
12072
12073
12074 /**
12075  * FilesystemPersister persists channel data on disk, where each channel's
12076  * data is stored in a file named after its funding outpoint.
12077  *
12078  * Warning: this module does the best it can with calls to persist data, but it
12079  * can only guarantee that the data is passed to the drive. It is up to the
12080  * drive manufacturers to do the actual persistence properly, which they often
12081  * don't (especially on consumer-grade hardware). Therefore, it is up to the
12082  * user to validate their entire storage stack, to ensure the writes are
12083  * persistent.
12084  * Corollary: especially when dealing with larger amounts of money, it is best
12085  * practice to have multiple channel data backups and not rely only on one
12086  * FilesystemPersister.
12087  */
12088 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
12089    /**
12090     * A pointer to the opaque Rust object.
12091     * Nearly everywhere, inner must be non-null, however in places where
12092     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12093     */
12094    LDKnativeFilesystemPersister *inner;
12095    /**
12096     * Indicates that this is the only struct which contains the same pointer.
12097     * Rust functions which take ownership of an object provided via an argument require
12098     * this to be true and invalidate the object pointed to by inner.
12099     */
12100    bool is_owned;
12101 } LDKFilesystemPersister;
12102
12103
12104
12105 /**
12106  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
12107  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
12108  * responsibilities are:
12109  * * Processing [`Event`]s with a user-provided [`EventHandler`].
12110  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
12111  *   writing it to disk/backups by invoking the callback given to it at startup.
12112  *   [`ChannelManager`] persistence should be done in the background.
12113  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
12114  *   at the appropriate intervals.
12115  * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to
12116  *   [`BackgroundProcessor::start`]).
12117  *
12118  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
12119  * upon as doing so may result in high latency.
12120  *
12121  * # Note
12122  *
12123  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
12124  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
12125  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
12126  * unilateral chain closure fees are at risk.
12127  *
12128  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
12129  * [`Event`]: lightning::util::events::Event
12130  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
12131  */
12132 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
12133    /**
12134     * A pointer to the opaque Rust object.
12135     * Nearly everywhere, inner must be non-null, however in places where
12136     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12137     */
12138    LDKnativeBackgroundProcessor *inner;
12139    /**
12140     * Indicates that this is the only struct which contains the same pointer.
12141     * Rust functions which take ownership of an object provided via an argument require
12142     * this to be true and invalidate the object pointed to by inner.
12143     */
12144    bool is_owned;
12145 } LDKBackgroundProcessor;
12146
12147 /**
12148  * Trait that handles persisting a [`ChannelManager`] and [`NetworkGraph`] to disk.
12149  */
12150 typedef struct LDKPersister {
12151    /**
12152     * An opaque pointer which is passed to your function implementations as an argument.
12153     * This has no meaning in the LDK, and can be NULL or any other value.
12154     */
12155    void *this_arg;
12156    /**
12157     * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
12158     * (which will cause the [`BackgroundProcessor`] which called this method to exit).
12159     */
12160    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
12161    /**
12162     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
12163     */
12164    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
12165    /**
12166     * Frees any resources associated with this object given its this_arg pointer.
12167     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12168     */
12169    void (*free)(void *this_arg);
12170 } LDKPersister;
12171
12172
12173
12174 /**
12175  * Data of the `RawInvoice` that is encoded in the data part
12176  */
12177 typedef struct MUST_USE_STRUCT LDKRawDataPart {
12178    /**
12179     * A pointer to the opaque Rust object.
12180     * Nearly everywhere, inner must be non-null, however in places where
12181     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12182     */
12183    LDKnativeRawDataPart *inner;
12184    /**
12185     * Indicates that this is the only struct which contains the same pointer.
12186     * Rust functions which take ownership of an object provided via an argument require
12187     * this to be true and invalidate the object pointed to by inner.
12188     */
12189    bool is_owned;
12190 } LDKRawDataPart;
12191
12192
12193
12194 /**
12195  * SHA-256 hash
12196  */
12197 typedef struct MUST_USE_STRUCT LDKSha256 {
12198    /**
12199     * A pointer to the opaque Rust object.
12200     * Nearly everywhere, inner must be non-null, however in places where
12201     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12202     */
12203    LDKnativeSha256 *inner;
12204    /**
12205     * Indicates that this is the only struct which contains the same pointer.
12206     * Rust functions which take ownership of an object provided via an argument require
12207     * this to be true and invalidate the object pointed to by inner.
12208     */
12209    bool is_owned;
12210 } LDKSha256;
12211
12212
12213
12214 /**
12215  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
12216  * expires
12217  */
12218 typedef struct MUST_USE_STRUCT LDKExpiryTime {
12219    /**
12220     * A pointer to the opaque Rust object.
12221     * Nearly everywhere, inner must be non-null, however in places where
12222     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12223     */
12224    LDKnativeExpiryTime *inner;
12225    /**
12226     * Indicates that this is the only struct which contains the same pointer.
12227     * Rust functions which take ownership of an object provided via an argument require
12228     * this to be true and invalidate the object pointed to by inner.
12229     */
12230    bool is_owned;
12231 } LDKExpiryTime;
12232
12233
12234
12235 /**
12236  * `min_final_cltv_expiry` to use for the last HTLC in the route
12237  */
12238 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
12239    /**
12240     * A pointer to the opaque Rust object.
12241     * Nearly everywhere, inner must be non-null, however in places where
12242     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12243     */
12244    LDKnativeMinFinalCltvExpiry *inner;
12245    /**
12246     * Indicates that this is the only struct which contains the same pointer.
12247     * Rust functions which take ownership of an object provided via an argument require
12248     * this to be true and invalidate the object pointed to by inner.
12249     */
12250    bool is_owned;
12251 } LDKMinFinalCltvExpiry;
12252
12253 /**
12254  * A 20-byte byte array.
12255  */
12256 typedef struct LDKTwentyBytes {
12257    /**
12258     * The twenty bytes
12259     */
12260    uint8_t data[20];
12261 } LDKTwentyBytes;
12262
12263 /**
12264  * Fallback address in case no LN payment is possible
12265  */
12266 typedef enum LDKFallback_Tag {
12267    LDKFallback_SegWitProgram,
12268    LDKFallback_PubKeyHash,
12269    LDKFallback_ScriptHash,
12270    /**
12271     * Must be last for serialization purposes
12272     */
12273    LDKFallback_Sentinel,
12274 } LDKFallback_Tag;
12275
12276 typedef struct LDKFallback_LDKSegWitProgram_Body {
12277    struct LDKu5 version;
12278    struct LDKCVec_u8Z program;
12279 } LDKFallback_LDKSegWitProgram_Body;
12280
12281 typedef struct MUST_USE_STRUCT LDKFallback {
12282    LDKFallback_Tag tag;
12283    union {
12284       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
12285       struct {
12286          struct LDKTwentyBytes pub_key_hash;
12287       };
12288       struct {
12289          struct LDKTwentyBytes script_hash;
12290       };
12291    };
12292 } LDKFallback;
12293
12294 /**
12295  * A trait defining behavior of an [`Invoice`] payer.
12296  */
12297 typedef struct LDKPayer {
12298    /**
12299     * An opaque pointer which is passed to your function implementations as an argument.
12300     * This has no meaning in the LDK, and can be NULL or any other value.
12301     */
12302    void *this_arg;
12303    /**
12304     * Returns the payer's node id.
12305     */
12306    struct LDKPublicKey (*node_id)(const void *this_arg);
12307    /**
12308     * Returns the payer's channels.
12309     */
12310    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
12311    /**
12312     * Sends a payment over the Lightning Network using the given [`Route`].
12313     *
12314     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
12315     */
12316    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
12317    /**
12318     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
12319     */
12320    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
12321    /**
12322     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
12323     */
12324    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
12325    /**
12326     * Signals that no further retries for the given payment will occur.
12327     */
12328    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
12329    /**
12330     * Frees any resources associated with this object given its this_arg pointer.
12331     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12332     */
12333    void (*free)(void *this_arg);
12334 } LDKPayer;
12335
12336 /**
12337  * A trait defining behavior for routing an [`Invoice`] payment.
12338  */
12339 typedef struct LDKRouter {
12340    /**
12341     * An opaque pointer which is passed to your function implementations as an argument.
12342     * This has no meaning in the LDK, and can be NULL or any other value.
12343     */
12344    void *this_arg;
12345    /**
12346     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
12347     *
12348     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
12349     */
12350    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);
12351    /**
12352     * Frees any resources associated with this object given its this_arg pointer.
12353     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12354     */
12355    void (*free)(void *this_arg);
12356 } LDKRouter;
12357
12358
12359
12360 /**
12361  * A utility for paying [`Invoice`]s and sending spontaneous payments.
12362  *
12363  * See [module-level documentation] for details.
12364  *
12365  * [module-level documentation]: crate::payment
12366  */
12367 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
12368    /**
12369     * A pointer to the opaque Rust object.
12370     * Nearly everywhere, inner must be non-null, however in places where
12371     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12372     */
12373    LDKnativeInvoicePayer *inner;
12374    /**
12375     * Indicates that this is the only struct which contains the same pointer.
12376     * Rust functions which take ownership of an object provided via an argument require
12377     * this to be true and invalidate the object pointed to by inner.
12378     */
12379    bool is_owned;
12380 } LDKInvoicePayer;
12381
12382
12383
12384 /**
12385  * Number of attempts to retry payment path failures for an [`Invoice`].
12386  *
12387  * Note that this is the number of *path* failures, not full payment retries. For multi-path
12388  * payments, if this is less than the total number of paths, we will never even retry all of the
12389  * payment's paths.
12390  */
12391 typedef struct MUST_USE_STRUCT LDKRetryAttempts {
12392    /**
12393     * A pointer to the opaque Rust object.
12394     * Nearly everywhere, inner must be non-null, however in places where
12395     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12396     */
12397    LDKnativeRetryAttempts *inner;
12398    /**
12399     * Indicates that this is the only struct which contains the same pointer.
12400     * Rust functions which take ownership of an object provided via an argument require
12401     * this to be true and invalidate the object pointed to by inner.
12402     */
12403    bool is_owned;
12404 } LDKRetryAttempts;
12405
12406
12407
12408 /**
12409  * A [`Router`] implemented using [`find_route`].
12410  */
12411 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
12412    /**
12413     * A pointer to the opaque Rust object.
12414     * Nearly everywhere, inner must be non-null, however in places where
12415     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12416     */
12417    LDKnativeDefaultRouter *inner;
12418    /**
12419     * Indicates that this is the only struct which contains the same pointer.
12420     * Rust functions which take ownership of an object provided via an argument require
12421     * this to be true and invalidate the object pointed to by inner.
12422     */
12423    bool is_owned;
12424 } LDKDefaultRouter;
12425
12426 extern const uintptr_t MAX_BUF_SIZE;
12427
12428 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
12429
12430 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
12431
12432 extern const uint32_t ANTI_REORG_DELAY;
12433
12434 extern const uint16_t BREAKDOWN_TIMEOUT;
12435
12436 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
12437
12438 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
12439
12440 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
12441
12442 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
12443
12444 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
12445
12446 extern const uint64_t MAX_TIMESTAMP;
12447
12448 extern const uint64_t DEFAULT_EXPIRY_TIME;
12449
12450 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
12451
12452 extern const uint8_t TAG_PAYMENT_HASH;
12453
12454 extern const uint8_t TAG_DESCRIPTION;
12455
12456 extern const uint8_t TAG_PAYEE_PUB_KEY;
12457
12458 extern const uint8_t TAG_DESCRIPTION_HASH;
12459
12460 extern const uint8_t TAG_EXPIRY_TIME;
12461
12462 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
12463
12464 extern const uint8_t TAG_FALLBACK;
12465
12466 extern const uint8_t TAG_PRIVATE_ROUTE;
12467
12468 extern const uint8_t TAG_PAYMENT_SECRET;
12469
12470 extern const uint8_t TAG_FEATURES;
12471
12472 struct LDKStr _ldk_get_compiled_version(void);
12473
12474 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
12475
12476 /**
12477  * Creates a new Bech32Error which has the same data as `orig`
12478  */
12479 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
12480
12481 /**
12482  * Releases any memory held by the given `Bech32Error` (which is currently none)
12483  */
12484 void Bech32Error_free(struct LDKBech32Error o);
12485
12486 /**
12487  * Frees the data buffer, if data_is_owned is set and datalen > 0.
12488  */
12489 void Transaction_free(struct LDKTransaction _res);
12490
12491 /**
12492  * Convenience function for constructing a new TxOut
12493  */
12494 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
12495
12496 /**
12497  * Frees the data pointed to by script_pubkey.
12498  */
12499 void TxOut_free(struct LDKTxOut _res);
12500
12501 /**
12502  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
12503  */
12504 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
12505
12506 /**
12507  * Frees the data buffer, if chars_is_owned is set and len > 0.
12508  */
12509 void Str_free(struct LDKStr _res);
12510
12511 #if defined(LDK_DEBUG_BUILD)
12512 /**
12513  * This function exists for memory safety testing purposes. It should never be used in production
12514  * code
12515  */
12516 const void *__unmangle_inner_ptr(const void *ptr);
12517 #endif
12518
12519 /**
12520  * Creates a new CResult_NoneNoneZ in the success state.
12521  */
12522 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
12523
12524 /**
12525  * Creates a new CResult_NoneNoneZ in the error state.
12526  */
12527 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
12528
12529 /**
12530  * Checks if the given object is currently in the success state
12531  */
12532 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
12533
12534 /**
12535  * Frees any resources used by the CResult_NoneNoneZ.
12536  */
12537 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
12538
12539 /**
12540  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
12541  * but with all dynamically-allocated buffers duplicated in new buffers.
12542  */
12543 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
12544
12545 /**
12546  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
12547  */
12548 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
12549
12550 /**
12551  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
12552  */
12553 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
12554
12555 /**
12556  * Checks if the given object is currently in the success state
12557  */
12558 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
12559
12560 /**
12561  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
12562  */
12563 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
12564
12565 /**
12566  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
12567  * but with all dynamically-allocated buffers duplicated in new buffers.
12568  */
12569 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
12570
12571 /**
12572  * Creates a new CResult_SecretKeyErrorZ in the success state.
12573  */
12574 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
12575
12576 /**
12577  * Creates a new CResult_SecretKeyErrorZ in the error state.
12578  */
12579 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
12580
12581 /**
12582  * Checks if the given object is currently in the success state
12583  */
12584 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
12585
12586 /**
12587  * Frees any resources used by the CResult_SecretKeyErrorZ.
12588  */
12589 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
12590
12591 /**
12592  * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
12593  * but with all dynamically-allocated buffers duplicated in new buffers.
12594  */
12595 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
12596
12597 /**
12598  * Creates a new CResult_PublicKeyErrorZ in the success state.
12599  */
12600 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
12601
12602 /**
12603  * Creates a new CResult_PublicKeyErrorZ in the error state.
12604  */
12605 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
12606
12607 /**
12608  * Checks if the given object is currently in the success state
12609  */
12610 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
12611
12612 /**
12613  * Frees any resources used by the CResult_PublicKeyErrorZ.
12614  */
12615 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
12616
12617 /**
12618  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
12619  * but with all dynamically-allocated buffers duplicated in new buffers.
12620  */
12621 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
12622
12623 /**
12624  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
12625  */
12626 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
12627
12628 /**
12629  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
12630  */
12631 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
12632
12633 /**
12634  * Checks if the given object is currently in the success state
12635  */
12636 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
12637
12638 /**
12639  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
12640  */
12641 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
12642
12643 /**
12644  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
12645  * but with all dynamically-allocated buffers duplicated in new buffers.
12646  */
12647 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
12648
12649 /**
12650  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
12651  */
12652 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
12653
12654 /**
12655  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
12656  */
12657 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
12658
12659 /**
12660  * Checks if the given object is currently in the success state
12661  */
12662 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
12663
12664 /**
12665  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
12666  */
12667 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
12668
12669 /**
12670  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
12671  * but with all dynamically-allocated buffers duplicated in new buffers.
12672  */
12673 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
12674
12675 /**
12676  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
12677  */
12678 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
12679
12680 /**
12681  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
12682  */
12683 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
12684
12685 /**
12686  * Checks if the given object is currently in the success state
12687  */
12688 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
12689
12690 /**
12691  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
12692  */
12693 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
12694
12695 /**
12696  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
12697  * but with all dynamically-allocated buffers duplicated in new buffers.
12698  */
12699 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
12700
12701 /**
12702  * Constructs a new COption_u32Z containing a u32
12703  */
12704 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
12705
12706 /**
12707  * Constructs a new COption_u32Z containing nothing
12708  */
12709 struct LDKCOption_u32Z COption_u32Z_none(void);
12710
12711 /**
12712  * Frees any resources associated with the u32, if we are in the Some state
12713  */
12714 void COption_u32Z_free(struct LDKCOption_u32Z _res);
12715
12716 /**
12717  * Creates a new COption_u32Z which has the same data as `orig`
12718  * but with all dynamically-allocated buffers duplicated in new buffers.
12719  */
12720 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
12721
12722 /**
12723  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
12724  */
12725 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
12726
12727 /**
12728  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
12729  */
12730 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
12731
12732 /**
12733  * Checks if the given object is currently in the success state
12734  */
12735 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
12736
12737 /**
12738  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
12739  */
12740 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
12741
12742 /**
12743  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
12744  * but with all dynamically-allocated buffers duplicated in new buffers.
12745  */
12746 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
12747
12748 /**
12749  * Constructs a new COption_NoneZ containing a
12750  */
12751 enum LDKCOption_NoneZ COption_NoneZ_some(void);
12752
12753 /**
12754  * Constructs a new COption_NoneZ containing nothing
12755  */
12756 enum LDKCOption_NoneZ COption_NoneZ_none(void);
12757
12758 /**
12759  * Frees any resources associated with the , if we are in the Some state
12760  */
12761 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
12762
12763 /**
12764  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
12765  */
12766 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
12767
12768 /**
12769  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
12770  */
12771 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
12772
12773 /**
12774  * Checks if the given object is currently in the success state
12775  */
12776 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
12777
12778 /**
12779  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
12780  */
12781 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
12782
12783 /**
12784  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
12785  * but with all dynamically-allocated buffers duplicated in new buffers.
12786  */
12787 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
12788
12789 /**
12790  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
12791  */
12792 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
12793
12794 /**
12795  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
12796  */
12797 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
12798
12799 /**
12800  * Checks if the given object is currently in the success state
12801  */
12802 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
12803
12804 /**
12805  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
12806  */
12807 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
12808
12809 /**
12810  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
12811  * but with all dynamically-allocated buffers duplicated in new buffers.
12812  */
12813 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
12814
12815 /**
12816  * Frees the buffer pointed to by `data` if `datalen` is non-0.
12817  */
12818 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
12819
12820 /**
12821  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
12822  */
12823 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
12824
12825 /**
12826  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
12827  */
12828 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12829
12830 /**
12831  * Checks if the given object is currently in the success state
12832  */
12833 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12834
12835 /**
12836  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
12837  */
12838 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
12839
12840 /**
12841  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
12842  * but with all dynamically-allocated buffers duplicated in new buffers.
12843  */
12844 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12845
12846 /**
12847  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
12848  */
12849 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
12850
12851 /**
12852  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
12853  */
12854 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12855
12856 /**
12857  * Checks if the given object is currently in the success state
12858  */
12859 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12860
12861 /**
12862  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
12863  */
12864 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
12865
12866 /**
12867  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
12868  * but with all dynamically-allocated buffers duplicated in new buffers.
12869  */
12870 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12871
12872 /**
12873  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
12874  */
12875 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
12876
12877 /**
12878  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
12879  */
12880 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
12881
12882 /**
12883  * Checks if the given object is currently in the success state
12884  */
12885 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
12886
12887 /**
12888  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
12889  */
12890 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
12891
12892 /**
12893  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
12894  */
12895 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
12896
12897 /**
12898  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
12899  */
12900 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
12901
12902 /**
12903  * Checks if the given object is currently in the success state
12904  */
12905 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
12906
12907 /**
12908  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
12909  */
12910 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
12911
12912 /**
12913  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
12914  * but with all dynamically-allocated buffers duplicated in new buffers.
12915  */
12916 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
12917
12918 /**
12919  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
12920  */
12921 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
12922
12923 /**
12924  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
12925  */
12926 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
12927
12928 /**
12929  * Checks if the given object is currently in the success state
12930  */
12931 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
12932
12933 /**
12934  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
12935  */
12936 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
12937
12938 /**
12939  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
12940  */
12941 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
12942
12943 /**
12944  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
12945  */
12946 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
12947
12948 /**
12949  * Checks if the given object is currently in the success state
12950  */
12951 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
12952
12953 /**
12954  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
12955  */
12956 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
12957
12958 /**
12959  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
12960  * but with all dynamically-allocated buffers duplicated in new buffers.
12961  */
12962 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
12963
12964 /**
12965  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
12966  */
12967 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
12968
12969 /**
12970  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
12971  */
12972 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
12973
12974 /**
12975  * Checks if the given object is currently in the success state
12976  */
12977 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
12978
12979 /**
12980  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
12981  */
12982 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
12983
12984 /**
12985  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
12986  * but with all dynamically-allocated buffers duplicated in new buffers.
12987  */
12988 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
12989
12990 /**
12991  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
12992  */
12993 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
12994
12995 /**
12996  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
12997  */
12998 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
12999
13000 /**
13001  * Checks if the given object is currently in the success state
13002  */
13003 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
13004
13005 /**
13006  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
13007  */
13008 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
13009
13010 /**
13011  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
13012  * but with all dynamically-allocated buffers duplicated in new buffers.
13013  */
13014 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
13015
13016 /**
13017  * Creates a new CResult_NoneErrorZ in the success state.
13018  */
13019 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
13020
13021 /**
13022  * Creates a new CResult_NoneErrorZ in the error state.
13023  */
13024 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
13025
13026 /**
13027  * Checks if the given object is currently in the success state
13028  */
13029 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
13030
13031 /**
13032  * Frees any resources used by the CResult_NoneErrorZ.
13033  */
13034 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
13035
13036 /**
13037  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
13038  * but with all dynamically-allocated buffers duplicated in new buffers.
13039  */
13040 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
13041
13042 /**
13043  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
13044  */
13045 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
13046
13047 /**
13048  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
13049  */
13050 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
13051
13052 /**
13053  * Checks if the given object is currently in the success state
13054  */
13055 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
13056
13057 /**
13058  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
13059  */
13060 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
13061
13062 /**
13063  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
13064  * but with all dynamically-allocated buffers duplicated in new buffers.
13065  */
13066 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
13067
13068 /**
13069  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13070  */
13071 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
13072
13073 /**
13074  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13075  */
13076 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
13077
13078 /**
13079  * Creates a new CResult_RouteDecodeErrorZ in the success state.
13080  */
13081 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
13082
13083 /**
13084  * Creates a new CResult_RouteDecodeErrorZ in the error state.
13085  */
13086 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
13087
13088 /**
13089  * Checks if the given object is currently in the success state
13090  */
13091 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
13092
13093 /**
13094  * Frees any resources used by the CResult_RouteDecodeErrorZ.
13095  */
13096 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
13097
13098 /**
13099  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
13100  * but with all dynamically-allocated buffers duplicated in new buffers.
13101  */
13102 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
13103
13104 /**
13105  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
13106  */
13107 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
13108
13109 /**
13110  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
13111  */
13112 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
13113
13114 /**
13115  * Checks if the given object is currently in the success state
13116  */
13117 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
13118
13119 /**
13120  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
13121  */
13122 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
13123
13124 /**
13125  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
13126  * but with all dynamically-allocated buffers duplicated in new buffers.
13127  */
13128 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
13129
13130 /**
13131  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13132  */
13133 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
13134
13135 /**
13136  * Constructs a new COption_u64Z containing a u64
13137  */
13138 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
13139
13140 /**
13141  * Constructs a new COption_u64Z containing nothing
13142  */
13143 struct LDKCOption_u64Z COption_u64Z_none(void);
13144
13145 /**
13146  * Frees any resources associated with the u64, if we are in the Some state
13147  */
13148 void COption_u64Z_free(struct LDKCOption_u64Z _res);
13149
13150 /**
13151  * Creates a new COption_u64Z which has the same data as `orig`
13152  * but with all dynamically-allocated buffers duplicated in new buffers.
13153  */
13154 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
13155
13156 /**
13157  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
13158  */
13159 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
13160
13161 /**
13162  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
13163  */
13164 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
13165
13166 /**
13167  * Checks if the given object is currently in the success state
13168  */
13169 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
13170
13171 /**
13172  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
13173  */
13174 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
13175
13176 /**
13177  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
13178  * but with all dynamically-allocated buffers duplicated in new buffers.
13179  */
13180 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
13181
13182 /**
13183  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13184  */
13185 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
13186
13187 /**
13188  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
13189  */
13190 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
13191
13192 /**
13193  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
13194  */
13195 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
13196
13197 /**
13198  * Checks if the given object is currently in the success state
13199  */
13200 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
13201
13202 /**
13203  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
13204  */
13205 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
13206
13207 /**
13208  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
13209  * but with all dynamically-allocated buffers duplicated in new buffers.
13210  */
13211 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
13212
13213 /**
13214  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
13215  */
13216 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
13217
13218 /**
13219  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
13220  */
13221 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
13222
13223 /**
13224  * Checks if the given object is currently in the success state
13225  */
13226 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
13227
13228 /**
13229  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
13230  */
13231 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
13232
13233 /**
13234  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
13235  * but with all dynamically-allocated buffers duplicated in new buffers.
13236  */
13237 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
13238
13239 /**
13240  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13241  */
13242 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
13243
13244 /**
13245  * Creates a new CResult_RouteLightningErrorZ in the success state.
13246  */
13247 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
13248
13249 /**
13250  * Creates a new CResult_RouteLightningErrorZ in the error state.
13251  */
13252 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
13253
13254 /**
13255  * Checks if the given object is currently in the success state
13256  */
13257 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
13258
13259 /**
13260  * Frees any resources used by the CResult_RouteLightningErrorZ.
13261  */
13262 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
13263
13264 /**
13265  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
13266  * but with all dynamically-allocated buffers duplicated in new buffers.
13267  */
13268 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
13269
13270 /**
13271  * Creates a new CResult_TxOutAccessErrorZ in the success state.
13272  */
13273 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
13274
13275 /**
13276  * Creates a new CResult_TxOutAccessErrorZ in the error state.
13277  */
13278 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
13279
13280 /**
13281  * Checks if the given object is currently in the success state
13282  */
13283 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
13284
13285 /**
13286  * Frees any resources used by the CResult_TxOutAccessErrorZ.
13287  */
13288 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
13289
13290 /**
13291  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
13292  * but with all dynamically-allocated buffers duplicated in new buffers.
13293  */
13294 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
13295
13296 /**
13297  * Creates a new tuple which has the same data as `orig`
13298  * but with all dynamically-allocated buffers duplicated in new buffers.
13299  */
13300 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
13301
13302 /**
13303  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
13304  */
13305 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
13306
13307 /**
13308  * Frees any resources used by the C2Tuple_usizeTransactionZ.
13309  */
13310 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
13311
13312 /**
13313  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13314  */
13315 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
13316
13317 /**
13318  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13319  */
13320 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
13321
13322 /**
13323  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
13324  */
13325 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
13326
13327 /**
13328  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
13329  */
13330 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
13331
13332 /**
13333  * Checks if the given object is currently in the success state
13334  */
13335 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
13336
13337 /**
13338  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
13339  */
13340 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
13341
13342 /**
13343  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
13344  * but with all dynamically-allocated buffers duplicated in new buffers.
13345  */
13346 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
13347
13348 /**
13349  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13350  */
13351 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
13352
13353 /**
13354  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
13355  */
13356 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
13357
13358 /**
13359  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
13360  */
13361 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
13362
13363 /**
13364  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
13365  */
13366 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
13367
13368 /**
13369  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
13370  * but with all dynamically-allocated buffers duplicated in new buffers.
13371  */
13372 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
13373
13374 /**
13375  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
13376  */
13377 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
13378
13379 /**
13380  * Constructs a new COption_ClosureReasonZ containing nothing
13381  */
13382 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
13383
13384 /**
13385  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
13386  */
13387 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
13388
13389 /**
13390  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
13391  * but with all dynamically-allocated buffers duplicated in new buffers.
13392  */
13393 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
13394
13395 /**
13396  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
13397  */
13398 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
13399
13400 /**
13401  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
13402  */
13403 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
13404
13405 /**
13406  * Checks if the given object is currently in the success state
13407  */
13408 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
13409
13410 /**
13411  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
13412  */
13413 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
13414
13415 /**
13416  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
13417  * but with all dynamically-allocated buffers duplicated in new buffers.
13418  */
13419 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
13420
13421 /**
13422  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
13423  */
13424 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
13425
13426 /**
13427  * Constructs a new COption_NetworkUpdateZ containing nothing
13428  */
13429 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
13430
13431 /**
13432  * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
13433  */
13434 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
13435
13436 /**
13437  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
13438  * but with all dynamically-allocated buffers duplicated in new buffers.
13439  */
13440 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
13441
13442 /**
13443  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13444  */
13445 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
13446
13447 /**
13448  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
13449  */
13450 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
13451
13452 /**
13453  * Constructs a new COption_EventZ containing nothing
13454  */
13455 struct LDKCOption_EventZ COption_EventZ_none(void);
13456
13457 /**
13458  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
13459  */
13460 void COption_EventZ_free(struct LDKCOption_EventZ _res);
13461
13462 /**
13463  * Creates a new COption_EventZ which has the same data as `orig`
13464  * but with all dynamically-allocated buffers duplicated in new buffers.
13465  */
13466 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
13467
13468 /**
13469  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
13470  */
13471 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
13472
13473 /**
13474  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
13475  */
13476 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
13477
13478 /**
13479  * Checks if the given object is currently in the success state
13480  */
13481 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
13482
13483 /**
13484  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
13485  */
13486 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
13487
13488 /**
13489  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
13490  * but with all dynamically-allocated buffers duplicated in new buffers.
13491  */
13492 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
13493
13494 /**
13495  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13496  */
13497 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
13498
13499 /**
13500  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
13501  */
13502 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
13503
13504 /**
13505  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
13506  */
13507 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
13508
13509 /**
13510  * Checks if the given object is currently in the success state
13511  */
13512 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
13513
13514 /**
13515  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
13516  */
13517 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
13518
13519 /**
13520  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
13521  * but with all dynamically-allocated buffers duplicated in new buffers.
13522  */
13523 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
13524
13525 /**
13526  * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
13527  */
13528 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
13529
13530 /**
13531  * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
13532  */
13533 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
13534
13535 /**
13536  * Checks if the given object is currently in the success state
13537  */
13538 bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o);
13539
13540 /**
13541  * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
13542  */
13543 void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
13544
13545 /**
13546  * Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig`
13547  * but with all dynamically-allocated buffers duplicated in new buffers.
13548  */
13549 struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR orig);
13550
13551 /**
13552  * Creates a new CResult_ScorerDecodeErrorZ in the success state.
13553  */
13554 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
13555
13556 /**
13557  * Creates a new CResult_ScorerDecodeErrorZ in the error state.
13558  */
13559 struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
13560
13561 /**
13562  * Checks if the given object is currently in the success state
13563  */
13564 bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o);
13565
13566 /**
13567  * Frees any resources used by the CResult_ScorerDecodeErrorZ.
13568  */
13569 void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
13570
13571 /**
13572  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
13573  */
13574 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
13575
13576 /**
13577  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
13578  */
13579 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
13580
13581 /**
13582  * Checks if the given object is currently in the success state
13583  */
13584 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
13585
13586 /**
13587  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
13588  */
13589 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
13590
13591 /**
13592  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
13593  */
13594 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
13595
13596 /**
13597  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
13598  */
13599 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13600
13601 /**
13602  * Checks if the given object is currently in the success state
13603  */
13604 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
13605
13606 /**
13607  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
13608  */
13609 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
13610
13611 /**
13612  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
13613  */
13614 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
13615
13616 /**
13617  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
13618  */
13619 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13620
13621 /**
13622  * Checks if the given object is currently in the success state
13623  */
13624 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
13625
13626 /**
13627  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
13628  */
13629 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
13630
13631 /**
13632  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
13633  */
13634 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
13635
13636 /**
13637  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
13638  */
13639 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13640
13641 /**
13642  * Checks if the given object is currently in the success state
13643  */
13644 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
13645
13646 /**
13647  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
13648  */
13649 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
13650
13651 /**
13652  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
13653  */
13654 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
13655
13656 /**
13657  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
13658  */
13659 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13660
13661 /**
13662  * Checks if the given object is currently in the success state
13663  */
13664 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
13665
13666 /**
13667  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
13668  */
13669 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
13670
13671 /**
13672  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
13673  */
13674 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
13675
13676 /**
13677  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
13678  */
13679 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13680
13681 /**
13682  * Checks if the given object is currently in the success state
13683  */
13684 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
13685
13686 /**
13687  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
13688  */
13689 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
13690
13691 /**
13692  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
13693  */
13694 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
13695
13696 /**
13697  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
13698  */
13699 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13700
13701 /**
13702  * Checks if the given object is currently in the success state
13703  */
13704 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13705
13706 /**
13707  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
13708  */
13709 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
13710
13711 /**
13712  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
13713  * but with all dynamically-allocated buffers duplicated in new buffers.
13714  */
13715 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13716
13717 /**
13718  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
13719  */
13720 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
13721
13722 /**
13723  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
13724  */
13725 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13726
13727 /**
13728  * Checks if the given object is currently in the success state
13729  */
13730 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13731
13732 /**
13733  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
13734  */
13735 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
13736
13737 /**
13738  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
13739  * but with all dynamically-allocated buffers duplicated in new buffers.
13740  */
13741 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13742
13743 /**
13744  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
13745  */
13746 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
13747
13748 /**
13749  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
13750  */
13751 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
13752
13753 /**
13754  * Checks if the given object is currently in the success state
13755  */
13756 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
13757
13758 /**
13759  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
13760  */
13761 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
13762
13763 /**
13764  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
13765  * but with all dynamically-allocated buffers duplicated in new buffers.
13766  */
13767 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
13768
13769 /**
13770  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13771  */
13772 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
13773
13774 /**
13775  * Creates a new tuple which has the same data as `orig`
13776  * but with all dynamically-allocated buffers duplicated in new buffers.
13777  */
13778 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
13779
13780 /**
13781  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
13782  */
13783 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
13784
13785 /**
13786  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
13787  */
13788 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
13789
13790 /**
13791  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
13792  */
13793 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
13794
13795 /**
13796  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
13797  */
13798 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
13799
13800 /**
13801  * Checks if the given object is currently in the success state
13802  */
13803 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
13804
13805 /**
13806  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
13807  */
13808 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
13809
13810 /**
13811  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
13812  * but with all dynamically-allocated buffers duplicated in new buffers.
13813  */
13814 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
13815
13816 /**
13817  * Creates a new CResult_SignatureNoneZ in the success state.
13818  */
13819 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
13820
13821 /**
13822  * Creates a new CResult_SignatureNoneZ in the error state.
13823  */
13824 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
13825
13826 /**
13827  * Checks if the given object is currently in the success state
13828  */
13829 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
13830
13831 /**
13832  * Frees any resources used by the CResult_SignatureNoneZ.
13833  */
13834 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
13835
13836 /**
13837  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
13838  * but with all dynamically-allocated buffers duplicated in new buffers.
13839  */
13840 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
13841
13842 /**
13843  * Creates a new tuple which has the same data as `orig`
13844  * but with all dynamically-allocated buffers duplicated in new buffers.
13845  */
13846 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
13847
13848 /**
13849  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
13850  */
13851 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
13852
13853 /**
13854  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
13855  */
13856 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
13857
13858 /**
13859  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
13860  */
13861 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
13862
13863 /**
13864  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
13865  */
13866 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
13867
13868 /**
13869  * Checks if the given object is currently in the success state
13870  */
13871 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
13872
13873 /**
13874  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
13875  */
13876 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
13877
13878 /**
13879  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
13880  * but with all dynamically-allocated buffers duplicated in new buffers.
13881  */
13882 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
13883
13884 /**
13885  * Creates a new CResult_SecretKeyNoneZ in the success state.
13886  */
13887 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
13888
13889 /**
13890  * Creates a new CResult_SecretKeyNoneZ in the error state.
13891  */
13892 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
13893
13894 /**
13895  * Checks if the given object is currently in the success state
13896  */
13897 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
13898
13899 /**
13900  * Frees any resources used by the CResult_SecretKeyNoneZ.
13901  */
13902 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
13903
13904 /**
13905  * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
13906  * but with all dynamically-allocated buffers duplicated in new buffers.
13907  */
13908 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
13909
13910 /**
13911  * Creates a new CResult_SignDecodeErrorZ in the success state.
13912  */
13913 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
13914
13915 /**
13916  * Creates a new CResult_SignDecodeErrorZ in the error state.
13917  */
13918 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
13919
13920 /**
13921  * Checks if the given object is currently in the success state
13922  */
13923 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
13924
13925 /**
13926  * Frees any resources used by the CResult_SignDecodeErrorZ.
13927  */
13928 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
13929
13930 /**
13931  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
13932  * but with all dynamically-allocated buffers duplicated in new buffers.
13933  */
13934 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
13935
13936 /**
13937  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13938  */
13939 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
13940
13941 /**
13942  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
13943  */
13944 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
13945
13946 /**
13947  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
13948  */
13949 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
13950
13951 /**
13952  * Checks if the given object is currently in the success state
13953  */
13954 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
13955
13956 /**
13957  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
13958  */
13959 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
13960
13961 /**
13962  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
13963  * but with all dynamically-allocated buffers duplicated in new buffers.
13964  */
13965 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
13966
13967 /**
13968  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13969  */
13970 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
13971
13972 /**
13973  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13974  */
13975 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
13976
13977 /**
13978  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
13979  */
13980 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
13981
13982 /**
13983  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
13984  */
13985 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
13986
13987 /**
13988  * Checks if the given object is currently in the success state
13989  */
13990 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
13991
13992 /**
13993  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
13994  */
13995 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
13996
13997 /**
13998  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
13999  * but with all dynamically-allocated buffers duplicated in new buffers.
14000  */
14001 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
14002
14003 /**
14004  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
14005  */
14006 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
14007
14008 /**
14009  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
14010  */
14011 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
14012
14013 /**
14014  * Checks if the given object is currently in the success state
14015  */
14016 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
14017
14018 /**
14019  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
14020  */
14021 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
14022
14023 /**
14024  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
14025  * but with all dynamically-allocated buffers duplicated in new buffers.
14026  */
14027 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
14028
14029 /**
14030  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14031  */
14032 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
14033
14034 /**
14035  * Creates a new CResult_TransactionNoneZ in the success state.
14036  */
14037 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
14038
14039 /**
14040  * Creates a new CResult_TransactionNoneZ in the error state.
14041  */
14042 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
14043
14044 /**
14045  * Checks if the given object is currently in the success state
14046  */
14047 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
14048
14049 /**
14050  * Frees any resources used by the CResult_TransactionNoneZ.
14051  */
14052 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
14053
14054 /**
14055  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
14056  * but with all dynamically-allocated buffers duplicated in new buffers.
14057  */
14058 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
14059
14060 /**
14061  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
14062  */
14063 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
14064
14065 /**
14066  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
14067  */
14068 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
14069
14070 /**
14071  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14072  */
14073 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
14074
14075 /**
14076  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
14077  */
14078 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
14079
14080 /**
14081  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
14082  */
14083 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
14084
14085 /**
14086  * Checks if the given object is currently in the success state
14087  */
14088 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
14089
14090 /**
14091  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
14092  */
14093 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
14094
14095 /**
14096  * Constructs a new COption_u16Z containing a u16
14097  */
14098 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
14099
14100 /**
14101  * Constructs a new COption_u16Z containing nothing
14102  */
14103 struct LDKCOption_u16Z COption_u16Z_none(void);
14104
14105 /**
14106  * Frees any resources associated with the u16, if we are in the Some state
14107  */
14108 void COption_u16Z_free(struct LDKCOption_u16Z _res);
14109
14110 /**
14111  * Creates a new COption_u16Z which has the same data as `orig`
14112  * but with all dynamically-allocated buffers duplicated in new buffers.
14113  */
14114 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
14115
14116 /**
14117  * Creates a new CResult_NoneAPIErrorZ in the success state.
14118  */
14119 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
14120
14121 /**
14122  * Creates a new CResult_NoneAPIErrorZ in the error state.
14123  */
14124 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
14125
14126 /**
14127  * Checks if the given object is currently in the success state
14128  */
14129 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
14130
14131 /**
14132  * Frees any resources used by the CResult_NoneAPIErrorZ.
14133  */
14134 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
14135
14136 /**
14137  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
14138  * but with all dynamically-allocated buffers duplicated in new buffers.
14139  */
14140 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
14141
14142 /**
14143  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14144  */
14145 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
14146
14147 /**
14148  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14149  */
14150 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
14151
14152 /**
14153  * Creates a new CResult__u832APIErrorZ in the success state.
14154  */
14155 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
14156
14157 /**
14158  * Creates a new CResult__u832APIErrorZ in the error state.
14159  */
14160 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
14161
14162 /**
14163  * Checks if the given object is currently in the success state
14164  */
14165 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
14166
14167 /**
14168  * Frees any resources used by the CResult__u832APIErrorZ.
14169  */
14170 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
14171
14172 /**
14173  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
14174  * but with all dynamically-allocated buffers duplicated in new buffers.
14175  */
14176 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
14177
14178 /**
14179  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
14180  */
14181 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
14182
14183 /**
14184  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
14185  */
14186 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14187
14188 /**
14189  * Checks if the given object is currently in the success state
14190  */
14191 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
14192
14193 /**
14194  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
14195  */
14196 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
14197
14198 /**
14199  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
14200  * but with all dynamically-allocated buffers duplicated in new buffers.
14201  */
14202 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
14203
14204 /**
14205  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
14206  */
14207 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
14208
14209 /**
14210  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
14211  */
14212 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14213
14214 /**
14215  * Checks if the given object is currently in the success state
14216  */
14217 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
14218
14219 /**
14220  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
14221  */
14222 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
14223
14224 /**
14225  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
14226  * but with all dynamically-allocated buffers duplicated in new buffers.
14227  */
14228 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
14229
14230 /**
14231  * Creates a new tuple which has the same data as `orig`
14232  * but with all dynamically-allocated buffers duplicated in new buffers.
14233  */
14234 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
14235
14236 /**
14237  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
14238  */
14239 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14240
14241 /**
14242  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
14243  */
14244 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
14245
14246 /**
14247  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
14248  */
14249 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
14250
14251 /**
14252  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
14253  */
14254 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14255
14256 /**
14257  * Checks if the given object is currently in the success state
14258  */
14259 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
14260
14261 /**
14262  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
14263  */
14264 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
14265
14266 /**
14267  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
14268  * but with all dynamically-allocated buffers duplicated in new buffers.
14269  */
14270 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
14271
14272 /**
14273  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14274  */
14275 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
14276
14277 /**
14278  * Creates a new tuple which has the same data as `orig`
14279  * but with all dynamically-allocated buffers duplicated in new buffers.
14280  */
14281 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
14282
14283 /**
14284  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
14285  */
14286 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14287
14288 /**
14289  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
14290  */
14291 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
14292
14293 /**
14294  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
14295  */
14296 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14297
14298 /**
14299  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
14300  */
14301 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
14302
14303 /**
14304  * Checks if the given object is currently in the success state
14305  */
14306 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
14307
14308 /**
14309  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
14310  */
14311 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
14312
14313 /**
14314  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
14315  * but with all dynamically-allocated buffers duplicated in new buffers.
14316  */
14317 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
14318
14319 /**
14320  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
14321  */
14322 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14323
14324 /**
14325  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
14326  */
14327 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
14328
14329 /**
14330  * Checks if the given object is currently in the success state
14331  */
14332 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
14333
14334 /**
14335  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
14336  */
14337 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
14338
14339 /**
14340  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
14341  * but with all dynamically-allocated buffers duplicated in new buffers.
14342  */
14343 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
14344
14345 /**
14346  * Creates a new CResult_PaymentSecretNoneZ in the success state.
14347  */
14348 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
14349
14350 /**
14351  * Creates a new CResult_PaymentSecretNoneZ in the error state.
14352  */
14353 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
14354
14355 /**
14356  * Checks if the given object is currently in the success state
14357  */
14358 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
14359
14360 /**
14361  * Frees any resources used by the CResult_PaymentSecretNoneZ.
14362  */
14363 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
14364
14365 /**
14366  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
14367  * but with all dynamically-allocated buffers duplicated in new buffers.
14368  */
14369 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
14370
14371 /**
14372  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
14373  */
14374 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
14375
14376 /**
14377  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
14378  */
14379 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
14380
14381 /**
14382  * Checks if the given object is currently in the success state
14383  */
14384 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
14385
14386 /**
14387  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
14388  */
14389 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
14390
14391 /**
14392  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
14393  * but with all dynamically-allocated buffers duplicated in new buffers.
14394  */
14395 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
14396
14397 /**
14398  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
14399  */
14400 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
14401
14402 /**
14403  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
14404  */
14405 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
14406
14407 /**
14408  * Checks if the given object is currently in the success state
14409  */
14410 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
14411
14412 /**
14413  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
14414  */
14415 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
14416
14417 /**
14418  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
14419  * but with all dynamically-allocated buffers duplicated in new buffers.
14420  */
14421 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
14422
14423 /**
14424  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
14425  */
14426 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
14427
14428 /**
14429  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
14430  */
14431 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
14432
14433 /**
14434  * Checks if the given object is currently in the success state
14435  */
14436 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
14437
14438 /**
14439  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
14440  */
14441 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
14442
14443 /**
14444  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
14445  * but with all dynamically-allocated buffers duplicated in new buffers.
14446  */
14447 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
14448
14449 /**
14450  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
14451  */
14452 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
14453
14454 /**
14455  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
14456  */
14457 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
14458
14459 /**
14460  * Checks if the given object is currently in the success state
14461  */
14462 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
14463
14464 /**
14465  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
14466  */
14467 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
14468
14469 /**
14470  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
14471  * but with all dynamically-allocated buffers duplicated in new buffers.
14472  */
14473 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
14474
14475 /**
14476  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
14477  */
14478 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
14479
14480 /**
14481  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
14482  */
14483 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
14484
14485 /**
14486  * Checks if the given object is currently in the success state
14487  */
14488 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
14489
14490 /**
14491  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
14492  */
14493 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
14494
14495 /**
14496  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
14497  * but with all dynamically-allocated buffers duplicated in new buffers.
14498  */
14499 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
14500
14501 /**
14502  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
14503  */
14504 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
14505
14506 /**
14507  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
14508  */
14509 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
14510
14511 /**
14512  * Checks if the given object is currently in the success state
14513  */
14514 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
14515
14516 /**
14517  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
14518  */
14519 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
14520
14521 /**
14522  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
14523  * but with all dynamically-allocated buffers duplicated in new buffers.
14524  */
14525 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
14526
14527 /**
14528  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14529  */
14530 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
14531
14532 /**
14533  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
14534  */
14535 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
14536
14537 /**
14538  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
14539  */
14540 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
14541
14542 /**
14543  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
14544  */
14545 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
14546
14547 /**
14548  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
14549  */
14550 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
14551
14552 /**
14553  * Checks if the given object is currently in the success state
14554  */
14555 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
14556
14557 /**
14558  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
14559  */
14560 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
14561
14562 /**
14563  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
14564  */
14565 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
14566
14567 /**
14568  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
14569  */
14570 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
14571
14572 /**
14573  * Checks if the given object is currently in the success state
14574  */
14575 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
14576
14577 /**
14578  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
14579  */
14580 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
14581
14582 /**
14583  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
14584  * but with all dynamically-allocated buffers duplicated in new buffers.
14585  */
14586 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
14587
14588 /**
14589  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
14590  */
14591 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
14592
14593 /**
14594  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
14595  */
14596 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
14597
14598 /**
14599  * Checks if the given object is currently in the success state
14600  */
14601 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
14602
14603 /**
14604  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
14605  */
14606 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
14607
14608 /**
14609  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
14610  * but with all dynamically-allocated buffers duplicated in new buffers.
14611  */
14612 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
14613
14614 /**
14615  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
14616  */
14617 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
14618
14619 /**
14620  * Constructs a new COption_TypeZ containing nothing
14621  */
14622 struct LDKCOption_TypeZ COption_TypeZ_none(void);
14623
14624 /**
14625  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
14626  */
14627 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
14628
14629 /**
14630  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
14631  */
14632 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
14633
14634 /**
14635  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
14636  */
14637 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
14638
14639 /**
14640  * Checks if the given object is currently in the success state
14641  */
14642 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
14643
14644 /**
14645  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
14646  */
14647 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
14648
14649 /**
14650  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
14651  */
14652 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
14653
14654 /**
14655  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
14656  */
14657 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
14658
14659 /**
14660  * Checks if the given object is currently in the success state
14661  */
14662 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
14663
14664 /**
14665  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
14666  */
14667 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
14668
14669 /**
14670  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
14671  * but with all dynamically-allocated buffers duplicated in new buffers.
14672  */
14673 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
14674
14675 /**
14676  * Creates a new CResult_SiPrefixParseErrorZ in the success state.
14677  */
14678 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
14679
14680 /**
14681  * Creates a new CResult_SiPrefixParseErrorZ in the error state.
14682  */
14683 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
14684
14685 /**
14686  * Checks if the given object is currently in the success state
14687  */
14688 bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
14689
14690 /**
14691  * Frees any resources used by the CResult_SiPrefixParseErrorZ.
14692  */
14693 void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
14694
14695 /**
14696  * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
14697  * but with all dynamically-allocated buffers duplicated in new buffers.
14698  */
14699 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
14700
14701 /**
14702  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
14703  */
14704 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
14705
14706 /**
14707  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
14708  */
14709 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
14710
14711 /**
14712  * Checks if the given object is currently in the success state
14713  */
14714 bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
14715
14716 /**
14717  * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
14718  */
14719 void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
14720
14721 /**
14722  * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
14723  * but with all dynamically-allocated buffers duplicated in new buffers.
14724  */
14725 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
14726
14727 /**
14728  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
14729  */
14730 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
14731
14732 /**
14733  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
14734  */
14735 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
14736
14737 /**
14738  * Checks if the given object is currently in the success state
14739  */
14740 bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
14741
14742 /**
14743  * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
14744  */
14745 void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
14746
14747 /**
14748  * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
14749  * but with all dynamically-allocated buffers duplicated in new buffers.
14750  */
14751 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
14752
14753 /**
14754  * Creates a new tuple which has the same data as `orig`
14755  * but with all dynamically-allocated buffers duplicated in new buffers.
14756  */
14757 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
14758
14759 /**
14760  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
14761  */
14762 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
14763
14764 /**
14765  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
14766  */
14767 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
14768
14769 /**
14770  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
14771  */
14772 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
14773
14774 /**
14775  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
14776  */
14777 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
14778
14779 /**
14780  * Checks if the given object is currently in the success state
14781  */
14782 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
14783
14784 /**
14785  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
14786  */
14787 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
14788
14789 /**
14790  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
14791  * but with all dynamically-allocated buffers duplicated in new buffers.
14792  */
14793 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
14794
14795 /**
14796  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14797  */
14798 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
14799
14800 /**
14801  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
14802  */
14803 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
14804
14805 /**
14806  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
14807  */
14808 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
14809
14810 /**
14811  * Checks if the given object is currently in the success state
14812  */
14813 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
14814
14815 /**
14816  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
14817  */
14818 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
14819
14820 /**
14821  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
14822  * but with all dynamically-allocated buffers duplicated in new buffers.
14823  */
14824 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
14825
14826 /**
14827  * Creates a new CResult_NoneSemanticErrorZ in the success state.
14828  */
14829 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
14830
14831 /**
14832  * Creates a new CResult_NoneSemanticErrorZ in the error state.
14833  */
14834 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
14835
14836 /**
14837  * Checks if the given object is currently in the success state
14838  */
14839 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
14840
14841 /**
14842  * Frees any resources used by the CResult_NoneSemanticErrorZ.
14843  */
14844 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
14845
14846 /**
14847  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
14848  * but with all dynamically-allocated buffers duplicated in new buffers.
14849  */
14850 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
14851
14852 /**
14853  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
14854  */
14855 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
14856
14857 /**
14858  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
14859  */
14860 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
14861
14862 /**
14863  * Checks if the given object is currently in the success state
14864  */
14865 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
14866
14867 /**
14868  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
14869  */
14870 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
14871
14872 /**
14873  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
14874  * but with all dynamically-allocated buffers duplicated in new buffers.
14875  */
14876 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
14877
14878 /**
14879  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
14880  */
14881 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
14882
14883 /**
14884  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
14885  */
14886 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
14887
14888 /**
14889  * Checks if the given object is currently in the success state
14890  */
14891 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
14892
14893 /**
14894  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
14895  */
14896 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
14897
14898 /**
14899  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
14900  * but with all dynamically-allocated buffers duplicated in new buffers.
14901  */
14902 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
14903
14904 /**
14905  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
14906  */
14907 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
14908
14909 /**
14910  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
14911  */
14912 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
14913
14914 /**
14915  * Checks if the given object is currently in the success state
14916  */
14917 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
14918
14919 /**
14920  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
14921  */
14922 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
14923
14924 /**
14925  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
14926  * but with all dynamically-allocated buffers duplicated in new buffers.
14927  */
14928 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
14929
14930 /**
14931  * Creates a new CResult_StringErrorZ in the success state.
14932  */
14933 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
14934
14935 /**
14936  * Creates a new CResult_StringErrorZ in the error state.
14937  */
14938 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
14939
14940 /**
14941  * Checks if the given object is currently in the success state
14942  */
14943 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
14944
14945 /**
14946  * Frees any resources used by the CResult_StringErrorZ.
14947  */
14948 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
14949
14950 /**
14951  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
14952  */
14953 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
14954
14955 /**
14956  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
14957  */
14958 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
14959
14960 /**
14961  * Checks if the given object is currently in the success state
14962  */
14963 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
14964
14965 /**
14966  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
14967  */
14968 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
14969
14970 /**
14971  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
14972  * but with all dynamically-allocated buffers duplicated in new buffers.
14973  */
14974 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
14975
14976 /**
14977  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
14978  */
14979 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
14980
14981 /**
14982  * Constructs a new COption_MonitorEventZ containing nothing
14983  */
14984 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
14985
14986 /**
14987  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
14988  */
14989 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
14990
14991 /**
14992  * Creates a new COption_MonitorEventZ which has the same data as `orig`
14993  * but with all dynamically-allocated buffers duplicated in new buffers.
14994  */
14995 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
14996
14997 /**
14998  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
14999  */
15000 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
15001
15002 /**
15003  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
15004  */
15005 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
15006
15007 /**
15008  * Checks if the given object is currently in the success state
15009  */
15010 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
15011
15012 /**
15013  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
15014  */
15015 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
15016
15017 /**
15018  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
15019  * but with all dynamically-allocated buffers duplicated in new buffers.
15020  */
15021 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
15022
15023 /**
15024  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
15025  */
15026 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
15027
15028 /**
15029  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
15030  */
15031 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15032
15033 /**
15034  * Checks if the given object is currently in the success state
15035  */
15036 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
15037
15038 /**
15039  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
15040  */
15041 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
15042
15043 /**
15044  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
15045  * but with all dynamically-allocated buffers duplicated in new buffers.
15046  */
15047 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
15048
15049 /**
15050  * Creates a new tuple which has the same data as `orig`
15051  * but with all dynamically-allocated buffers duplicated in new buffers.
15052  */
15053 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
15054
15055 /**
15056  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
15057  */
15058 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
15059
15060 /**
15061  * Frees any resources used by the C2Tuple_OutPointScriptZ.
15062  */
15063 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
15064
15065 /**
15066  * Creates a new tuple which has the same data as `orig`
15067  * but with all dynamically-allocated buffers duplicated in new buffers.
15068  */
15069 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
15070
15071 /**
15072  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
15073  */
15074 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
15075
15076 /**
15077  * Frees any resources used by the C2Tuple_u32ScriptZ.
15078  */
15079 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
15080
15081 /**
15082  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15083  */
15084 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
15085
15086 /**
15087  * Creates a new tuple which has the same data as `orig`
15088  * but with all dynamically-allocated buffers duplicated in new buffers.
15089  */
15090 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
15091
15092 /**
15093  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
15094  */
15095 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
15096
15097 /**
15098  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
15099  */
15100 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
15101
15102 /**
15103  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15104  */
15105 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
15106
15107 /**
15108  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15109  */
15110 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
15111
15112 /**
15113  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15114  */
15115 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
15116
15117 /**
15118  * Creates a new tuple which has the same data as `orig`
15119  * but with all dynamically-allocated buffers duplicated in new buffers.
15120  */
15121 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
15122
15123 /**
15124  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
15125  */
15126 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
15127
15128 /**
15129  * Frees any resources used by the C2Tuple_u32TxOutZ.
15130  */
15131 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
15132
15133 /**
15134  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15135  */
15136 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
15137
15138 /**
15139  * Creates a new tuple which has the same data as `orig`
15140  * but with all dynamically-allocated buffers duplicated in new buffers.
15141  */
15142 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
15143
15144 /**
15145  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
15146  */
15147 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
15148
15149 /**
15150  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
15151  */
15152 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
15153
15154 /**
15155  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15156  */
15157 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
15158
15159 /**
15160  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15161  */
15162 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
15163
15164 /**
15165  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
15166  */
15167 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
15168
15169 /**
15170  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
15171  */
15172 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
15173
15174 /**
15175  * Checks if the given object is currently in the success state
15176  */
15177 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
15178
15179 /**
15180  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
15181  */
15182 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
15183
15184 /**
15185  * Creates a new CResult_NoneLightningErrorZ in the success state.
15186  */
15187 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
15188
15189 /**
15190  * Creates a new CResult_NoneLightningErrorZ in the error state.
15191  */
15192 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
15193
15194 /**
15195  * Checks if the given object is currently in the success state
15196  */
15197 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
15198
15199 /**
15200  * Frees any resources used by the CResult_NoneLightningErrorZ.
15201  */
15202 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
15203
15204 /**
15205  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
15206  * but with all dynamically-allocated buffers duplicated in new buffers.
15207  */
15208 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
15209
15210 /**
15211  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
15212  */
15213 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
15214
15215 /**
15216  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
15217  */
15218 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
15219
15220 /**
15221  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15222  */
15223 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
15224
15225 /**
15226  * Creates a new CResult_boolLightningErrorZ in the success state.
15227  */
15228 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
15229
15230 /**
15231  * Creates a new CResult_boolLightningErrorZ in the error state.
15232  */
15233 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
15234
15235 /**
15236  * Checks if the given object is currently in the success state
15237  */
15238 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
15239
15240 /**
15241  * Frees any resources used by the CResult_boolLightningErrorZ.
15242  */
15243 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
15244
15245 /**
15246  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
15247  * but with all dynamically-allocated buffers duplicated in new buffers.
15248  */
15249 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
15250
15251 /**
15252  * Creates a new tuple which has the same data as `orig`
15253  * but with all dynamically-allocated buffers duplicated in new buffers.
15254  */
15255 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
15256
15257 /**
15258  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
15259  */
15260 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
15261
15262 /**
15263  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
15264  */
15265 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
15266
15267 /**
15268  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15269  */
15270 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
15271
15272 /**
15273  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15274  */
15275 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
15276
15277 /**
15278  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15279  */
15280 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
15281
15282 /**
15283  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
15284  */
15285 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
15286
15287 /**
15288  * Constructs a new COption_NetAddressZ containing nothing
15289  */
15290 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
15291
15292 /**
15293  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
15294  */
15295 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
15296
15297 /**
15298  * Creates a new COption_NetAddressZ which has the same data as `orig`
15299  * but with all dynamically-allocated buffers duplicated in new buffers.
15300  */
15301 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
15302
15303 /**
15304  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
15305  */
15306 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
15307
15308 /**
15309  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
15310  */
15311 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15312
15313 /**
15314  * Checks if the given object is currently in the success state
15315  */
15316 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
15317
15318 /**
15319  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
15320  */
15321 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
15322
15323 /**
15324  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
15325  * but with all dynamically-allocated buffers duplicated in new buffers.
15326  */
15327 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
15328
15329 /**
15330  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
15331  */
15332 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
15333
15334 /**
15335  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
15336  */
15337 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
15338
15339 /**
15340  * Checks if the given object is currently in the success state
15341  */
15342 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
15343
15344 /**
15345  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
15346  */
15347 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
15348
15349 /**
15350  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
15351  * but with all dynamically-allocated buffers duplicated in new buffers.
15352  */
15353 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
15354
15355 /**
15356  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
15357  */
15358 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
15359
15360 /**
15361  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
15362  */
15363 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15364
15365 /**
15366  * Checks if the given object is currently in the success state
15367  */
15368 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
15369
15370 /**
15371  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
15372  */
15373 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
15374
15375 /**
15376  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
15377  * but with all dynamically-allocated buffers duplicated in new buffers.
15378  */
15379 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
15380
15381 /**
15382  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
15383  */
15384 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
15385
15386 /**
15387  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
15388  */
15389 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
15390
15391 /**
15392  * Checks if the given object is currently in the success state
15393  */
15394 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
15395
15396 /**
15397  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
15398  */
15399 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
15400
15401 /**
15402  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
15403  * but with all dynamically-allocated buffers duplicated in new buffers.
15404  */
15405 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
15406
15407 /**
15408  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
15409  */
15410 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
15411
15412 /**
15413  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
15414  */
15415 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
15416
15417 /**
15418  * Checks if the given object is currently in the success state
15419  */
15420 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
15421
15422 /**
15423  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
15424  */
15425 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
15426
15427 /**
15428  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
15429  * but with all dynamically-allocated buffers duplicated in new buffers.
15430  */
15431 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
15432
15433 /**
15434  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
15435  */
15436 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
15437
15438 /**
15439  * Constructs a new COption_AccessZ containing nothing
15440  */
15441 struct LDKCOption_AccessZ COption_AccessZ_none(void);
15442
15443 /**
15444  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
15445  */
15446 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
15447
15448 /**
15449  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
15450  */
15451 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
15452
15453 /**
15454  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
15455  */
15456 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
15457
15458 /**
15459  * Checks if the given object is currently in the success state
15460  */
15461 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
15462
15463 /**
15464  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
15465  */
15466 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
15467
15468 /**
15469  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
15470  * but with all dynamically-allocated buffers duplicated in new buffers.
15471  */
15472 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
15473
15474 /**
15475  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
15476  */
15477 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
15478
15479 /**
15480  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
15481  */
15482 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
15483
15484 /**
15485  * Checks if the given object is currently in the success state
15486  */
15487 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
15488
15489 /**
15490  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
15491  */
15492 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
15493
15494 /**
15495  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
15496  * but with all dynamically-allocated buffers duplicated in new buffers.
15497  */
15498 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
15499
15500 /**
15501  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
15502  */
15503 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
15504
15505 /**
15506  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
15507  */
15508 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
15509
15510 /**
15511  * Checks if the given object is currently in the success state
15512  */
15513 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
15514
15515 /**
15516  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
15517  */
15518 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
15519
15520 /**
15521  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
15522  * but with all dynamically-allocated buffers duplicated in new buffers.
15523  */
15524 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
15525
15526 /**
15527  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
15528  */
15529 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
15530
15531 /**
15532  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
15533  */
15534 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
15535
15536 /**
15537  * Checks if the given object is currently in the success state
15538  */
15539 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
15540
15541 /**
15542  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
15543  */
15544 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
15545
15546 /**
15547  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
15548  * but with all dynamically-allocated buffers duplicated in new buffers.
15549  */
15550 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
15551
15552 /**
15553  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15554  */
15555 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
15556
15557 /**
15558  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
15559  */
15560 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
15561
15562 /**
15563  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
15564  */
15565 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
15566
15567 /**
15568  * Checks if the given object is currently in the success state
15569  */
15570 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
15571
15572 /**
15573  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
15574  */
15575 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
15576
15577 /**
15578  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
15579  * but with all dynamically-allocated buffers duplicated in new buffers.
15580  */
15581 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
15582
15583 /**
15584  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
15585  */
15586 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
15587
15588 /**
15589  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
15590  */
15591 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
15592
15593 /**
15594  * Checks if the given object is currently in the success state
15595  */
15596 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
15597
15598 /**
15599  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
15600  */
15601 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
15602
15603 /**
15604  * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
15605  * but with all dynamically-allocated buffers duplicated in new buffers.
15606  */
15607 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
15608
15609 /**
15610  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
15611  */
15612 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
15613
15614 /**
15615  * Constructs a new COption_CVec_NetAddressZZ containing nothing
15616  */
15617 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
15618
15619 /**
15620  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
15621  */
15622 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
15623
15624 /**
15625  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
15626  * but with all dynamically-allocated buffers duplicated in new buffers.
15627  */
15628 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
15629
15630 /**
15631  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
15632  */
15633 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
15634
15635 /**
15636  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
15637  */
15638 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
15639
15640 /**
15641  * Checks if the given object is currently in the success state
15642  */
15643 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
15644
15645 /**
15646  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
15647  */
15648 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
15649
15650 /**
15651  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
15652  * but with all dynamically-allocated buffers duplicated in new buffers.
15653  */
15654 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
15655
15656 /**
15657  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15658  */
15659 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
15660
15661 /**
15662  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15663  */
15664 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
15665
15666 /**
15667  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15668  */
15669 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
15670
15671 /**
15672  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15673  */
15674 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
15675
15676 /**
15677  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15678  */
15679 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
15680
15681 /**
15682  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15683  */
15684 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
15685
15686 /**
15687  * Checks if the given object is currently in the success state
15688  */
15689 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
15690
15691 /**
15692  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
15693  */
15694 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
15695
15696 /**
15697  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
15698  * but with all dynamically-allocated buffers duplicated in new buffers.
15699  */
15700 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
15701
15702 /**
15703  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
15704  */
15705 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
15706
15707 /**
15708  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
15709  */
15710 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
15711
15712 /**
15713  * Checks if the given object is currently in the success state
15714  */
15715 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
15716
15717 /**
15718  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
15719  */
15720 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
15721
15722 /**
15723  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
15724  * but with all dynamically-allocated buffers duplicated in new buffers.
15725  */
15726 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
15727
15728 /**
15729  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
15730  */
15731 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
15732
15733 /**
15734  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
15735  */
15736 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
15737
15738 /**
15739  * Checks if the given object is currently in the success state
15740  */
15741 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
15742
15743 /**
15744  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
15745  */
15746 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
15747
15748 /**
15749  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
15750  * but with all dynamically-allocated buffers duplicated in new buffers.
15751  */
15752 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
15753
15754 /**
15755  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
15756  */
15757 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
15758
15759 /**
15760  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
15761  */
15762 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
15763
15764 /**
15765  * Checks if the given object is currently in the success state
15766  */
15767 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
15768
15769 /**
15770  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
15771  */
15772 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
15773
15774 /**
15775  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
15776  * but with all dynamically-allocated buffers duplicated in new buffers.
15777  */
15778 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
15779
15780 /**
15781  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
15782  */
15783 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
15784
15785 /**
15786  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
15787  */
15788 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
15789
15790 /**
15791  * Checks if the given object is currently in the success state
15792  */
15793 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
15794
15795 /**
15796  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
15797  */
15798 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
15799
15800 /**
15801  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
15802  * but with all dynamically-allocated buffers duplicated in new buffers.
15803  */
15804 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
15805
15806 /**
15807  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
15808  */
15809 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
15810
15811 /**
15812  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
15813  */
15814 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
15815
15816 /**
15817  * Checks if the given object is currently in the success state
15818  */
15819 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
15820
15821 /**
15822  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
15823  */
15824 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
15825
15826 /**
15827  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
15828  * but with all dynamically-allocated buffers duplicated in new buffers.
15829  */
15830 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
15831
15832 /**
15833  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
15834  */
15835 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
15836
15837 /**
15838  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
15839  */
15840 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
15841
15842 /**
15843  * Checks if the given object is currently in the success state
15844  */
15845 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
15846
15847 /**
15848  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
15849  */
15850 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
15851
15852 /**
15853  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
15854  * but with all dynamically-allocated buffers duplicated in new buffers.
15855  */
15856 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
15857
15858 /**
15859  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
15860  */
15861 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
15862
15863 /**
15864  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
15865  */
15866 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
15867
15868 /**
15869  * Checks if the given object is currently in the success state
15870  */
15871 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
15872
15873 /**
15874  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
15875  */
15876 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
15877
15878 /**
15879  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
15880  * but with all dynamically-allocated buffers duplicated in new buffers.
15881  */
15882 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
15883
15884 /**
15885  * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
15886  */
15887 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
15888
15889 /**
15890  * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
15891  */
15892 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
15893
15894 /**
15895  * Checks if the given object is currently in the success state
15896  */
15897 bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o);
15898
15899 /**
15900  * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
15901  */
15902 void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
15903
15904 /**
15905  * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
15906  * but with all dynamically-allocated buffers duplicated in new buffers.
15907  */
15908 struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
15909
15910 /**
15911  * Creates a new CResult_InitDecodeErrorZ in the success state.
15912  */
15913 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
15914
15915 /**
15916  * Creates a new CResult_InitDecodeErrorZ in the error state.
15917  */
15918 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
15919
15920 /**
15921  * Checks if the given object is currently in the success state
15922  */
15923 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
15924
15925 /**
15926  * Frees any resources used by the CResult_InitDecodeErrorZ.
15927  */
15928 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
15929
15930 /**
15931  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
15932  * but with all dynamically-allocated buffers duplicated in new buffers.
15933  */
15934 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
15935
15936 /**
15937  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
15938  */
15939 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
15940
15941 /**
15942  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
15943  */
15944 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
15945
15946 /**
15947  * Checks if the given object is currently in the success state
15948  */
15949 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
15950
15951 /**
15952  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
15953  */
15954 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
15955
15956 /**
15957  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
15958  * but with all dynamically-allocated buffers duplicated in new buffers.
15959  */
15960 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
15961
15962 /**
15963  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
15964  */
15965 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
15966
15967 /**
15968  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
15969  */
15970 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
15971
15972 /**
15973  * Checks if the given object is currently in the success state
15974  */
15975 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
15976
15977 /**
15978  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
15979  */
15980 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
15981
15982 /**
15983  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
15984  * but with all dynamically-allocated buffers duplicated in new buffers.
15985  */
15986 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
15987
15988 /**
15989  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
15990  */
15991 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
15992
15993 /**
15994  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
15995  */
15996 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
15997
15998 /**
15999  * Checks if the given object is currently in the success state
16000  */
16001 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
16002
16003 /**
16004  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
16005  */
16006 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
16007
16008 /**
16009  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
16010  * but with all dynamically-allocated buffers duplicated in new buffers.
16011  */
16012 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
16013
16014 /**
16015  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
16016  */
16017 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
16018
16019 /**
16020  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
16021  */
16022 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16023
16024 /**
16025  * Checks if the given object is currently in the success state
16026  */
16027 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
16028
16029 /**
16030  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
16031  */
16032 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
16033
16034 /**
16035  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
16036  * but with all dynamically-allocated buffers duplicated in new buffers.
16037  */
16038 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
16039
16040 /**
16041  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
16042  */
16043 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
16044
16045 /**
16046  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
16047  */
16048 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16049
16050 /**
16051  * Checks if the given object is currently in the success state
16052  */
16053 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
16054
16055 /**
16056  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
16057  */
16058 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
16059
16060 /**
16061  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
16062  * but with all dynamically-allocated buffers duplicated in new buffers.
16063  */
16064 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
16065
16066 /**
16067  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16068  */
16069 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
16070
16071 /**
16072  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16073  */
16074 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
16075
16076 /**
16077  * Checks if the given object is currently in the success state
16078  */
16079 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
16080
16081 /**
16082  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16083  */
16084 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
16085
16086 /**
16087  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16088  * but with all dynamically-allocated buffers duplicated in new buffers.
16089  */
16090 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
16091
16092 /**
16093  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16094  */
16095 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
16096
16097 /**
16098  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16099  */
16100 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16101
16102 /**
16103  * Checks if the given object is currently in the success state
16104  */
16105 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
16106
16107 /**
16108  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16109  */
16110 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
16111
16112 /**
16113  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16114  * but with all dynamically-allocated buffers duplicated in new buffers.
16115  */
16116 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
16117
16118 /**
16119  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16120  */
16121 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
16122
16123 /**
16124  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16125  */
16126 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16127
16128 /**
16129  * Checks if the given object is currently in the success state
16130  */
16131 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
16132
16133 /**
16134  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16135  */
16136 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
16137
16138 /**
16139  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16140  * but with all dynamically-allocated buffers duplicated in new buffers.
16141  */
16142 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
16143
16144 /**
16145  * Creates a new CResult_PingDecodeErrorZ in the success state.
16146  */
16147 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
16148
16149 /**
16150  * Creates a new CResult_PingDecodeErrorZ in the error state.
16151  */
16152 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
16153
16154 /**
16155  * Checks if the given object is currently in the success state
16156  */
16157 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
16158
16159 /**
16160  * Frees any resources used by the CResult_PingDecodeErrorZ.
16161  */
16162 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
16163
16164 /**
16165  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16166  * but with all dynamically-allocated buffers duplicated in new buffers.
16167  */
16168 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
16169
16170 /**
16171  * Creates a new CResult_PongDecodeErrorZ in the success state.
16172  */
16173 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
16174
16175 /**
16176  * Creates a new CResult_PongDecodeErrorZ in the error state.
16177  */
16178 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
16179
16180 /**
16181  * Checks if the given object is currently in the success state
16182  */
16183 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
16184
16185 /**
16186  * Frees any resources used by the CResult_PongDecodeErrorZ.
16187  */
16188 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
16189
16190 /**
16191  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16192  * but with all dynamically-allocated buffers duplicated in new buffers.
16193  */
16194 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
16195
16196 /**
16197  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16198  */
16199 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
16200
16201 /**
16202  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16203  */
16204 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16205
16206 /**
16207  * Checks if the given object is currently in the success state
16208  */
16209 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16210
16211 /**
16212  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16213  */
16214 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
16215
16216 /**
16217  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16218  * but with all dynamically-allocated buffers duplicated in new buffers.
16219  */
16220 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16221
16222 /**
16223  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16224  */
16225 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
16226
16227 /**
16228  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16229  */
16230 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16231
16232 /**
16233  * Checks if the given object is currently in the success state
16234  */
16235 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16236
16237 /**
16238  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16239  */
16240 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
16241
16242 /**
16243  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16244  * but with all dynamically-allocated buffers duplicated in new buffers.
16245  */
16246 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16247
16248 /**
16249  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16250  */
16251 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
16252
16253 /**
16254  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16255  */
16256 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16257
16258 /**
16259  * Checks if the given object is currently in the success state
16260  */
16261 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16262
16263 /**
16264  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16265  */
16266 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
16267
16268 /**
16269  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16270  * but with all dynamically-allocated buffers duplicated in new buffers.
16271  */
16272 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16273
16274 /**
16275  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16276  */
16277 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
16278
16279 /**
16280  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16281  */
16282 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16283
16284 /**
16285  * Checks if the given object is currently in the success state
16286  */
16287 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16288
16289 /**
16290  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16291  */
16292 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
16293
16294 /**
16295  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16296  * but with all dynamically-allocated buffers duplicated in new buffers.
16297  */
16298 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16299
16300 /**
16301  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16302  */
16303 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
16304
16305 /**
16306  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16307  */
16308 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
16309
16310 /**
16311  * Checks if the given object is currently in the success state
16312  */
16313 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
16314
16315 /**
16316  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16317  */
16318 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
16319
16320 /**
16321  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16322  * but with all dynamically-allocated buffers duplicated in new buffers.
16323  */
16324 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
16325
16326 /**
16327  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16328  */
16329 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
16330
16331 /**
16332  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16333  */
16334 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
16335
16336 /**
16337  * Checks if the given object is currently in the success state
16338  */
16339 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
16340
16341 /**
16342  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16343  */
16344 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
16345
16346 /**
16347  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16348  * but with all dynamically-allocated buffers duplicated in new buffers.
16349  */
16350 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
16351
16352 /**
16353  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16354  */
16355 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
16356
16357 /**
16358  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16359  */
16360 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16361
16362 /**
16363  * Checks if the given object is currently in the success state
16364  */
16365 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16366
16367 /**
16368  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16369  */
16370 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
16371
16372 /**
16373  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16374  * but with all dynamically-allocated buffers duplicated in new buffers.
16375  */
16376 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16377
16378 /**
16379  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16380  */
16381 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
16382
16383 /**
16384  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16385  */
16386 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16387
16388 /**
16389  * Checks if the given object is currently in the success state
16390  */
16391 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16392
16393 /**
16394  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16395  */
16396 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
16397
16398 /**
16399  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16400  * but with all dynamically-allocated buffers duplicated in new buffers.
16401  */
16402 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16403
16404 /**
16405  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16406  */
16407 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
16408
16409 /**
16410  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16411  */
16412 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
16413
16414 /**
16415  * Checks if the given object is currently in the success state
16416  */
16417 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
16418
16419 /**
16420  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16421  */
16422 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
16423
16424 /**
16425  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16426  * but with all dynamically-allocated buffers duplicated in new buffers.
16427  */
16428 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
16429
16430 /**
16431  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16432  */
16433 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
16434
16435 /**
16436  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16437  */
16438 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
16439
16440 /**
16441  * Checks if the given object is currently in the success state
16442  */
16443 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
16444
16445 /**
16446  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16447  */
16448 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
16449
16450 /**
16451  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16452  * but with all dynamically-allocated buffers duplicated in new buffers.
16453  */
16454 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
16455
16456 /**
16457  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16458  */
16459 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
16460
16461 /**
16462  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16463  */
16464 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16465
16466 /**
16467  * Checks if the given object is currently in the success state
16468  */
16469 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
16470
16471 /**
16472  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16473  */
16474 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
16475
16476 /**
16477  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16478  * but with all dynamically-allocated buffers duplicated in new buffers.
16479  */
16480 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16481
16482 /**
16483  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16484  */
16485 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
16486
16487 /**
16488  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16489  */
16490 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16491
16492 /**
16493  * Checks if the given object is currently in the success state
16494  */
16495 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
16496
16497 /**
16498  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16499  */
16500 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
16501
16502 /**
16503  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16504  * but with all dynamically-allocated buffers duplicated in new buffers.
16505  */
16506 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16507
16508 /**
16509  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16510  */
16511 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
16512
16513 /**
16514  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16515  */
16516 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
16517
16518 /**
16519  * Checks if the given object is currently in the success state
16520  */
16521 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
16522
16523 /**
16524  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16525  */
16526 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
16527
16528 /**
16529  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16530  * but with all dynamically-allocated buffers duplicated in new buffers.
16531  */
16532 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
16533
16534 /**
16535  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16536  */
16537 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
16538
16539 /**
16540  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16541  */
16542 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
16543
16544 /**
16545  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16546  */
16547 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
16548
16549 /**
16550  * Checks if the given object is currently in the success state
16551  */
16552 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
16553
16554 /**
16555  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16556  */
16557 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
16558
16559 /**
16560  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16561  * but with all dynamically-allocated buffers duplicated in new buffers.
16562  */
16563 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
16564
16565 /**
16566  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16567  */
16568 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
16569
16570 /**
16571  * Constructs a new COption_FilterZ containing nothing
16572  */
16573 struct LDKCOption_FilterZ COption_FilterZ_none(void);
16574
16575 /**
16576  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16577  */
16578 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
16579
16580 /**
16581  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16582  */
16583 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
16584
16585 /**
16586  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16587  */
16588 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
16589
16590 /**
16591  * Checks if the given object is currently in the success state
16592  */
16593 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
16594
16595 /**
16596  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16597  */
16598 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
16599
16600 /**
16601  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16602  */
16603 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
16604
16605 /**
16606  * Frees any resources used by the PaymentPurpose
16607  */
16608 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
16609
16610 /**
16611  * Creates a copy of the PaymentPurpose
16612  */
16613 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
16614
16615 /**
16616  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
16617  */
16618 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
16619
16620 /**
16621  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
16622  */
16623 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
16624
16625 /**
16626  * Frees any resources used by the ClosureReason
16627  */
16628 void ClosureReason_free(struct LDKClosureReason this_ptr);
16629
16630 /**
16631  * Creates a copy of the ClosureReason
16632  */
16633 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
16634
16635 /**
16636  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
16637  */
16638 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
16639
16640 /**
16641  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
16642  */
16643 struct LDKClosureReason ClosureReason_holder_force_closed(void);
16644
16645 /**
16646  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
16647  */
16648 struct LDKClosureReason ClosureReason_cooperative_closure(void);
16649
16650 /**
16651  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
16652  */
16653 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
16654
16655 /**
16656  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
16657  */
16658 struct LDKClosureReason ClosureReason_funding_timed_out(void);
16659
16660 /**
16661  * Utility method to constructs a new ProcessingError-variant ClosureReason
16662  */
16663 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
16664
16665 /**
16666  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
16667  */
16668 struct LDKClosureReason ClosureReason_disconnected_peer(void);
16669
16670 /**
16671  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
16672  */
16673 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
16674
16675 /**
16676  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
16677  */
16678 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
16679
16680 /**
16681  * Read a ClosureReason from a byte array, created by ClosureReason_write
16682  */
16683 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
16684
16685 /**
16686  * Frees any resources used by the Event
16687  */
16688 void Event_free(struct LDKEvent this_ptr);
16689
16690 /**
16691  * Creates a copy of the Event
16692  */
16693 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
16694
16695 /**
16696  * Utility method to constructs a new FundingGenerationReady-variant Event
16697  */
16698 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);
16699
16700 /**
16701  * Utility method to constructs a new PaymentReceived-variant Event
16702  */
16703 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
16704
16705 /**
16706  * Utility method to constructs a new PaymentSent-variant Event
16707  */
16708 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
16709
16710 /**
16711  * Utility method to constructs a new PaymentPathFailed-variant Event
16712  */
16713 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);
16714
16715 /**
16716  * Utility method to constructs a new PaymentFailed-variant Event
16717  */
16718 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
16719
16720 /**
16721  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
16722  */
16723 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
16724
16725 /**
16726  * Utility method to constructs a new SpendableOutputs-variant Event
16727  */
16728 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
16729
16730 /**
16731  * Utility method to constructs a new PaymentForwarded-variant Event
16732  */
16733 struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
16734
16735 /**
16736  * Utility method to constructs a new ChannelClosed-variant Event
16737  */
16738 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
16739
16740 /**
16741  * Utility method to constructs a new DiscardFunding-variant Event
16742  */
16743 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
16744
16745 /**
16746  * Utility method to constructs a new PaymentPathSuccessful-variant Event
16747  */
16748 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
16749
16750 /**
16751  * Utility method to constructs a new OpenChannelRequest-variant Event
16752  */
16753 struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type);
16754
16755 /**
16756  * Serialize the Event object into a byte array which can be read by Event_read
16757  */
16758 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
16759
16760 /**
16761  * Read a Event from a byte array, created by Event_write
16762  */
16763 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
16764
16765 /**
16766  * Frees any resources used by the MessageSendEvent
16767  */
16768 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
16769
16770 /**
16771  * Creates a copy of the MessageSendEvent
16772  */
16773 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
16774
16775 /**
16776  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
16777  */
16778 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
16779
16780 /**
16781  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
16782  */
16783 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
16784
16785 /**
16786  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
16787  */
16788 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
16789
16790 /**
16791  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
16792  */
16793 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
16794
16795 /**
16796  * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
16797  */
16798 struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
16799
16800 /**
16801  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
16802  */
16803 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
16804
16805 /**
16806  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
16807  */
16808 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
16809
16810 /**
16811  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
16812  */
16813 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
16814
16815 /**
16816  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
16817  */
16818 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
16819
16820 /**
16821  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
16822  */
16823 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
16824
16825 /**
16826  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
16827  */
16828 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
16829
16830 /**
16831  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
16832  */
16833 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
16834
16835 /**
16836  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
16837  */
16838 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
16839
16840 /**
16841  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
16842  */
16843 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
16844
16845 /**
16846  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
16847  */
16848 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
16849
16850 /**
16851  * Utility method to constructs a new HandleError-variant MessageSendEvent
16852  */
16853 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
16854
16855 /**
16856  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
16857  */
16858 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
16859
16860 /**
16861  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
16862  */
16863 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
16864
16865 /**
16866  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
16867  */
16868 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
16869
16870 /**
16871  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
16872  */
16873 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
16874
16875 /**
16876  * Calls the free function if one is set
16877  */
16878 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
16879
16880 /**
16881  * Calls the free function if one is set
16882  */
16883 void EventsProvider_free(struct LDKEventsProvider this_ptr);
16884
16885 /**
16886  * Calls the free function if one is set
16887  */
16888 void EventHandler_free(struct LDKEventHandler this_ptr);
16889
16890 /**
16891  * Frees any resources used by the APIError
16892  */
16893 void APIError_free(struct LDKAPIError this_ptr);
16894
16895 /**
16896  * Creates a copy of the APIError
16897  */
16898 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
16899
16900 /**
16901  * Utility method to constructs a new APIMisuseError-variant APIError
16902  */
16903 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
16904
16905 /**
16906  * Utility method to constructs a new FeeRateTooHigh-variant APIError
16907  */
16908 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
16909
16910 /**
16911  * Utility method to constructs a new RouteError-variant APIError
16912  */
16913 struct LDKAPIError APIError_route_error(struct LDKStr err);
16914
16915 /**
16916  * Utility method to constructs a new ChannelUnavailable-variant APIError
16917  */
16918 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
16919
16920 /**
16921  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
16922  */
16923 struct LDKAPIError APIError_monitor_update_failed(void);
16924
16925 /**
16926  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
16927  */
16928 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
16929
16930 /**
16931  * Creates a digital signature of a message given a SecretKey, like the node's secret.
16932  * 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.
16933  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
16934  */
16935 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
16936
16937 /**
16938  * Recovers the PublicKey of the signer of the message given the message and the signature.
16939  */
16940 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
16941
16942 /**
16943  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
16944  * and the PublicKey.
16945  */
16946 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
16947
16948 /**
16949  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
16950  */
16951 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
16952
16953 /**
16954  * Creates a copy of the Level
16955  */
16956 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
16957
16958 /**
16959  * Utility method to constructs a new Gossip-variant Level
16960  */
16961 enum LDKLevel Level_gossip(void);
16962
16963 /**
16964  * Utility method to constructs a new Trace-variant Level
16965  */
16966 enum LDKLevel Level_trace(void);
16967
16968 /**
16969  * Utility method to constructs a new Debug-variant Level
16970  */
16971 enum LDKLevel Level_debug(void);
16972
16973 /**
16974  * Utility method to constructs a new Info-variant Level
16975  */
16976 enum LDKLevel Level_info(void);
16977
16978 /**
16979  * Utility method to constructs a new Warn-variant Level
16980  */
16981 enum LDKLevel Level_warn(void);
16982
16983 /**
16984  * Utility method to constructs a new Error-variant Level
16985  */
16986 enum LDKLevel Level_error(void);
16987
16988 /**
16989  * Checks if two Levels contain equal inner contents.
16990  * This ignores pointers and is_owned flags and looks at the values in fields.
16991  */
16992 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
16993
16994 /**
16995  * Checks if two Levels contain equal inner contents.
16996  */
16997 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
16998
16999 /**
17000  * Returns the most verbose logging level.
17001  */
17002 MUST_USE_RES enum LDKLevel Level_max(void);
17003
17004 /**
17005  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
17006  */
17007 void Record_free(struct LDKRecord this_obj);
17008
17009 /**
17010  * The verbosity level of the message.
17011  */
17012 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
17013
17014 /**
17015  * The verbosity level of the message.
17016  */
17017 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
17018
17019 /**
17020  * The message body.
17021  */
17022 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
17023
17024 /**
17025  * The message body.
17026  */
17027 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17028
17029 /**
17030  * The module path of the message.
17031  */
17032 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
17033
17034 /**
17035  * The module path of the message.
17036  */
17037 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17038
17039 /**
17040  * The source file containing the message.
17041  */
17042 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
17043
17044 /**
17045  * The source file containing the message.
17046  */
17047 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17048
17049 /**
17050  * The line containing the message.
17051  */
17052 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
17053
17054 /**
17055  * The line containing the message.
17056  */
17057 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
17058
17059 /**
17060  * Creates a copy of the Record
17061  */
17062 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
17063
17064 /**
17065  * Calls the free function if one is set
17066  */
17067 void Logger_free(struct LDKLogger this_ptr);
17068
17069 /**
17070  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
17071  */
17072 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
17073
17074 /**
17075  * Confirmations we will wait for before considering the channel locked in.
17076  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
17077  * equivalent limit applied to outbound channels).
17078  *
17079  * Default value: 6.
17080  */
17081 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17082
17083 /**
17084  * Confirmations we will wait for before considering the channel locked in.
17085  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
17086  * equivalent limit applied to outbound channels).
17087  *
17088  * Default value: 6.
17089  */
17090 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
17091
17092 /**
17093  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
17094  * the number of blocks we have to punish our counterparty if they broadcast a revoked
17095  * transaction).
17096  *
17097  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
17098  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
17099  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
17100  * possibly with time in between to RBF the spending transaction).
17101  *
17102  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
17103  * case of an honest unilateral channel close, which implicitly decrease the economic value of
17104  * our channel.
17105  *
17106  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
17107  * can tweak config to ask for more security, not less.
17108  */
17109 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17110
17111 /**
17112  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
17113  * the number of blocks we have to punish our counterparty if they broadcast a revoked
17114  * transaction).
17115  *
17116  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
17117  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
17118  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
17119  * possibly with time in between to RBF the spending transaction).
17120  *
17121  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
17122  * case of an honest unilateral channel close, which implicitly decrease the economic value of
17123  * our channel.
17124  *
17125  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
17126  * can tweak config to ask for more security, not less.
17127  */
17128 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
17129
17130 /**
17131  * Set to the smallest value HTLC we will accept to process.
17132  *
17133  * This value is sent to our counterparty on channel-open and we close the channel any time
17134  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
17135  *
17136  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
17137  * by the protocol.
17138  */
17139 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17140
17141 /**
17142  * Set to the smallest value HTLC we will accept to process.
17143  *
17144  * This value is sent to our counterparty on channel-open and we close the channel any time
17145  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
17146  *
17147  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
17148  * by the protocol.
17149  */
17150 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
17151
17152 /**
17153  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
17154  * BOLTs) option for outbound private channels. This provides better privacy by not including
17155  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
17156  * relay HTLCs to us using the channel's SCID alias.
17157  *
17158  * If this option is set, channels may be created that will not be readable by LDK versions
17159  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
17160  * [`DecodeError:InvalidValue`].
17161  *
17162  * Note that setting this to true does *not* prevent us from opening channels with
17163  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
17164  * private channel without that option.
17165  *
17166  * Ignored if the channel is negotiated to be announced, see
17167  * [`ChannelConfig::announced_channel`] and
17168  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
17169  *
17170  * Default value: false. This value is likely to change to true in the future.
17171  *
17172  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17173  * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
17174  */
17175 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17176
17177 /**
17178  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
17179  * BOLTs) option for outbound private channels. This provides better privacy by not including
17180  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
17181  * relay HTLCs to us using the channel's SCID alias.
17182  *
17183  * If this option is set, channels may be created that will not be readable by LDK versions
17184  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
17185  * [`DecodeError:InvalidValue`].
17186  *
17187  * Note that setting this to true does *not* prevent us from opening channels with
17188  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
17189  * private channel without that option.
17190  *
17191  * Ignored if the channel is negotiated to be announced, see
17192  * [`ChannelConfig::announced_channel`] and
17193  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
17194  *
17195  * Default value: false. This value is likely to change to true in the future.
17196  *
17197  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17198  * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
17199  */
17200 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
17201
17202 /**
17203  * Constructs a new ChannelHandshakeConfig given each field
17204  */
17205 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, bool negotiate_scid_privacy_arg);
17206
17207 /**
17208  * Creates a copy of the ChannelHandshakeConfig
17209  */
17210 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
17211
17212 /**
17213  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
17214  */
17215 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
17216
17217 /**
17218  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
17219  */
17220 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
17221
17222 /**
17223  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
17224  * only applies to inbound channels.
17225  *
17226  * Default value: 0.
17227  */
17228 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17229
17230 /**
17231  * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
17232  * only applies to inbound channels.
17233  *
17234  * Default value: 0.
17235  */
17236 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17237
17238 /**
17239  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
17240  * you to limit the maximum minimum-size they can require.
17241  *
17242  * Default value: u64::max_value.
17243  */
17244 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17245
17246 /**
17247  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
17248  * you to limit the maximum minimum-size they can require.
17249  *
17250  * Default value: u64::max_value.
17251  */
17252 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17253
17254 /**
17255  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17256  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17257  *
17258  * Default value: 0.
17259  */
17260 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17261
17262 /**
17263  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17264  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17265  *
17266  * Default value: 0.
17267  */
17268 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17269
17270 /**
17271  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17272  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17273  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17274  *
17275  * Default value: u64::max_value.
17276  */
17277 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17278
17279 /**
17280  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17281  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17282  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17283  *
17284  * Default value: u64::max_value.
17285  */
17286 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17287
17288 /**
17289  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17290  * time. This allows you to set a minimum such value.
17291  *
17292  * Default value: 0.
17293  */
17294 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17295
17296 /**
17297  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17298  * time. This allows you to set a minimum such value.
17299  *
17300  * Default value: 0.
17301  */
17302 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17303
17304 /**
17305  * Before a channel is usable the funding transaction will need to be confirmed by at least a
17306  * certain number of blocks, specified by the node which is not the funder (as the funder can
17307  * assume they aren't going to double-spend themselves).
17308  * This config allows you to set a limit on the maximum amount of time to wait.
17309  *
17310  * Default value: 144, or roughly one day and only applies to outbound channels.
17311  */
17312 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17313
17314 /**
17315  * Before a channel is usable the funding transaction will need to be confirmed by at least a
17316  * certain number of blocks, specified by the node which is not the funder (as the funder can
17317  * assume they aren't going to double-spend themselves).
17318  * This config allows you to set a limit on the maximum amount of time to wait.
17319  *
17320  * Default value: 144, or roughly one day and only applies to outbound channels.
17321  */
17322 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
17323
17324 /**
17325  * Set to force an incoming channel to match our announced channel preference in
17326  * [`ChannelConfig::announced_channel`].
17327  *
17328  * For a node which is not online reliably, this should be set to true and
17329  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
17330  * channels will ever be opened.
17331  *
17332  * Default value: true.
17333  */
17334 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17335
17336 /**
17337  * Set to force an incoming channel to match our announced channel preference in
17338  * [`ChannelConfig::announced_channel`].
17339  *
17340  * For a node which is not online reliably, this should be set to true and
17341  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
17342  * channels will ever be opened.
17343  *
17344  * Default value: true.
17345  */
17346 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
17347
17348 /**
17349  * Set to the amount of time we're willing to wait to claim money back to us.
17350  *
17351  * Not checking this value would be a security issue, as our peer would be able to set it to
17352  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17353  *
17354  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17355  * reduce the loss of having useless locked funds (if your peer accepts)
17356  */
17357 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17358
17359 /**
17360  * Set to the amount of time we're willing to wait to claim money back to us.
17361  *
17362  * Not checking this value would be a security issue, as our peer would be able to set it to
17363  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17364  *
17365  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17366  * reduce the loss of having useless locked funds (if your peer accepts)
17367  */
17368 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17369
17370 /**
17371  * Constructs a new ChannelHandshakeLimits given each field
17372  */
17373 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);
17374
17375 /**
17376  * Creates a copy of the ChannelHandshakeLimits
17377  */
17378 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
17379
17380 /**
17381  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
17382  */
17383 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
17384
17385 /**
17386  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
17387  */
17388 void ChannelConfig_free(struct LDKChannelConfig this_obj);
17389
17390 /**
17391  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17392  * over the channel.
17393  * This may be allowed to change at runtime in a later update, however doing so must result in
17394  * update messages sent to notify all nodes of our updated relay fee.
17395  *
17396  * Default value: 0.
17397  */
17398 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17399
17400 /**
17401  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17402  * over the channel.
17403  * This may be allowed to change at runtime in a later update, however doing so must result in
17404  * update messages sent to notify all nodes of our updated relay fee.
17405  *
17406  * Default value: 0.
17407  */
17408 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17409
17410 /**
17411  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17412  * excess of [`forwarding_fee_proportional_millionths`].
17413  * This may be allowed to change at runtime in a later update, however doing so must result in
17414  * update messages sent to notify all nodes of our updated relay fee.
17415  *
17416  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17417  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17418  * this node.
17419  *
17420  * Default value: 1000.
17421  *
17422  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17423  */
17424 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17425
17426 /**
17427  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17428  * excess of [`forwarding_fee_proportional_millionths`].
17429  * This may be allowed to change at runtime in a later update, however doing so must result in
17430  * update messages sent to notify all nodes of our updated relay fee.
17431  *
17432  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17433  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17434  * this node.
17435  *
17436  * Default value: 1000.
17437  *
17438  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17439  */
17440 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17441
17442 /**
17443  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17444  * the channel this config applies to.
17445  *
17446  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17447  * HTLC balance when a channel appears on-chain whereas
17448  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17449  * (non-HTLC-encumbered) balance.
17450  *
17451  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17452  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17453  * commitment transaction at least once per this many blocks (minus some margin to allow us
17454  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17455  * the spending transaction).
17456  *
17457  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17458  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17459  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17460  *
17461  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17462  */
17463 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17464
17465 /**
17466  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17467  * the channel this config applies to.
17468  *
17469  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17470  * HTLC balance when a channel appears on-chain whereas
17471  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17472  * (non-HTLC-encumbered) balance.
17473  *
17474  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17475  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17476  * commitment transaction at least once per this many blocks (minus some margin to allow us
17477  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17478  * the spending transaction).
17479  *
17480  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17481  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17482  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17483  *
17484  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17485  */
17486 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
17487
17488 /**
17489  * Set to announce the channel publicly and notify all nodes that they can route via this
17490  * channel.
17491  *
17492  * This should only be set to true for nodes which expect to be online reliably.
17493  *
17494  * As the node which funds a channel picks this value this will only apply for new outbound
17495  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17496  *
17497  * This cannot be changed after the initial channel handshake.
17498  *
17499  * Default value: false.
17500  */
17501 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17502
17503 /**
17504  * Set to announce the channel publicly and notify all nodes that they can route via this
17505  * channel.
17506  *
17507  * This should only be set to true for nodes which expect to be online reliably.
17508  *
17509  * As the node which funds a channel picks this value this will only apply for new outbound
17510  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17511  *
17512  * This cannot be changed after the initial channel handshake.
17513  *
17514  * Default value: false.
17515  */
17516 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
17517
17518 /**
17519  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17520  * supports it, they will then enforce the mutual-close output to us matches what we provided
17521  * at intialization, preventing us from closing to an alternate pubkey.
17522  *
17523  * This is set to true by default to provide a slight increase in security, though ultimately
17524  * any attacker who is able to take control of a channel can just as easily send the funds via
17525  * lightning payments, so we never require that our counterparties support this option.
17526  *
17527  * This cannot be changed after a channel has been initialized.
17528  *
17529  * Default value: true.
17530  */
17531 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17532
17533 /**
17534  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17535  * supports it, they will then enforce the mutual-close output to us matches what we provided
17536  * at intialization, preventing us from closing to an alternate pubkey.
17537  *
17538  * This is set to true by default to provide a slight increase in security, though ultimately
17539  * any attacker who is able to take control of a channel can just as easily send the funds via
17540  * lightning payments, so we never require that our counterparties support this option.
17541  *
17542  * This cannot be changed after a channel has been initialized.
17543  *
17544  * Default value: true.
17545  */
17546 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
17547
17548 /**
17549  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
17550  * small to claim on-chain.
17551  *
17552  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
17553  * not be claimable on-chain, instead being turned into additional miner fees if either
17554  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
17555  * to such payments may be sustantial if there are many dust HTLCs present when the
17556  * channel is force-closed.
17557  *
17558  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
17559  * exposure across all three types per-channel. Setting this too low may prevent the
17560  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
17561  * important to prevent stealing of dust HTLCs by miners.
17562  *
17563  * Default value: 5_000_000 msat.
17564  */
17565 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17566
17567 /**
17568  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
17569  * small to claim on-chain.
17570  *
17571  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
17572  * not be claimable on-chain, instead being turned into additional miner fees if either
17573  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
17574  * to such payments may be sustantial if there are many dust HTLCs present when the
17575  * channel is force-closed.
17576  *
17577  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
17578  * exposure across all three types per-channel. Setting this too low may prevent the
17579  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
17580  * important to prevent stealing of dust HTLCs by miners.
17581  *
17582  * Default value: 5_000_000 msat.
17583  */
17584 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
17585
17586 /**
17587  * The additional fee we're willing to pay to avoid waiting for the counterparty's
17588  * `to_self_delay` to reclaim funds.
17589  *
17590  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
17591  * closing transaction which both sides find acceptable, ultimately paid by the channel
17592  * funder/initiator.
17593  *
17594  * When we are the funder, because we have to pay the channel closing fee, we bound the
17595  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
17596  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
17597  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
17598  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
17599  * funds.
17600  *
17601  * When we are not the funder, we require the closing transaction fee pay at least our
17602  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
17603  * Thus, this value is ignored when we are not the funder.
17604  *
17605  * Default value: 1000 satoshis.
17606  *
17607  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
17608  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
17609  */
17610 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17611
17612 /**
17613  * The additional fee we're willing to pay to avoid waiting for the counterparty's
17614  * `to_self_delay` to reclaim funds.
17615  *
17616  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
17617  * closing transaction which both sides find acceptable, ultimately paid by the channel
17618  * funder/initiator.
17619  *
17620  * When we are the funder, because we have to pay the channel closing fee, we bound the
17621  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
17622  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
17623  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
17624  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
17625  * funds.
17626  *
17627  * When we are not the funder, we require the closing transaction fee pay at least our
17628  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
17629  * Thus, this value is ignored when we are not the funder.
17630  *
17631  * Default value: 1000 satoshis.
17632  *
17633  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
17634  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
17635  */
17636 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
17637
17638 /**
17639  * Constructs a new ChannelConfig given each field
17640  */
17641 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);
17642
17643 /**
17644  * Creates a copy of the ChannelConfig
17645  */
17646 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
17647
17648 /**
17649  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
17650  */
17651 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
17652
17653 /**
17654  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
17655  */
17656 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
17657
17658 /**
17659  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
17660  */
17661 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
17662
17663 /**
17664  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
17665  */
17666 void UserConfig_free(struct LDKUserConfig this_obj);
17667
17668 /**
17669  * Channel config that we propose to our counterparty.
17670  */
17671 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17672
17673 /**
17674  * Channel config that we propose to our counterparty.
17675  */
17676 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
17677
17678 /**
17679  * Limits applied to our counterparty's proposed channel config settings.
17680  */
17681 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17682
17683 /**
17684  * Limits applied to our counterparty's proposed channel config settings.
17685  */
17686 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
17687
17688 /**
17689  * Channel config which affects behavior during channel lifetime.
17690  */
17691 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17692
17693 /**
17694  * Channel config which affects behavior during channel lifetime.
17695  */
17696 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
17697
17698 /**
17699  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
17700  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
17701  * node which is not online reliably.
17702  *
17703  * For nodes which are not online reliably, you should set all channels to *not* be announced
17704  * (using [`ChannelConfig::announced_channel`] and
17705  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
17706  * ensure you are not exposed to any forwarding risk.
17707  *
17708  * Note that because you cannot change a channel's announced state after creation, there is no
17709  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
17710  * from a publicly-announced forwarding node to a private non-forwarding node you must close
17711  * all your channels and open new ones. For privacy, you should also change your node_id
17712  * (swapping all private and public key material for new ones) at that time.
17713  *
17714  * Default value: false.
17715  */
17716 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17717
17718 /**
17719  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
17720  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
17721  * node which is not online reliably.
17722  *
17723  * For nodes which are not online reliably, you should set all channels to *not* be announced
17724  * (using [`ChannelConfig::announced_channel`] and
17725  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
17726  * ensure you are not exposed to any forwarding risk.
17727  *
17728  * Note that because you cannot change a channel's announced state after creation, there is no
17729  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
17730  * from a publicly-announced forwarding node to a private non-forwarding node you must close
17731  * all your channels and open new ones. For privacy, you should also change your node_id
17732  * (swapping all private and public key material for new ones) at that time.
17733  *
17734  * Default value: false.
17735  */
17736 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17737
17738 /**
17739  * If this is set to false, we do not accept inbound requests to open a new channel.
17740  * Default value: true.
17741  */
17742 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17743
17744 /**
17745  * If this is set to false, we do not accept inbound requests to open a new channel.
17746  * Default value: true.
17747  */
17748 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17749
17750 /**
17751  * If this is set to true, the user needs to manually accept inbound requests to open a new
17752  * channel.
17753  *
17754  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
17755  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
17756  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
17757  * user explicitly chooses to accept the request.
17758  *
17759  * Default value: false.
17760  *
17761  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
17762  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
17763  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
17764  */
17765 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
17766
17767 /**
17768  * If this is set to true, the user needs to manually accept inbound requests to open a new
17769  * channel.
17770  *
17771  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
17772  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
17773  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
17774  * user explicitly chooses to accept the request.
17775  *
17776  * Default value: false.
17777  *
17778  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
17779  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
17780  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
17781  */
17782 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
17783
17784 /**
17785  * Constructs a new UserConfig given each field
17786  */
17787 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);
17788
17789 /**
17790  * Creates a copy of the UserConfig
17791  */
17792 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
17793
17794 /**
17795  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
17796  */
17797 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
17798
17799 /**
17800  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
17801  */
17802 void BestBlock_free(struct LDKBestBlock this_obj);
17803
17804 /**
17805  * Creates a copy of the BestBlock
17806  */
17807 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
17808
17809 /**
17810  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
17811  * network.
17812  */
17813 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
17814
17815 /**
17816  * Returns a `BestBlock` as identified by the given block hash and height.
17817  */
17818 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
17819
17820 /**
17821  * Returns the best block hash.
17822  */
17823 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
17824
17825 /**
17826  * Returns the best block height.
17827  */
17828 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
17829
17830 /**
17831  * Creates a copy of the AccessError
17832  */
17833 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
17834
17835 /**
17836  * Utility method to constructs a new UnknownChain-variant AccessError
17837  */
17838 enum LDKAccessError AccessError_unknown_chain(void);
17839
17840 /**
17841  * Utility method to constructs a new UnknownTx-variant AccessError
17842  */
17843 enum LDKAccessError AccessError_unknown_tx(void);
17844
17845 /**
17846  * Calls the free function if one is set
17847  */
17848 void Access_free(struct LDKAccess this_ptr);
17849
17850 /**
17851  * Calls the free function if one is set
17852  */
17853 void Listen_free(struct LDKListen this_ptr);
17854
17855 /**
17856  * Calls the free function if one is set
17857  */
17858 void Confirm_free(struct LDKConfirm this_ptr);
17859
17860 /**
17861  * Creates a copy of the ChannelMonitorUpdateErr
17862  */
17863 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
17864
17865 /**
17866  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
17867  */
17868 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
17869
17870 /**
17871  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
17872  */
17873 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
17874
17875 /**
17876  * Calls the free function if one is set
17877  */
17878 void Watch_free(struct LDKWatch this_ptr);
17879
17880 /**
17881  * Calls the free function if one is set
17882  */
17883 void Filter_free(struct LDKFilter this_ptr);
17884
17885 /**
17886  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
17887  */
17888 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
17889
17890 /**
17891  * First block where the transaction output may have been spent.
17892  *
17893  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
17894  */
17895 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17896
17897 /**
17898  * First block where the transaction output may have been spent.
17899  *
17900  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
17901  */
17902 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
17903
17904 /**
17905  * Outpoint identifying the transaction output.
17906  */
17907 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17908
17909 /**
17910  * Outpoint identifying the transaction output.
17911  */
17912 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
17913
17914 /**
17915  * Spending condition of the transaction output.
17916  */
17917 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
17918
17919 /**
17920  * Spending condition of the transaction output.
17921  */
17922 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
17923
17924 /**
17925  * Constructs a new WatchedOutput given each field
17926  */
17927 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
17928
17929 /**
17930  * Creates a copy of the WatchedOutput
17931  */
17932 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
17933
17934 /**
17935  * Checks if two WatchedOutputs contain equal inner contents.
17936  */
17937 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
17938
17939 /**
17940  * Calls the free function if one is set
17941  */
17942 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
17943
17944 /**
17945  * Creates a copy of the ConfirmationTarget
17946  */
17947 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
17948
17949 /**
17950  * Utility method to constructs a new Background-variant ConfirmationTarget
17951  */
17952 enum LDKConfirmationTarget ConfirmationTarget_background(void);
17953
17954 /**
17955  * Utility method to constructs a new Normal-variant ConfirmationTarget
17956  */
17957 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
17958
17959 /**
17960  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
17961  */
17962 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
17963
17964 /**
17965  * Checks if two ConfirmationTargets contain equal inner contents.
17966  * This ignores pointers and is_owned flags and looks at the values in fields.
17967  */
17968 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
17969
17970 /**
17971  * Calls the free function if one is set
17972  */
17973 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
17974
17975 /**
17976  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
17977  */
17978 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
17979
17980 /**
17981  * Creates a copy of the MonitorUpdateId
17982  */
17983 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
17984
17985 /**
17986  * Checks if two MonitorUpdateIds contain equal inner contents.
17987  */
17988 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
17989
17990 /**
17991  * Checks if two MonitorUpdateIds contain equal inner contents.
17992  * This ignores pointers and is_owned flags and looks at the values in fields.
17993  * Two objects with NULL inner values will be considered "equal" here.
17994  */
17995 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
17996
17997 /**
17998  * Calls the free function if one is set
17999  */
18000 void Persist_free(struct LDKPersist this_ptr);
18001
18002 /**
18003  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
18004  */
18005 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
18006
18007 /**
18008  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
18009  */
18010 void ChainMonitor_free(struct LDKChainMonitor this_obj);
18011
18012 /**
18013  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
18014  *
18015  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
18016  * will call back to it indicating transactions and outputs of interest. This allows clients to
18017  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
18018  * always need to fetch full blocks absent another means for determining which blocks contain
18019  * transactions relevant to the watched channels.
18020  */
18021 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
18022
18023 /**
18024  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
18025  * claims which are awaiting confirmation.
18026  *
18027  * Includes the balances from each [`ChannelMonitor`] *except* those included in
18028  * `ignored_channels`, allowing you to filter out balances from channels which are still open
18029  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
18030  *
18031  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
18032  * inclusion in the return value.
18033  */
18034 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
18035
18036 /**
18037  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
18038  * such [`ChannelMonitor`] is currently being monitored for.
18039  *
18040  * Note that the result holds a mutex over our monitor set, and should not be held
18041  * indefinitely.
18042  */
18043 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
18044
18045 /**
18046  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
18047  *
18048  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
18049  * monitoring for on-chain state resolutions.
18050  */
18051 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18052
18053 /**
18054  * Indicates the persistence of a [`ChannelMonitor`] has completed after
18055  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
18056  *
18057  * Thus, the anticipated use is, at a high level:
18058  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
18059  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
18060  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
18061  *  2) once all remote copies are updated, you call this function with the
18062  *     `completed_update_id` that completed, and once all pending updates have completed the
18063  *     channel will be re-enabled.
18064  *
18065  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
18066  * registered [`ChannelMonitor`]s.
18067  */
18068 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);
18069
18070 /**
18071  * Constructs a new Listen which calls the relevant methods on this_arg.
18072  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
18073  */
18074 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18075
18076 /**
18077  * Constructs a new Confirm which calls the relevant methods on this_arg.
18078  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
18079  */
18080 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18081
18082 /**
18083  * Constructs a new Watch which calls the relevant methods on this_arg.
18084  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
18085  */
18086 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18087
18088 /**
18089  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
18090  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
18091  */
18092 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18093
18094 /**
18095  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
18096  */
18097 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
18098
18099 /**
18100  * The sequence number of this update. Updates *must* be replayed in-order according to this
18101  * sequence number (and updates may panic if they are not). The update_id values are strictly
18102  * increasing and increase by one for each new update, with one exception specified below.
18103  *
18104  * This sequence number is also used to track up to which points updates which returned
18105  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
18106  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
18107  *
18108  * The only instance where update_id values are not strictly increasing is the case where we
18109  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
18110  * its docs for more details.
18111  */
18112 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
18113
18114 /**
18115  * The sequence number of this update. Updates *must* be replayed in-order according to this
18116  * sequence number (and updates may panic if they are not). The update_id values are strictly
18117  * increasing and increase by one for each new update, with one exception specified below.
18118  *
18119  * This sequence number is also used to track up to which points updates which returned
18120  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
18121  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
18122  *
18123  * The only instance where update_id values are not strictly increasing is the case where we
18124  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
18125  * its docs for more details.
18126  */
18127 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
18128
18129 /**
18130  * Creates a copy of the ChannelMonitorUpdate
18131  */
18132 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
18133
18134 /**
18135  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
18136  */
18137 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
18138
18139 /**
18140  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
18141  */
18142 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
18143
18144 /**
18145  * Frees any resources used by the MonitorEvent
18146  */
18147 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
18148
18149 /**
18150  * Creates a copy of the MonitorEvent
18151  */
18152 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
18153
18154 /**
18155  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
18156  */
18157 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
18158
18159 /**
18160  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
18161  */
18162 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
18163
18164 /**
18165  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
18166  */
18167 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
18168
18169 /**
18170  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
18171  */
18172 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
18173
18174 /**
18175  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
18176  */
18177 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
18178
18179 /**
18180  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
18181  */
18182 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
18183
18184 /**
18185  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
18186  */
18187 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
18188
18189 /**
18190  * Creates a copy of the HTLCUpdate
18191  */
18192 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
18193
18194 /**
18195  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
18196  */
18197 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
18198
18199 /**
18200  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
18201  */
18202 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
18203
18204 /**
18205  * Frees any resources used by the Balance
18206  */
18207 void Balance_free(struct LDKBalance this_ptr);
18208
18209 /**
18210  * Creates a copy of the Balance
18211  */
18212 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
18213
18214 /**
18215  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
18216  */
18217 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
18218
18219 /**
18220  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
18221  */
18222 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
18223
18224 /**
18225  * Utility method to constructs a new ContentiousClaimable-variant Balance
18226  */
18227 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
18228
18229 /**
18230  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
18231  */
18232 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
18233
18234 /**
18235  * Checks if two Balances contain equal inner contents.
18236  * This ignores pointers and is_owned flags and looks at the values in fields.
18237  */
18238 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
18239
18240 /**
18241  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
18242  */
18243 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
18244
18245 /**
18246  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
18247  */
18248 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
18249
18250 /**
18251  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
18252  * itself.
18253  *
18254  * panics if the given update is not the next update by update_id.
18255  */
18256 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);
18257
18258 /**
18259  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
18260  * ChannelMonitor.
18261  */
18262 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18263
18264 /**
18265  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
18266  */
18267 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18268
18269 /**
18270  * Gets a list of txids, with their output scripts (in the order they appear in the
18271  * transaction), which we must learn about spends of via block_connected().
18272  */
18273 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18274
18275 /**
18276  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
18277  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
18278  * have been registered.
18279  */
18280 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
18281
18282 /**
18283  * Get the list of HTLCs who's status has been updated on chain. This should be called by
18284  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
18285  */
18286 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18287
18288 /**
18289  * Gets the list of pending events which were generated by previous actions, clearing the list
18290  * in the process.
18291  *
18292  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
18293  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
18294  * no internal locking in ChannelMonitors.
18295  */
18296 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18297
18298 /**
18299  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
18300  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
18301  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
18302  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
18303  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
18304  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
18305  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
18306  * out-of-band the other node operator to coordinate with him if option is available to you.
18307  * In any-case, choice is up to the user.
18308  */
18309 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);
18310
18311 /**
18312  * Processes transactions in a newly connected block, which may result in any of the following:
18313  * - update the monitor's state against resolved HTLCs
18314  * - punish the counterparty in the case of seeing a revoked commitment transaction
18315  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
18316  * - detect settled outputs for later spending
18317  * - schedule and bump any in-flight claims
18318  *
18319  * Returns any new outputs to watch from `txdata`; after called, these are also included in
18320  * [`get_outputs_to_watch`].
18321  *
18322  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
18323  */
18324 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);
18325
18326 /**
18327  * Determines if the disconnected block contained any transactions of interest and updates
18328  * appropriately.
18329  */
18330 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);
18331
18332 /**
18333  * Processes transactions confirmed in a block with the given header and height, returning new
18334  * outputs to watch. See [`block_connected`] for details.
18335  *
18336  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
18337  * blocks. See [`chain::Confirm`] for calling expectations.
18338  *
18339  * [`block_connected`]: Self::block_connected
18340  */
18341 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);
18342
18343 /**
18344  * Processes a transaction that was reorganized out of the chain.
18345  *
18346  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
18347  * than blocks. See [`chain::Confirm`] for calling expectations.
18348  *
18349  * [`block_disconnected`]: Self::block_disconnected
18350  */
18351 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);
18352
18353 /**
18354  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
18355  * [`block_connected`] for details.
18356  *
18357  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
18358  * blocks. See [`chain::Confirm`] for calling expectations.
18359  *
18360  * [`block_connected`]: Self::block_connected
18361  */
18362 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);
18363
18364 /**
18365  * Returns the set of txids that should be monitored for re-organization out of the chain.
18366  */
18367 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18368
18369 /**
18370  * Gets the latest best block which was connected either via the [`chain::Listen`] or
18371  * [`chain::Confirm`] interfaces.
18372  */
18373 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18374
18375 /**
18376  * Gets the balances in this channel which are either claimable by us if we were to
18377  * force-close the channel now or which are claimable on-chain (possibly awaiting
18378  * confirmation).
18379  *
18380  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
18381  * included here until an [`Event::SpendableOutputs`] event has been generated for the
18382  * balance, or until our counterparty has claimed the balance and accrued several
18383  * confirmations on the claim transaction.
18384  *
18385  * Note that the balances available when you or your counterparty have broadcasted revoked
18386  * state(s) may not be fully captured here.
18387  *
18388  * See [`Balance`] for additional details on the types of claimable balances which
18389  * may be returned here and their meanings.
18390  */
18391 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18392
18393 /**
18394  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
18395  */
18396 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
18397
18398 /**
18399  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
18400  */
18401 void OutPoint_free(struct LDKOutPoint this_obj);
18402
18403 /**
18404  * The referenced transaction's txid.
18405  */
18406 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
18407
18408 /**
18409  * The referenced transaction's txid.
18410  */
18411 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18412
18413 /**
18414  * The index of the referenced output in its transaction's vout.
18415  */
18416 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
18417
18418 /**
18419  * The index of the referenced output in its transaction's vout.
18420  */
18421 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
18422
18423 /**
18424  * Constructs a new OutPoint given each field
18425  */
18426 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
18427
18428 /**
18429  * Creates a copy of the OutPoint
18430  */
18431 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
18432
18433 /**
18434  * Checks if two OutPoints contain equal inner contents.
18435  * This ignores pointers and is_owned flags and looks at the values in fields.
18436  * Two objects with NULL inner values will be considered "equal" here.
18437  */
18438 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
18439
18440 /**
18441  * Checks if two OutPoints contain equal inner contents.
18442  */
18443 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
18444
18445 /**
18446  * Convert an `OutPoint` to a lightning channel id.
18447  */
18448 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
18449
18450 /**
18451  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
18452  */
18453 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
18454
18455 /**
18456  * Read a OutPoint from a byte array, created by OutPoint_write
18457  */
18458 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
18459
18460 /**
18461  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
18462  */
18463 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
18464
18465 /**
18466  * The outpoint which is spendable
18467  */
18468 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18469
18470 /**
18471  * The outpoint which is spendable
18472  */
18473 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18474
18475 /**
18476  * Per commitment point to derive delayed_payment_key by key holder
18477  */
18478 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18479
18480 /**
18481  * Per commitment point to derive delayed_payment_key by key holder
18482  */
18483 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18484
18485 /**
18486  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
18487  * the witness_script.
18488  */
18489 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18490
18491 /**
18492  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
18493  * the witness_script.
18494  */
18495 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
18496
18497 /**
18498  * The output which is referenced by the given outpoint
18499  */
18500 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
18501
18502 /**
18503  * The revocation point specific to the commitment transaction which was broadcast. Used to
18504  * derive the witnessScript for this output.
18505  */
18506 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18507
18508 /**
18509  * The revocation point specific to the commitment transaction which was broadcast. Used to
18510  * derive the witnessScript for this output.
18511  */
18512 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18513
18514 /**
18515  * Arbitrary identification information returned by a call to
18516  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18517  * the channel to spend the output.
18518  */
18519 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
18520
18521 /**
18522  * Arbitrary identification information returned by a call to
18523  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18524  * the channel to spend the output.
18525  */
18526 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18527
18528 /**
18529  * The value of the channel which this output originated from, possibly indirectly.
18530  */
18531 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18532
18533 /**
18534  * The value of the channel which this output originated from, possibly indirectly.
18535  */
18536 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
18537
18538 /**
18539  * Constructs a new DelayedPaymentOutputDescriptor given each field
18540  */
18541 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);
18542
18543 /**
18544  * Creates a copy of the DelayedPaymentOutputDescriptor
18545  */
18546 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
18547
18548 /**
18549  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
18550  */
18551 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
18552
18553 /**
18554  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
18555  */
18556 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
18557
18558 /**
18559  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
18560  */
18561 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
18562
18563 /**
18564  * The outpoint which is spendable
18565  */
18566 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18567
18568 /**
18569  * The outpoint which is spendable
18570  */
18571 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18572
18573 /**
18574  * The output which is referenced by the given outpoint
18575  */
18576 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
18577
18578 /**
18579  * Arbitrary identification information returned by a call to
18580  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18581  * the channel to spend the output.
18582  */
18583 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
18584
18585 /**
18586  * Arbitrary identification information returned by a call to
18587  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18588  * the channel to spend the output.
18589  */
18590 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18591
18592 /**
18593  * The value of the channel which this transactions spends.
18594  */
18595 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18596
18597 /**
18598  * The value of the channel which this transactions spends.
18599  */
18600 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
18601
18602 /**
18603  * Constructs a new StaticPaymentOutputDescriptor given each field
18604  */
18605 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);
18606
18607 /**
18608  * Creates a copy of the StaticPaymentOutputDescriptor
18609  */
18610 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
18611
18612 /**
18613  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
18614  */
18615 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
18616
18617 /**
18618  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
18619  */
18620 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
18621
18622 /**
18623  * Frees any resources used by the SpendableOutputDescriptor
18624  */
18625 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
18626
18627 /**
18628  * Creates a copy of the SpendableOutputDescriptor
18629  */
18630 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
18631
18632 /**
18633  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
18634  */
18635 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
18636
18637 /**
18638  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
18639  */
18640 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
18641
18642 /**
18643  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
18644  */
18645 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
18646
18647 /**
18648  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
18649  */
18650 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
18651
18652 /**
18653  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
18654  */
18655 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
18656
18657 /**
18658  * Calls the free function if one is set
18659  */
18660 void BaseSign_free(struct LDKBaseSign this_ptr);
18661
18662 /**
18663  * Creates a copy of a Sign
18664  */
18665 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
18666
18667 /**
18668  * Calls the free function if one is set
18669  */
18670 void Sign_free(struct LDKSign this_ptr);
18671
18672 /**
18673  * Creates a copy of the Recipient
18674  */
18675 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
18676
18677 /**
18678  * Utility method to constructs a new Node-variant Recipient
18679  */
18680 enum LDKRecipient Recipient_node(void);
18681
18682 /**
18683  * Utility method to constructs a new PhantomNode-variant Recipient
18684  */
18685 enum LDKRecipient Recipient_phantom_node(void);
18686
18687 /**
18688  * Calls the free function if one is set
18689  */
18690 void KeysInterface_free(struct LDKKeysInterface this_ptr);
18691
18692 /**
18693  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
18694  */
18695 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
18696
18697 /**
18698  * Private key of anchor tx
18699  */
18700 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18701
18702 /**
18703  * Private key of anchor tx
18704  */
18705 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18706
18707 /**
18708  * Holder secret key for blinded revocation pubkey
18709  */
18710 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18711
18712 /**
18713  * Holder secret key for blinded revocation pubkey
18714  */
18715 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18716
18717 /**
18718  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
18719  */
18720 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18721
18722 /**
18723  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
18724  */
18725 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18726
18727 /**
18728  * Holder secret key used in HTLC tx
18729  */
18730 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18731
18732 /**
18733  * Holder secret key used in HTLC tx
18734  */
18735 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18736
18737 /**
18738  * Holder htlc secret key used in commitment tx htlc outputs
18739  */
18740 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18741
18742 /**
18743  * Holder htlc secret key used in commitment tx htlc outputs
18744  */
18745 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
18746
18747 /**
18748  * Commitment seed
18749  */
18750 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
18751
18752 /**
18753  * Commitment seed
18754  */
18755 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18756
18757 /**
18758  * Creates a copy of the InMemorySigner
18759  */
18760 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
18761
18762 /**
18763  * Create a new InMemorySigner
18764  */
18765 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);
18766
18767 /**
18768  * Counterparty pubkeys.
18769  * Will panic if ready_channel wasn't called.
18770  */
18771 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18772
18773 /**
18774  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
18775  * transactions, ie the amount of time that we have to wait to recover our funds if we
18776  * broadcast a transaction.
18777  * Will panic if ready_channel wasn't called.
18778  */
18779 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18780
18781 /**
18782  * The contest_delay value specified by us and applied on transactions broadcastable
18783  * by our counterparty, ie the amount of time that they have to wait to recover their funds
18784  * if they broadcast a transaction.
18785  * Will panic if ready_channel wasn't called.
18786  */
18787 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18788
18789 /**
18790  * Whether the holder is the initiator
18791  * Will panic if ready_channel wasn't called.
18792  */
18793 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18794
18795 /**
18796  * Funding outpoint
18797  * Will panic if ready_channel wasn't called.
18798  */
18799 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18800
18801 /**
18802  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
18803  * building transactions.
18804  *
18805  * Will panic if ready_channel wasn't called.
18806  */
18807 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18808
18809 /**
18810  * Whether anchors should be used.
18811  * Will panic if ready_channel wasn't called.
18812  */
18813 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18814
18815 /**
18816  * Sign the single input of spend_tx at index `input_idx` which spends the output
18817  * described by descriptor, returning the witness stack for the input.
18818  *
18819  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
18820  * is not spending the outpoint described by `descriptor.outpoint`,
18821  * or if an output descriptor script_pubkey does not match the one we can spend.
18822  */
18823 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);
18824
18825 /**
18826  * Sign the single input of spend_tx at index `input_idx` which spends the output
18827  * described by descriptor, returning the witness stack for the input.
18828  *
18829  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
18830  * is not spending the outpoint described by `descriptor.outpoint`, does not have a
18831  * sequence set to `descriptor.to_self_delay`, or if an output descriptor
18832  * script_pubkey does not match the one we can spend.
18833  */
18834 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);
18835
18836 /**
18837  * Constructs a new BaseSign which calls the relevant methods on this_arg.
18838  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
18839  */
18840 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18841
18842 /**
18843  * Constructs a new Sign which calls the relevant methods on this_arg.
18844  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
18845  */
18846 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
18847
18848 /**
18849  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
18850  */
18851 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
18852
18853 /**
18854  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
18855  */
18856 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
18857
18858 /**
18859  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
18860  */
18861 void KeysManager_free(struct LDKKeysManager this_obj);
18862
18863 /**
18864  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
18865  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
18866  * starting_time isn't strictly required to actually be a time, but it must absolutely,
18867  * without a doubt, be unique to this instance. ie if you start multiple times with the same
18868  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
18869  * simply use the current time (with very high precision).
18870  *
18871  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
18872  * obviously, starting_time should be unique every time you reload the library - it is only
18873  * used to generate new ephemeral key data (which will be stored by the individual channel if
18874  * necessary).
18875  *
18876  * Note that the seed is required to recover certain on-chain funds independent of
18877  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
18878  * channel, and some on-chain during-closing funds.
18879  *
18880  * Note that until the 0.1 release there is no guarantee of backward compatibility between
18881  * versions. Once the library is more fully supported, the docs will be updated to include a
18882  * detailed description of the guarantee.
18883  */
18884 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
18885
18886 /**
18887  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
18888  *
18889  * Key derivation parameters are accessible through a per-channel secrets
18890  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
18891  * onchain output detection for which a corresponding delayed_payment_key must be derived.
18892  */
18893 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]);
18894
18895 /**
18896  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
18897  * output to the given change destination (if sufficient change value remains). The
18898  * transaction will have a feerate, at least, of the given value.
18899  *
18900  * Returns `Err(())` if the output value is greater than the input value minus required fee,
18901  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
18902  * does not match the one we can spend.
18903  *
18904  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
18905  *
18906  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
18907  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
18908  */
18909 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);
18910
18911 /**
18912  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
18913  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
18914  */
18915 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
18916
18917 /**
18918  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
18919  */
18920 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
18921
18922 /**
18923  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
18924  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
18925  */
18926 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
18927
18928 /**
18929  * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
18930  * that is shared across all nodes that intend to participate in [phantom node payments] together.
18931  *
18932  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
18933  * `starting_time_nanos`.
18934  *
18935  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
18936  * same across restarts, or else inbound payments may fail.
18937  *
18938  * [phantom node payments]: PhantomKeysManager
18939  */
18940 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]);
18941
18942 /**
18943  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
18944  */
18945 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);
18946
18947 /**
18948  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
18949  */
18950 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]);
18951
18952 /**
18953  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
18954  */
18955 void ChannelManager_free(struct LDKChannelManager this_obj);
18956
18957 /**
18958  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
18959  */
18960 void ChainParameters_free(struct LDKChainParameters this_obj);
18961
18962 /**
18963  * The network for determining the `chain_hash` in Lightning messages.
18964  */
18965 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
18966
18967 /**
18968  * The network for determining the `chain_hash` in Lightning messages.
18969  */
18970 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
18971
18972 /**
18973  * The hash and height of the latest block successfully connected.
18974  *
18975  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
18976  */
18977 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
18978
18979 /**
18980  * The hash and height of the latest block successfully connected.
18981  *
18982  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
18983  */
18984 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
18985
18986 /**
18987  * Constructs a new ChainParameters given each field
18988  */
18989 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
18990
18991 /**
18992  * Creates a copy of the ChainParameters
18993  */
18994 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
18995
18996 /**
18997  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
18998  */
18999 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
19000
19001 /**
19002  * Base routing fee in millisatoshis.
19003  */
19004 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19005
19006 /**
19007  * Base routing fee in millisatoshis.
19008  */
19009 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
19010
19011 /**
19012  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
19013  */
19014 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19015
19016 /**
19017  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
19018  */
19019 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
19020
19021 /**
19022  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
19023  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
19024  * `cltv_expiry_delta` for more details.
19025  */
19026 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19027
19028 /**
19029  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
19030  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
19031  * `cltv_expiry_delta` for more details.
19032  */
19033 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
19034
19035 /**
19036  * Constructs a new CounterpartyForwardingInfo given each field
19037  */
19038 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);
19039
19040 /**
19041  * Creates a copy of the CounterpartyForwardingInfo
19042  */
19043 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
19044
19045 /**
19046  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
19047  */
19048 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
19049
19050 /**
19051  * The node_id of our counterparty
19052  */
19053 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19054
19055 /**
19056  * The node_id of our counterparty
19057  */
19058 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19059
19060 /**
19061  * The Features the channel counterparty provided upon last connection.
19062  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
19063  * many routing-relevant features are present in the init context.
19064  */
19065 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19066
19067 /**
19068  * The Features the channel counterparty provided upon last connection.
19069  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
19070  * many routing-relevant features are present in the init context.
19071  */
19072 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
19073
19074 /**
19075  * The value, in satoshis, that must always be held in the channel for our counterparty. This
19076  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
19077  * claiming at least this value on chain.
19078  *
19079  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
19080  *
19081  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
19082  */
19083 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19084
19085 /**
19086  * The value, in satoshis, that must always be held in the channel for our counterparty. This
19087  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
19088  * claiming at least this value on chain.
19089  *
19090  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
19091  *
19092  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
19093  */
19094 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
19095
19096 /**
19097  * Information on the fees and requirements that the counterparty requires when forwarding
19098  * payments to us through this channel.
19099  *
19100  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19101  */
19102 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19103
19104 /**
19105  * Information on the fees and requirements that the counterparty requires when forwarding
19106  * payments to us through this channel.
19107  *
19108  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19109  */
19110 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
19111
19112 /**
19113  * Constructs a new ChannelCounterparty given each field
19114  */
19115 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);
19116
19117 /**
19118  * Creates a copy of the ChannelCounterparty
19119  */
19120 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
19121
19122 /**
19123  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
19124  */
19125 void ChannelDetails_free(struct LDKChannelDetails this_obj);
19126
19127 /**
19128  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
19129  * thereafter this is the txid of the funding transaction xor the funding transaction output).
19130  * Note that this means this value is *not* persistent - it can change once during the
19131  * lifetime of the channel.
19132  */
19133 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
19134
19135 /**
19136  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
19137  * thereafter this is the txid of the funding transaction xor the funding transaction output).
19138  * Note that this means this value is *not* persistent - it can change once during the
19139  * lifetime of the channel.
19140  */
19141 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19142
19143 /**
19144  * Parameters which apply to our counterparty. See individual fields for more information.
19145  */
19146 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19147
19148 /**
19149  * Parameters which apply to our counterparty. See individual fields for more information.
19150  */
19151 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
19152
19153 /**
19154  * The Channel's funding transaction output, if we've negotiated the funding transaction with
19155  * our counterparty already.
19156  *
19157  * Note that, if this has been set, `channel_id` will be equivalent to
19158  * `funding_txo.unwrap().to_channel_id()`.
19159  *
19160  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19161  */
19162 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19163
19164 /**
19165  * The Channel's funding transaction output, if we've negotiated the funding transaction with
19166  * our counterparty already.
19167  *
19168  * Note that, if this has been set, `channel_id` will be equivalent to
19169  * `funding_txo.unwrap().to_channel_id()`.
19170  *
19171  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19172  */
19173 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19174
19175 /**
19176  * The features which this channel operates with. See individual features for more info.
19177  *
19178  * `None` until negotiation completes and the channel type is finalized.
19179  *
19180  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19181  */
19182 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19183
19184 /**
19185  * The features which this channel operates with. See individual features for more info.
19186  *
19187  * `None` until negotiation completes and the channel type is finalized.
19188  *
19189  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19190  */
19191 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
19192
19193 /**
19194  * The position of the funding transaction in the chain. None if the funding transaction has
19195  * not yet been confirmed and the channel fully opened.
19196  *
19197  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
19198  * payments instead of this. See [`get_inbound_payment_scid`].
19199  *
19200  * [`inbound_scid_alias`]: Self::inbound_scid_alias
19201  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
19202  */
19203 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19204
19205 /**
19206  * The position of the funding transaction in the chain. None if the funding transaction has
19207  * not yet been confirmed and the channel fully opened.
19208  *
19209  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
19210  * payments instead of this. See [`get_inbound_payment_scid`].
19211  *
19212  * [`inbound_scid_alias`]: Self::inbound_scid_alias
19213  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
19214  */
19215 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19216
19217 /**
19218  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
19219  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
19220  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
19221  * when they see a payment to be routed to us.
19222  *
19223  * Our counterparty may choose to rotate this value at any time, though will always recognize
19224  * previous values for inbound payment forwarding.
19225  *
19226  * [`short_channel_id`]: Self::short_channel_id
19227  */
19228 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19229
19230 /**
19231  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
19232  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
19233  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
19234  * when they see a payment to be routed to us.
19235  *
19236  * Our counterparty may choose to rotate this value at any time, though will always recognize
19237  * previous values for inbound payment forwarding.
19238  *
19239  * [`short_channel_id`]: Self::short_channel_id
19240  */
19241 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19242
19243 /**
19244  * The value, in satoshis, of this channel as appears in the funding output
19245  */
19246 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19247
19248 /**
19249  * The value, in satoshis, of this channel as appears in the funding output
19250  */
19251 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19252
19253 /**
19254  * The value, in satoshis, that must always be held in the channel for us. This value ensures
19255  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
19256  * this value on chain.
19257  *
19258  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
19259  *
19260  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19261  *
19262  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
19263  */
19264 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19265
19266 /**
19267  * The value, in satoshis, that must always be held in the channel for us. This value ensures
19268  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
19269  * this value on chain.
19270  *
19271  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
19272  *
19273  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19274  *
19275  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
19276  */
19277 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19278
19279 /**
19280  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
19281  */
19282 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19283
19284 /**
19285  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
19286  */
19287 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19288
19289 /**
19290  * Our total balance.  This is the amount we would get if we close the channel.
19291  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
19292  * amount is not likely to be recoverable on close.
19293  *
19294  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
19295  * balance is not available for inclusion in new outbound HTLCs). This further does not include
19296  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
19297  * This does not consider any on-chain fees.
19298  *
19299  * See also [`ChannelDetails::outbound_capacity_msat`]
19300  */
19301 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19302
19303 /**
19304  * Our total balance.  This is the amount we would get if we close the channel.
19305  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
19306  * amount is not likely to be recoverable on close.
19307  *
19308  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
19309  * balance is not available for inclusion in new outbound HTLCs). This further does not include
19310  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
19311  * This does not consider any on-chain fees.
19312  *
19313  * See also [`ChannelDetails::outbound_capacity_msat`]
19314  */
19315 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19316
19317 /**
19318  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
19319  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19320  * available for inclusion in new outbound HTLCs). This further does not include any pending
19321  * outgoing HTLCs which are awaiting some other resolution to be sent.
19322  *
19323  * See also [`ChannelDetails::balance_msat`]
19324  *
19325  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19326  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
19327  * should be able to spend nearly this amount.
19328  */
19329 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19330
19331 /**
19332  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
19333  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19334  * available for inclusion in new outbound HTLCs). This further does not include any pending
19335  * outgoing HTLCs which are awaiting some other resolution to be sent.
19336  *
19337  * See also [`ChannelDetails::balance_msat`]
19338  *
19339  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19340  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
19341  * should be able to spend nearly this amount.
19342  */
19343 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19344
19345 /**
19346  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
19347  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19348  * available for inclusion in new inbound HTLCs).
19349  * Note that there are some corner cases not fully handled here, so the actual available
19350  * inbound capacity may be slightly higher than this.
19351  *
19352  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19353  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
19354  * However, our counterparty should be able to spend nearly this amount.
19355  */
19356 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19357
19358 /**
19359  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
19360  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19361  * available for inclusion in new inbound HTLCs).
19362  * Note that there are some corner cases not fully handled here, so the actual available
19363  * inbound capacity may be slightly higher than this.
19364  *
19365  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19366  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
19367  * However, our counterparty should be able to spend nearly this amount.
19368  */
19369 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19370
19371 /**
19372  * The number of required confirmations on the funding transaction before the funding will be
19373  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
19374  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
19375  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
19376  * [`ChannelHandshakeLimits::max_minimum_depth`].
19377  *
19378  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19379  *
19380  * [`is_outbound`]: ChannelDetails::is_outbound
19381  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
19382  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
19383  */
19384 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19385
19386 /**
19387  * The number of required confirmations on the funding transaction before the funding will be
19388  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
19389  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
19390  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
19391  * [`ChannelHandshakeLimits::max_minimum_depth`].
19392  *
19393  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19394  *
19395  * [`is_outbound`]: ChannelDetails::is_outbound
19396  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
19397  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
19398  */
19399 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
19400
19401 /**
19402  * The number of blocks (after our commitment transaction confirms) that we will need to wait
19403  * until we can claim our funds after we force-close the channel. During this time our
19404  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
19405  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
19406  * time to claim our non-HTLC-encumbered funds.
19407  *
19408  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19409  */
19410 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19411
19412 /**
19413  * The number of blocks (after our commitment transaction confirms) that we will need to wait
19414  * until we can claim our funds after we force-close the channel. During this time our
19415  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
19416  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
19417  * time to claim our non-HTLC-encumbered funds.
19418  *
19419  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19420  */
19421 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
19422
19423 /**
19424  * True if the channel was initiated (and thus funded) by us.
19425  */
19426 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19427
19428 /**
19429  * True if the channel was initiated (and thus funded) by us.
19430  */
19431 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19432
19433 /**
19434  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
19435  * channel is not currently being shut down. `funding_locked` message exchange implies the
19436  * required confirmation count has been reached (and we were connected to the peer at some
19437  * point after the funding transaction received enough confirmations). The required
19438  * confirmation count is provided in [`confirmations_required`].
19439  *
19440  * [`confirmations_required`]: ChannelDetails::confirmations_required
19441  */
19442 bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19443
19444 /**
19445  * True if the channel is confirmed, funding_locked messages have been exchanged, and the
19446  * channel is not currently being shut down. `funding_locked` message exchange implies the
19447  * required confirmation count has been reached (and we were connected to the peer at some
19448  * point after the funding transaction received enough confirmations). The required
19449  * confirmation count is provided in [`confirmations_required`].
19450  *
19451  * [`confirmations_required`]: ChannelDetails::confirmations_required
19452  */
19453 void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19454
19455 /**
19456  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
19457  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
19458  *
19459  * This is a strict superset of `is_funding_locked`.
19460  */
19461 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19462
19463 /**
19464  * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
19465  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
19466  *
19467  * This is a strict superset of `is_funding_locked`.
19468  */
19469 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19470
19471 /**
19472  * True if this channel is (or will be) publicly-announced.
19473  */
19474 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19475
19476 /**
19477  * True if this channel is (or will be) publicly-announced.
19478  */
19479 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19480
19481 /**
19482  * Constructs a new ChannelDetails given each field
19483  */
19484 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg);
19485
19486 /**
19487  * Creates a copy of the ChannelDetails
19488  */
19489 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
19490
19491 /**
19492  * Gets the current SCID which should be used to identify this channel for inbound payments.
19493  * This should be used for providing invoice hints or in any other context where our
19494  * counterparty will forward a payment to us.
19495  *
19496  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
19497  * [`ChannelDetails::short_channel_id`]. See those for more information.
19498  */
19499 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
19500
19501 /**
19502  * Frees any resources used by the PaymentSendFailure
19503  */
19504 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
19505
19506 /**
19507  * Creates a copy of the PaymentSendFailure
19508  */
19509 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
19510
19511 /**
19512  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
19513  */
19514 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
19515
19516 /**
19517  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
19518  */
19519 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
19520
19521 /**
19522  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
19523  */
19524 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
19525
19526 /**
19527  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
19528  */
19529 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
19530
19531 /**
19532  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
19533  */
19534 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
19535
19536 /**
19537  * The list of channels to be included in the invoice route hints.
19538  */
19539 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19540
19541 /**
19542  * The list of channels to be included in the invoice route hints.
19543  */
19544 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
19545
19546 /**
19547  * A fake scid used for representing the phantom node's fake channel in generating the invoice
19548  * route hints.
19549  */
19550 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19551
19552 /**
19553  * A fake scid used for representing the phantom node's fake channel in generating the invoice
19554  * route hints.
19555  */
19556 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
19557
19558 /**
19559  * The pubkey of the real backing node that would ultimately receive the payment.
19560  */
19561 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
19562
19563 /**
19564  * The pubkey of the real backing node that would ultimately receive the payment.
19565  */
19566 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19567
19568 /**
19569  * Constructs a new PhantomRouteHints given each field
19570  */
19571 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
19572
19573 /**
19574  * Creates a copy of the PhantomRouteHints
19575  */
19576 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
19577
19578 /**
19579  * Constructs a new ChannelManager to hold several channels and route between them.
19580  *
19581  * This is the main \"logic hub\" for all channel-related actions, and implements
19582  * ChannelMessageHandler.
19583  *
19584  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
19585  *
19586  * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`!
19587  *
19588  * Users need to notify the new ChannelManager when a new block is connected or
19589  * disconnected using its `block_connected` and `block_disconnected` methods, starting
19590  * from after `params.latest_hash`.
19591  */
19592 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);
19593
19594 /**
19595  * Gets the current configuration applied to all new channels,  as
19596  */
19597 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
19598
19599 /**
19600  * Creates a new outbound channel to the given remote node and with the given value.
19601  *
19602  * `user_channel_id` will be provided back as in
19603  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
19604  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
19605  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
19606  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
19607  * ignored.
19608  *
19609  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
19610  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
19611  *
19612  * Note that we do not check if you are currently connected to the given peer. If no
19613  * connection is available, the outbound `open_channel` message may fail to send, resulting in
19614  * the channel eventually being silently forgotten (dropped on reload).
19615  *
19616  * Returns the new Channel's temporary `channel_id`. This ID will appear as
19617  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
19618  * [`ChannelDetails::channel_id`] until after
19619  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
19620  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
19621  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
19622  *
19623  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
19624  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
19625  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
19626  *
19627  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
19628  */
19629 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);
19630
19631 /**
19632  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
19633  * more information.
19634  */
19635 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19636
19637 /**
19638  * Gets the list of usable channels, in random order. Useful as an argument to
19639  * get_route to ensure non-announced channels are used.
19640  *
19641  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
19642  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
19643  * are.
19644  */
19645 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19646
19647 /**
19648  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
19649  * will be accepted on the given channel, and after additional timeout/the closing of all
19650  * pending HTLCs, the channel will be closed on chain.
19651  *
19652  *  * If we are the channel initiator, we will pay between our [`Background`] and
19653  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
19654  *    estimate.
19655  *  * If our counterparty is the channel initiator, we will require a channel closing
19656  *    transaction feerate of at least our [`Background`] feerate or the feerate which
19657  *    would appear on a force-closure transaction, whichever is lower. We will allow our
19658  *    counterparty to pay as much fee as they'd like, however.
19659  *
19660  * May generate a SendShutdown message event on success, which should be relayed.
19661  *
19662  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
19663  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
19664  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
19665  */
19666 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
19667
19668 /**
19669  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
19670  * will be accepted on the given channel, and after additional timeout/the closing of all
19671  * pending HTLCs, the channel will be closed on chain.
19672  *
19673  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
19674  * the channel being closed or not:
19675  *  * If we are the channel initiator, we will pay at least this feerate on the closing
19676  *    transaction. The upper-bound is set by
19677  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
19678  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
19679  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
19680  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
19681  *    will appear on a force-closure transaction, whichever is lower).
19682  *
19683  * May generate a SendShutdown message event on success, which should be relayed.
19684  *
19685  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
19686  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
19687  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
19688  */
19689 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);
19690
19691 /**
19692  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
19693  * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
19694  */
19695 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
19696
19697 /**
19698  * Force close all channels, immediately broadcasting the latest local commitment transaction
19699  * for each to the chain and rejecting new HTLCs on each.
19700  */
19701 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
19702
19703 /**
19704  * Sends a payment along a given route.
19705  *
19706  * Value parameters are provided via the last hop in route, see documentation for RouteHop
19707  * fields for more info.
19708  *
19709  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
19710  * payment), we don't do anything to stop you! We always try to ensure that if the provided
19711  * next hop knows the preimage to payment_hash they can claim an additional amount as
19712  * specified in the last hop in the route! Thus, you should probably do your own
19713  * payment_preimage tracking (which you should already be doing as they represent \"proof of
19714  * payment\") and prevent double-sends yourself.
19715  *
19716  * May generate SendHTLCs message(s) event on success, which should be relayed.
19717  *
19718  * Each path may have a different return value, and PaymentSendValue may return a Vec with
19719  * each entry matching the corresponding-index entry in the route paths, see
19720  * PaymentSendFailure for more info.
19721  *
19722  * In general, a path may raise:
19723  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
19724  *    node public key) is specified.
19725  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
19726  *    (including due to previous monitor update failure or new permanent monitor update
19727  *    failure).
19728  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
19729  *    relevant updates.
19730  *
19731  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
19732  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
19733  * different route unless you intend to pay twice!
19734  *
19735  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
19736  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
19737  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
19738  * must not contain multiple paths as multi-path payments require a recipient-provided
19739  * payment_secret.
19740  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
19741  * bit set (either as required or as available). If multiple paths are present in the Route,
19742  * we assume the invoice had the basic_mpp feature set.
19743  *
19744  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
19745  */
19746 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);
19747
19748 /**
19749  * Retries a payment along the given [`Route`].
19750  *
19751  * Errors returned are a superset of those returned from [`send_payment`], so see
19752  * [`send_payment`] documentation for more details on errors. This method will also error if the
19753  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
19754  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
19755  * further retries have been disabled with [`abandon_payment`].
19756  *
19757  * [`send_payment`]: [`ChannelManager::send_payment`]
19758  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
19759  */
19760 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);
19761
19762 /**
19763  * Signals that no further retries for the given payment will occur.
19764  *
19765  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
19766  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
19767  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
19768  * pending HTLCs for this payment.
19769  *
19770  * Note that calling this method does *not* prevent a payment from succeeding. You must still
19771  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
19772  * determine the ultimate status of a payment.
19773  *
19774  * [`retry_payment`]: Self::retry_payment
19775  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
19776  * [`Event::PaymentSent`]: events::Event::PaymentSent
19777  */
19778 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
19779
19780 /**
19781  * Send a spontaneous payment, which is a payment that does not require the recipient to have
19782  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
19783  * the preimage, it must be a cryptographically secure random value that no intermediate node
19784  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
19785  * never reach the recipient.
19786  *
19787  * See [`send_payment`] documentation for more details on the return value of this function.
19788  *
19789  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
19790  * [`send_payment`] for more information about the risks of duplicate preimage usage.
19791  *
19792  * Note that `route` must have exactly one path.
19793  *
19794  * [`send_payment`]: Self::send_payment
19795  *
19796  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
19797  */
19798 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);
19799
19800 /**
19801  * Call this upon creation of a funding transaction for the given channel.
19802  *
19803  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
19804  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
19805  *
19806  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
19807  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
19808  *
19809  * May panic if the output found in the funding transaction is duplicative with some other
19810  * channel (note that this should be trivially prevented by using unique funding transaction
19811  * keys per-channel).
19812  *
19813  * Do NOT broadcast the funding transaction yourself. When we have safely received our
19814  * counterparty's signature the funding transaction will automatically be broadcast via the
19815  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
19816  *
19817  * Note that this includes RBF or similar transaction replacement strategies - lightning does
19818  * not currently support replacing a funding transaction on an existing channel. Instead,
19819  * create a new channel with a conflicting funding transaction.
19820  *
19821  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
19822  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
19823  */
19824 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);
19825
19826 /**
19827  * Regenerates channel_announcements and generates a signed node_announcement from the given
19828  * arguments, providing them in corresponding events via
19829  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
19830  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
19831  * announcement to ensure that the lightning P2P network is aware of the channels we have and
19832  * our network addresses.
19833  *
19834  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
19835  * node to humans. They carry no in-protocol meaning.
19836  *
19837  * `addresses` represent the set (possibly empty) of socket addresses on which this node
19838  * accepts incoming connections. These will be included in the node_announcement, publicly
19839  * tying these addresses together and to this node. If you wish to preserve user privacy,
19840  * addresses should likely contain only Tor Onion addresses.
19841  *
19842  * Panics if `addresses` is absurdly large (more than 500).
19843  *
19844  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
19845  */
19846 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
19847
19848 /**
19849  * Processes HTLCs which are pending waiting on random forward delay.
19850  *
19851  * Should only really ever be called in response to a PendingHTLCsForwardable event.
19852  * Will likely generate further events.
19853  */
19854 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
19855
19856 /**
19857  * Performs actions which should happen on startup and roughly once per minute thereafter.
19858  *
19859  * This currently includes:
19860  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
19861  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
19862  *    than a minute, informing the network that they should no longer attempt to route over
19863  *    the channel.
19864  *
19865  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
19866  * estimate fetches.
19867  */
19868 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
19869
19870 /**
19871  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
19872  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
19873  * along the path (including in our own channel on which we received it).
19874  * Returns false if no payment was found to fail backwards, true if the process of failing the
19875  * HTLC backwards has been started.
19876  */
19877 MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
19878
19879 /**
19880  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
19881  * [`MessageSendEvent`]s needed to claim the payment.
19882  *
19883  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
19884  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
19885  * event matches your expectation. If you fail to do so and call this method, you may provide
19886  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
19887  *
19888  * Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now
19889  * pending for processing via [`get_and_clear_pending_msg_events`].
19890  *
19891  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
19892  * [`create_inbound_payment`]: Self::create_inbound_payment
19893  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19894  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
19895  */
19896 MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
19897
19898 /**
19899  * Gets the node_id held by this ChannelManager
19900  */
19901 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
19902
19903 /**
19904  * Called to accept a request to open a channel after [`Event::OpenChannelRequest`] has been
19905  * triggered.
19906  *
19907  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted.
19908  *
19909  * For inbound channels, the `user_channel_id` parameter will be provided back in
19910  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
19911  * with which `accept_inbound_channel` call.
19912  *
19913  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
19914  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
19915  */
19916 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], uint64_t user_channel_id);
19917
19918 /**
19919  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
19920  * to pay us.
19921  *
19922  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
19923  * [`PaymentHash`] and [`PaymentPreimage`] for you.
19924  *
19925  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
19926  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
19927  * passed directly to [`claim_funds`].
19928  *
19929  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
19930  *
19931  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
19932  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
19933  *
19934  * # Note
19935  *
19936  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
19937  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
19938  *
19939  * Errors if `min_value_msat` is greater than total bitcoin supply.
19940  *
19941  * [`claim_funds`]: Self::claim_funds
19942  * [`PaymentReceived`]: events::Event::PaymentReceived
19943  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
19944  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
19945  */
19946 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);
19947
19948 /**
19949  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
19950  * serialized state with LDK node(s) running 0.0.103 and earlier.
19951  *
19952  * May panic if `invoice_expiry_delta_secs` is greater than one year.
19953  *
19954  * # Note
19955  * This method is deprecated and will be removed soon.
19956  *
19957  * [`create_inbound_payment`]: Self::create_inbound_payment
19958  */
19959 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);
19960
19961 /**
19962  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
19963  * stored external to LDK.
19964  *
19965  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
19966  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
19967  * the `min_value_msat` provided here, if one is provided.
19968  *
19969  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
19970  * note that LDK will not stop you from registering duplicate payment hashes for inbound
19971  * payments.
19972  *
19973  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
19974  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
19975  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
19976  * sender \"proof-of-payment\" unless they have paid the required amount.
19977  *
19978  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
19979  * in excess of the current time. This should roughly match the expiry time set in the invoice.
19980  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
19981  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
19982  * invoices when no timeout is set.
19983  *
19984  * Note that we use block header time to time-out pending inbound payments (with some margin
19985  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
19986  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
19987  * If you need exact expiry semantics, you should enforce them upon receipt of
19988  * [`PaymentReceived`].
19989  *
19990  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
19991  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
19992  *
19993  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
19994  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
19995  *
19996  * # Note
19997  *
19998  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
19999  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
20000  *
20001  * Errors if `min_value_msat` is greater than total bitcoin supply.
20002  *
20003  * [`create_inbound_payment`]: Self::create_inbound_payment
20004  * [`PaymentReceived`]: events::Event::PaymentReceived
20005  */
20006 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);
20007
20008 /**
20009  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
20010  * serialized state with LDK node(s) running 0.0.103 and earlier.
20011  *
20012  * May panic if `invoice_expiry_delta_secs` is greater than one year.
20013  *
20014  * # Note
20015  * This method is deprecated and will be removed soon.
20016  *
20017  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
20018  */
20019 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);
20020
20021 /**
20022  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
20023  * previously returned from [`create_inbound_payment`].
20024  *
20025  * [`create_inbound_payment`]: Self::create_inbound_payment
20026  */
20027 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);
20028
20029 /**
20030  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
20031  * are used when constructing the phantom invoice's route hints.
20032  *
20033  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20034  */
20035 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
20036
20037 /**
20038  * Gets route hints for use in receiving [phantom node payments].
20039  *
20040  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20041  */
20042 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
20043
20044 /**
20045  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
20046  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
20047  */
20048 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
20049
20050 /**
20051  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
20052  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
20053  */
20054 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
20055
20056 /**
20057  * Constructs a new Listen which calls the relevant methods on this_arg.
20058  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
20059  */
20060 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
20061
20062 /**
20063  * Constructs a new Confirm which calls the relevant methods on this_arg.
20064  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
20065  */
20066 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
20067
20068 /**
20069  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
20070  * indicating whether persistence is necessary. Only one listener on
20071  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
20072  * up.
20073  *
20074  * Note that this method is not available with the `no-std` feature.
20075  */
20076 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
20077
20078 /**
20079  * Blocks until ChannelManager needs to be persisted. Only one listener on
20080  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
20081  * up.
20082  */
20083 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
20084
20085 /**
20086  * Gets the latest best block which was connected either via the [`chain::Listen`] or
20087  * [`chain::Confirm`] interfaces.
20088  */
20089 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
20090
20091 /**
20092  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
20093  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
20094  */
20095 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
20096
20097 /**
20098  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
20099  */
20100 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
20101
20102 /**
20103  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
20104  */
20105 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
20106
20107 /**
20108  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
20109  */
20110 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
20111
20112 /**
20113  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
20114  */
20115 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
20116
20117 /**
20118  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
20119  */
20120 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
20121
20122 /**
20123  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
20124  */
20125 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
20126
20127 /**
20128  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
20129  */
20130 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
20131
20132 /**
20133  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
20134  */
20135 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
20136
20137 /**
20138  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
20139  */
20140 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
20141
20142 /**
20143  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
20144  */
20145 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
20146
20147 /**
20148  * The keys provider which will give us relevant keys. Some keys will be loaded during
20149  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
20150  * signing data.
20151  */
20152 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20153
20154 /**
20155  * The keys provider which will give us relevant keys. Some keys will be loaded during
20156  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
20157  * signing data.
20158  */
20159 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
20160
20161 /**
20162  * The fee_estimator for use in the ChannelManager in the future.
20163  *
20164  * No calls to the FeeEstimator will be made during deserialization.
20165  */
20166 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20167
20168 /**
20169  * The fee_estimator for use in the ChannelManager in the future.
20170  *
20171  * No calls to the FeeEstimator will be made during deserialization.
20172  */
20173 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
20174
20175 /**
20176  * The chain::Watch for use in the ChannelManager in the future.
20177  *
20178  * No calls to the chain::Watch will be made during deserialization. It is assumed that
20179  * you have deserialized ChannelMonitors separately and will add them to your
20180  * chain::Watch after deserializing this ChannelManager.
20181  */
20182 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20183
20184 /**
20185  * The chain::Watch for use in the ChannelManager in the future.
20186  *
20187  * No calls to the chain::Watch will be made during deserialization. It is assumed that
20188  * you have deserialized ChannelMonitors separately and will add them to your
20189  * chain::Watch after deserializing this ChannelManager.
20190  */
20191 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
20192
20193 /**
20194  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
20195  * used to broadcast the latest local commitment transactions of channels which must be
20196  * force-closed during deserialization.
20197  */
20198 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20199
20200 /**
20201  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
20202  * used to broadcast the latest local commitment transactions of channels which must be
20203  * force-closed during deserialization.
20204  */
20205 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
20206
20207 /**
20208  * The Logger for use in the ChannelManager and which may be used to log information during
20209  * deserialization.
20210  */
20211 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20212
20213 /**
20214  * The Logger for use in the ChannelManager and which may be used to log information during
20215  * deserialization.
20216  */
20217 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
20218
20219 /**
20220  * Default settings used for new channels. Any existing channels will continue to use the
20221  * runtime settings which were stored when the ChannelManager was serialized.
20222  */
20223 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20224
20225 /**
20226  * Default settings used for new channels. Any existing channels will continue to use the
20227  * runtime settings which were stored when the ChannelManager was serialized.
20228  */
20229 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
20230
20231 /**
20232  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
20233  * HashMap for you. This is primarily useful for C bindings where it is not practical to
20234  * populate a HashMap directly from C.
20235  */
20236 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);
20237
20238 /**
20239  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
20240  */
20241 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
20242
20243 /**
20244  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
20245  */
20246 void DecodeError_free(struct LDKDecodeError this_obj);
20247
20248 /**
20249  * Creates a copy of the DecodeError
20250  */
20251 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
20252
20253 /**
20254  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
20255  */
20256 void Init_free(struct LDKInit this_obj);
20257
20258 /**
20259  * The relevant features which the sender supports
20260  */
20261 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
20262
20263 /**
20264  * The relevant features which the sender supports
20265  */
20266 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
20267
20268 /**
20269  * The receipient's network address. This adds the option to report a remote IP address
20270  * back to a connecting peer using the init message. A node can decide to use that information
20271  * to discover a potential update to its public IPv4 address (NAT) and use
20272  * that for a node_announcement update message containing the new address.
20273  */
20274 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
20275
20276 /**
20277  * The receipient's network address. This adds the option to report a remote IP address
20278  * back to a connecting peer using the init message. A node can decide to use that information
20279  * to discover a potential update to its public IPv4 address (NAT) and use
20280  * that for a node_announcement update message containing the new address.
20281  */
20282 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
20283
20284 /**
20285  * Constructs a new Init given each field
20286  */
20287 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
20288
20289 /**
20290  * Creates a copy of the Init
20291  */
20292 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
20293
20294 /**
20295  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
20296  */
20297 void ErrorMessage_free(struct LDKErrorMessage this_obj);
20298
20299 /**
20300  * The channel ID involved in the error.
20301  *
20302  * All-0s indicates a general error unrelated to a specific channel, after which all channels
20303  * with the sending peer should be closed.
20304  */
20305 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
20306
20307 /**
20308  * The channel ID involved in the error.
20309  *
20310  * All-0s indicates a general error unrelated to a specific channel, after which all channels
20311  * with the sending peer should be closed.
20312  */
20313 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20314
20315 /**
20316  * A possibly human-readable error description.
20317  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20318  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20319  * the terminal emulator or the logging subsystem.
20320  */
20321 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
20322
20323 /**
20324  * A possibly human-readable error description.
20325  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20326  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20327  * the terminal emulator or the logging subsystem.
20328  */
20329 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
20330
20331 /**
20332  * Constructs a new ErrorMessage given each field
20333  */
20334 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
20335
20336 /**
20337  * Creates a copy of the ErrorMessage
20338  */
20339 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
20340
20341 /**
20342  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
20343  */
20344 void WarningMessage_free(struct LDKWarningMessage this_obj);
20345
20346 /**
20347  * The channel ID involved in the warning.
20348  *
20349  * All-0s indicates a warning unrelated to a specific channel.
20350  */
20351 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
20352
20353 /**
20354  * The channel ID involved in the warning.
20355  *
20356  * All-0s indicates a warning unrelated to a specific channel.
20357  */
20358 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20359
20360 /**
20361  * A possibly human-readable warning description.
20362  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20363  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20364  * the terminal emulator or the logging subsystem.
20365  */
20366 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
20367
20368 /**
20369  * A possibly human-readable warning description.
20370  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20371  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20372  * the terminal emulator or the logging subsystem.
20373  */
20374 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
20375
20376 /**
20377  * Constructs a new WarningMessage given each field
20378  */
20379 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
20380
20381 /**
20382  * Creates a copy of the WarningMessage
20383  */
20384 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
20385
20386 /**
20387  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
20388  */
20389 void Ping_free(struct LDKPing this_obj);
20390
20391 /**
20392  * The desired response length
20393  */
20394 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
20395
20396 /**
20397  * The desired response length
20398  */
20399 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
20400
20401 /**
20402  * The ping packet size.
20403  * This field is not sent on the wire. byteslen zeros are sent.
20404  */
20405 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
20406
20407 /**
20408  * The ping packet size.
20409  * This field is not sent on the wire. byteslen zeros are sent.
20410  */
20411 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
20412
20413 /**
20414  * Constructs a new Ping given each field
20415  */
20416 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
20417
20418 /**
20419  * Creates a copy of the Ping
20420  */
20421 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
20422
20423 /**
20424  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
20425  */
20426 void Pong_free(struct LDKPong this_obj);
20427
20428 /**
20429  * The pong packet size.
20430  * This field is not sent on the wire. byteslen zeros are sent.
20431  */
20432 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
20433
20434 /**
20435  * The pong packet size.
20436  * This field is not sent on the wire. byteslen zeros are sent.
20437  */
20438 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
20439
20440 /**
20441  * Constructs a new Pong given each field
20442  */
20443 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
20444
20445 /**
20446  * Creates a copy of the Pong
20447  */
20448 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
20449
20450 /**
20451  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
20452  */
20453 void OpenChannel_free(struct LDKOpenChannel this_obj);
20454
20455 /**
20456  * The genesis hash of the blockchain where the channel is to be opened
20457  */
20458 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
20459
20460 /**
20461  * The genesis hash of the blockchain where the channel is to be opened
20462  */
20463 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20464
20465 /**
20466  * A temporary channel ID, until the funding outpoint is announced
20467  */
20468 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
20469
20470 /**
20471  * A temporary channel ID, until the funding outpoint is announced
20472  */
20473 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20474
20475 /**
20476  * The channel value
20477  */
20478 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20479
20480 /**
20481  * The channel value
20482  */
20483 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20484
20485 /**
20486  * The amount to push to the counterparty as part of the open, in milli-satoshi
20487  */
20488 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20489
20490 /**
20491  * The amount to push to the counterparty as part of the open, in milli-satoshi
20492  */
20493 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20494
20495 /**
20496  * The threshold below which outputs on transactions broadcast by sender will be omitted
20497  */
20498 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20499
20500 /**
20501  * The threshold below which outputs on transactions broadcast by sender will be omitted
20502  */
20503 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20504
20505 /**
20506  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20507  */
20508 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20509
20510 /**
20511  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20512  */
20513 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20514
20515 /**
20516  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20517  */
20518 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20519
20520 /**
20521  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20522  */
20523 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20524
20525 /**
20526  * The minimum HTLC size incoming to sender, in milli-satoshi
20527  */
20528 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20529
20530 /**
20531  * The minimum HTLC size incoming to sender, in milli-satoshi
20532  */
20533 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
20534
20535 /**
20536  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
20537  */
20538 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20539
20540 /**
20541  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
20542  */
20543 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
20544
20545 /**
20546  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20547  */
20548 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20549
20550 /**
20551  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20552  */
20553 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
20554
20555 /**
20556  * The maximum number of inbound HTLCs towards sender
20557  */
20558 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20559
20560 /**
20561  * The maximum number of inbound HTLCs towards sender
20562  */
20563 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
20564
20565 /**
20566  * The sender's key controlling the funding transaction
20567  */
20568 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20569
20570 /**
20571  * The sender's key controlling the funding transaction
20572  */
20573 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20574
20575 /**
20576  * Used to derive a revocation key for transactions broadcast by counterparty
20577  */
20578 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20579
20580 /**
20581  * Used to derive a revocation key for transactions broadcast by counterparty
20582  */
20583 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20584
20585 /**
20586  * A payment key to sender for transactions broadcast by counterparty
20587  */
20588 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20589
20590 /**
20591  * A payment key to sender for transactions broadcast by counterparty
20592  */
20593 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20594
20595 /**
20596  * Used to derive a payment key to sender for transactions broadcast by sender
20597  */
20598 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20599
20600 /**
20601  * Used to derive a payment key to sender for transactions broadcast by sender
20602  */
20603 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20604
20605 /**
20606  * Used to derive an HTLC payment key to sender
20607  */
20608 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20609
20610 /**
20611  * Used to derive an HTLC payment key to sender
20612  */
20613 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20614
20615 /**
20616  * The first to-be-broadcast-by-sender transaction's per commitment point
20617  */
20618 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20619
20620 /**
20621  * The first to-be-broadcast-by-sender transaction's per commitment point
20622  */
20623 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20624
20625 /**
20626  * Channel flags
20627  */
20628 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20629
20630 /**
20631  * Channel flags
20632  */
20633 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
20634
20635 /**
20636  * The channel type that this channel will represent. If none is set, we derive the channel
20637  * type from the intersection of our feature bits with our counterparty's feature bits from
20638  * the Init message.
20639  *
20640  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20641  */
20642 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
20643
20644 /**
20645  * The channel type that this channel will represent. If none is set, we derive the channel
20646  * type from the intersection of our feature bits with our counterparty's feature bits from
20647  * the Init message.
20648  *
20649  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20650  */
20651 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
20652
20653 /**
20654  * Creates a copy of the OpenChannel
20655  */
20656 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
20657
20658 /**
20659  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
20660  */
20661 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
20662
20663 /**
20664  * A temporary channel ID, until the funding outpoint is announced
20665  */
20666 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
20667
20668 /**
20669  * A temporary channel ID, until the funding outpoint is announced
20670  */
20671 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20672
20673 /**
20674  * The threshold below which outputs on transactions broadcast by sender will be omitted
20675  */
20676 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20677
20678 /**
20679  * The threshold below which outputs on transactions broadcast by sender will be omitted
20680  */
20681 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20682
20683 /**
20684  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20685  */
20686 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20687
20688 /**
20689  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
20690  */
20691 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20692
20693 /**
20694  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20695  */
20696 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20697
20698 /**
20699  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
20700  */
20701 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20702
20703 /**
20704  * The minimum HTLC size incoming to sender, in milli-satoshi
20705  */
20706 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20707
20708 /**
20709  * The minimum HTLC size incoming to sender, in milli-satoshi
20710  */
20711 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
20712
20713 /**
20714  * Minimum depth of the funding transaction before the channel is considered open
20715  */
20716 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20717
20718 /**
20719  * Minimum depth of the funding transaction before the channel is considered open
20720  */
20721 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
20722
20723 /**
20724  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20725  */
20726 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20727
20728 /**
20729  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
20730  */
20731 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
20732
20733 /**
20734  * The maximum number of inbound HTLCs towards sender
20735  */
20736 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20737
20738 /**
20739  * The maximum number of inbound HTLCs towards sender
20740  */
20741 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
20742
20743 /**
20744  * The sender's key controlling the funding transaction
20745  */
20746 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20747
20748 /**
20749  * The sender's key controlling the funding transaction
20750  */
20751 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20752
20753 /**
20754  * Used to derive a revocation key for transactions broadcast by counterparty
20755  */
20756 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20757
20758 /**
20759  * Used to derive a revocation key for transactions broadcast by counterparty
20760  */
20761 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20762
20763 /**
20764  * A payment key to sender for transactions broadcast by counterparty
20765  */
20766 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20767
20768 /**
20769  * A payment key to sender for transactions broadcast by counterparty
20770  */
20771 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20772
20773 /**
20774  * Used to derive a payment key to sender for transactions broadcast by sender
20775  */
20776 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20777
20778 /**
20779  * Used to derive a payment key to sender for transactions broadcast by sender
20780  */
20781 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20782
20783 /**
20784  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
20785  */
20786 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20787
20788 /**
20789  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
20790  */
20791 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20792
20793 /**
20794  * The first to-be-broadcast-by-sender transaction's per commitment point
20795  */
20796 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20797
20798 /**
20799  * The first to-be-broadcast-by-sender transaction's per commitment point
20800  */
20801 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20802
20803 /**
20804  * The channel type that this channel will represent. If none is set, we derive the channel
20805  * type from the intersection of our feature bits with our counterparty's feature bits from
20806  * the Init message.
20807  *
20808  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
20809  *
20810  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20811  */
20812 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
20813
20814 /**
20815  * The channel type that this channel will represent. If none is set, we derive the channel
20816  * type from the intersection of our feature bits with our counterparty's feature bits from
20817  * the Init message.
20818  *
20819  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
20820  *
20821  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20822  */
20823 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
20824
20825 /**
20826  * Creates a copy of the AcceptChannel
20827  */
20828 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
20829
20830 /**
20831  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
20832  */
20833 void FundingCreated_free(struct LDKFundingCreated this_obj);
20834
20835 /**
20836  * A temporary channel ID, until the funding is established
20837  */
20838 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
20839
20840 /**
20841  * A temporary channel ID, until the funding is established
20842  */
20843 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20844
20845 /**
20846  * The funding transaction ID
20847  */
20848 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
20849
20850 /**
20851  * The funding transaction ID
20852  */
20853 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20854
20855 /**
20856  * The specific output index funding this channel
20857  */
20858 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
20859
20860 /**
20861  * The specific output index funding this channel
20862  */
20863 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
20864
20865 /**
20866  * The signature of the channel initiator (funder) on the initial commitment transaction
20867  */
20868 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
20869
20870 /**
20871  * The signature of the channel initiator (funder) on the initial commitment transaction
20872  */
20873 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
20874
20875 /**
20876  * Constructs a new FundingCreated given each field
20877  */
20878 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);
20879
20880 /**
20881  * Creates a copy of the FundingCreated
20882  */
20883 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
20884
20885 /**
20886  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
20887  */
20888 void FundingSigned_free(struct LDKFundingSigned this_obj);
20889
20890 /**
20891  * The channel ID
20892  */
20893 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
20894
20895 /**
20896  * The channel ID
20897  */
20898 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20899
20900 /**
20901  * The signature of the channel acceptor (fundee) on the initial commitment transaction
20902  */
20903 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
20904
20905 /**
20906  * The signature of the channel acceptor (fundee) on the initial commitment transaction
20907  */
20908 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
20909
20910 /**
20911  * Constructs a new FundingSigned given each field
20912  */
20913 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
20914
20915 /**
20916  * Creates a copy of the FundingSigned
20917  */
20918 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
20919
20920 /**
20921  * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL.
20922  */
20923 void FundingLocked_free(struct LDKFundingLocked this_obj);
20924
20925 /**
20926  * The channel ID
20927  */
20928 const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32];
20929
20930 /**
20931  * The channel ID
20932  */
20933 void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20934
20935 /**
20936  * The per-commitment point of the second commitment transaction
20937  */
20938 struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
20939
20940 /**
20941  * The per-commitment point of the second commitment transaction
20942  */
20943 void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20944
20945 /**
20946  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
20947  * to be forwarded over this SCID and forward them to this messages' recipient.
20948  */
20949 struct LDKCOption_u64Z FundingLocked_get_short_channel_id_alias(const struct LDKFundingLocked *NONNULL_PTR this_ptr);
20950
20951 /**
20952  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
20953  * to be forwarded over this SCID and forward them to this messages' recipient.
20954  */
20955 void FundingLocked_set_short_channel_id_alias(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20956
20957 /**
20958  * Constructs a new FundingLocked given each field
20959  */
20960 MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg);
20961
20962 /**
20963  * Creates a copy of the FundingLocked
20964  */
20965 struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig);
20966
20967 /**
20968  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
20969  */
20970 void Shutdown_free(struct LDKShutdown this_obj);
20971
20972 /**
20973  * The channel ID
20974  */
20975 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
20976
20977 /**
20978  * The channel ID
20979  */
20980 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20981
20982 /**
20983  * The destination of this peer's funds on closing.
20984  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
20985  */
20986 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
20987
20988 /**
20989  * The destination of this peer's funds on closing.
20990  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
20991  */
20992 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
20993
20994 /**
20995  * Constructs a new Shutdown given each field
20996  */
20997 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
20998
20999 /**
21000  * Creates a copy of the Shutdown
21001  */
21002 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
21003
21004 /**
21005  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
21006  */
21007 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
21008
21009 /**
21010  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
21011  * transaction.
21012  */
21013 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
21014
21015 /**
21016  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
21017  * transaction.
21018  */
21019 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
21020
21021 /**
21022  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
21023  * transaction.
21024  */
21025 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
21026
21027 /**
21028  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
21029  * transaction.
21030  */
21031 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
21032
21033 /**
21034  * Constructs a new ClosingSignedFeeRange given each field
21035  */
21036 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
21037
21038 /**
21039  * Creates a copy of the ClosingSignedFeeRange
21040  */
21041 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
21042
21043 /**
21044  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
21045  */
21046 void ClosingSigned_free(struct LDKClosingSigned this_obj);
21047
21048 /**
21049  * The channel ID
21050  */
21051 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
21052
21053 /**
21054  * The channel ID
21055  */
21056 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21057
21058 /**
21059  * The proposed total fee for the closing transaction
21060  */
21061 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
21062
21063 /**
21064  * The proposed total fee for the closing transaction
21065  */
21066 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
21067
21068 /**
21069  * A signature on the closing transaction
21070  */
21071 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
21072
21073 /**
21074  * A signature on the closing transaction
21075  */
21076 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
21077
21078 /**
21079  * The minimum and maximum fees which the sender is willing to accept, provided only by new
21080  * nodes.
21081  *
21082  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21083  */
21084 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
21085
21086 /**
21087  * The minimum and maximum fees which the sender is willing to accept, provided only by new
21088  * nodes.
21089  *
21090  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21091  */
21092 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
21093
21094 /**
21095  * Constructs a new ClosingSigned given each field
21096  */
21097 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);
21098
21099 /**
21100  * Creates a copy of the ClosingSigned
21101  */
21102 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
21103
21104 /**
21105  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
21106  */
21107 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
21108
21109 /**
21110  * The channel ID
21111  */
21112 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
21113
21114 /**
21115  * The channel ID
21116  */
21117 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21118
21119 /**
21120  * The HTLC ID
21121  */
21122 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
21123
21124 /**
21125  * The HTLC ID
21126  */
21127 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
21128
21129 /**
21130  * The HTLC value in milli-satoshi
21131  */
21132 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
21133
21134 /**
21135  * The HTLC value in milli-satoshi
21136  */
21137 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
21138
21139 /**
21140  * The payment hash, the pre-image of which controls HTLC redemption
21141  */
21142 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
21143
21144 /**
21145  * The payment hash, the pre-image of which controls HTLC redemption
21146  */
21147 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21148
21149 /**
21150  * The expiry height of the HTLC
21151  */
21152 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
21153
21154 /**
21155  * The expiry height of the HTLC
21156  */
21157 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
21158
21159 /**
21160  * Creates a copy of the UpdateAddHTLC
21161  */
21162 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
21163
21164 /**
21165  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
21166  */
21167 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
21168
21169 /**
21170  * The channel ID
21171  */
21172 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
21173
21174 /**
21175  * The channel ID
21176  */
21177 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21178
21179 /**
21180  * The HTLC ID
21181  */
21182 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
21183
21184 /**
21185  * The HTLC ID
21186  */
21187 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
21188
21189 /**
21190  * The pre-image of the payment hash, allowing HTLC redemption
21191  */
21192 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
21193
21194 /**
21195  * The pre-image of the payment hash, allowing HTLC redemption
21196  */
21197 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21198
21199 /**
21200  * Constructs a new UpdateFulfillHTLC given each field
21201  */
21202 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
21203
21204 /**
21205  * Creates a copy of the UpdateFulfillHTLC
21206  */
21207 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
21208
21209 /**
21210  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
21211  */
21212 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
21213
21214 /**
21215  * The channel ID
21216  */
21217 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
21218
21219 /**
21220  * The channel ID
21221  */
21222 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21223
21224 /**
21225  * The HTLC ID
21226  */
21227 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
21228
21229 /**
21230  * The HTLC ID
21231  */
21232 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
21233
21234 /**
21235  * Creates a copy of the UpdateFailHTLC
21236  */
21237 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
21238
21239 /**
21240  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
21241  */
21242 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
21243
21244 /**
21245  * The channel ID
21246  */
21247 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
21248
21249 /**
21250  * The channel ID
21251  */
21252 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21253
21254 /**
21255  * The HTLC ID
21256  */
21257 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
21258
21259 /**
21260  * The HTLC ID
21261  */
21262 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
21263
21264 /**
21265  * The failure code
21266  */
21267 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
21268
21269 /**
21270  * The failure code
21271  */
21272 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
21273
21274 /**
21275  * Creates a copy of the UpdateFailMalformedHTLC
21276  */
21277 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
21278
21279 /**
21280  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
21281  */
21282 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
21283
21284 /**
21285  * The channel ID
21286  */
21287 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
21288
21289 /**
21290  * The channel ID
21291  */
21292 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21293
21294 /**
21295  * A signature on the commitment transaction
21296  */
21297 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
21298
21299 /**
21300  * A signature on the commitment transaction
21301  */
21302 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
21303
21304 /**
21305  * Signatures on the HTLC transactions
21306  */
21307 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
21308
21309 /**
21310  * Constructs a new CommitmentSigned given each field
21311  */
21312 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
21313
21314 /**
21315  * Creates a copy of the CommitmentSigned
21316  */
21317 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
21318
21319 /**
21320  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
21321  */
21322 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
21323
21324 /**
21325  * The channel ID
21326  */
21327 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
21328
21329 /**
21330  * The channel ID
21331  */
21332 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21333
21334 /**
21335  * The secret corresponding to the per-commitment point
21336  */
21337 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
21338
21339 /**
21340  * The secret corresponding to the per-commitment point
21341  */
21342 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21343
21344 /**
21345  * The next sender-broadcast commitment transaction's per-commitment point
21346  */
21347 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
21348
21349 /**
21350  * The next sender-broadcast commitment transaction's per-commitment point
21351  */
21352 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21353
21354 /**
21355  * Constructs a new RevokeAndACK given each field
21356  */
21357 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);
21358
21359 /**
21360  * Creates a copy of the RevokeAndACK
21361  */
21362 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
21363
21364 /**
21365  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
21366  */
21367 void UpdateFee_free(struct LDKUpdateFee this_obj);
21368
21369 /**
21370  * The channel ID
21371  */
21372 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
21373
21374 /**
21375  * The channel ID
21376  */
21377 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21378
21379 /**
21380  * Fee rate per 1000-weight of the transaction
21381  */
21382 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
21383
21384 /**
21385  * Fee rate per 1000-weight of the transaction
21386  */
21387 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
21388
21389 /**
21390  * Constructs a new UpdateFee given each field
21391  */
21392 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
21393
21394 /**
21395  * Creates a copy of the UpdateFee
21396  */
21397 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
21398
21399 /**
21400  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
21401  */
21402 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
21403
21404 /**
21405  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
21406  * belonging to the recipient
21407  */
21408 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
21409
21410 /**
21411  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
21412  * belonging to the recipient
21413  */
21414 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21415
21416 /**
21417  * The sender's per-commitment point for their current commitment transaction
21418  */
21419 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
21420
21421 /**
21422  * The sender's per-commitment point for their current commitment transaction
21423  */
21424 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21425
21426 /**
21427  * Constructs a new DataLossProtect given each field
21428  */
21429 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
21430
21431 /**
21432  * Creates a copy of the DataLossProtect
21433  */
21434 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
21435
21436 /**
21437  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
21438  */
21439 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
21440
21441 /**
21442  * The channel ID
21443  */
21444 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
21445
21446 /**
21447  * The channel ID
21448  */
21449 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21450
21451 /**
21452  * The next commitment number for the sender
21453  */
21454 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
21455
21456 /**
21457  * The next commitment number for the sender
21458  */
21459 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
21460
21461 /**
21462  * The next commitment number for the recipient
21463  */
21464 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
21465
21466 /**
21467  * The next commitment number for the recipient
21468  */
21469 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
21470
21471 /**
21472  * Creates a copy of the ChannelReestablish
21473  */
21474 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
21475
21476 /**
21477  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
21478  */
21479 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
21480
21481 /**
21482  * The channel ID
21483  */
21484 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
21485
21486 /**
21487  * The channel ID
21488  */
21489 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21490
21491 /**
21492  * The short channel ID
21493  */
21494 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21495
21496 /**
21497  * The short channel ID
21498  */
21499 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
21500
21501 /**
21502  * A signature by the node key
21503  */
21504 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21505
21506 /**
21507  * A signature by the node key
21508  */
21509 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
21510
21511 /**
21512  * A signature by the funding key
21513  */
21514 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
21515
21516 /**
21517  * A signature by the funding key
21518  */
21519 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
21520
21521 /**
21522  * Constructs a new AnnouncementSignatures given each field
21523  */
21524 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);
21525
21526 /**
21527  * Creates a copy of the AnnouncementSignatures
21528  */
21529 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
21530
21531 /**
21532  * Frees any resources used by the NetAddress
21533  */
21534 void NetAddress_free(struct LDKNetAddress this_ptr);
21535
21536 /**
21537  * Creates a copy of the NetAddress
21538  */
21539 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
21540
21541 /**
21542  * Utility method to constructs a new IPv4-variant NetAddress
21543  */
21544 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
21545
21546 /**
21547  * Utility method to constructs a new IPv6-variant NetAddress
21548  */
21549 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
21550
21551 /**
21552  * Utility method to constructs a new OnionV2-variant NetAddress
21553  */
21554 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
21555
21556 /**
21557  * Utility method to constructs a new OnionV3-variant NetAddress
21558  */
21559 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
21560
21561 /**
21562  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
21563  */
21564 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
21565
21566 /**
21567  * Read a NetAddress from a byte array, created by NetAddress_write
21568  */
21569 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
21570
21571 /**
21572  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
21573  */
21574 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
21575
21576 /**
21577  * The advertised features
21578  */
21579 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21580
21581 /**
21582  * The advertised features
21583  */
21584 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
21585
21586 /**
21587  * A strictly monotonic announcement counter, with gaps allowed
21588  */
21589 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21590
21591 /**
21592  * A strictly monotonic announcement counter, with gaps allowed
21593  */
21594 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
21595
21596 /**
21597  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
21598  * to this node).
21599  */
21600 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
21601
21602 /**
21603  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
21604  * to this node).
21605  */
21606 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21607
21608 /**
21609  * An RGB color for UI purposes
21610  */
21611 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
21612
21613 /**
21614  * An RGB color for UI purposes
21615  */
21616 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
21617
21618 /**
21619  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
21620  * of uniqueness.
21621  */
21622 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
21623
21624 /**
21625  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
21626  * of uniqueness.
21627  */
21628 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21629
21630 /**
21631  * List of addresses on which this node is reachable
21632  */
21633 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
21634
21635 /**
21636  * Creates a copy of the UnsignedNodeAnnouncement
21637  */
21638 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
21639
21640 /**
21641  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
21642  */
21643 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
21644
21645 /**
21646  * The signature by the node key
21647  */
21648 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
21649
21650 /**
21651  * The signature by the node key
21652  */
21653 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21654
21655 /**
21656  * The actual content of the announcement
21657  */
21658 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
21659
21660 /**
21661  * The actual content of the announcement
21662  */
21663 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
21664
21665 /**
21666  * Constructs a new NodeAnnouncement given each field
21667  */
21668 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
21669
21670 /**
21671  * Creates a copy of the NodeAnnouncement
21672  */
21673 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
21674
21675 /**
21676  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
21677  */
21678 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
21679
21680 /**
21681  * The advertised channel features
21682  */
21683 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21684
21685 /**
21686  * The advertised channel features
21687  */
21688 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
21689
21690 /**
21691  * The genesis hash of the blockchain where the channel is to be opened
21692  */
21693 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
21694
21695 /**
21696  * The genesis hash of the blockchain where the channel is to be opened
21697  */
21698 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21699
21700 /**
21701  * The short channel ID
21702  */
21703 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21704
21705 /**
21706  * The short channel ID
21707  */
21708 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
21709
21710 /**
21711  * One of the two node_ids which are endpoints of this channel
21712  */
21713 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21714
21715 /**
21716  * One of the two node_ids which are endpoints of this channel
21717  */
21718 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21719
21720 /**
21721  * The other of the two node_ids which are endpoints of this channel
21722  */
21723 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21724
21725 /**
21726  * The other of the two node_ids which are endpoints of this channel
21727  */
21728 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21729
21730 /**
21731  * The funding key for the first node
21732  */
21733 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21734
21735 /**
21736  * The funding key for the first node
21737  */
21738 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21739
21740 /**
21741  * The funding key for the second node
21742  */
21743 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
21744
21745 /**
21746  * The funding key for the second node
21747  */
21748 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21749
21750 /**
21751  * Creates a copy of the UnsignedChannelAnnouncement
21752  */
21753 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
21754
21755 /**
21756  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
21757  */
21758 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
21759
21760 /**
21761  * Authentication of the announcement by the first public node
21762  */
21763 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21764
21765 /**
21766  * Authentication of the announcement by the first public node
21767  */
21768 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21769
21770 /**
21771  * Authentication of the announcement by the second public node
21772  */
21773 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21774
21775 /**
21776  * Authentication of the announcement by the second public node
21777  */
21778 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21779
21780 /**
21781  * Proof of funding UTXO ownership by the first public node
21782  */
21783 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21784
21785 /**
21786  * Proof of funding UTXO ownership by the first public node
21787  */
21788 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21789
21790 /**
21791  * Proof of funding UTXO ownership by the second public node
21792  */
21793 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21794
21795 /**
21796  * Proof of funding UTXO ownership by the second public node
21797  */
21798 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
21799
21800 /**
21801  * The actual announcement
21802  */
21803 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
21804
21805 /**
21806  * The actual announcement
21807  */
21808 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
21809
21810 /**
21811  * Constructs a new ChannelAnnouncement given each field
21812  */
21813 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);
21814
21815 /**
21816  * Creates a copy of the ChannelAnnouncement
21817  */
21818 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
21819
21820 /**
21821  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
21822  */
21823 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
21824
21825 /**
21826  * The genesis hash of the blockchain where the channel is to be opened
21827  */
21828 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
21829
21830 /**
21831  * The genesis hash of the blockchain where the channel is to be opened
21832  */
21833 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21834
21835 /**
21836  * The short channel ID
21837  */
21838 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21839
21840 /**
21841  * The short channel ID
21842  */
21843 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
21844
21845 /**
21846  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
21847  */
21848 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21849
21850 /**
21851  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
21852  */
21853 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21854
21855 /**
21856  * Channel flags
21857  */
21858 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21859
21860 /**
21861  * Channel flags
21862  */
21863 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
21864
21865 /**
21866  * The number of blocks such that if:
21867  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
21868  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
21869  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
21870  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
21871  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
21872  * forwarding. Note that the HTLC sender is the one who originally sets this value when
21873  * constructing the route.
21874  */
21875 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21876
21877 /**
21878  * The number of blocks such that if:
21879  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
21880  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
21881  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
21882  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
21883  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
21884  * forwarding. Note that the HTLC sender is the one who originally sets this value when
21885  * constructing the route.
21886  */
21887 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
21888
21889 /**
21890  * The minimum HTLC size incoming to sender, in milli-satoshi
21891  */
21892 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21893
21894 /**
21895  * The minimum HTLC size incoming to sender, in milli-satoshi
21896  */
21897 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
21898
21899 /**
21900  * The base HTLC fee charged by sender, in milli-satoshi
21901  */
21902 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21903
21904 /**
21905  * The base HTLC fee charged by sender, in milli-satoshi
21906  */
21907 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21908
21909 /**
21910  * The amount to fee multiplier, in micro-satoshi
21911  */
21912 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
21913
21914 /**
21915  * The amount to fee multiplier, in micro-satoshi
21916  */
21917 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
21918
21919 /**
21920  * Creates a copy of the UnsignedChannelUpdate
21921  */
21922 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
21923
21924 /**
21925  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
21926  */
21927 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
21928
21929 /**
21930  * A signature of the channel update
21931  */
21932 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
21933
21934 /**
21935  * A signature of the channel update
21936  */
21937 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
21938
21939 /**
21940  * The actual channel update
21941  */
21942 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
21943
21944 /**
21945  * The actual channel update
21946  */
21947 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
21948
21949 /**
21950  * Constructs a new ChannelUpdate given each field
21951  */
21952 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
21953
21954 /**
21955  * Creates a copy of the ChannelUpdate
21956  */
21957 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
21958
21959 /**
21960  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
21961  */
21962 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
21963
21964 /**
21965  * The genesis hash of the blockchain being queried
21966  */
21967 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
21968
21969 /**
21970  * The genesis hash of the blockchain being queried
21971  */
21972 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21973
21974 /**
21975  * The height of the first block for the channel UTXOs being queried
21976  */
21977 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
21978
21979 /**
21980  * The height of the first block for the channel UTXOs being queried
21981  */
21982 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21983
21984 /**
21985  * The number of blocks to include in the query results
21986  */
21987 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
21988
21989 /**
21990  * The number of blocks to include in the query results
21991  */
21992 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
21993
21994 /**
21995  * Constructs a new QueryChannelRange given each field
21996  */
21997 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
21998
21999 /**
22000  * Creates a copy of the QueryChannelRange
22001  */
22002 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
22003
22004 /**
22005  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
22006  */
22007 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
22008
22009 /**
22010  * The genesis hash of the blockchain being queried
22011  */
22012 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
22013
22014 /**
22015  * The genesis hash of the blockchain being queried
22016  */
22017 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22018
22019 /**
22020  * The height of the first block in the range of the reply
22021  */
22022 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22023
22024 /**
22025  * The height of the first block in the range of the reply
22026  */
22027 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22028
22029 /**
22030  * The number of blocks included in the range of the reply
22031  */
22032 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22033
22034 /**
22035  * The number of blocks included in the range of the reply
22036  */
22037 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22038
22039 /**
22040  * True when this is the final reply for a query
22041  */
22042 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22043
22044 /**
22045  * True when this is the final reply for a query
22046  */
22047 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
22048
22049 /**
22050  * The short_channel_ids in the channel range
22051  */
22052 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
22053
22054 /**
22055  * Constructs a new ReplyChannelRange given each field
22056  */
22057 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);
22058
22059 /**
22060  * Creates a copy of the ReplyChannelRange
22061  */
22062 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
22063
22064 /**
22065  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
22066  */
22067 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
22068
22069 /**
22070  * The genesis hash of the blockchain being queried
22071  */
22072 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
22073
22074 /**
22075  * The genesis hash of the blockchain being queried
22076  */
22077 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22078
22079 /**
22080  * The short_channel_ids that are being queried
22081  */
22082 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
22083
22084 /**
22085  * Constructs a new QueryShortChannelIds given each field
22086  */
22087 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
22088
22089 /**
22090  * Creates a copy of the QueryShortChannelIds
22091  */
22092 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
22093
22094 /**
22095  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
22096  */
22097 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
22098
22099 /**
22100  * The genesis hash of the blockchain that was queried
22101  */
22102 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
22103
22104 /**
22105  * The genesis hash of the blockchain that was queried
22106  */
22107 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22108
22109 /**
22110  * Indicates if the query recipient maintains up-to-date channel
22111  * information for the chain_hash
22112  */
22113 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
22114
22115 /**
22116  * Indicates if the query recipient maintains up-to-date channel
22117  * information for the chain_hash
22118  */
22119 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
22120
22121 /**
22122  * Constructs a new ReplyShortChannelIdsEnd given each field
22123  */
22124 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
22125
22126 /**
22127  * Creates a copy of the ReplyShortChannelIdsEnd
22128  */
22129 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
22130
22131 /**
22132  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
22133  */
22134 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
22135
22136 /**
22137  * The genesis hash of the blockchain for channel and node information
22138  */
22139 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
22140
22141 /**
22142  * The genesis hash of the blockchain for channel and node information
22143  */
22144 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22145
22146 /**
22147  * The starting unix timestamp
22148  */
22149 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
22150
22151 /**
22152  * The starting unix timestamp
22153  */
22154 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
22155
22156 /**
22157  * The range of information in seconds
22158  */
22159 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
22160
22161 /**
22162  * The range of information in seconds
22163  */
22164 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
22165
22166 /**
22167  * Constructs a new GossipTimestampFilter given each field
22168  */
22169 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
22170
22171 /**
22172  * Creates a copy of the GossipTimestampFilter
22173  */
22174 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
22175
22176 /**
22177  * Frees any resources used by the ErrorAction
22178  */
22179 void ErrorAction_free(struct LDKErrorAction this_ptr);
22180
22181 /**
22182  * Creates a copy of the ErrorAction
22183  */
22184 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
22185
22186 /**
22187  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
22188  */
22189 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
22190
22191 /**
22192  * Utility method to constructs a new IgnoreError-variant ErrorAction
22193  */
22194 struct LDKErrorAction ErrorAction_ignore_error(void);
22195
22196 /**
22197  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
22198  */
22199 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
22200
22201 /**
22202  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
22203  */
22204 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
22205
22206 /**
22207  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
22208  */
22209 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
22210
22211 /**
22212  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
22213  */
22214 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
22215
22216 /**
22217  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
22218  */
22219 void LightningError_free(struct LDKLightningError this_obj);
22220
22221 /**
22222  * A human-readable message describing the error
22223  */
22224 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
22225
22226 /**
22227  * A human-readable message describing the error
22228  */
22229 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
22230
22231 /**
22232  * The action which should be taken against the offending peer.
22233  */
22234 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
22235
22236 /**
22237  * The action which should be taken against the offending peer.
22238  */
22239 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
22240
22241 /**
22242  * Constructs a new LightningError given each field
22243  */
22244 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
22245
22246 /**
22247  * Creates a copy of the LightningError
22248  */
22249 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
22250
22251 /**
22252  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
22253  */
22254 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
22255
22256 /**
22257  * update_add_htlc messages which should be sent
22258  */
22259 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22260
22261 /**
22262  * update_add_htlc messages which should be sent
22263  */
22264 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
22265
22266 /**
22267  * update_fulfill_htlc messages which should be sent
22268  */
22269 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22270
22271 /**
22272  * update_fulfill_htlc messages which should be sent
22273  */
22274 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
22275
22276 /**
22277  * update_fail_htlc messages which should be sent
22278  */
22279 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22280
22281 /**
22282  * update_fail_htlc messages which should be sent
22283  */
22284 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
22285
22286 /**
22287  * update_fail_malformed_htlc messages which should be sent
22288  */
22289 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22290
22291 /**
22292  * update_fail_malformed_htlc messages which should be sent
22293  */
22294 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
22295
22296 /**
22297  * An update_fee message which should be sent
22298  *
22299  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22300  */
22301 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22302
22303 /**
22304  * An update_fee message which should be sent
22305  *
22306  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22307  */
22308 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
22309
22310 /**
22311  * Finally, the commitment_signed message which should be sent
22312  */
22313 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22314
22315 /**
22316  * Finally, the commitment_signed message which should be sent
22317  */
22318 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
22319
22320 /**
22321  * Constructs a new CommitmentUpdate given each field
22322  */
22323 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);
22324
22325 /**
22326  * Creates a copy of the CommitmentUpdate
22327  */
22328 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
22329
22330 /**
22331  * Calls the free function if one is set
22332  */
22333 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
22334
22335 /**
22336  * Calls the free function if one is set
22337  */
22338 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
22339
22340 /**
22341  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
22342  */
22343 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
22344
22345 /**
22346  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
22347  */
22348 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
22349
22350 /**
22351  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
22352  */
22353 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
22354
22355 /**
22356  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
22357  */
22358 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
22359
22360 /**
22361  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
22362  */
22363 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
22364
22365 /**
22366  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
22367  */
22368 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
22369
22370 /**
22371  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
22372  */
22373 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
22374
22375 /**
22376  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
22377  */
22378 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
22379
22380 /**
22381  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
22382  */
22383 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
22384
22385 /**
22386  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
22387  */
22388 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
22389
22390 /**
22391  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
22392  */
22393 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
22394
22395 /**
22396  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
22397  */
22398 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
22399
22400 /**
22401  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
22402  */
22403 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
22404
22405 /**
22406  * Read a FundingCreated from a byte array, created by FundingCreated_write
22407  */
22408 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
22409
22410 /**
22411  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
22412  */
22413 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
22414
22415 /**
22416  * Read a FundingSigned from a byte array, created by FundingSigned_write
22417  */
22418 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
22419
22420 /**
22421  * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read
22422  */
22423 struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj);
22424
22425 /**
22426  * Read a FundingLocked from a byte array, created by FundingLocked_write
22427  */
22428 struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser);
22429
22430 /**
22431  * Serialize the Init object into a byte array which can be read by Init_read
22432  */
22433 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
22434
22435 /**
22436  * Read a Init from a byte array, created by Init_write
22437  */
22438 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
22439
22440 /**
22441  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
22442  */
22443 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
22444
22445 /**
22446  * Read a OpenChannel from a byte array, created by OpenChannel_write
22447  */
22448 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
22449
22450 /**
22451  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
22452  */
22453 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
22454
22455 /**
22456  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
22457  */
22458 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
22459
22460 /**
22461  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
22462  */
22463 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
22464
22465 /**
22466  * Read a Shutdown from a byte array, created by Shutdown_write
22467  */
22468 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
22469
22470 /**
22471  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
22472  */
22473 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
22474
22475 /**
22476  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
22477  */
22478 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
22479
22480 /**
22481  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
22482  */
22483 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
22484
22485 /**
22486  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
22487  */
22488 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
22489
22490 /**
22491  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
22492  */
22493 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
22494
22495 /**
22496  * Read a UpdateFee from a byte array, created by UpdateFee_write
22497  */
22498 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
22499
22500 /**
22501  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
22502  */
22503 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
22504
22505 /**
22506  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
22507  */
22508 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
22509
22510 /**
22511  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
22512  */
22513 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
22514
22515 /**
22516  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
22517  */
22518 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
22519
22520 /**
22521  * Serialize the Ping object into a byte array which can be read by Ping_read
22522  */
22523 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
22524
22525 /**
22526  * Read a Ping from a byte array, created by Ping_write
22527  */
22528 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
22529
22530 /**
22531  * Serialize the Pong object into a byte array which can be read by Pong_read
22532  */
22533 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
22534
22535 /**
22536  * Read a Pong from a byte array, created by Pong_write
22537  */
22538 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
22539
22540 /**
22541  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
22542  */
22543 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
22544
22545 /**
22546  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
22547  */
22548 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
22549
22550 /**
22551  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
22552  */
22553 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
22554
22555 /**
22556  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
22557  */
22558 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
22559
22560 /**
22561  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
22562  */
22563 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
22564
22565 /**
22566  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
22567  */
22568 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
22569
22570 /**
22571  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
22572  */
22573 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
22574
22575 /**
22576  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
22577  */
22578 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
22579
22580 /**
22581  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
22582  */
22583 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
22584
22585 /**
22586  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
22587  */
22588 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
22589
22590 /**
22591  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
22592  */
22593 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
22594
22595 /**
22596  * Read a WarningMessage from a byte array, created by WarningMessage_write
22597  */
22598 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
22599
22600 /**
22601  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
22602  */
22603 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
22604
22605 /**
22606  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
22607  */
22608 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
22609
22610 /**
22611  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
22612  */
22613 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
22614
22615 /**
22616  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
22617  */
22618 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
22619
22620 /**
22621  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
22622  */
22623 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
22624
22625 /**
22626  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
22627  */
22628 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
22629
22630 /**
22631  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
22632  */
22633 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
22634
22635 /**
22636  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
22637  */
22638 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
22639
22640 /**
22641  *\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
22642  */
22643 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
22644
22645 /**
22646  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
22647  */
22648 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
22649
22650 /**
22651  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
22652  */
22653 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
22654
22655 /**
22656  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
22657  */
22658 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
22659
22660 /**
22661  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
22662  */
22663 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
22664
22665 /**
22666  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
22667  */
22668 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
22669
22670 /**
22671  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
22672  */
22673 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
22674
22675 /**
22676  * Calls the free function if one is set
22677  */
22678 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
22679
22680 /**
22681  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
22682  */
22683 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
22684
22685 /**
22686  * Constructs a new IgnoringMessageHandler given each field
22687  */
22688 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
22689
22690 /**
22691  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22692  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22693  */
22694 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22695
22696 /**
22697  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
22698  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
22699  */
22700 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22701
22702 /**
22703  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
22704  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
22705  */
22706 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22707
22708 /**
22709  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
22710  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
22711  */
22712 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
22713
22714 /**
22715  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
22716  */
22717 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
22718
22719 /**
22720  * Constructs a new ErroringMessageHandler
22721  */
22722 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
22723
22724 /**
22725  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
22726  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
22727  */
22728 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
22729
22730 /**
22731  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
22732  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
22733  */
22734 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
22735
22736 /**
22737  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
22738  */
22739 void MessageHandler_free(struct LDKMessageHandler this_obj);
22740
22741 /**
22742  * A message handler which handles messages specific to channels. Usually this is just a
22743  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
22744  *
22745  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
22746  */
22747 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
22748
22749 /**
22750  * A message handler which handles messages specific to channels. Usually this is just a
22751  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
22752  *
22753  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
22754  */
22755 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
22756
22757 /**
22758  * A message handler which handles messages updating our knowledge of the network channel
22759  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
22760  * [`IgnoringMessageHandler`].
22761  *
22762  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
22763  */
22764 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
22765
22766 /**
22767  * A message handler which handles messages updating our knowledge of the network channel
22768  * graph. Usually this is just a [`NetGraphMsgHandler`] object or an
22769  * [`IgnoringMessageHandler`].
22770  *
22771  * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
22772  */
22773 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
22774
22775 /**
22776  * Constructs a new MessageHandler given each field
22777  */
22778 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
22779
22780 /**
22781  * Creates a copy of a SocketDescriptor
22782  */
22783 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
22784
22785 /**
22786  * Calls the free function if one is set
22787  */
22788 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
22789
22790 /**
22791  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
22792  */
22793 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
22794
22795 /**
22796  * Used to indicate that we probably can't make any future connections to this peer, implying
22797  * we should go ahead and force-close any channels we have with it.
22798  */
22799 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
22800
22801 /**
22802  * Used to indicate that we probably can't make any future connections to this peer, implying
22803  * we should go ahead and force-close any channels we have with it.
22804  */
22805 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
22806
22807 /**
22808  * Constructs a new PeerHandleError given each field
22809  */
22810 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
22811
22812 /**
22813  * Creates a copy of the PeerHandleError
22814  */
22815 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
22816
22817 /**
22818  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
22819  */
22820 void PeerManager_free(struct LDKPeerManager this_obj);
22821
22822 /**
22823  * Constructs a new PeerManager with the given message handlers and node_id secret key
22824  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
22825  * cryptographically secure random bytes.
22826  */
22827 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);
22828
22829 /**
22830  * Get the list of node ids for peers which have completed the initial handshake.
22831  *
22832  * For outbound connections, this will be the same as the their_node_id parameter passed in to
22833  * new_outbound_connection, however entries will only appear once the initial handshake has
22834  * completed and we are sure the remote peer has the private key for the given node_id.
22835  */
22836 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
22837
22838 /**
22839  * Indicates a new outbound connection has been established to a node with the given node_id
22840  * and an optional remote network address.
22841  *
22842  * The remote network address adds the option to report a remote IP address back to a connecting
22843  * peer using the init message.
22844  * The user should pass the remote network address of the host they are connected to.
22845  *
22846  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
22847  * descriptor but must disconnect the connection immediately.
22848  *
22849  * Returns a small number of bytes to send to the remote node (currently always 50).
22850  *
22851  * Panics if descriptor is duplicative with some other descriptor which has not yet been
22852  * [`socket_disconnected()`].
22853  *
22854  * [`socket_disconnected()`]: PeerManager::socket_disconnected
22855  */
22856 MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
22857
22858 /**
22859  * Indicates a new inbound connection has been established to a node with an optional remote
22860  * network address.
22861  *
22862  * The remote network address adds the option to report a remote IP address back to a connecting
22863  * peer using the init message.
22864  * The user should pass the remote network address of the host they are connected to.
22865  *
22866  * May refuse the connection by returning an Err, but will never write bytes to the remote end
22867  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
22868  * call socket_disconnected for the new descriptor but must disconnect the connection
22869  * immediately.
22870  *
22871  * Panics if descriptor is duplicative with some other descriptor which has not yet been
22872  * [`socket_disconnected()`].
22873  *
22874  * [`socket_disconnected()`]: PeerManager::socket_disconnected
22875  */
22876 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
22877
22878 /**
22879  * Indicates that there is room to write data to the given socket descriptor.
22880  *
22881  * May return an Err to indicate that the connection should be closed.
22882  *
22883  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
22884  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
22885  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
22886  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
22887  * sufficient!
22888  *
22889  * [`send_data`]: SocketDescriptor::send_data
22890  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
22891  */
22892 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
22893
22894 /**
22895  * Indicates that data was read from the given socket descriptor.
22896  *
22897  * May return an Err to indicate that the connection should be closed.
22898  *
22899  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
22900  * Thus, however, you should call [`process_events`] after any `read_event` to generate
22901  * [`send_data`] calls to handle responses.
22902  *
22903  * If `Ok(true)` is returned, further read_events should not be triggered until a
22904  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
22905  * send buffer).
22906  *
22907  * [`send_data`]: SocketDescriptor::send_data
22908  * [`process_events`]: PeerManager::process_events
22909  */
22910 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);
22911
22912 /**
22913  * Checks for any events generated by our handlers and processes them. Includes sending most
22914  * response messages as well as messages generated by calls to handler functions directly (eg
22915  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
22916  *
22917  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
22918  * issues!
22919  *
22920  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
22921  * or one of the other clients provided in our language bindings.
22922  *
22923  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
22924  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
22925  * [`send_data`]: SocketDescriptor::send_data
22926  */
22927 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
22928
22929 /**
22930  * Indicates that the given socket descriptor's connection is now closed.
22931  */
22932 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
22933
22934 /**
22935  * Disconnect a peer given its node id.
22936  *
22937  * Set `no_connection_possible` to true to prevent any further connection with this peer,
22938  * force-closing any channels we have with it.
22939  *
22940  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
22941  * peer. Thus, be very careful about reentrancy issues.
22942  *
22943  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
22944  */
22945 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
22946
22947 /**
22948  * Disconnects all currently-connected peers. This is useful on platforms where there may be
22949  * an indication that TCP sockets have stalled even if we weren't around to time them out
22950  * using regular ping/pongs.
22951  */
22952 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
22953
22954 /**
22955  * Send pings to each peer and disconnect those which did not respond to the last round of
22956  * pings.
22957  *
22958  * This may be called on any timescale you want, however, roughly once every ten seconds is
22959  * preferred. The call rate determines both how often we send a ping to our peers and how much
22960  * time they have to respond before we disconnect them.
22961  *
22962  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
22963  * issues!
22964  *
22965  * [`send_data`]: SocketDescriptor::send_data
22966  */
22967 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
22968
22969 /**
22970  * Gets the weight for an HTLC-Success transaction.
22971  */
22972 uint64_t htlc_success_tx_weight(bool opt_anchors);
22973
22974 /**
22975  * Gets the weight for an HTLC-Timeout transaction.
22976  */
22977 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
22978
22979 /**
22980  * Build the commitment secret from the seed and the commitment number
22981  */
22982 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
22983
22984 /**
22985  * Build a closing transaction
22986  */
22987 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);
22988
22989 /**
22990  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
22991  */
22992 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
22993
22994 /**
22995  * Creates a copy of the CounterpartyCommitmentSecrets
22996  */
22997 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
22998
22999 /**
23000  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
23001  */
23002 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
23003
23004 /**
23005  * Returns the minimum index of all stored secrets. Note that indexes start
23006  * at 1 << 48 and get decremented by one for each new secret.
23007  */
23008 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
23009
23010 /**
23011  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
23012  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
23013  */
23014 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
23015
23016 /**
23017  * Returns the secret at `idx`.
23018  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
23019  *
23020  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23021  */
23022 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
23023
23024 /**
23025  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
23026  */
23027 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
23028
23029 /**
23030  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
23031  */
23032 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
23033
23034 /**
23035  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
23036  * from the base secret and the per_commitment_point.
23037  *
23038  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23039  * generated (ie our own).
23040  */
23041 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
23042
23043 /**
23044  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
23045  * from the base point and the per_commitment_key. This is the public equivalent of
23046  * derive_private_key - using only public keys to derive a public key instead of private keys.
23047  *
23048  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23049  * generated (ie our own).
23050  */
23051 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
23052
23053 /**
23054  * Derives a per-commitment-transaction revocation key from its constituent parts.
23055  *
23056  * Only the cheating participant owns a valid witness to propagate a revoked
23057  * commitment transaction, thus per_commitment_secret always come from cheater
23058  * and revocation_base_secret always come from punisher, which is the broadcaster
23059  * of the transaction spending with this key knowledge.
23060  *
23061  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23062  * generated (ie our own).
23063  */
23064 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
23065
23066 /**
23067  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
23068  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
23069  * public key instead of private keys.
23070  *
23071  * Only the cheating participant owns a valid witness to propagate a revoked
23072  * commitment transaction, thus per_commitment_point always come from cheater
23073  * and revocation_base_point always come from punisher, which is the broadcaster
23074  * of the transaction spending with this key knowledge.
23075  *
23076  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23077  * generated (ie our own).
23078  */
23079 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
23080
23081 /**
23082  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
23083  */
23084 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
23085
23086 /**
23087  * The broadcaster's per-commitment public key which was used to derive the other keys.
23088  */
23089 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23090
23091 /**
23092  * The broadcaster's per-commitment public key which was used to derive the other keys.
23093  */
23094 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23095
23096 /**
23097  * The revocation key which is used to allow the broadcaster of the commitment
23098  * transaction to provide their counterparty the ability to punish them if they broadcast
23099  * an old state.
23100  */
23101 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23102
23103 /**
23104  * The revocation key which is used to allow the broadcaster of the commitment
23105  * transaction to provide their counterparty the ability to punish them if they broadcast
23106  * an old state.
23107  */
23108 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23109
23110 /**
23111  * Broadcaster's HTLC Key
23112  */
23113 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23114
23115 /**
23116  * Broadcaster's HTLC Key
23117  */
23118 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23119
23120 /**
23121  * Countersignatory's HTLC Key
23122  */
23123 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23124
23125 /**
23126  * Countersignatory's HTLC Key
23127  */
23128 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23129
23130 /**
23131  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
23132  */
23133 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23134
23135 /**
23136  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
23137  */
23138 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23139
23140 /**
23141  * Constructs a new TxCreationKeys given each field
23142  */
23143 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);
23144
23145 /**
23146  * Creates a copy of the TxCreationKeys
23147  */
23148 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
23149
23150 /**
23151  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
23152  */
23153 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
23154
23155 /**
23156  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
23157  */
23158 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
23159
23160 /**
23161  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
23162  */
23163 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
23164
23165 /**
23166  * The public key which is used to sign all commitment transactions, as it appears in the
23167  * on-chain channel lock-in 2-of-2 multisig output.
23168  */
23169 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23170
23171 /**
23172  * The public key which is used to sign all commitment transactions, as it appears in the
23173  * on-chain channel lock-in 2-of-2 multisig output.
23174  */
23175 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23176
23177 /**
23178  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
23179  * revocation keys. This is combined with the per-commitment-secret generated by the
23180  * counterparty to create a secret which the counterparty can reveal to revoke previous
23181  * states.
23182  */
23183 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23184
23185 /**
23186  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
23187  * revocation keys. This is combined with the per-commitment-secret generated by the
23188  * counterparty to create a secret which the counterparty can reveal to revoke previous
23189  * states.
23190  */
23191 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23192
23193 /**
23194  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
23195  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
23196  * static across every commitment transaction.
23197  */
23198 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23199
23200 /**
23201  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
23202  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
23203  * static across every commitment transaction.
23204  */
23205 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23206
23207 /**
23208  * The base point which is used (with derive_public_key) to derive a per-commitment payment
23209  * public key which receives non-HTLC-encumbered funds which are only available for spending
23210  * after some delay (or can be claimed via the revocation path).
23211  */
23212 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23213
23214 /**
23215  * The base point which is used (with derive_public_key) to derive a per-commitment payment
23216  * public key which receives non-HTLC-encumbered funds which are only available for spending
23217  * after some delay (or can be claimed via the revocation path).
23218  */
23219 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23220
23221 /**
23222  * The base point which is used (with derive_public_key) to derive a per-commitment public key
23223  * which is used to encumber HTLC-in-flight outputs.
23224  */
23225 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23226
23227 /**
23228  * The base point which is used (with derive_public_key) to derive a per-commitment public key
23229  * which is used to encumber HTLC-in-flight outputs.
23230  */
23231 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23232
23233 /**
23234  * Constructs a new ChannelPublicKeys given each field
23235  */
23236 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);
23237
23238 /**
23239  * Creates a copy of the ChannelPublicKeys
23240  */
23241 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
23242
23243 /**
23244  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
23245  */
23246 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
23247
23248 /**
23249  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
23250  */
23251 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
23252
23253 /**
23254  * Create per-state keys from channel base points and the per-commitment point.
23255  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
23256  */
23257 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);
23258
23259 /**
23260  * Generate per-state keys from channel static keys.
23261  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
23262  */
23263 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);
23264
23265 /**
23266  * A script either spendable by the revocation
23267  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
23268  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
23269  */
23270 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
23271
23272 /**
23273  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
23274  */
23275 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
23276
23277 /**
23278  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
23279  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
23280  * need to compare this value to whether the commitment transaction in question is that of
23281  * the counterparty or our own.
23282  */
23283 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23284
23285 /**
23286  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
23287  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
23288  * need to compare this value to whether the commitment transaction in question is that of
23289  * the counterparty or our own.
23290  */
23291 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
23292
23293 /**
23294  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
23295  * this divided by 1000.
23296  */
23297 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23298
23299 /**
23300  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
23301  * this divided by 1000.
23302  */
23303 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
23304
23305 /**
23306  * The CLTV lock-time at which this HTLC expires.
23307  */
23308 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23309
23310 /**
23311  * The CLTV lock-time at which this HTLC expires.
23312  */
23313 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
23314
23315 /**
23316  * The hash of the preimage which unlocks this HTLC.
23317  */
23318 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
23319
23320 /**
23321  * The hash of the preimage which unlocks this HTLC.
23322  */
23323 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23324
23325 /**
23326  * The position within the commitment transactions' outputs. This may be None if the value is
23327  * below the dust limit (in which case no output appears in the commitment transaction and the
23328  * value is spent to additional transaction fees).
23329  */
23330 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23331
23332 /**
23333  * The position within the commitment transactions' outputs. This may be None if the value is
23334  * below the dust limit (in which case no output appears in the commitment transaction and the
23335  * value is spent to additional transaction fees).
23336  */
23337 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
23338
23339 /**
23340  * Constructs a new HTLCOutputInCommitment given each field
23341  */
23342 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);
23343
23344 /**
23345  * Creates a copy of the HTLCOutputInCommitment
23346  */
23347 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
23348
23349 /**
23350  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
23351  */
23352 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
23353
23354 /**
23355  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
23356  */
23357 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
23358
23359 /**
23360  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
23361  * does not need to have its previous_output_index filled.
23362  */
23363 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
23364
23365 /**
23366  * Gets the redeemscript for a funding output from the two funding public keys.
23367  * Note that the order of funding public keys does not matter.
23368  */
23369 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
23370
23371 /**
23372  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
23373  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
23374  * transaction which needs signing, and can be used to construct an HTLC transaction which is
23375  * broadcastable given a counterparty HTLC signature.
23376  *
23377  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
23378  * commitment transaction).
23379  */
23380 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);
23381
23382 /**
23383  * Gets the witnessScript for an anchor output from the funding public key.
23384  * The witness in the spending input must be:
23385  * <BIP 143 funding_signature>
23386  * After 16 blocks of confirmation, an alternative satisfying witness could be:
23387  * <>
23388  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
23389  */
23390 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
23391
23392 /**
23393  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23394  */
23395 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
23396
23397 /**
23398  * Holder public keys
23399  */
23400 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23401
23402 /**
23403  * Holder public keys
23404  */
23405 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
23406
23407 /**
23408  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
23409  */
23410 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23411
23412 /**
23413  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
23414  */
23415 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
23416
23417 /**
23418  * Whether the holder is the initiator of this channel.
23419  * This is an input to the commitment number obscure factor computation.
23420  */
23421 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23422
23423 /**
23424  * Whether the holder is the initiator of this channel.
23425  * This is an input to the commitment number obscure factor computation.
23426  */
23427 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
23428
23429 /**
23430  * The late-bound counterparty channel transaction parameters.
23431  * These parameters are populated at the point in the protocol where the counterparty provides them.
23432  *
23433  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23434  */
23435 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23436
23437 /**
23438  * The late-bound counterparty channel transaction parameters.
23439  * These parameters are populated at the point in the protocol where the counterparty provides them.
23440  *
23441  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23442  */
23443 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
23444
23445 /**
23446  * The late-bound funding outpoint
23447  *
23448  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23449  */
23450 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23451
23452 /**
23453  * The late-bound funding outpoint
23454  *
23455  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23456  */
23457 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
23458
23459 /**
23460  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
23461  */
23462 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
23463
23464 /**
23465  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
23466  */
23467 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
23468
23469 /**
23470  * Constructs a new ChannelTransactionParameters given each field
23471  */
23472 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);
23473
23474 /**
23475  * Creates a copy of the ChannelTransactionParameters
23476  */
23477 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
23478
23479 /**
23480  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23481  */
23482 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
23483
23484 /**
23485  * Counter-party public keys
23486  */
23487 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
23488
23489 /**
23490  * Counter-party public keys
23491  */
23492 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
23493
23494 /**
23495  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
23496  */
23497 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
23498
23499 /**
23500  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
23501  */
23502 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
23503
23504 /**
23505  * Constructs a new CounterpartyChannelTransactionParameters given each field
23506  */
23507 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
23508
23509 /**
23510  * Creates a copy of the CounterpartyChannelTransactionParameters
23511  */
23512 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
23513
23514 /**
23515  * Whether the late bound parameters are populated.
23516  */
23517 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23518
23519 /**
23520  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
23521  * given that the holder is the broadcaster.
23522  *
23523  * self.is_populated() must be true before calling this function.
23524  */
23525 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23526
23527 /**
23528  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
23529  * given that the counterparty is the broadcaster.
23530  *
23531  * self.is_populated() must be true before calling this function.
23532  */
23533 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
23534
23535 /**
23536  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
23537  */
23538 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
23539
23540 /**
23541  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
23542  */
23543 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
23544
23545 /**
23546  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
23547  */
23548 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
23549
23550 /**
23551  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
23552  */
23553 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
23554
23555 /**
23556  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
23557  */
23558 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
23559
23560 /**
23561  * Get the channel pubkeys for the broadcaster
23562  */
23563 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23564
23565 /**
23566  * Get the channel pubkeys for the countersignatory
23567  */
23568 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23569
23570 /**
23571  * Get the contest delay applicable to the transactions.
23572  * Note that the contest delay was selected by the countersignatory.
23573  */
23574 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23575
23576 /**
23577  * Whether the channel is outbound from the broadcaster.
23578  *
23579  * The boolean representing the side that initiated the channel is
23580  * an input to the commitment number obscure factor computation.
23581  */
23582 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23583
23584 /**
23585  * The funding outpoint
23586  */
23587 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23588
23589 /**
23590  * Whether to use anchors for this channel
23591  */
23592 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
23593
23594 /**
23595  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
23596  */
23597 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
23598
23599 /**
23600  * Our counterparty's signature for the transaction
23601  */
23602 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
23603
23604 /**
23605  * Our counterparty's signature for the transaction
23606  */
23607 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
23608
23609 /**
23610  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
23611  */
23612 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
23613
23614 /**
23615  * Creates a copy of the HolderCommitmentTransaction
23616  */
23617 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
23618
23619 /**
23620  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
23621  */
23622 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
23623
23624 /**
23625  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
23626  */
23627 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
23628
23629 /**
23630  * Create a new holder transaction with the given counterparty signatures.
23631  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
23632  */
23633 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);
23634
23635 /**
23636  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
23637  */
23638 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
23639
23640 /**
23641  * The commitment transaction
23642  */
23643 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
23644
23645 /**
23646  * The commitment transaction
23647  */
23648 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
23649
23650 /**
23651  * The txid for the commitment transaction.
23652  *
23653  * This is provided as a performance optimization, instead of calling transaction.txid()
23654  * multiple times.
23655  */
23656 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
23657
23658 /**
23659  * The txid for the commitment transaction.
23660  *
23661  * This is provided as a performance optimization, instead of calling transaction.txid()
23662  * multiple times.
23663  */
23664 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23665
23666 /**
23667  * Constructs a new BuiltCommitmentTransaction given each field
23668  */
23669 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
23670
23671 /**
23672  * Creates a copy of the BuiltCommitmentTransaction
23673  */
23674 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
23675
23676 /**
23677  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
23678  */
23679 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
23680
23681 /**
23682  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
23683  */
23684 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
23685
23686 /**
23687  * Get the SIGHASH_ALL sighash value of the transaction.
23688  *
23689  * This can be used to verify a signature.
23690  */
23691 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);
23692
23693 /**
23694  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
23695  * because we are about to broadcast a holder transaction.
23696  */
23697 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);
23698
23699 /**
23700  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
23701  */
23702 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
23703
23704 /**
23705  * Creates a copy of the ClosingTransaction
23706  */
23707 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
23708
23709 /**
23710  * Checks if two ClosingTransactions contain equal inner contents.
23711  */
23712 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
23713
23714 /**
23715  * Construct an object of the class
23716  */
23717 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);
23718
23719 /**
23720  * Trust our pre-built transaction.
23721  *
23722  * Applies a wrapper which allows access to the transaction.
23723  *
23724  * This should only be used if you fully trust the builder of this object. It should not
23725  * be used by an external signer - instead use the verify function.
23726  */
23727 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23728
23729 /**
23730  * Verify our pre-built transaction.
23731  *
23732  * Applies a wrapper which allows access to the transaction.
23733  *
23734  * An external validating signer must call this method before signing
23735  * or using the built transaction.
23736  */
23737 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
23738
23739 /**
23740  * The value to be sent to the holder, or zero if the output will be omitted
23741  */
23742 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23743
23744 /**
23745  * The value to be sent to the counterparty, or zero if the output will be omitted
23746  */
23747 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23748
23749 /**
23750  * The destination of the holder's output
23751  */
23752 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23753
23754 /**
23755  * The destination of the counterparty's output
23756  */
23757 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
23758
23759 /**
23760  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
23761  */
23762 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
23763
23764 /**
23765  * The pre-built Bitcoin commitment transaction
23766  */
23767 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
23768
23769 /**
23770  * Get the SIGHASH_ALL sighash value of the transaction.
23771  *
23772  * This can be used to verify a signature.
23773  */
23774 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);
23775
23776 /**
23777  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
23778  * because we are about to broadcast a holder transaction.
23779  */
23780 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);
23781
23782 /**
23783  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
23784  */
23785 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
23786
23787 /**
23788  * Creates a copy of the CommitmentTransaction
23789  */
23790 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
23791
23792 /**
23793  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
23794  */
23795 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
23796
23797 /**
23798  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
23799  */
23800 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
23801
23802 /**
23803  * The backwards-counting commitment number
23804  */
23805 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23806
23807 /**
23808  * The value to be sent to the broadcaster
23809  */
23810 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23811
23812 /**
23813  * The value to be sent to the counterparty
23814  */
23815 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23816
23817 /**
23818  * The feerate paid per 1000-weight-unit in this commitment transaction.
23819  */
23820 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23821
23822 /**
23823  * Trust our pre-built transaction and derived transaction creation public keys.
23824  *
23825  * Applies a wrapper which allows access to these fields.
23826  *
23827  * This should only be used if you fully trust the builder of this object.  It should not
23828  * be used by an external signer - instead use the verify function.
23829  */
23830 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
23831
23832 /**
23833  * Verify our pre-built transaction and derived transaction creation public keys.
23834  *
23835  * Applies a wrapper which allows access to these fields.
23836  *
23837  * An external validating signer must call this method before signing
23838  * or using the built transaction.
23839  */
23840 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);
23841
23842 /**
23843  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
23844  */
23845 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
23846
23847 /**
23848  * The transaction ID of the built Bitcoin transaction
23849  */
23850 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23851
23852 /**
23853  * The pre-built Bitcoin commitment transaction
23854  */
23855 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23856
23857 /**
23858  * The pre-calculated transaction creation public keys.
23859  */
23860 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23861
23862 /**
23863  * Should anchors be used.
23864  */
23865 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
23866
23867 /**
23868  * Get a signature for each HTLC which was included in the commitment transaction (ie for
23869  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
23870  *
23871  * The returned Vec has one entry for each HTLC, and in the same order.
23872  *
23873  * This function is only valid in the holder commitment context, it always uses SigHashType::All.
23874  */
23875 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);
23876
23877 /**
23878  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
23879  * shared secret first. This prevents on-chain observers from discovering how many commitment
23880  * transactions occurred in a channel before it was closed.
23881  *
23882  * This function gets the shared secret from relevant channel public keys and can be used to
23883  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
23884  */
23885 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
23886
23887 /**
23888  * Checks if two InitFeaturess contain equal inner contents.
23889  * This ignores pointers and is_owned flags and looks at the values in fields.
23890  * Two objects with NULL inner values will be considered "equal" here.
23891  */
23892 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
23893
23894 /**
23895  * Checks if two NodeFeaturess contain equal inner contents.
23896  * This ignores pointers and is_owned flags and looks at the values in fields.
23897  * Two objects with NULL inner values will be considered "equal" here.
23898  */
23899 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
23900
23901 /**
23902  * Checks if two ChannelFeaturess contain equal inner contents.
23903  * This ignores pointers and is_owned flags and looks at the values in fields.
23904  * Two objects with NULL inner values will be considered "equal" here.
23905  */
23906 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
23907
23908 /**
23909  * Checks if two InvoiceFeaturess contain equal inner contents.
23910  * This ignores pointers and is_owned flags and looks at the values in fields.
23911  * Two objects with NULL inner values will be considered "equal" here.
23912  */
23913 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
23914
23915 /**
23916  * Checks if two ChannelTypeFeaturess contain equal inner contents.
23917  * This ignores pointers and is_owned flags and looks at the values in fields.
23918  * Two objects with NULL inner values will be considered "equal" here.
23919  */
23920 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
23921
23922 /**
23923  * Creates a copy of the InitFeatures
23924  */
23925 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
23926
23927 /**
23928  * Creates a copy of the NodeFeatures
23929  */
23930 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
23931
23932 /**
23933  * Creates a copy of the ChannelFeatures
23934  */
23935 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
23936
23937 /**
23938  * Creates a copy of the InvoiceFeatures
23939  */
23940 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
23941
23942 /**
23943  * Creates a copy of the ChannelTypeFeatures
23944  */
23945 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
23946
23947 /**
23948  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
23949  */
23950 void InitFeatures_free(struct LDKInitFeatures this_obj);
23951
23952 /**
23953  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
23954  */
23955 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
23956
23957 /**
23958  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
23959  */
23960 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
23961
23962 /**
23963  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
23964  */
23965 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
23966
23967 /**
23968  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
23969  */
23970 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
23971
23972 /**
23973  * Create a blank Features with no features set
23974  */
23975 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
23976
23977 /**
23978  * Creates a Features with the bits set which are known by the implementation
23979  */
23980 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
23981
23982 /**
23983  * Returns true if this `Features` object contains unknown feature flags which are set as
23984  * \"required\".
23985  */
23986 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
23987
23988 /**
23989  * Create a blank Features with no features set
23990  */
23991 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
23992
23993 /**
23994  * Creates a Features with the bits set which are known by the implementation
23995  */
23996 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
23997
23998 /**
23999  * Returns true if this `Features` object contains unknown feature flags which are set as
24000  * \"required\".
24001  */
24002 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24003
24004 /**
24005  * Create a blank Features with no features set
24006  */
24007 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
24008
24009 /**
24010  * Creates a Features with the bits set which are known by the implementation
24011  */
24012 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
24013
24014 /**
24015  * Returns true if this `Features` object contains unknown feature flags which are set as
24016  * \"required\".
24017  */
24018 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
24019
24020 /**
24021  * Create a blank Features with no features set
24022  */
24023 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
24024
24025 /**
24026  * Creates a Features with the bits set which are known by the implementation
24027  */
24028 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
24029
24030 /**
24031  * Returns true if this `Features` object contains unknown feature flags which are set as
24032  * \"required\".
24033  */
24034 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24035
24036 /**
24037  * Create a blank Features with no features set
24038  */
24039 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
24040
24041 /**
24042  * Creates a Features with the bits set which are known by the implementation
24043  */
24044 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
24045
24046 /**
24047  * Returns true if this `Features` object contains unknown feature flags which are set as
24048  * \"required\".
24049  */
24050 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24051
24052 /**
24053  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
24054  */
24055 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
24056
24057 /**
24058  * Read a InitFeatures from a byte array, created by InitFeatures_write
24059  */
24060 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
24061
24062 /**
24063  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
24064  */
24065 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
24066
24067 /**
24068  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
24069  */
24070 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
24071
24072 /**
24073  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
24074  */
24075 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
24076
24077 /**
24078  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
24079  */
24080 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
24081
24082 /**
24083  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
24084  */
24085 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
24086
24087 /**
24088  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
24089  */
24090 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
24091
24092 /**
24093  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
24094  */
24095 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
24096
24097 /**
24098  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
24099  */
24100 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
24101
24102 /**
24103  * Set this feature as optional.
24104  */
24105 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24106
24107 /**
24108  * Set this feature as required.
24109  */
24110 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24111
24112 /**
24113  * Checks if this feature is supported.
24114  */
24115 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24116
24117 /**
24118  * Set this feature as optional.
24119  */
24120 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24121
24122 /**
24123  * Set this feature as required.
24124  */
24125 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24126
24127 /**
24128  * Checks if this feature is supported.
24129  */
24130 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24131
24132 /**
24133  * Checks if this feature is required.
24134  */
24135 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24136
24137 /**
24138  * Checks if this feature is required.
24139  */
24140 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24141
24142 /**
24143  * Set this feature as optional.
24144  */
24145 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24146
24147 /**
24148  * Set this feature as required.
24149  */
24150 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24151
24152 /**
24153  * Checks if this feature is supported.
24154  */
24155 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24156
24157 /**
24158  * Set this feature as optional.
24159  */
24160 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24161
24162 /**
24163  * Set this feature as required.
24164  */
24165 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24166
24167 /**
24168  * Checks if this feature is supported.
24169  */
24170 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24171
24172 /**
24173  * Set this feature as optional.
24174  */
24175 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24176
24177 /**
24178  * Set this feature as required.
24179  */
24180 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24181
24182 /**
24183  * Checks if this feature is supported.
24184  */
24185 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24186
24187 /**
24188  * Checks if this feature is required.
24189  */
24190 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24191
24192 /**
24193  * Checks if this feature is required.
24194  */
24195 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24196
24197 /**
24198  * Set this feature as optional.
24199  */
24200 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24201
24202 /**
24203  * Set this feature as required.
24204  */
24205 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24206
24207 /**
24208  * Checks if this feature is supported.
24209  */
24210 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24211
24212 /**
24213  * Set this feature as optional.
24214  */
24215 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24216
24217 /**
24218  * Set this feature as required.
24219  */
24220 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24221
24222 /**
24223  * Checks if this feature is supported.
24224  */
24225 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24226
24227 /**
24228  * Checks if this feature is required.
24229  */
24230 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24231
24232 /**
24233  * Checks if this feature is required.
24234  */
24235 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24236
24237 /**
24238  * Set this feature as optional.
24239  */
24240 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24241
24242 /**
24243  * Set this feature as required.
24244  */
24245 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24246
24247 /**
24248  * Checks if this feature is supported.
24249  */
24250 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24251
24252 /**
24253  * Set this feature as optional.
24254  */
24255 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24256
24257 /**
24258  * Set this feature as required.
24259  */
24260 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24261
24262 /**
24263  * Checks if this feature is supported.
24264  */
24265 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24266
24267 /**
24268  * Set this feature as optional.
24269  */
24270 void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24271
24272 /**
24273  * Set this feature as required.
24274  */
24275 void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24276
24277 /**
24278  * Checks if this feature is supported.
24279  */
24280 MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24281
24282 /**
24283  * Checks if this feature is required.
24284  */
24285 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24286
24287 /**
24288  * Checks if this feature is required.
24289  */
24290 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24291
24292 /**
24293  * Checks if this feature is required.
24294  */
24295 MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24296
24297 /**
24298  * Set this feature as optional.
24299  */
24300 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24301
24302 /**
24303  * Set this feature as required.
24304  */
24305 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24306
24307 /**
24308  * Checks if this feature is supported.
24309  */
24310 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24311
24312 /**
24313  * Set this feature as optional.
24314  */
24315 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24316
24317 /**
24318  * Set this feature as required.
24319  */
24320 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24321
24322 /**
24323  * Checks if this feature is supported.
24324  */
24325 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24326
24327 /**
24328  * Set this feature as optional.
24329  */
24330 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24331
24332 /**
24333  * Set this feature as required.
24334  */
24335 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24336
24337 /**
24338  * Checks if this feature is supported.
24339  */
24340 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24341
24342 /**
24343  * Checks if this feature is required.
24344  */
24345 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24346
24347 /**
24348  * Checks if this feature is required.
24349  */
24350 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24351
24352 /**
24353  * Checks if this feature is required.
24354  */
24355 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24356
24357 /**
24358  * Set this feature as optional.
24359  */
24360 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24361
24362 /**
24363  * Set this feature as required.
24364  */
24365 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24366
24367 /**
24368  * Checks if this feature is supported.
24369  */
24370 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24371
24372 /**
24373  * Set this feature as optional.
24374  */
24375 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24376
24377 /**
24378  * Set this feature as required.
24379  */
24380 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24381
24382 /**
24383  * Checks if this feature is supported.
24384  */
24385 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24386
24387 /**
24388  * Set this feature as optional.
24389  */
24390 void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24391
24392 /**
24393  * Set this feature as required.
24394  */
24395 void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24396
24397 /**
24398  * Checks if this feature is supported.
24399  */
24400 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24401
24402 /**
24403  * Checks if this feature is required.
24404  */
24405 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24406
24407 /**
24408  * Checks if this feature is required.
24409  */
24410 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24411
24412 /**
24413  * Checks if this feature is required.
24414  */
24415 MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24416
24417 /**
24418  * Set this feature as optional.
24419  */
24420 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24421
24422 /**
24423  * Set this feature as required.
24424  */
24425 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24426
24427 /**
24428  * Checks if this feature is supported.
24429  */
24430 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24431
24432 /**
24433  * Set this feature as optional.
24434  */
24435 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24436
24437 /**
24438  * Set this feature as required.
24439  */
24440 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24441
24442 /**
24443  * Checks if this feature is supported.
24444  */
24445 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24446
24447 /**
24448  * Set this feature as optional.
24449  */
24450 void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24451
24452 /**
24453  * Set this feature as required.
24454  */
24455 void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24456
24457 /**
24458  * Checks if this feature is supported.
24459  */
24460 MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24461
24462 /**
24463  * Checks if this feature is required.
24464  */
24465 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24466
24467 /**
24468  * Checks if this feature is required.
24469  */
24470 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24471
24472 /**
24473  * Checks if this feature is required.
24474  */
24475 MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24476
24477 /**
24478  * Set this feature as optional.
24479  */
24480 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24481
24482 /**
24483  * Set this feature as required.
24484  */
24485 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24486
24487 /**
24488  * Checks if this feature is supported.
24489  */
24490 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24491
24492 /**
24493  * Set this feature as optional.
24494  */
24495 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24496
24497 /**
24498  * Set this feature as required.
24499  */
24500 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24501
24502 /**
24503  * Checks if this feature is supported.
24504  */
24505 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24506
24507 /**
24508  * Checks if this feature is required.
24509  */
24510 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24511
24512 /**
24513  * Checks if this feature is required.
24514  */
24515 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24516
24517 /**
24518  * Set this feature as optional.
24519  */
24520 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24521
24522 /**
24523  * Set this feature as required.
24524  */
24525 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24526
24527 /**
24528  * Checks if this feature is supported.
24529  */
24530 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24531
24532 /**
24533  * Set this feature as optional.
24534  */
24535 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24536
24537 /**
24538  * Set this feature as required.
24539  */
24540 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24541
24542 /**
24543  * Checks if this feature is supported.
24544  */
24545 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24546
24547 /**
24548  * Checks if this feature is required.
24549  */
24550 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24551
24552 /**
24553  * Checks if this feature is required.
24554  */
24555 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24556
24557 /**
24558  * Set this feature as optional.
24559  */
24560 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24561
24562 /**
24563  * Set this feature as required.
24564  */
24565 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24566
24567 /**
24568  * Checks if this feature is supported.
24569  */
24570 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24571
24572 /**
24573  * Set this feature as optional.
24574  */
24575 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24576
24577 /**
24578  * Set this feature as required.
24579  */
24580 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24581
24582 /**
24583  * Checks if this feature is supported.
24584  */
24585 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24586
24587 /**
24588  * Set this feature as optional.
24589  */
24590 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24591
24592 /**
24593  * Set this feature as required.
24594  */
24595 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24596
24597 /**
24598  * Checks if this feature is supported.
24599  */
24600 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24601
24602 /**
24603  * Checks if this feature is required.
24604  */
24605 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24606
24607 /**
24608  * Checks if this feature is required.
24609  */
24610 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24611
24612 /**
24613  * Checks if this feature is required.
24614  */
24615 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24616
24617 /**
24618  * Set this feature as optional.
24619  */
24620 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24621
24622 /**
24623  * Set this feature as required.
24624  */
24625 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24626
24627 /**
24628  * Checks if this feature is supported.
24629  */
24630 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24631
24632 /**
24633  * Checks if this feature is required.
24634  */
24635 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24636
24637 /**
24638  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
24639  */
24640 void ShutdownScript_free(struct LDKShutdownScript this_obj);
24641
24642 /**
24643  * Creates a copy of the ShutdownScript
24644  */
24645 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
24646
24647 /**
24648  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
24649  */
24650 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
24651
24652 /**
24653  * The script that did not meet the requirements from [BOLT #2].
24654  *
24655  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
24656  */
24657 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
24658
24659 /**
24660  * The script that did not meet the requirements from [BOLT #2].
24661  *
24662  * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
24663  */
24664 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
24665
24666 /**
24667  * Constructs a new InvalidShutdownScript given each field
24668  */
24669 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
24670
24671 /**
24672  * Creates a copy of the InvalidShutdownScript
24673  */
24674 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
24675
24676 /**
24677  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
24678  */
24679 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
24680
24681 /**
24682  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
24683  */
24684 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
24685
24686 /**
24687  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
24688  */
24689 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
24690
24691 /**
24692  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
24693  */
24694 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
24695
24696 /**
24697  * Generates a witness script pubkey from the given segwit version and program.
24698  *
24699  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
24700  * [`ShutdownScript::new_p2wsh`] instead.
24701  *
24702  * # Errors
24703  *
24704  * This function may return an error if `program` is invalid for the segwit `version`.
24705  */
24706 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
24707
24708 /**
24709  * Converts the shutdown script into the underlying [`Script`].
24710  */
24711 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
24712
24713 /**
24714  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
24715  *
24716  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24717  */
24718 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
24719
24720 /**
24721  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
24722  *
24723  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
24724  */
24725 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
24726
24727 /**
24728  * Calls the free function if one is set
24729  */
24730 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
24731
24732 /**
24733  * Calls the free function if one is set
24734  */
24735 void Type_free(struct LDKType this_ptr);
24736
24737 /**
24738  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
24739  */
24740 void NodeId_free(struct LDKNodeId this_obj);
24741
24742 /**
24743  * Creates a copy of the NodeId
24744  */
24745 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
24746
24747 /**
24748  * Create a new NodeId from a public key
24749  */
24750 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
24751
24752 /**
24753  * Get the public key slice from this NodeId
24754  */
24755 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
24756
24757 /**
24758  * Checks if two NodeIds contain equal inner contents.
24759  */
24760 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
24761
24762 /**
24763  * Serialize the NodeId object into a byte array which can be read by NodeId_read
24764  */
24765 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
24766
24767 /**
24768  * Read a NodeId from a byte array, created by NodeId_write
24769  */
24770 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
24771
24772 /**
24773  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
24774  */
24775 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
24776
24777 /**
24778  * Creates a copy of the NetworkGraph
24779  */
24780 struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
24781
24782 /**
24783  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
24784  */
24785 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
24786
24787 /**
24788  * Frees any resources used by the NetworkUpdate
24789  */
24790 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
24791
24792 /**
24793  * Creates a copy of the NetworkUpdate
24794  */
24795 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
24796
24797 /**
24798  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
24799  */
24800 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
24801
24802 /**
24803  * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
24804  */
24805 struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
24806
24807 /**
24808  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
24809  */
24810 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
24811
24812 /**
24813  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
24814  */
24815 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
24816
24817 /**
24818  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
24819  */
24820 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
24821
24822 /**
24823  * Constructs a new EventHandler which calls the relevant methods on this_arg.
24824  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
24825  */
24826 struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
24827
24828 /**
24829  * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL.
24830  */
24831 void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
24832
24833 /**
24834  * Creates a new tracker of the actual state of the network of channels and nodes,
24835  * assuming an existing Network Graph.
24836  * Chain monitor is used to make sure announced channels exist on-chain,
24837  * channel data is correct, and that the announcement is signed with
24838  * channel owners' keys.
24839  */
24840 MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
24841
24842 /**
24843  * Adds a provider used to check new announcements. Does not affect
24844  * existing announcements unless they are updated.
24845  * Add, update or remove the provider would replace the current one.
24846  */
24847 void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
24848
24849 /**
24850  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
24851  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
24852  */
24853 struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
24854
24855 /**
24856  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
24857  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
24858  */
24859 struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
24860
24861 /**
24862  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
24863  */
24864 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
24865
24866 /**
24867  * When the last update to the channel direction was issued.
24868  * Value is opaque, as set in the announcement.
24869  */
24870 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24871
24872 /**
24873  * When the last update to the channel direction was issued.
24874  * Value is opaque, as set in the announcement.
24875  */
24876 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
24877
24878 /**
24879  * Whether the channel can be currently used for payments (in this one direction).
24880  */
24881 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24882
24883 /**
24884  * Whether the channel can be currently used for payments (in this one direction).
24885  */
24886 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
24887
24888 /**
24889  * The difference in CLTV values that you must have when routing through this channel.
24890  */
24891 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24892
24893 /**
24894  * The difference in CLTV values that you must have when routing through this channel.
24895  */
24896 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
24897
24898 /**
24899  * The minimum value, which must be relayed to the next hop via the channel
24900  */
24901 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24902
24903 /**
24904  * The minimum value, which must be relayed to the next hop via the channel
24905  */
24906 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
24907
24908 /**
24909  * The maximum value which may be relayed to the next hop via the channel.
24910  */
24911 struct LDKCOption_u64Z ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24912
24913 /**
24914  * The maximum value which may be relayed to the next hop via the channel.
24915  */
24916 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
24917
24918 /**
24919  * Fees charged when the channel is used for routing
24920  */
24921 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24922
24923 /**
24924  * Fees charged when the channel is used for routing
24925  */
24926 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
24927
24928 /**
24929  * Most recent update for the channel received from the network
24930  * Mostly redundant with the data we store in fields explicitly.
24931  * Everything else is useful only for sending out for initial routing sync.
24932  * Not stored if contains excess data to prevent DoS.
24933  *
24934  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24935  */
24936 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
24937
24938 /**
24939  * Most recent update for the channel received from the network
24940  * Mostly redundant with the data we store in fields explicitly.
24941  * Everything else is useful only for sending out for initial routing sync.
24942  * Not stored if contains excess data to prevent DoS.
24943  *
24944  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24945  */
24946 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
24947
24948 /**
24949  * Constructs a new ChannelUpdateInfo given each field
24950  */
24951 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);
24952
24953 /**
24954  * Creates a copy of the ChannelUpdateInfo
24955  */
24956 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
24957
24958 /**
24959  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
24960  */
24961 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
24962
24963 /**
24964  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
24965  */
24966 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
24967
24968 /**
24969  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
24970  */
24971 void ChannelInfo_free(struct LDKChannelInfo this_obj);
24972
24973 /**
24974  * Protocol features of a channel communicated during its announcement
24975  */
24976 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24977
24978 /**
24979  * Protocol features of a channel communicated during its announcement
24980  */
24981 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
24982
24983 /**
24984  * Source node of the first direction of a channel
24985  */
24986 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24987
24988 /**
24989  * Source node of the first direction of a channel
24990  */
24991 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
24992
24993 /**
24994  * Details about the first direction of a channel
24995  *
24996  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24997  */
24998 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
24999
25000 /**
25001  * Details about the first direction of a channel
25002  *
25003  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25004  */
25005 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
25006
25007 /**
25008  * Source node of the second direction of a channel
25009  */
25010 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25011
25012 /**
25013  * Source node of the second direction of a channel
25014  */
25015 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
25016
25017 /**
25018  * Details about the second direction of a channel
25019  *
25020  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25021  */
25022 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25023
25024 /**
25025  * Details about the second direction of a channel
25026  *
25027  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25028  */
25029 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
25030
25031 /**
25032  * The channel capacity as seen on-chain, if chain lookup is available.
25033  */
25034 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25035
25036 /**
25037  * The channel capacity as seen on-chain, if chain lookup is available.
25038  */
25039 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25040
25041 /**
25042  * An initial announcement of the channel
25043  * Mostly redundant with the data we store in fields explicitly.
25044  * Everything else is useful only for sending out for initial routing sync.
25045  * Not stored if contains excess data to prevent DoS.
25046  *
25047  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25048  */
25049 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25050
25051 /**
25052  * An initial announcement of the channel
25053  * Mostly redundant with the data we store in fields explicitly.
25054  * Everything else is useful only for sending out for initial routing sync.
25055  * Not stored if contains excess data to prevent DoS.
25056  *
25057  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25058  */
25059 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
25060
25061 /**
25062  * Creates a copy of the ChannelInfo
25063  */
25064 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
25065
25066 /**
25067  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
25068  */
25069 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
25070
25071 /**
25072  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
25073  */
25074 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
25075
25076 /**
25077  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
25078  */
25079 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
25080
25081 /**
25082  * Creates a copy of the DirectedChannelInfo
25083  */
25084 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
25085
25086 /**
25087  * Returns information for the channel.
25088  */
25089 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25090
25091 /**
25092  * Returns information for the direction.
25093  *
25094  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25095  */
25096 MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25097
25098 /**
25099  * Returns the [`EffectiveCapacity`] of the channel in the direction.
25100  *
25101  * This is either the total capacity from the funding transaction, if known, or the
25102  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
25103  * whichever is smaller.
25104  */
25105 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25106
25107 /**
25108  * Frees any resources used by the EffectiveCapacity
25109  */
25110 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
25111
25112 /**
25113  * Creates a copy of the EffectiveCapacity
25114  */
25115 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
25116
25117 /**
25118  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
25119  */
25120 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
25121
25122 /**
25123  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
25124  */
25125 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
25126
25127 /**
25128  * Utility method to constructs a new Total-variant EffectiveCapacity
25129  */
25130 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat);
25131
25132 /**
25133  * Utility method to constructs a new Infinite-variant EffectiveCapacity
25134  */
25135 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
25136
25137 /**
25138  * Utility method to constructs a new Unknown-variant EffectiveCapacity
25139  */
25140 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
25141
25142 /**
25143  * Returns the effective capacity denominated in millisatoshi.
25144  */
25145 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
25146
25147 /**
25148  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
25149  */
25150 void RoutingFees_free(struct LDKRoutingFees this_obj);
25151
25152 /**
25153  * Flat routing fee in satoshis
25154  */
25155 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
25156
25157 /**
25158  * Flat routing fee in satoshis
25159  */
25160 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
25161
25162 /**
25163  * Liquidity-based routing fee in millionths of a routed amount.
25164  * In other words, 10000 is 1%.
25165  */
25166 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
25167
25168 /**
25169  * Liquidity-based routing fee in millionths of a routed amount.
25170  * In other words, 10000 is 1%.
25171  */
25172 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
25173
25174 /**
25175  * Constructs a new RoutingFees given each field
25176  */
25177 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
25178
25179 /**
25180  * Checks if two RoutingFeess contain equal inner contents.
25181  * This ignores pointers and is_owned flags and looks at the values in fields.
25182  * Two objects with NULL inner values will be considered "equal" here.
25183  */
25184 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
25185
25186 /**
25187  * Creates a copy of the RoutingFees
25188  */
25189 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
25190
25191 /**
25192  * Checks if two RoutingFeess contain equal inner contents.
25193  */
25194 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
25195
25196 /**
25197  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
25198  */
25199 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
25200
25201 /**
25202  * Read a RoutingFees from a byte array, created by RoutingFees_write
25203  */
25204 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
25205
25206 /**
25207  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
25208  */
25209 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
25210
25211 /**
25212  * Protocol features the node announced support for
25213  */
25214 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
25215
25216 /**
25217  * Protocol features the node announced support for
25218  */
25219 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
25220
25221 /**
25222  * When the last known update to the node state was issued.
25223  * Value is opaque, as set in the announcement.
25224  */
25225 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
25226
25227 /**
25228  * When the last known update to the node state was issued.
25229  * Value is opaque, as set in the announcement.
25230  */
25231 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
25232
25233 /**
25234  * Color assigned to the node
25235  */
25236 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
25237
25238 /**
25239  * Color assigned to the node
25240  */
25241 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
25242
25243 /**
25244  * Moniker assigned to the node.
25245  * May be invalid or malicious (eg control chars),
25246  * should not be exposed to the user.
25247  */
25248 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
25249
25250 /**
25251  * Moniker assigned to the node.
25252  * May be invalid or malicious (eg control chars),
25253  * should not be exposed to the user.
25254  */
25255 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25256
25257 /**
25258  * Internet-level addresses via which one can connect to the node
25259  */
25260 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
25261
25262 /**
25263  * An initial announcement of the node
25264  * Mostly redundant with the data we store in fields explicitly.
25265  * Everything else is useful only for sending out for initial routing sync.
25266  * Not stored if contains excess data to prevent DoS.
25267  *
25268  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25269  */
25270 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
25271
25272 /**
25273  * An initial announcement of the node
25274  * Mostly redundant with the data we store in fields explicitly.
25275  * Everything else is useful only for sending out for initial routing sync.
25276  * Not stored if contains excess data to prevent DoS.
25277  *
25278  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25279  */
25280 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
25281
25282 /**
25283  * Constructs a new NodeAnnouncementInfo given each field
25284  */
25285 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);
25286
25287 /**
25288  * Creates a copy of the NodeAnnouncementInfo
25289  */
25290 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
25291
25292 /**
25293  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
25294  */
25295 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
25296
25297 /**
25298  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
25299  */
25300 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
25301
25302 /**
25303  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
25304  */
25305 void NodeInfo_free(struct LDKNodeInfo this_obj);
25306
25307 /**
25308  * All valid channels a node has announced
25309  */
25310 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
25311
25312 /**
25313  * Lowest fees enabling routing via any of the enabled, known channels to a node.
25314  * The two fields (flat and proportional fee) are independent,
25315  * meaning they don't have to refer to the same channel.
25316  *
25317  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25318  */
25319 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
25320
25321 /**
25322  * Lowest fees enabling routing via any of the enabled, known channels to a node.
25323  * The two fields (flat and proportional fee) are independent,
25324  * meaning they don't have to refer to the same channel.
25325  *
25326  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25327  */
25328 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
25329
25330 /**
25331  * More information about a node from node_announcement.
25332  * Optional because we store a Node entry after learning about it from
25333  * a channel announcement, but before receiving a node announcement.
25334  *
25335  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25336  */
25337 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
25338
25339 /**
25340  * More information about a node from node_announcement.
25341  * Optional because we store a Node entry after learning about it from
25342  * a channel announcement, but before receiving a node announcement.
25343  *
25344  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25345  */
25346 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
25347
25348 /**
25349  * Constructs a new NodeInfo given each field
25350  */
25351 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
25352
25353 /**
25354  * Creates a copy of the NodeInfo
25355  */
25356 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
25357
25358 /**
25359  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
25360  */
25361 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
25362
25363 /**
25364  * Read a NodeInfo from a byte array, created by NodeInfo_write
25365  */
25366 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
25367
25368 /**
25369  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
25370  */
25371 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
25372
25373 /**
25374  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
25375  */
25376 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser);
25377
25378 /**
25379  * Creates a new, empty, network graph.
25380  */
25381 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
25382
25383 /**
25384  * Returns a read-only view of the network graph.
25385  */
25386 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
25387
25388 /**
25389  * For an already known node (from channel announcements), update its stored properties from a
25390  * given node announcement.
25391  *
25392  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
25393  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
25394  * routing messages from a source using a protocol other than the lightning P2P protocol.
25395  */
25396 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
25397
25398 /**
25399  * For an already known node (from channel announcements), update its stored properties from a
25400  * given node announcement without verifying the associated signatures. Because we aren't
25401  * given the associated signatures here we cannot relay the node announcement to any of our
25402  * peers.
25403  */
25404 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);
25405
25406 /**
25407  * Store or update channel info from a channel announcement.
25408  *
25409  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
25410  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
25411  * routing messages from a source using a protocol other than the lightning P2P protocol.
25412  *
25413  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
25414  * the corresponding UTXO exists on chain and is correctly-formatted.
25415  */
25416 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);
25417
25418 /**
25419  * Store or update channel info from a channel announcement without verifying the associated
25420  * signatures. Because we aren't given the associated signatures here we cannot relay the
25421  * channel announcement to any of our peers.
25422  *
25423  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
25424  * the corresponding UTXO exists on chain and is correctly-formatted.
25425  */
25426 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);
25427
25428 /**
25429  * Close a channel if a corresponding HTLC fail was sent.
25430  * If permanent, removes a channel from the local storage.
25431  * May cause the removal of nodes too, if this was their last channel.
25432  * If not permanent, makes channels unavailable for routing.
25433  */
25434 void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
25435
25436 /**
25437  * Marks a node in the graph as failed.
25438  */
25439 void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
25440
25441 /**
25442  * Removes information about channels that we haven't heard any updates about in some time.
25443  * This can be used regularly to prune the network graph of channels that likely no longer
25444  * exist.
25445  *
25446  * While there is no formal requirement that nodes regularly re-broadcast their channel
25447  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
25448  * pruning occur for updates which are at least two weeks old, which we implement here.
25449  *
25450  * Note that for users of the `lightning-background-processor` crate this method may be
25451  * automatically called regularly for you.
25452  *
25453  * This method is only available with the `std` feature. See
25454  * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
25455  */
25456 void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
25457
25458 /**
25459  * Removes information about channels that we haven't heard any updates about in some time.
25460  * This can be used regularly to prune the network graph of channels that likely no longer
25461  * exist.
25462  *
25463  * While there is no formal requirement that nodes regularly re-broadcast their channel
25464  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
25465  * pruning occur for updates which are at least two weeks old, which we implement here.
25466  *
25467  * This function takes the current unix time as an argument. For users with the `std` feature
25468  * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
25469  */
25470 void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
25471
25472 /**
25473  * For an already known (from announcement) channel, update info about one of the directions
25474  * of the channel.
25475  *
25476  * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's
25477  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
25478  * routing messages from a source using a protocol other than the lightning P2P protocol.
25479  *
25480  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
25481  * materially in the future will be rejected.
25482  */
25483 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
25484
25485 /**
25486  * For an already known (from announcement) channel, update info about one of the directions
25487  * of the channel without verifying the associated signatures. Because we aren't given the
25488  * associated signatures here we cannot relay the channel update to any of our peers.
25489  *
25490  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
25491  * materially in the future will be rejected.
25492  */
25493 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
25494
25495 /**
25496  * Get network addresses by node id.
25497  * Returns None if the requested node is completely unknown,
25498  * or if node announcement for the node was never received.
25499  */
25500 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
25501
25502 /**
25503  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
25504  */
25505 void RouteHop_free(struct LDKRouteHop this_obj);
25506
25507 /**
25508  * The node_id of the node at this hop.
25509  */
25510 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
25511
25512 /**
25513  * The node_id of the node at this hop.
25514  */
25515 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25516
25517 /**
25518  * The node_announcement features of the node at this hop. For the last hop, these may be
25519  * amended to match the features present in the invoice this node generated.
25520  */
25521 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
25522
25523 /**
25524  * The node_announcement features of the node at this hop. For the last hop, these may be
25525  * amended to match the features present in the invoice this node generated.
25526  */
25527 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
25528
25529 /**
25530  * The channel that should be used from the previous hop to reach this node.
25531  */
25532 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
25533
25534 /**
25535  * The channel that should be used from the previous hop to reach this node.
25536  */
25537 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
25538
25539 /**
25540  * The channel_announcement features of the channel that should be used from the previous hop
25541  * to reach this node.
25542  */
25543 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
25544
25545 /**
25546  * The channel_announcement features of the channel that should be used from the previous hop
25547  * to reach this node.
25548  */
25549 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
25550
25551 /**
25552  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
25553  * For the last hop, this should be the full value of the payment (might be more than
25554  * requested if we had to match htlc_minimum_msat).
25555  */
25556 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
25557
25558 /**
25559  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
25560  * For the last hop, this should be the full value of the payment (might be more than
25561  * requested if we had to match htlc_minimum_msat).
25562  */
25563 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
25564
25565 /**
25566  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
25567  * expected at the destination, in excess of the current block height.
25568  */
25569 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
25570
25571 /**
25572  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
25573  * expected at the destination, in excess of the current block height.
25574  */
25575 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
25576
25577 /**
25578  * Constructs a new RouteHop given each field
25579  */
25580 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);
25581
25582 /**
25583  * Creates a copy of the RouteHop
25584  */
25585 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
25586
25587 /**
25588  * Checks if two RouteHops contain equal inner contents.
25589  */
25590 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
25591
25592 /**
25593  * Checks if two RouteHops contain equal inner contents.
25594  * This ignores pointers and is_owned flags and looks at the values in fields.
25595  * Two objects with NULL inner values will be considered "equal" here.
25596  */
25597 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
25598
25599 /**
25600  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
25601  */
25602 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
25603
25604 /**
25605  * Read a RouteHop from a byte array, created by RouteHop_write
25606  */
25607 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
25608
25609 /**
25610  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
25611  */
25612 void Route_free(struct LDKRoute this_obj);
25613
25614 /**
25615  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
25616  * last RouteHop in each path must be the same.
25617  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
25618  * destination. Thus, this must always be at least length one. While the maximum length of any
25619  * given path is variable, keeping the length of any path to less than 20 should currently
25620  * ensure it is viable.
25621  */
25622 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
25623
25624 /**
25625  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
25626  * last RouteHop in each path must be the same.
25627  * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
25628  * destination. Thus, this must always be at least length one. While the maximum length of any
25629  * given path is variable, keeping the length of any path to less than 20 should currently
25630  * ensure it is viable.
25631  */
25632 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
25633
25634 /**
25635  * The `payment_params` parameter passed to [`find_route`].
25636  * This is used by `ChannelManager` to track information which may be required for retries,
25637  * provided back to you via [`Event::PaymentPathFailed`].
25638  *
25639  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
25640  *
25641  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25642  */
25643 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
25644
25645 /**
25646  * The `payment_params` parameter passed to [`find_route`].
25647  * This is used by `ChannelManager` to track information which may be required for retries,
25648  * provided back to you via [`Event::PaymentPathFailed`].
25649  *
25650  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
25651  *
25652  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25653  */
25654 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
25655
25656 /**
25657  * Constructs a new Route given each field
25658  */
25659 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
25660
25661 /**
25662  * Creates a copy of the Route
25663  */
25664 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
25665
25666 /**
25667  * Checks if two Routes contain equal inner contents.
25668  */
25669 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
25670
25671 /**
25672  * Checks if two Routes contain equal inner contents.
25673  * This ignores pointers and is_owned flags and looks at the values in fields.
25674  * Two objects with NULL inner values will be considered "equal" here.
25675  */
25676 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
25677
25678 /**
25679  * Returns the total amount of fees paid on this [`Route`].
25680  *
25681  * This doesn't include any extra payment made to the recipient, which can happen in excess of
25682  * the amount passed to [`find_route`]'s `params.final_value_msat`.
25683  */
25684 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
25685
25686 /**
25687  * Returns the total amount paid on this [`Route`], excluding the fees.
25688  */
25689 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
25690
25691 /**
25692  * Serialize the Route object into a byte array which can be read by Route_read
25693  */
25694 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
25695
25696 /**
25697  * Read a Route from a byte array, created by Route_write
25698  */
25699 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
25700
25701 /**
25702  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
25703  */
25704 void RouteParameters_free(struct LDKRouteParameters this_obj);
25705
25706 /**
25707  * The parameters of the failed payment path.
25708  */
25709 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
25710
25711 /**
25712  * The parameters of the failed payment path.
25713  */
25714 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
25715
25716 /**
25717  * The amount in msats sent on the failed payment path.
25718  */
25719 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
25720
25721 /**
25722  * The amount in msats sent on the failed payment path.
25723  */
25724 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
25725
25726 /**
25727  * The CLTV on the final hop of the failed payment path.
25728  */
25729 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
25730
25731 /**
25732  * The CLTV on the final hop of the failed payment path.
25733  */
25734 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
25735
25736 /**
25737  * Constructs a new RouteParameters given each field
25738  */
25739 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);
25740
25741 /**
25742  * Creates a copy of the RouteParameters
25743  */
25744 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
25745
25746 /**
25747  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
25748  */
25749 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
25750
25751 /**
25752  * Read a RouteParameters from a byte array, created by RouteParameters_write
25753  */
25754 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
25755
25756 /**
25757  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
25758  */
25759 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
25760
25761 /**
25762  * The node id of the payee.
25763  */
25764 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
25765
25766 /**
25767  * The node id of the payee.
25768  */
25769 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25770
25771 /**
25772  * Features supported by the payee.
25773  *
25774  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
25775  * does not contain any features.
25776  *
25777  * [`for_keysend`]: Self::for_keysend
25778  *
25779  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25780  */
25781 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
25782
25783 /**
25784  * Features supported by the payee.
25785  *
25786  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
25787  * does not contain any features.
25788  *
25789  * [`for_keysend`]: Self::for_keysend
25790  *
25791  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25792  */
25793 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
25794
25795 /**
25796  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
25797  */
25798 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
25799
25800 /**
25801  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
25802  */
25803 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
25804
25805 /**
25806  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
25807  */
25808 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
25809
25810 /**
25811  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
25812  */
25813 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25814
25815 /**
25816  * The maximum total CLTV delta we accept for the route.
25817  */
25818 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
25819
25820 /**
25821  * The maximum total CLTV delta we accept for the route.
25822  */
25823 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
25824
25825 /**
25826  * Constructs a new PaymentParameters given each field
25827  */
25828 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);
25829
25830 /**
25831  * Creates a copy of the PaymentParameters
25832  */
25833 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
25834
25835 /**
25836  * Checks if two PaymentParameterss contain equal inner contents.
25837  */
25838 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
25839
25840 /**
25841  * Checks if two PaymentParameterss contain equal inner contents.
25842  * This ignores pointers and is_owned flags and looks at the values in fields.
25843  * Two objects with NULL inner values will be considered "equal" here.
25844  */
25845 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
25846
25847 /**
25848  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
25849  */
25850 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
25851
25852 /**
25853  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
25854  */
25855 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
25856
25857 /**
25858  * Creates a payee with the node id of the given `pubkey`.
25859  */
25860 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
25861
25862 /**
25863  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
25864  */
25865 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
25866
25867 /**
25868  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
25869  */
25870 void RouteHint_free(struct LDKRouteHint this_obj);
25871
25872 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
25873
25874 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
25875
25876 /**
25877  * Constructs a new RouteHint given each field
25878  */
25879 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
25880
25881 /**
25882  * Creates a copy of the RouteHint
25883  */
25884 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
25885
25886 /**
25887  * Checks if two RouteHints contain equal inner contents.
25888  */
25889 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
25890
25891 /**
25892  * Checks if two RouteHints contain equal inner contents.
25893  * This ignores pointers and is_owned flags and looks at the values in fields.
25894  * Two objects with NULL inner values will be considered "equal" here.
25895  */
25896 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
25897
25898 /**
25899  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
25900  */
25901 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
25902
25903 /**
25904  * Read a RouteHint from a byte array, created by RouteHint_write
25905  */
25906 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
25907
25908 /**
25909  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
25910  */
25911 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
25912
25913 /**
25914  * The node_id of the non-target end of the route
25915  */
25916 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25917
25918 /**
25919  * The node_id of the non-target end of the route
25920  */
25921 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
25922
25923 /**
25924  * The short_channel_id of this channel
25925  */
25926 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25927
25928 /**
25929  * The short_channel_id of this channel
25930  */
25931 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
25932
25933 /**
25934  * The fees which must be paid to use this channel
25935  */
25936 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25937
25938 /**
25939  * The fees which must be paid to use this channel
25940  */
25941 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
25942
25943 /**
25944  * The difference in CLTV values between this node and the next node.
25945  */
25946 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25947
25948 /**
25949  * The difference in CLTV values between this node and the next node.
25950  */
25951 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
25952
25953 /**
25954  * The minimum value, in msat, which must be relayed to the next hop.
25955  */
25956 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25957
25958 /**
25959  * The minimum value, in msat, which must be relayed to the next hop.
25960  */
25961 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25962
25963 /**
25964  * The maximum value in msat available for routing with a single HTLC.
25965  */
25966 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
25967
25968 /**
25969  * The maximum value in msat available for routing with a single HTLC.
25970  */
25971 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25972
25973 /**
25974  * Constructs a new RouteHintHop given each field
25975  */
25976 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);
25977
25978 /**
25979  * Creates a copy of the RouteHintHop
25980  */
25981 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
25982
25983 /**
25984  * Checks if two RouteHintHops contain equal inner contents.
25985  */
25986 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
25987
25988 /**
25989  * Checks if two RouteHintHops contain equal inner contents.
25990  * This ignores pointers and is_owned flags and looks at the values in fields.
25991  * Two objects with NULL inner values will be considered "equal" here.
25992  */
25993 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
25994
25995 /**
25996  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
25997  */
25998 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
25999
26000 /**
26001  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
26002  */
26003 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
26004
26005 /**
26006  * Finds a route from us (payer) to the given target node (payee).
26007  *
26008  * If the payee provided features in their invoice, they should be provided via `params.payee`.
26009  * Without this, MPP will only be used if the payee's features are available in the network graph.
26010  *
26011  * Private routing paths between a public node and the target may be included in `params.payee`.
26012  *
26013  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
26014  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local
26015  * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
26016  *
26017  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
26018  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
26019  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
26020  *
26021  * # Note
26022  *
26023  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
26024  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
26025  * function.
26026  *
26027  * # Panics
26028  *
26029  * Panics if first_hops contains channels without short_channel_ids;
26030  * [`ChannelManager::list_usable_channels`] will never include such channels.
26031  *
26032  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
26033  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
26034  *
26035  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
26036  */
26037 struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]);
26038
26039 /**
26040  * Calls the free function if one is set
26041  */
26042 void Score_free(struct LDKScore this_ptr);
26043
26044 /**
26045  * Calls the free function if one is set
26046  */
26047 void LockableScore_free(struct LDKLockableScore this_ptr);
26048
26049 /**
26050  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
26051  */
26052 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
26053
26054 /**
26055  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
26056  */
26057 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
26058
26059 /**
26060  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
26061  */
26062 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
26063
26064 /**
26065  * Creates a copy of the FixedPenaltyScorer
26066  */
26067 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
26068
26069 /**
26070  * Creates a new scorer using `penalty_msat`.
26071  */
26072 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
26073
26074 /**
26075  * Constructs a new Score which calls the relevant methods on this_arg.
26076  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
26077  */
26078 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
26079
26080 /**
26081  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
26082  */
26083 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
26084
26085 /**
26086  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
26087  */
26088 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
26089
26090 /**
26091  * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL.
26092  */
26093 void Scorer_free(struct LDKScorer this_obj);
26094
26095 /**
26096  * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL.
26097  */
26098 void ScoringParameters_free(struct LDKScoringParameters this_obj);
26099
26100 /**
26101  * A fixed penalty in msats to apply to each channel.
26102  *
26103  * Default value: 500 msat
26104  */
26105 uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
26106
26107 /**
26108  * A fixed penalty in msats to apply to each channel.
26109  *
26110  * Default value: 500 msat
26111  */
26112 void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
26113
26114 /**
26115  * A penalty in msats to apply to a channel upon failing to relay a payment.
26116  *
26117  * This accumulates for each failure but may be reduced over time based on
26118  * [`failure_penalty_half_life`] or when successfully routing through a channel.
26119  *
26120  * Default value: 1,024,000 msat
26121  *
26122  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
26123  */
26124 uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
26125
26126 /**
26127  * A penalty in msats to apply to a channel upon failing to relay a payment.
26128  *
26129  * This accumulates for each failure but may be reduced over time based on
26130  * [`failure_penalty_half_life`] or when successfully routing through a channel.
26131  *
26132  * Default value: 1,024,000 msat
26133  *
26134  * [`failure_penalty_half_life`]: Self::failure_penalty_half_life
26135  */
26136 void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
26137
26138 /**
26139  * When the amount being sent over a channel is this many 1024ths of the total channel
26140  * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
26141  *
26142  * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
26143  *
26144  * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
26145  */
26146 uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
26147
26148 /**
26149  * When the amount being sent over a channel is this many 1024ths of the total channel
26150  * capacity, we begin applying [`overuse_penalty_msat_per_1024th`].
26151  *
26152  * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel)
26153  *
26154  * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th
26155  */
26156 void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val);
26157
26158 /**
26159  * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
26160  * over the channel exceeds [`overuse_penalty_start_1024th`] by.
26161  *
26162  * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
26163  *                to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
26164  *
26165  * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
26166  */
26167 uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
26168
26169 /**
26170  * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent
26171  * over the channel exceeds [`overuse_penalty_start_1024th`] by.
26172  *
26173  * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty
26174  *                to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel)
26175  *
26176  * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th
26177  */
26178 void ScoringParameters_set_overuse_penalty_msat_per_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
26179
26180 /**
26181  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
26182  * cut in half.
26183  *
26184  * Successfully routing through a channel will immediately cut the penalty in half as well.
26185  *
26186  * Default value: 1 hour
26187  *
26188  * # Note
26189  *
26190  * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
26191  * never decay.
26192  *
26193  * [`failure_penalty_msat`]: Self::failure_penalty_msat
26194  */
26195 uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr);
26196
26197 /**
26198  * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are
26199  * cut in half.
26200  *
26201  * Successfully routing through a channel will immediately cut the penalty in half as well.
26202  *
26203  * Default value: 1 hour
26204  *
26205  * # Note
26206  *
26207  * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will
26208  * never decay.
26209  *
26210  * [`failure_penalty_msat`]: Self::failure_penalty_msat
26211  */
26212 void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
26213
26214 /**
26215  * Constructs a new ScoringParameters given each field
26216  */
26217 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);
26218
26219 /**
26220  * Creates a copy of the ScoringParameters
26221  */
26222 struct LDKScoringParameters ScoringParameters_clone(const struct LDKScoringParameters *NONNULL_PTR orig);
26223
26224 /**
26225  * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read
26226  */
26227 struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj);
26228
26229 /**
26230  * Read a ScoringParameters from a byte array, created by ScoringParameters_write
26231  */
26232 struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser);
26233
26234 /**
26235  * Creates a new scorer using the given scoring parameters.
26236  */
26237 MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params);
26238
26239 /**
26240  * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used.
26241  */
26242 MUST_USE_RES struct LDKScorer Scorer_default(void);
26243
26244 /**
26245  * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used.
26246  */
26247 MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void);
26248
26249 /**
26250  * Constructs a new Score which calls the relevant methods on this_arg.
26251  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
26252  */
26253 struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg);
26254
26255 /**
26256  * Serialize the Scorer object into a byte array which can be read by Scorer_read
26257  */
26258 struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj);
26259
26260 /**
26261  * Read a Scorer from a byte array, created by Scorer_write
26262  */
26263 struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser);
26264
26265 /**
26266  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
26267  */
26268 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
26269
26270 /**
26271  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
26272  */
26273 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
26274
26275 /**
26276  * A fixed penalty in msats to apply to each channel.
26277  *
26278  * Default value: 500 msat
26279  */
26280 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
26281
26282 /**
26283  * A fixed penalty in msats to apply to each channel.
26284  *
26285  * Default value: 500 msat
26286  */
26287 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
26288
26289 /**
26290  * A multiplier used in conjunction with the negative `log10` of the channel's success
26291  * probability for a payment to determine the liquidity penalty.
26292  *
26293  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
26294  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
26295  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
26296  * lower bounding the success probability to `0.01`) when the amount falls within the
26297  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
26298  * result in a `u64::max_value` penalty, however.
26299  *
26300  * Default value: 40,000 msat
26301  *
26302  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
26303  */
26304 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
26305
26306 /**
26307  * A multiplier used in conjunction with the negative `log10` of the channel's success
26308  * probability for a payment to determine the liquidity penalty.
26309  *
26310  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
26311  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
26312  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
26313  * lower bounding the success probability to `0.01`) when the amount falls within the
26314  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
26315  * result in a `u64::max_value` penalty, however.
26316  *
26317  * Default value: 40,000 msat
26318  *
26319  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
26320  */
26321 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
26322
26323 /**
26324  * The time required to elapse before any knowledge learned about channel liquidity balances is
26325  * cut in half.
26326  *
26327  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
26328  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
26329  * the certainty of the channel liquidity balance.
26330  *
26331  * Default value: 1 hour
26332  *
26333  * # Note
26334  *
26335  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
26336  * liquidity knowledge will never decay except when the bounds cross.
26337  */
26338 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
26339
26340 /**
26341  * The time required to elapse before any knowledge learned about channel liquidity balances is
26342  * cut in half.
26343  *
26344  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
26345  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
26346  * the certainty of the channel liquidity balance.
26347  *
26348  * Default value: 1 hour
26349  *
26350  * # Note
26351  *
26352  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
26353  * liquidity knowledge will never decay except when the bounds cross.
26354  */
26355 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
26356
26357 /**
26358  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
26359  * channel's success probability for the payment to determine the amount penalty.
26360  *
26361  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
26362  * fees plus penalty) for large payments. The penalty is computed as the product of this
26363  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
26364  * success probability.
26365  *
26366  * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
26367  *
26368  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
26369  * the amount will result in a penalty of the multiplier. And, as the success probability
26370  * decreases, the negative `log10` weighting will increase dramatically. For higher success
26371  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
26372  * fall below `1`.
26373  *
26374  * Default value: 256 msat
26375  */
26376 uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
26377
26378 /**
26379  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
26380  * channel's success probability for the payment to determine the amount penalty.
26381  *
26382  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
26383  * fees plus penalty) for large payments. The penalty is computed as the product of this
26384  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
26385  * success probability.
26386  *
26387  * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
26388  *
26389  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
26390  * the amount will result in a penalty of the multiplier. And, as the success probability
26391  * decreases, the negative `log10` weighting will increase dramatically. For higher success
26392  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
26393  * fall below `1`.
26394  *
26395  * Default value: 256 msat
26396  */
26397 void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
26398
26399 /**
26400  * Constructs a new ProbabilisticScoringParameters given each field
26401  */
26402 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg, uint64_t amount_penalty_multiplier_msat_arg);
26403
26404 /**
26405  * Creates a copy of the ProbabilisticScoringParameters
26406  */
26407 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
26408
26409 /**
26410  * Creates a new scorer using the given scoring parameters for sending payments from a node
26411  * through a network graph.
26412  */
26413 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
26414
26415 /**
26416  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
26417  */
26418 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
26419
26420 /**
26421  * Constructs a new Score which calls the relevant methods on this_arg.
26422  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
26423  */
26424 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
26425
26426 /**
26427  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
26428  */
26429 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
26430
26431 /**
26432  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
26433  */
26434 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b);
26435
26436 /**
26437  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
26438  */
26439 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
26440
26441 /**
26442  * Initialize a new FilesystemPersister and set the path to the individual channels'
26443  * files.
26444  */
26445 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
26446
26447 /**
26448  * Get the directory which was provided when this persister was initialized.
26449  */
26450 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
26451
26452 /**
26453  * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
26454  * initialization, within a file called \"manager\".
26455  */
26456 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager);
26457
26458 /**
26459  * Write the provided `NetworkGraph` to the path provided at `FilesystemPersister`
26460  * initialization, within a file called \"network_graph\"
26461  */
26462 MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_network_graph(struct LDKStr data_dir, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
26463
26464 /**
26465  * Read `ChannelMonitor`s from disk.
26466  */
26467 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
26468
26469 /**
26470  * Constructs a new Persist which calls the relevant methods on this_arg.
26471  * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is
26472  */
26473 struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
26474
26475 /**
26476  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
26477  */
26478 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
26479
26480 /**
26481  * Calls the free function if one is set
26482  */
26483 void Persister_free(struct LDKPersister this_ptr);
26484
26485 /**
26486  * Start a background thread that takes care of responsibilities enumerated in the [top-level
26487  * documentation].
26488  *
26489  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
26490  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
26491  * either [`join`] or [`stop`].
26492  *
26493  * # Data Persistence
26494  *
26495  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
26496  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
26497  * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
26498  * provided implementation.
26499  *
26500  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk. See
26501  * [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. See [`FilesystemPersister::persist_network_graph`]
26502  * for Rust-Lightning's provided implementation.
26503  *
26504  * Typically, users should either implement [`Persister::persist_manager`] to never return an
26505  * error or call [`join`] and handle any error that may arise. For the latter case,
26506  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
26507  *
26508  * # Event Handling
26509  *
26510  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
26511  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
26512  * functionality implemented by other handlers.
26513  * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
26514  *
26515  * [top-level documentation]: BackgroundProcessor
26516  * [`join`]: Self::join
26517  * [`stop`]: Self::stop
26518  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
26519  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
26520  * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
26521  * [`FilesystemPersister::persist_network_graph`]: lightning_persister::FilesystemPersister::persist_network_graph
26522  * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
26523  * [`NetworkGraph::write`]: lightning::routing::network_graph::NetworkGraph#impl-Writeable
26524  *
26525  * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
26526  */
26527 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
26528
26529 /**
26530  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
26531  * [`ChannelManager`].
26532  *
26533  * # Panics
26534  *
26535  * This function panics if the background thread has panicked such as while persisting or
26536  * handling events.
26537  *
26538  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
26539  */
26540 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
26541
26542 /**
26543  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
26544  * [`ChannelManager`].
26545  *
26546  * # Panics
26547  *
26548  * This function panics if the background thread has panicked such as while persisting or
26549  * handling events.
26550  *
26551  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
26552  */
26553 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
26554
26555 /**
26556  * Frees any resources used by the ParseError
26557  */
26558 void ParseError_free(struct LDKParseError this_ptr);
26559
26560 /**
26561  * Creates a copy of the ParseError
26562  */
26563 struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
26564
26565 /**
26566  * Utility method to constructs a new Bech32Error-variant ParseError
26567  */
26568 struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
26569
26570 /**
26571  * Utility method to constructs a new ParseAmountError-variant ParseError
26572  */
26573 struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
26574
26575 /**
26576  * Utility method to constructs a new MalformedSignature-variant ParseError
26577  */
26578 struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
26579
26580 /**
26581  * Utility method to constructs a new BadPrefix-variant ParseError
26582  */
26583 struct LDKParseError ParseError_bad_prefix(void);
26584
26585 /**
26586  * Utility method to constructs a new UnknownCurrency-variant ParseError
26587  */
26588 struct LDKParseError ParseError_unknown_currency(void);
26589
26590 /**
26591  * Utility method to constructs a new UnknownSiPrefix-variant ParseError
26592  */
26593 struct LDKParseError ParseError_unknown_si_prefix(void);
26594
26595 /**
26596  * Utility method to constructs a new MalformedHRP-variant ParseError
26597  */
26598 struct LDKParseError ParseError_malformed_hrp(void);
26599
26600 /**
26601  * Utility method to constructs a new TooShortDataPart-variant ParseError
26602  */
26603 struct LDKParseError ParseError_too_short_data_part(void);
26604
26605 /**
26606  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
26607  */
26608 struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
26609
26610 /**
26611  * Utility method to constructs a new DescriptionDecodeError-variant ParseError
26612  */
26613 struct LDKParseError ParseError_description_decode_error(struct LDKError a);
26614
26615 /**
26616  * Utility method to constructs a new PaddingError-variant ParseError
26617  */
26618 struct LDKParseError ParseError_padding_error(void);
26619
26620 /**
26621  * Utility method to constructs a new IntegerOverflowError-variant ParseError
26622  */
26623 struct LDKParseError ParseError_integer_overflow_error(void);
26624
26625 /**
26626  * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
26627  */
26628 struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
26629
26630 /**
26631  * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
26632  */
26633 struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
26634
26635 /**
26636  * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
26637  */
26638 struct LDKParseError ParseError_invalid_script_hash_length(void);
26639
26640 /**
26641  * Utility method to constructs a new InvalidRecoveryId-variant ParseError
26642  */
26643 struct LDKParseError ParseError_invalid_recovery_id(void);
26644
26645 /**
26646  * Utility method to constructs a new InvalidSliceLength-variant ParseError
26647  */
26648 struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
26649
26650 /**
26651  * Utility method to constructs a new Skip-variant ParseError
26652  */
26653 struct LDKParseError ParseError_skip(void);
26654
26655 /**
26656  * Frees any resources used by the ParseOrSemanticError
26657  */
26658 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
26659
26660 /**
26661  * Creates a copy of the ParseOrSemanticError
26662  */
26663 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
26664
26665 /**
26666  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
26667  */
26668 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
26669
26670 /**
26671  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
26672  */
26673 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
26674
26675 /**
26676  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
26677  */
26678 void Invoice_free(struct LDKInvoice this_obj);
26679
26680 /**
26681  * Checks if two Invoices contain equal inner contents.
26682  * This ignores pointers and is_owned flags and looks at the values in fields.
26683  * Two objects with NULL inner values will be considered "equal" here.
26684  */
26685 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
26686
26687 /**
26688  * Creates a copy of the Invoice
26689  */
26690 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
26691
26692 /**
26693  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
26694  */
26695 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
26696
26697 /**
26698  * Checks if two SignedRawInvoices contain equal inner contents.
26699  * This ignores pointers and is_owned flags and looks at the values in fields.
26700  * Two objects with NULL inner values will be considered "equal" here.
26701  */
26702 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
26703
26704 /**
26705  * Creates a copy of the SignedRawInvoice
26706  */
26707 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
26708
26709 /**
26710  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
26711  */
26712 void RawInvoice_free(struct LDKRawInvoice this_obj);
26713
26714 /**
26715  * data part
26716  */
26717 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
26718
26719 /**
26720  * data part
26721  */
26722 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
26723
26724 /**
26725  * Checks if two RawInvoices contain equal inner contents.
26726  * This ignores pointers and is_owned flags and looks at the values in fields.
26727  * Two objects with NULL inner values will be considered "equal" here.
26728  */
26729 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
26730
26731 /**
26732  * Creates a copy of the RawInvoice
26733  */
26734 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
26735
26736 /**
26737  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
26738  */
26739 void RawDataPart_free(struct LDKRawDataPart this_obj);
26740
26741 /**
26742  * generation time of the invoice
26743  */
26744 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
26745
26746 /**
26747  * generation time of the invoice
26748  */
26749 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
26750
26751 /**
26752  * Checks if two RawDataParts contain equal inner contents.
26753  * This ignores pointers and is_owned flags and looks at the values in fields.
26754  * Two objects with NULL inner values will be considered "equal" here.
26755  */
26756 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
26757
26758 /**
26759  * Creates a copy of the RawDataPart
26760  */
26761 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
26762
26763 /**
26764  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
26765  */
26766 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
26767
26768 /**
26769  * Checks if two PositiveTimestamps contain equal inner contents.
26770  * This ignores pointers and is_owned flags and looks at the values in fields.
26771  * Two objects with NULL inner values will be considered "equal" here.
26772  */
26773 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
26774
26775 /**
26776  * Creates a copy of the PositiveTimestamp
26777  */
26778 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
26779
26780 /**
26781  * Creates a copy of the SiPrefix
26782  */
26783 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
26784
26785 /**
26786  * Utility method to constructs a new Milli-variant SiPrefix
26787  */
26788 enum LDKSiPrefix SiPrefix_milli(void);
26789
26790 /**
26791  * Utility method to constructs a new Micro-variant SiPrefix
26792  */
26793 enum LDKSiPrefix SiPrefix_micro(void);
26794
26795 /**
26796  * Utility method to constructs a new Nano-variant SiPrefix
26797  */
26798 enum LDKSiPrefix SiPrefix_nano(void);
26799
26800 /**
26801  * Utility method to constructs a new Pico-variant SiPrefix
26802  */
26803 enum LDKSiPrefix SiPrefix_pico(void);
26804
26805 /**
26806  * Checks if two SiPrefixs contain equal inner contents.
26807  * This ignores pointers and is_owned flags and looks at the values in fields.
26808  */
26809 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
26810
26811 /**
26812  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
26813  * This is effectively 10^12 * the prefix multiplier
26814  */
26815 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
26816
26817 /**
26818  * Creates a copy of the Currency
26819  */
26820 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
26821
26822 /**
26823  * Utility method to constructs a new Bitcoin-variant Currency
26824  */
26825 enum LDKCurrency Currency_bitcoin(void);
26826
26827 /**
26828  * Utility method to constructs a new BitcoinTestnet-variant Currency
26829  */
26830 enum LDKCurrency Currency_bitcoin_testnet(void);
26831
26832 /**
26833  * Utility method to constructs a new Regtest-variant Currency
26834  */
26835 enum LDKCurrency Currency_regtest(void);
26836
26837 /**
26838  * Utility method to constructs a new Simnet-variant Currency
26839  */
26840 enum LDKCurrency Currency_simnet(void);
26841
26842 /**
26843  * Utility method to constructs a new Signet-variant Currency
26844  */
26845 enum LDKCurrency Currency_signet(void);
26846
26847 /**
26848  * Checks if two Currencys contain equal inner contents.
26849  */
26850 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
26851
26852 /**
26853  * Checks if two Currencys contain equal inner contents.
26854  * This ignores pointers and is_owned flags and looks at the values in fields.
26855  */
26856 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
26857
26858 /**
26859  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
26860  */
26861 void Sha256_free(struct LDKSha256 this_obj);
26862
26863 /**
26864  * Creates a copy of the Sha256
26865  */
26866 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
26867
26868 /**
26869  * Checks if two Sha256s contain equal inner contents.
26870  */
26871 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
26872
26873 /**
26874  * Checks if two Sha256s contain equal inner contents.
26875  * This ignores pointers and is_owned flags and looks at the values in fields.
26876  * Two objects with NULL inner values will be considered "equal" here.
26877  */
26878 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
26879
26880 /**
26881  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
26882  */
26883 void Description_free(struct LDKDescription this_obj);
26884
26885 /**
26886  * Creates a copy of the Description
26887  */
26888 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
26889
26890 /**
26891  * Checks if two Descriptions contain equal inner contents.
26892  */
26893 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
26894
26895 /**
26896  * Checks if two Descriptions contain equal inner contents.
26897  * This ignores pointers and is_owned flags and looks at the values in fields.
26898  * Two objects with NULL inner values will be considered "equal" here.
26899  */
26900 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
26901
26902 /**
26903  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
26904  */
26905 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
26906
26907 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
26908
26909 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26910
26911 /**
26912  * Constructs a new PayeePubKey given each field
26913  */
26914 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
26915
26916 /**
26917  * Creates a copy of the PayeePubKey
26918  */
26919 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
26920
26921 /**
26922  * Checks if two PayeePubKeys contain equal inner contents.
26923  */
26924 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
26925
26926 /**
26927  * Checks if two PayeePubKeys contain equal inner contents.
26928  * This ignores pointers and is_owned flags and looks at the values in fields.
26929  * Two objects with NULL inner values will be considered "equal" here.
26930  */
26931 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
26932
26933 /**
26934  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
26935  */
26936 void ExpiryTime_free(struct LDKExpiryTime this_obj);
26937
26938 /**
26939  * Creates a copy of the ExpiryTime
26940  */
26941 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
26942
26943 /**
26944  * Checks if two ExpiryTimes contain equal inner contents.
26945  */
26946 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
26947
26948 /**
26949  * Checks if two ExpiryTimes contain equal inner contents.
26950  * This ignores pointers and is_owned flags and looks at the values in fields.
26951  * Two objects with NULL inner values will be considered "equal" here.
26952  */
26953 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
26954
26955 /**
26956  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
26957  */
26958 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
26959
26960 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
26961
26962 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
26963
26964 /**
26965  * Constructs a new MinFinalCltvExpiry given each field
26966  */
26967 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
26968
26969 /**
26970  * Creates a copy of the MinFinalCltvExpiry
26971  */
26972 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
26973
26974 /**
26975  * Checks if two MinFinalCltvExpirys contain equal inner contents.
26976  */
26977 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
26978
26979 /**
26980  * Checks if two MinFinalCltvExpirys contain equal inner contents.
26981  * This ignores pointers and is_owned flags and looks at the values in fields.
26982  * Two objects with NULL inner values will be considered "equal" here.
26983  */
26984 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
26985
26986 /**
26987  * Frees any resources used by the Fallback
26988  */
26989 void Fallback_free(struct LDKFallback this_ptr);
26990
26991 /**
26992  * Creates a copy of the Fallback
26993  */
26994 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
26995
26996 /**
26997  * Utility method to constructs a new SegWitProgram-variant Fallback
26998  */
26999 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
27000
27001 /**
27002  * Utility method to constructs a new PubKeyHash-variant Fallback
27003  */
27004 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
27005
27006 /**
27007  * Utility method to constructs a new ScriptHash-variant Fallback
27008  */
27009 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
27010
27011 /**
27012  * Checks if two Fallbacks contain equal inner contents.
27013  */
27014 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
27015
27016 /**
27017  * Checks if two Fallbacks contain equal inner contents.
27018  * This ignores pointers and is_owned flags and looks at the values in fields.
27019  */
27020 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
27021
27022 /**
27023  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
27024  */
27025 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
27026
27027 /**
27028  * Creates a copy of the InvoiceSignature
27029  */
27030 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
27031
27032 /**
27033  * Checks if two InvoiceSignatures contain equal inner contents.
27034  * This ignores pointers and is_owned flags and looks at the values in fields.
27035  * Two objects with NULL inner values will be considered "equal" here.
27036  */
27037 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
27038
27039 /**
27040  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
27041  */
27042 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
27043
27044 /**
27045  * Creates a copy of the PrivateRoute
27046  */
27047 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
27048
27049 /**
27050  * Checks if two PrivateRoutes contain equal inner contents.
27051  */
27052 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
27053
27054 /**
27055  * Checks if two PrivateRoutes contain equal inner contents.
27056  * This ignores pointers and is_owned flags and looks at the values in fields.
27057  * Two objects with NULL inner values will be considered "equal" here.
27058  */
27059 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
27060
27061 /**
27062  * Disassembles the `SignedRawInvoice` into its three parts:
27063  *  1. raw invoice
27064  *  2. hash of the raw invoice
27065  *  3. signature
27066  */
27067 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
27068
27069 /**
27070  * The `RawInvoice` which was signed.
27071  */
27072 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27073
27074 /**
27075  * The hash of the `RawInvoice` that was signed.
27076  */
27077 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
27078
27079 /**
27080  * InvoiceSignature for the invoice.
27081  */
27082 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27083
27084 /**
27085  * Recovers the public key used for signing the invoice from the recoverable signature.
27086  */
27087 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27088
27089 /**
27090  * Checks if the signature is valid for the included payee public key or if none exists if it's
27091  * valid for the recovered signature (which should always be true?).
27092  */
27093 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27094
27095 /**
27096  * Calculate the hash of the encoded `RawInvoice`
27097  */
27098 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27099
27100 /**
27101  *
27102  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27103  */
27104 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27105
27106 /**
27107  *
27108  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27109  */
27110 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27111
27112 /**
27113  *
27114  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27115  */
27116 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27117
27118 /**
27119  *
27120  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27121  */
27122 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27123
27124 /**
27125  *
27126  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27127  */
27128 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27129
27130 /**
27131  *
27132  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27133  */
27134 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27135
27136 /**
27137  *
27138  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27139  */
27140 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27141
27142 /**
27143  *
27144  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27145  */
27146 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27147
27148 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27149
27150 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27151
27152 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27153
27154 /**
27155  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
27156  *
27157  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
27158  */
27159 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
27160
27161 /**
27162  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
27163  * the range `0..=MAX_TIMESTAMP`.
27164  *
27165  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
27166  */
27167 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
27168
27169 /**
27170  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
27171  * `0..=MAX_TIMESTAMP`.
27172  *
27173  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
27174  */
27175 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
27176
27177 /**
27178  * Returns the Unix timestamp representing the stored time
27179  */
27180 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
27181
27182 /**
27183  * Returns the duration of the stored time since the Unix epoch
27184  */
27185 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
27186
27187 /**
27188  * Returns the [`SystemTime`] representing the stored time
27189  */
27190 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
27191
27192 /**
27193  * Transform the `Invoice` into it's unchecked version
27194  */
27195 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
27196
27197 /**
27198  * Check that the invoice is signed correctly and that key recovery works
27199  */
27200 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
27201
27202 /**
27203  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
27204  * ```
27205  * use lightning_invoice::*;
27206  *
27207  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
27208  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
27209  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
27210  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
27211  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
27212  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
27213  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
27214  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
27215  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
27216  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
27217  * j5r6drg6k6zcqj0fcwg\";
27218  *
27219  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
27220  *
27221  * assert!(Invoice::from_signed(signed).is_ok());
27222  * ```
27223  */
27224 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
27225
27226 /**
27227  * Returns the `Invoice`'s timestamp (should equal its creation time)
27228  */
27229 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
27230
27231 /**
27232  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
27233  */
27234 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
27235
27236 /**
27237  * Returns the hash to which we will receive the preimage on completion of the payment
27238  */
27239 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
27240
27241 /**
27242  * Get the payee's public key if one was included in the invoice
27243  *
27244  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27245  */
27246 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
27247
27248 /**
27249  * Get the payment secret if one was included in the invoice
27250  */
27251 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
27252
27253 /**
27254  * Get the invoice features if they were included in the invoice
27255  *
27256  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27257  */
27258 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
27259
27260 /**
27261  * Recover the payee's public key (only to be used if none was included in the invoice)
27262  */
27263 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
27264
27265 /**
27266  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
27267  */
27268 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
27269
27270 /**
27271  * Returns whether the invoice has expired.
27272  */
27273 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
27274
27275 /**
27276  * Returns whether the expiry time would pass at the given point in time.
27277  * `at_time` is the timestamp as a duration since the Unix epoch.
27278  */
27279 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
27280
27281 /**
27282  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
27283  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
27284  */
27285 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
27286
27287 /**
27288  * Returns a list of all routes included in the invoice
27289  */
27290 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
27291
27292 /**
27293  * Returns a list of all routes included in the invoice as the underlying hints
27294  */
27295 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
27296
27297 /**
27298  * Returns the currency for which the invoice was issued
27299  */
27300 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
27301
27302 /**
27303  * Returns the amount if specified in the invoice as millisatoshis.
27304  */
27305 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
27306
27307 /**
27308  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
27309  * returns `CreationError::DescriptionTooLong` otherwise
27310  *
27311  * Please note that single characters may use more than one byte due to UTF8 encoding.
27312  */
27313 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
27314
27315 /**
27316  * Returns the underlying description `String`
27317  */
27318 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
27319
27320 /**
27321  * Construct an `ExpiryTime` from seconds.
27322  */
27323 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
27324
27325 /**
27326  * Construct an `ExpiryTime` from a `Duration`.
27327  */
27328 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
27329
27330 /**
27331  * Returns the expiry time in seconds
27332  */
27333 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
27334
27335 /**
27336  * Returns a reference to the underlying `Duration` (=expiry time)
27337  */
27338 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
27339
27340 /**
27341  * Creates a new (partial) route from a list of hops
27342  */
27343 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
27344
27345 /**
27346  * Returns the underlying list of hops
27347  */
27348 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
27349
27350 /**
27351  * Creates a copy of the CreationError
27352  */
27353 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
27354
27355 /**
27356  * Utility method to constructs a new DescriptionTooLong-variant CreationError
27357  */
27358 enum LDKCreationError CreationError_description_too_long(void);
27359
27360 /**
27361  * Utility method to constructs a new RouteTooLong-variant CreationError
27362  */
27363 enum LDKCreationError CreationError_route_too_long(void);
27364
27365 /**
27366  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
27367  */
27368 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
27369
27370 /**
27371  * Utility method to constructs a new InvalidAmount-variant CreationError
27372  */
27373 enum LDKCreationError CreationError_invalid_amount(void);
27374
27375 /**
27376  * Utility method to constructs a new MissingRouteHints-variant CreationError
27377  */
27378 enum LDKCreationError CreationError_missing_route_hints(void);
27379
27380 /**
27381  * Checks if two CreationErrors contain equal inner contents.
27382  * This ignores pointers and is_owned flags and looks at the values in fields.
27383  */
27384 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
27385
27386 /**
27387  * Get the string representation of a CreationError object
27388  */
27389 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
27390
27391 /**
27392  * Creates a copy of the SemanticError
27393  */
27394 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
27395
27396 /**
27397  * Utility method to constructs a new NoPaymentHash-variant SemanticError
27398  */
27399 enum LDKSemanticError SemanticError_no_payment_hash(void);
27400
27401 /**
27402  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
27403  */
27404 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
27405
27406 /**
27407  * Utility method to constructs a new NoDescription-variant SemanticError
27408  */
27409 enum LDKSemanticError SemanticError_no_description(void);
27410
27411 /**
27412  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
27413  */
27414 enum LDKSemanticError SemanticError_multiple_descriptions(void);
27415
27416 /**
27417  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
27418  */
27419 enum LDKSemanticError SemanticError_no_payment_secret(void);
27420
27421 /**
27422  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
27423  */
27424 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
27425
27426 /**
27427  * Utility method to constructs a new InvalidFeatures-variant SemanticError
27428  */
27429 enum LDKSemanticError SemanticError_invalid_features(void);
27430
27431 /**
27432  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
27433  */
27434 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
27435
27436 /**
27437  * Utility method to constructs a new InvalidSignature-variant SemanticError
27438  */
27439 enum LDKSemanticError SemanticError_invalid_signature(void);
27440
27441 /**
27442  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
27443  */
27444 enum LDKSemanticError SemanticError_imprecise_amount(void);
27445
27446 /**
27447  * Checks if two SemanticErrors contain equal inner contents.
27448  * This ignores pointers and is_owned flags and looks at the values in fields.
27449  */
27450 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
27451
27452 /**
27453  * Get the string representation of a SemanticError object
27454  */
27455 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
27456
27457 /**
27458  * Frees any resources used by the SignOrCreationError
27459  */
27460 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
27461
27462 /**
27463  * Creates a copy of the SignOrCreationError
27464  */
27465 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
27466
27467 /**
27468  * Utility method to constructs a new SignError-variant SignOrCreationError
27469  */
27470 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
27471
27472 /**
27473  * Utility method to constructs a new CreationError-variant SignOrCreationError
27474  */
27475 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
27476
27477 /**
27478  * Checks if two SignOrCreationErrors contain equal inner contents.
27479  * This ignores pointers and is_owned flags and looks at the values in fields.
27480  */
27481 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
27482
27483 /**
27484  * Get the string representation of a SignOrCreationError object
27485  */
27486 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
27487
27488 /**
27489  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
27490  */
27491 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
27492
27493 /**
27494  * Calls the free function if one is set
27495  */
27496 void Payer_free(struct LDKPayer this_ptr);
27497
27498 /**
27499  * Calls the free function if one is set
27500  */
27501 void Router_free(struct LDKRouter this_ptr);
27502
27503 /**
27504  * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL.
27505  */
27506 void RetryAttempts_free(struct LDKRetryAttempts this_obj);
27507
27508 uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr);
27509
27510 void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val);
27511
27512 /**
27513  * Constructs a new RetryAttempts given each field
27514  */
27515 MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg);
27516
27517 /**
27518  * Creates a copy of the RetryAttempts
27519  */
27520 struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig);
27521
27522 /**
27523  * Checks if two RetryAttemptss contain equal inner contents.
27524  * This ignores pointers and is_owned flags and looks at the values in fields.
27525  * Two objects with NULL inner values will be considered "equal" here.
27526  */
27527 bool RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b);
27528
27529 /**
27530  * Checks if two RetryAttemptss contain equal inner contents.
27531  */
27532 uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o);
27533
27534 /**
27535  * Frees any resources used by the PaymentError
27536  */
27537 void PaymentError_free(struct LDKPaymentError this_ptr);
27538
27539 /**
27540  * Creates a copy of the PaymentError
27541  */
27542 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
27543
27544 /**
27545  * Utility method to constructs a new Invoice-variant PaymentError
27546  */
27547 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
27548
27549 /**
27550  * Utility method to constructs a new Routing-variant PaymentError
27551  */
27552 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
27553
27554 /**
27555  * Utility method to constructs a new Sending-variant PaymentError
27556  */
27557 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
27558
27559 /**
27560  * Creates an invoice payer that retries failed payment paths.
27561  *
27562  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
27563  * `retry_attempts` has been exceeded for a given [`Invoice`].
27564  */
27565 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);
27566
27567 /**
27568  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
27569  *
27570  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
27571  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
27572  * for you.
27573  */
27574 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
27575
27576 /**
27577  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
27578  * case a retry is needed.
27579  *
27580  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
27581  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
27582  * for you.
27583  */
27584 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);
27585
27586 /**
27587  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
27588  * case a retry is needed.
27589  *
27590  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
27591  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
27592  */
27593 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);
27594
27595 /**
27596  * Removes the payment cached by the given payment hash.
27597  *
27598  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
27599  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
27600  */
27601 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
27602
27603 /**
27604  * Constructs a new EventHandler which calls the relevant methods on this_arg.
27605  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
27606  */
27607 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
27608
27609 /**
27610  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
27611  * See [`PhantomKeysManager`] for more information on phantom node payments.
27612  *
27613  * `phantom_route_hints` parameter:
27614  * * Contains channel info for all nodes participating in the phantom invoice
27615  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
27616  *   participating node
27617  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
27618  *   updated when a channel becomes disabled or closes
27619  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
27620  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
27621  *   down
27622  *
27623  * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
27624  * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
27625  * participating node.
27626  *
27627  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
27628  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
27629  * requirement).
27630  *
27631  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
27632  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
27633  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
27634  */
27635 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);
27636
27637 /**
27638  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
27639  * See [`PhantomKeysManager`] for more information on phantom node payments.
27640  *
27641  * `phantom_route_hints` parameter:
27642  * * Contains channel info for all nodes participating in the phantom invoice
27643  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
27644  *   participating node
27645  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
27646  *   updated when a channel becomes disabled or closes
27647  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
27648  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
27649  *   down
27650  *
27651  * `description_hash` is a SHA-256 hash of the description text
27652  *
27653  * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or
27654  * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any
27655  * participating node.
27656  *
27657  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
27658  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
27659  * requirement).
27660  *
27661  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
27662  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
27663  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
27664  */
27665 struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
27666
27667 /**
27668  * Utility to construct an invoice. Generally, unless you want to do something like a custom
27669  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
27670  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
27671  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
27672  * that the payment secret is valid when the invoice is paid.
27673  */
27674 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);
27675
27676 /**
27677  * Utility to construct an invoice. Generally, unless you want to do something like a custom
27678  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
27679  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
27680  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
27681  * that the payment secret is valid when the invoice is paid.
27682  * Use this variant if you want to pass the `description_hash` to the invoice.
27683  */
27684 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash);
27685
27686 /**
27687  * See [`create_invoice_from_channelmanager_with_description_hash`]
27688  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
27689  * available and the current time is supplied by the caller.
27690  */
27691 struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch);
27692
27693 /**
27694  * See [`create_invoice_from_channelmanager`]
27695  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
27696  * available and the current time is supplied by the caller.
27697  */
27698 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);
27699
27700 /**
27701  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
27702  */
27703 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
27704
27705 /**
27706  * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source
27707  * `random_seed_bytes`.
27708  */
27709 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes);
27710
27711 /**
27712  * Constructs a new Router which calls the relevant methods on this_arg.
27713  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
27714  */
27715 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
27716
27717 /**
27718  * Constructs a new Payer which calls the relevant methods on this_arg.
27719  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
27720  */
27721 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
27722
27723 /**
27724  * Read a SiPrefix object from a string
27725  */
27726 struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
27727
27728 /**
27729  * Read a Invoice object from a string
27730  */
27731 struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
27732
27733 /**
27734  * Read a SignedRawInvoice object from a string
27735  */
27736 struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
27737
27738 /**
27739  * Get the string representation of a ParseError object
27740  */
27741 struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
27742
27743 /**
27744  * Get the string representation of a ParseOrSemanticError object
27745  */
27746 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
27747
27748 /**
27749  * Get the string representation of a Invoice object
27750  */
27751 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
27752
27753 /**
27754  * Get the string representation of a SignedRawInvoice object
27755  */
27756 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
27757
27758 /**
27759  * Get the string representation of a Currency object
27760  */
27761 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
27762
27763 /**
27764  * Get the string representation of a SiPrefix object
27765  */
27766 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
27767
27768 #endif /* LDK_C_BINDINGS_H */
27769
27770 #include "ldk_ver.h"