Update auto-generated C bindings for 0.0.109
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.24.3 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include "ldk_rust_types.h"
12
13 /**
14  * An 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 shared secret.
345     */
346    LDKSecp256k1Error_InvalidSharedSecret,
347    /**
348     * Bad recovery id
349     */
350    LDKSecp256k1Error_InvalidRecoveryId,
351    /**
352     * Invalid tweak for add_assign or mul_assign
353     */
354    LDKSecp256k1Error_InvalidTweak,
355    /**
356     * Didn't pass enough memory to context creation with preallocated memory
357     */
358    LDKSecp256k1Error_NotEnoughMemory,
359    /**
360     * Bad set of public keys.
361     */
362    LDKSecp256k1Error_InvalidPublicKeySum,
363    /**
364     * The only valid parity values are 0 or 1.
365     */
366    LDKSecp256k1Error_InvalidParityValue,
367    /**
368     * Must be last for serialization purposes
369     */
370    LDKSecp256k1Error_Sentinel,
371 } LDKSecp256k1Error;
372
373 /**
374  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
375  * requirements sections in BOLT #11
376  */
377 typedef enum LDKSemanticError {
378    /**
379     * The invoice is missing the mandatory payment hash
380     */
381    LDKSemanticError_NoPaymentHash,
382    /**
383     * The invoice has multiple payment hashes which isn't allowed
384     */
385    LDKSemanticError_MultiplePaymentHashes,
386    /**
387     * No description or description hash are part of the invoice
388     */
389    LDKSemanticError_NoDescription,
390    /**
391     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
392     */
393    LDKSemanticError_MultipleDescriptions,
394    /**
395     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
396     * should provide.
397     */
398    LDKSemanticError_NoPaymentSecret,
399    /**
400     * The invoice contains multiple payment secrets
401     */
402    LDKSemanticError_MultiplePaymentSecrets,
403    /**
404     * The invoice's features are invalid
405     */
406    LDKSemanticError_InvalidFeatures,
407    /**
408     * The recovery id doesn't fit the signature/pub key
409     */
410    LDKSemanticError_InvalidRecoveryId,
411    /**
412     * The invoice's signature is invalid
413     */
414    LDKSemanticError_InvalidSignature,
415    /**
416     * The invoice's amount was not a whole number of millisatoshis
417     */
418    LDKSemanticError_ImpreciseAmount,
419    /**
420     * Must be last for serialization purposes
421     */
422    LDKSemanticError_Sentinel,
423 } LDKSemanticError;
424
425 /**
426  * SI prefixes for the human readable part
427  */
428 typedef enum LDKSiPrefix {
429    /**
430     * 10^-3
431     */
432    LDKSiPrefix_Milli,
433    /**
434     * 10^-6
435     */
436    LDKSiPrefix_Micro,
437    /**
438     * 10^-9
439     */
440    LDKSiPrefix_Nano,
441    /**
442     * 10^-12
443     */
444    LDKSiPrefix_Pico,
445    /**
446     * Must be last for serialization purposes
447     */
448    LDKSiPrefix_Sentinel,
449 } LDKSiPrefix;
450
451 /**
452  * A Rust str object, ie a reference to a UTF8-valid string.
453  * This is *not* null-terminated so cannot be used directly as a C string!
454  */
455 typedef struct LDKStr {
456    /**
457     * A pointer to the string's bytes, in UTF8 encoding
458     */
459    const uint8_t *chars;
460    /**
461     * The number of bytes (not characters!) pointed to by `chars`
462     */
463    uintptr_t len;
464    /**
465     * Whether the data pointed to by `chars` should be freed or not.
466     */
467    bool chars_is_owned;
468 } LDKStr;
469
470 /**
471  * Represents an error returned from the bech32 library during validation of some bech32 data
472  */
473 typedef enum LDKBech32Error_Tag {
474    /**
475     * String does not contain the separator character
476     */
477    LDKBech32Error_MissingSeparator,
478    /**
479     * The checksum does not match the rest of the data
480     */
481    LDKBech32Error_InvalidChecksum,
482    /**
483     * The data or human-readable part is too long or too short
484     */
485    LDKBech32Error_InvalidLength,
486    /**
487     * Some part of the string contains an invalid character
488     */
489    LDKBech32Error_InvalidChar,
490    /**
491     * Some part of the data has an invalid value
492     */
493    LDKBech32Error_InvalidData,
494    /**
495     * The bit conversion failed due to a padding issue
496     */
497    LDKBech32Error_InvalidPadding,
498    /**
499     * The whole string must be of one case
500     */
501    LDKBech32Error_MixedCase,
502    /**
503     * Must be last for serialization purposes
504     */
505    LDKBech32Error_Sentinel,
506 } LDKBech32Error_Tag;
507
508 typedef struct LDKBech32Error {
509    LDKBech32Error_Tag tag;
510    union {
511       struct {
512          uint32_t invalid_char;
513       };
514       struct {
515          uint8_t invalid_data;
516       };
517    };
518 } LDKBech32Error;
519
520 /**
521  * A serialized transaction, in (pointer, length) form.
522  *
523  * This type optionally owns its own memory, and thus the semantics around access change based on
524  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
525  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
526  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
527  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
528  * you would be invalid.
529  *
530  * Note that, while it may change in the future, because transactions on the Rust side are stored
531  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
532  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
533  * `data_is_owned` either set or unset at your discretion.
534  */
535 typedef struct LDKTransaction {
536    /**
537     * The serialized transaction data.
538     *
539     * This is non-const for your convenience, an object passed to Rust is never written to.
540     */
541    uint8_t *data;
542    /**
543     * The length of the serialized transaction
544     */
545    uintptr_t datalen;
546    /**
547     * Whether the data pointed to by `data` should be freed or not.
548     */
549    bool data_is_owned;
550 } LDKTransaction;
551
552 /**
553  * A dynamically-allocated array of u8s of arbitrary size.
554  * This corresponds to std::vector in C++
555  */
556 typedef struct LDKCVec_u8Z {
557    /**
558     * The elements in the array.
559     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
560     */
561    uint8_t *data;
562    /**
563     * The number of elements pointed to by `data`.
564     */
565    uintptr_t datalen;
566 } LDKCVec_u8Z;
567
568 /**
569  * A transaction output including a scriptPubKey and value.
570  * This type *does* own its own memory, so must be free'd appropriately.
571  */
572 typedef struct LDKTxOut {
573    /**
574     * The script_pubkey in this output
575     */
576    struct LDKCVec_u8Z script_pubkey;
577    /**
578     * The value, in satoshis, of this output
579     */
580    uint64_t value;
581 } LDKTxOut;
582
583 /**
584  * The contents of CResult_NoneNoneZ
585  */
586 typedef union LDKCResult_NoneNoneZPtr {
587    /**
588     * Note that this value is always NULL, as there are no contents in the OK variant
589     */
590    void *result;
591    /**
592     * Note that this value is always NULL, as there are no contents in the Err variant
593     */
594    void *err;
595 } LDKCResult_NoneNoneZPtr;
596
597 /**
598  * A CResult_NoneNoneZ represents the result of a fallible operation,
599  * containing a () on success and a () on failure.
600  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
601  */
602 typedef struct LDKCResult_NoneNoneZ {
603    /**
604     * The contents of this CResult_NoneNoneZ, accessible via either
605     * `err` or `result` depending on the state of `result_ok`.
606     */
607    union LDKCResult_NoneNoneZPtr contents;
608    /**
609     * Whether this CResult_NoneNoneZ represents a success state.
610     */
611    bool result_ok;
612 } LDKCResult_NoneNoneZ;
613
614
615
616 /**
617  * Implements the per-commitment secret storage scheme from
618  * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
619  *
620  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
621  * or so.
622  */
623 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
624    /**
625     * A pointer to the opaque Rust object.
626     * Nearly everywhere, inner must be non-null, however in places where
627     * the Rust equivalent takes an Option, it may be set to null to indicate None.
628     */
629    LDKnativeCounterpartyCommitmentSecrets *inner;
630    /**
631     * Indicates that this is the only struct which contains the same pointer.
632     * Rust functions which take ownership of an object provided via an argument require
633     * this to be true and invalidate the object pointed to by inner.
634     */
635    bool is_owned;
636 } LDKCounterpartyCommitmentSecrets;
637
638
639
640 /**
641  * An error in decoding a message or struct.
642  */
643 typedef struct MUST_USE_STRUCT LDKDecodeError {
644    /**
645     * A pointer to the opaque Rust object.
646     * Nearly everywhere, inner must be non-null, however in places where
647     * the Rust equivalent takes an Option, it may be set to null to indicate None.
648     */
649    LDKnativeDecodeError *inner;
650    /**
651     * Indicates that this is the only struct which contains the same pointer.
652     * Rust functions which take ownership of an object provided via an argument require
653     * this to be true and invalidate the object pointed to by inner.
654     */
655    bool is_owned;
656 } LDKDecodeError;
657
658 /**
659  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
660  */
661 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
662    /**
663     * A pointer to the contents in the success state.
664     * Reading from this pointer when `result_ok` is not set is undefined.
665     */
666    struct LDKCounterpartyCommitmentSecrets *result;
667    /**
668     * A pointer to the contents in the error state.
669     * Reading from this pointer when `result_ok` is set is undefined.
670     */
671    struct LDKDecodeError *err;
672 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
673
674 /**
675  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
676  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
677  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
678  */
679 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
680    /**
681     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
682     * `err` or `result` depending on the state of `result_ok`.
683     */
684    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
685    /**
686     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
687     */
688    bool result_ok;
689 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
690
691 /**
692  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
693  */
694 typedef struct LDKSecretKey {
695    /**
696     * The bytes of the secret key
697     */
698    uint8_t bytes[32];
699 } LDKSecretKey;
700
701 /**
702  * The contents of CResult_SecretKeyErrorZ
703  */
704 typedef union LDKCResult_SecretKeyErrorZPtr {
705    /**
706     * A pointer to the contents in the success state.
707     * Reading from this pointer when `result_ok` is not set is undefined.
708     */
709    struct LDKSecretKey *result;
710    /**
711     * A pointer to the contents in the error state.
712     * Reading from this pointer when `result_ok` is set is undefined.
713     */
714    enum LDKSecp256k1Error *err;
715 } LDKCResult_SecretKeyErrorZPtr;
716
717 /**
718  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
719  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
720  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
721  */
722 typedef struct LDKCResult_SecretKeyErrorZ {
723    /**
724     * The contents of this CResult_SecretKeyErrorZ, accessible via either
725     * `err` or `result` depending on the state of `result_ok`.
726     */
727    union LDKCResult_SecretKeyErrorZPtr contents;
728    /**
729     * Whether this CResult_SecretKeyErrorZ represents a success state.
730     */
731    bool result_ok;
732 } LDKCResult_SecretKeyErrorZ;
733
734 /**
735  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
736  */
737 typedef struct LDKPublicKey {
738    /**
739     * The bytes of the public key
740     */
741    uint8_t compressed_form[33];
742 } LDKPublicKey;
743
744 /**
745  * The contents of CResult_PublicKeyErrorZ
746  */
747 typedef union LDKCResult_PublicKeyErrorZPtr {
748    /**
749     * A pointer to the contents in the success state.
750     * Reading from this pointer when `result_ok` is not set is undefined.
751     */
752    struct LDKPublicKey *result;
753    /**
754     * A pointer to the contents in the error state.
755     * Reading from this pointer when `result_ok` is set is undefined.
756     */
757    enum LDKSecp256k1Error *err;
758 } LDKCResult_PublicKeyErrorZPtr;
759
760 /**
761  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
762  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
763  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
764  */
765 typedef struct LDKCResult_PublicKeyErrorZ {
766    /**
767     * The contents of this CResult_PublicKeyErrorZ, accessible via either
768     * `err` or `result` depending on the state of `result_ok`.
769     */
770    union LDKCResult_PublicKeyErrorZPtr contents;
771    /**
772     * Whether this CResult_PublicKeyErrorZ represents a success state.
773     */
774    bool result_ok;
775 } LDKCResult_PublicKeyErrorZ;
776
777
778
779 /**
780  * The set of public keys which are used in the creation of one commitment transaction.
781  * These are derived from the channel base keys and per-commitment data.
782  *
783  * A broadcaster key is provided from potential broadcaster of the computed transaction.
784  * A countersignatory key is coming from a protocol participant unable to broadcast the
785  * transaction.
786  *
787  * These keys are assumed to be good, either because the code derived them from
788  * channel basepoints via the new function, or they were obtained via
789  * CommitmentTransaction.trust().keys() because we trusted the source of the
790  * pre-calculated keys.
791  */
792 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
793    /**
794     * A pointer to the opaque Rust object.
795     * Nearly everywhere, inner must be non-null, however in places where
796     * the Rust equivalent takes an Option, it may be set to null to indicate None.
797     */
798    LDKnativeTxCreationKeys *inner;
799    /**
800     * Indicates that this is the only struct which contains the same pointer.
801     * Rust functions which take ownership of an object provided via an argument require
802     * this to be true and invalidate the object pointed to by inner.
803     */
804    bool is_owned;
805 } LDKTxCreationKeys;
806
807 /**
808  * The contents of CResult_TxCreationKeysDecodeErrorZ
809  */
810 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
811    /**
812     * A pointer to the contents in the success state.
813     * Reading from this pointer when `result_ok` is not set is undefined.
814     */
815    struct LDKTxCreationKeys *result;
816    /**
817     * A pointer to the contents in the error state.
818     * Reading from this pointer when `result_ok` is set is undefined.
819     */
820    struct LDKDecodeError *err;
821 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
822
823 /**
824  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
825  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
826  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
827  */
828 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
829    /**
830     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
831     * `err` or `result` depending on the state of `result_ok`.
832     */
833    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
834    /**
835     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
836     */
837    bool result_ok;
838 } LDKCResult_TxCreationKeysDecodeErrorZ;
839
840
841
842 /**
843  * One counterparty's public keys which do not change over the life of a channel.
844  */
845 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
846    /**
847     * A pointer to the opaque Rust object.
848     * Nearly everywhere, inner must be non-null, however in places where
849     * the Rust equivalent takes an Option, it may be set to null to indicate None.
850     */
851    LDKnativeChannelPublicKeys *inner;
852    /**
853     * Indicates that this is the only struct which contains the same pointer.
854     * Rust functions which take ownership of an object provided via an argument require
855     * this to be true and invalidate the object pointed to by inner.
856     */
857    bool is_owned;
858 } LDKChannelPublicKeys;
859
860 /**
861  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
862  */
863 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
864    /**
865     * A pointer to the contents in the success state.
866     * Reading from this pointer when `result_ok` is not set is undefined.
867     */
868    struct LDKChannelPublicKeys *result;
869    /**
870     * A pointer to the contents in the error state.
871     * Reading from this pointer when `result_ok` is set is undefined.
872     */
873    struct LDKDecodeError *err;
874 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
875
876 /**
877  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
878  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
879  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
880  */
881 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
882    /**
883     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
884     * `err` or `result` depending on the state of `result_ok`.
885     */
886    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
887    /**
888     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
889     */
890    bool result_ok;
891 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
892
893 /**
894  * The contents of CResult_TxCreationKeysErrorZ
895  */
896 typedef union LDKCResult_TxCreationKeysErrorZPtr {
897    /**
898     * A pointer to the contents in the success state.
899     * Reading from this pointer when `result_ok` is not set is undefined.
900     */
901    struct LDKTxCreationKeys *result;
902    /**
903     * A pointer to the contents in the error state.
904     * Reading from this pointer when `result_ok` is set is undefined.
905     */
906    enum LDKSecp256k1Error *err;
907 } LDKCResult_TxCreationKeysErrorZPtr;
908
909 /**
910  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
911  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
912  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
913  */
914 typedef struct LDKCResult_TxCreationKeysErrorZ {
915    /**
916     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
917     * `err` or `result` depending on the state of `result_ok`.
918     */
919    union LDKCResult_TxCreationKeysErrorZPtr contents;
920    /**
921     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
922     */
923    bool result_ok;
924 } LDKCResult_TxCreationKeysErrorZ;
925
926 /**
927  * An enum which can either contain a u32 or not
928  */
929 typedef enum LDKCOption_u32Z_Tag {
930    /**
931     * When we're in this state, this COption_u32Z contains a u32
932     */
933    LDKCOption_u32Z_Some,
934    /**
935     * When we're in this state, this COption_u32Z contains nothing
936     */
937    LDKCOption_u32Z_None,
938    /**
939     * Must be last for serialization purposes
940     */
941    LDKCOption_u32Z_Sentinel,
942 } LDKCOption_u32Z_Tag;
943
944 typedef struct LDKCOption_u32Z {
945    LDKCOption_u32Z_Tag tag;
946    union {
947       struct {
948          uint32_t some;
949       };
950    };
951 } LDKCOption_u32Z;
952
953
954
955 /**
956  * Information about an HTLC as it appears in a commitment transaction
957  */
958 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
959    /**
960     * A pointer to the opaque Rust object.
961     * Nearly everywhere, inner must be non-null, however in places where
962     * the Rust equivalent takes an Option, it may be set to null to indicate None.
963     */
964    LDKnativeHTLCOutputInCommitment *inner;
965    /**
966     * Indicates that this is the only struct which contains the same pointer.
967     * Rust functions which take ownership of an object provided via an argument require
968     * this to be true and invalidate the object pointed to by inner.
969     */
970    bool is_owned;
971 } LDKHTLCOutputInCommitment;
972
973 /**
974  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
975  */
976 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
977    /**
978     * A pointer to the contents in the success state.
979     * Reading from this pointer when `result_ok` is not set is undefined.
980     */
981    struct LDKHTLCOutputInCommitment *result;
982    /**
983     * A pointer to the contents in the error state.
984     * Reading from this pointer when `result_ok` is set is undefined.
985     */
986    struct LDKDecodeError *err;
987 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
988
989 /**
990  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
991  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
992  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
993  */
994 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
995    /**
996     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
997     * `err` or `result` depending on the state of `result_ok`.
998     */
999    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
1000    /**
1001     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
1002     */
1003    bool result_ok;
1004 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
1005
1006
1007
1008 /**
1009  * Late-bound per-channel counterparty data used to build transactions.
1010  */
1011 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
1012    /**
1013     * A pointer to the opaque Rust object.
1014     * Nearly everywhere, inner must be non-null, however in places where
1015     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1016     */
1017    LDKnativeCounterpartyChannelTransactionParameters *inner;
1018    /**
1019     * Indicates that this is the only struct which contains the same pointer.
1020     * Rust functions which take ownership of an object provided via an argument require
1021     * this to be true and invalidate the object pointed to by inner.
1022     */
1023    bool is_owned;
1024 } LDKCounterpartyChannelTransactionParameters;
1025
1026 /**
1027  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1028  */
1029 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1030    /**
1031     * A pointer to the contents in the success state.
1032     * Reading from this pointer when `result_ok` is not set is undefined.
1033     */
1034    struct LDKCounterpartyChannelTransactionParameters *result;
1035    /**
1036     * A pointer to the contents in the error state.
1037     * Reading from this pointer when `result_ok` is set is undefined.
1038     */
1039    struct LDKDecodeError *err;
1040 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
1041
1042 /**
1043  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1044  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1045  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1046  */
1047 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1048    /**
1049     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1050     * `err` or `result` depending on the state of `result_ok`.
1051     */
1052    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
1053    /**
1054     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1055     */
1056    bool result_ok;
1057 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
1058
1059
1060
1061 /**
1062  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1063  * The fields are organized by holder/counterparty.
1064  *
1065  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1066  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1067  */
1068 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1069    /**
1070     * A pointer to the opaque Rust object.
1071     * Nearly everywhere, inner must be non-null, however in places where
1072     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1073     */
1074    LDKnativeChannelTransactionParameters *inner;
1075    /**
1076     * Indicates that this is the only struct which contains the same pointer.
1077     * Rust functions which take ownership of an object provided via an argument require
1078     * this to be true and invalidate the object pointed to by inner.
1079     */
1080    bool is_owned;
1081 } LDKChannelTransactionParameters;
1082
1083 /**
1084  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1085  */
1086 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
1087    /**
1088     * A pointer to the contents in the success state.
1089     * Reading from this pointer when `result_ok` is not set is undefined.
1090     */
1091    struct LDKChannelTransactionParameters *result;
1092    /**
1093     * A pointer to the contents in the error state.
1094     * Reading from this pointer when `result_ok` is set is undefined.
1095     */
1096    struct LDKDecodeError *err;
1097 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
1098
1099 /**
1100  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1101  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1102  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1103  */
1104 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1105    /**
1106     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1107     * `err` or `result` depending on the state of `result_ok`.
1108     */
1109    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1110    /**
1111     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1112     */
1113    bool result_ok;
1114 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1115
1116 /**
1117  * Represents a secp256k1 signature serialized as two 32-byte numbers
1118  */
1119 typedef struct LDKSignature {
1120    /**
1121     * The bytes of the signature in "compact" form
1122     */
1123    uint8_t compact_form[64];
1124 } LDKSignature;
1125
1126 /**
1127  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1128  * This corresponds to std::vector in C++
1129  */
1130 typedef struct LDKCVec_SignatureZ {
1131    /**
1132     * The elements in the array.
1133     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1134     */
1135    struct LDKSignature *data;
1136    /**
1137     * The number of elements pointed to by `data`.
1138     */
1139    uintptr_t datalen;
1140 } LDKCVec_SignatureZ;
1141
1142
1143
1144 /**
1145  * Information needed to build and sign a holder's commitment transaction.
1146  *
1147  * The transaction is only signed once we are ready to broadcast.
1148  */
1149 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1150    /**
1151     * A pointer to the opaque Rust object.
1152     * Nearly everywhere, inner must be non-null, however in places where
1153     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1154     */
1155    LDKnativeHolderCommitmentTransaction *inner;
1156    /**
1157     * Indicates that this is the only struct which contains the same pointer.
1158     * Rust functions which take ownership of an object provided via an argument require
1159     * this to be true and invalidate the object pointed to by inner.
1160     */
1161    bool is_owned;
1162 } LDKHolderCommitmentTransaction;
1163
1164 /**
1165  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1166  */
1167 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1168    /**
1169     * A pointer to the contents in the success state.
1170     * Reading from this pointer when `result_ok` is not set is undefined.
1171     */
1172    struct LDKHolderCommitmentTransaction *result;
1173    /**
1174     * A pointer to the contents in the error state.
1175     * Reading from this pointer when `result_ok` is set is undefined.
1176     */
1177    struct LDKDecodeError *err;
1178 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1179
1180 /**
1181  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184  */
1185 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1186    /**
1187     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1188     * `err` or `result` depending on the state of `result_ok`.
1189     */
1190    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1191    /**
1192     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1193     */
1194    bool result_ok;
1195 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1196
1197
1198
1199 /**
1200  * A pre-built Bitcoin commitment transaction and its txid.
1201  */
1202 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1203    /**
1204     * A pointer to the opaque Rust object.
1205     * Nearly everywhere, inner must be non-null, however in places where
1206     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1207     */
1208    LDKnativeBuiltCommitmentTransaction *inner;
1209    /**
1210     * Indicates that this is the only struct which contains the same pointer.
1211     * Rust functions which take ownership of an object provided via an argument require
1212     * this to be true and invalidate the object pointed to by inner.
1213     */
1214    bool is_owned;
1215 } LDKBuiltCommitmentTransaction;
1216
1217 /**
1218  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1219  */
1220 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1221    /**
1222     * A pointer to the contents in the success state.
1223     * Reading from this pointer when `result_ok` is not set is undefined.
1224     */
1225    struct LDKBuiltCommitmentTransaction *result;
1226    /**
1227     * A pointer to the contents in the error state.
1228     * Reading from this pointer when `result_ok` is set is undefined.
1229     */
1230    struct LDKDecodeError *err;
1231 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1232
1233 /**
1234  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1235  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1236  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1237  */
1238 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1239    /**
1240     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1241     * `err` or `result` depending on the state of `result_ok`.
1242     */
1243    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1244    /**
1245     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1246     */
1247    bool result_ok;
1248 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1249
1250
1251
1252 /**
1253  * A wrapper on ClosingTransaction indicating that the built bitcoin
1254  * transaction is trusted.
1255  *
1256  * See trust() and verify() functions on CommitmentTransaction.
1257  *
1258  * This structure implements Deref.
1259  */
1260 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1261    /**
1262     * A pointer to the opaque Rust object.
1263     * Nearly everywhere, inner must be non-null, however in places where
1264     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1265     */
1266    LDKnativeTrustedClosingTransaction *inner;
1267    /**
1268     * Indicates that this is the only struct which contains the same pointer.
1269     * Rust functions which take ownership of an object provided via an argument require
1270     * this to be true and invalidate the object pointed to by inner.
1271     */
1272    bool is_owned;
1273 } LDKTrustedClosingTransaction;
1274
1275 /**
1276  * The contents of CResult_TrustedClosingTransactionNoneZ
1277  */
1278 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1279    /**
1280     * A pointer to the contents in the success state.
1281     * Reading from this pointer when `result_ok` is not set is undefined.
1282     */
1283    struct LDKTrustedClosingTransaction *result;
1284    /**
1285     * Note that this value is always NULL, as there are no contents in the Err variant
1286     */
1287    void *err;
1288 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1289
1290 /**
1291  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1292  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1293  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1294  */
1295 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1296    /**
1297     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1298     * `err` or `result` depending on the state of `result_ok`.
1299     */
1300    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1301    /**
1302     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1303     */
1304    bool result_ok;
1305 } LDKCResult_TrustedClosingTransactionNoneZ;
1306
1307
1308
1309 /**
1310  * This class tracks the per-transaction information needed to build a commitment transaction and will
1311  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1312  * and for transactions we sign for the counterparty.
1313  *
1314  * This class can be used inside a signer implementation to generate a signature given the relevant
1315  * secret key.
1316  */
1317 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1318    /**
1319     * A pointer to the opaque Rust object.
1320     * Nearly everywhere, inner must be non-null, however in places where
1321     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1322     */
1323    LDKnativeCommitmentTransaction *inner;
1324    /**
1325     * Indicates that this is the only struct which contains the same pointer.
1326     * Rust functions which take ownership of an object provided via an argument require
1327     * this to be true and invalidate the object pointed to by inner.
1328     */
1329    bool is_owned;
1330 } LDKCommitmentTransaction;
1331
1332 /**
1333  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1334  */
1335 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1336    /**
1337     * A pointer to the contents in the success state.
1338     * Reading from this pointer when `result_ok` is not set is undefined.
1339     */
1340    struct LDKCommitmentTransaction *result;
1341    /**
1342     * A pointer to the contents in the error state.
1343     * Reading from this pointer when `result_ok` is set is undefined.
1344     */
1345    struct LDKDecodeError *err;
1346 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1347
1348 /**
1349  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1350  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1351  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1352  */
1353 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1354    /**
1355     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1356     * `err` or `result` depending on the state of `result_ok`.
1357     */
1358    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1359    /**
1360     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1361     */
1362    bool result_ok;
1363 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1364
1365
1366
1367 /**
1368  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1369  * transaction and the transaction creation keys) are trusted.
1370  *
1371  * See trust() and verify() functions on CommitmentTransaction.
1372  *
1373  * This structure implements Deref.
1374  */
1375 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1376    /**
1377     * A pointer to the opaque Rust object.
1378     * Nearly everywhere, inner must be non-null, however in places where
1379     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1380     */
1381    LDKnativeTrustedCommitmentTransaction *inner;
1382    /**
1383     * Indicates that this is the only struct which contains the same pointer.
1384     * Rust functions which take ownership of an object provided via an argument require
1385     * this to be true and invalidate the object pointed to by inner.
1386     */
1387    bool is_owned;
1388 } LDKTrustedCommitmentTransaction;
1389
1390 /**
1391  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1392  */
1393 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1394    /**
1395     * A pointer to the contents in the success state.
1396     * Reading from this pointer when `result_ok` is not set is undefined.
1397     */
1398    struct LDKTrustedCommitmentTransaction *result;
1399    /**
1400     * Note that this value is always NULL, as there are no contents in the Err variant
1401     */
1402    void *err;
1403 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1404
1405 /**
1406  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1407  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1408  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1409  */
1410 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1411    /**
1412     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1413     * `err` or `result` depending on the state of `result_ok`.
1414     */
1415    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1416    /**
1417     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1418     */
1419    bool result_ok;
1420 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1421
1422 /**
1423  * The contents of CResult_CVec_SignatureZNoneZ
1424  */
1425 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1426    /**
1427     * A pointer to the contents in the success state.
1428     * Reading from this pointer when `result_ok` is not set is undefined.
1429     */
1430    struct LDKCVec_SignatureZ *result;
1431    /**
1432     * Note that this value is always NULL, as there are no contents in the Err variant
1433     */
1434    void *err;
1435 } LDKCResult_CVec_SignatureZNoneZPtr;
1436
1437 /**
1438  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1439  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1440  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1441  */
1442 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1443    /**
1444     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1445     * `err` or `result` depending on the state of `result_ok`.
1446     */
1447    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1448    /**
1449     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1450     */
1451    bool result_ok;
1452 } LDKCResult_CVec_SignatureZNoneZ;
1453
1454
1455
1456 /**
1457  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1458  *
1459  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
1460  */
1461 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1462    /**
1463     * A pointer to the opaque Rust object.
1464     * Nearly everywhere, inner must be non-null, however in places where
1465     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1466     */
1467    LDKnativeShutdownScript *inner;
1468    /**
1469     * Indicates that this is the only struct which contains the same pointer.
1470     * Rust functions which take ownership of an object provided via an argument require
1471     * this to be true and invalidate the object pointed to by inner.
1472     */
1473    bool is_owned;
1474 } LDKShutdownScript;
1475
1476 /**
1477  * The contents of CResult_ShutdownScriptDecodeErrorZ
1478  */
1479 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1480    /**
1481     * A pointer to the contents in the success state.
1482     * Reading from this pointer when `result_ok` is not set is undefined.
1483     */
1484    struct LDKShutdownScript *result;
1485    /**
1486     * A pointer to the contents in the error state.
1487     * Reading from this pointer when `result_ok` is set is undefined.
1488     */
1489    struct LDKDecodeError *err;
1490 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1491
1492 /**
1493  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1494  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1495  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1496  */
1497 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1498    /**
1499     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1500     * `err` or `result` depending on the state of `result_ok`.
1501     */
1502    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1503    /**
1504     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1505     */
1506    bool result_ok;
1507 } LDKCResult_ShutdownScriptDecodeErrorZ;
1508
1509
1510
1511 /**
1512  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1513  */
1514 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1515    /**
1516     * A pointer to the opaque Rust object.
1517     * Nearly everywhere, inner must be non-null, however in places where
1518     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1519     */
1520    LDKnativeInvalidShutdownScript *inner;
1521    /**
1522     * Indicates that this is the only struct which contains the same pointer.
1523     * Rust functions which take ownership of an object provided via an argument require
1524     * this to be true and invalidate the object pointed to by inner.
1525     */
1526    bool is_owned;
1527 } LDKInvalidShutdownScript;
1528
1529 /**
1530  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1531  */
1532 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1533    /**
1534     * A pointer to the contents in the success state.
1535     * Reading from this pointer when `result_ok` is not set is undefined.
1536     */
1537    struct LDKShutdownScript *result;
1538    /**
1539     * A pointer to the contents in the error state.
1540     * Reading from this pointer when `result_ok` is set is undefined.
1541     */
1542    struct LDKInvalidShutdownScript *err;
1543 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1544
1545 /**
1546  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1547  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1548  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1549  */
1550 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1551    /**
1552     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1553     * `err` or `result` depending on the state of `result_ok`.
1554     */
1555    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1556    /**
1557     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1558     */
1559    bool result_ok;
1560 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1561
1562 /**
1563  * The contents of CResult_NoneErrorZ
1564  */
1565 typedef union LDKCResult_NoneErrorZPtr {
1566    /**
1567     * Note that this value is always NULL, as there are no contents in the OK variant
1568     */
1569    void *result;
1570    /**
1571     * A pointer to the contents in the error state.
1572     * Reading from this pointer when `result_ok` is set is undefined.
1573     */
1574    enum LDKIOError *err;
1575 } LDKCResult_NoneErrorZPtr;
1576
1577 /**
1578  * A CResult_NoneErrorZ represents the result of a fallible operation,
1579  * containing a () on success and a crate::c_types::IOError on failure.
1580  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1581  */
1582 typedef struct LDKCResult_NoneErrorZ {
1583    /**
1584     * The contents of this CResult_NoneErrorZ, accessible via either
1585     * `err` or `result` depending on the state of `result_ok`.
1586     */
1587    union LDKCResult_NoneErrorZPtr contents;
1588    /**
1589     * Whether this CResult_NoneErrorZ represents a success state.
1590     */
1591    bool result_ok;
1592 } LDKCResult_NoneErrorZ;
1593
1594
1595
1596 /**
1597  * A hop in a route
1598  */
1599 typedef struct MUST_USE_STRUCT LDKRouteHop {
1600    /**
1601     * A pointer to the opaque Rust object.
1602     * Nearly everywhere, inner must be non-null, however in places where
1603     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1604     */
1605    LDKnativeRouteHop *inner;
1606    /**
1607     * Indicates that this is the only struct which contains the same pointer.
1608     * Rust functions which take ownership of an object provided via an argument require
1609     * this to be true and invalidate the object pointed to by inner.
1610     */
1611    bool is_owned;
1612 } LDKRouteHop;
1613
1614 /**
1615  * The contents of CResult_RouteHopDecodeErrorZ
1616  */
1617 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1618    /**
1619     * A pointer to the contents in the success state.
1620     * Reading from this pointer when `result_ok` is not set is undefined.
1621     */
1622    struct LDKRouteHop *result;
1623    /**
1624     * A pointer to the contents in the error state.
1625     * Reading from this pointer when `result_ok` is set is undefined.
1626     */
1627    struct LDKDecodeError *err;
1628 } LDKCResult_RouteHopDecodeErrorZPtr;
1629
1630 /**
1631  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1632  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1633  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1634  */
1635 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1636    /**
1637     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1638     * `err` or `result` depending on the state of `result_ok`.
1639     */
1640    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1641    /**
1642     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1643     */
1644    bool result_ok;
1645 } LDKCResult_RouteHopDecodeErrorZ;
1646
1647 /**
1648  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1649  * This corresponds to std::vector in C++
1650  */
1651 typedef struct LDKCVec_RouteHopZ {
1652    /**
1653     * The elements in the array.
1654     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1655     */
1656    struct LDKRouteHop *data;
1657    /**
1658     * The number of elements pointed to by `data`.
1659     */
1660    uintptr_t datalen;
1661 } LDKCVec_RouteHopZ;
1662
1663 /**
1664  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1665  * This corresponds to std::vector in C++
1666  */
1667 typedef struct LDKCVec_CVec_RouteHopZZ {
1668    /**
1669     * The elements in the array.
1670     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1671     */
1672    struct LDKCVec_RouteHopZ *data;
1673    /**
1674     * The number of elements pointed to by `data`.
1675     */
1676    uintptr_t datalen;
1677 } LDKCVec_CVec_RouteHopZZ;
1678
1679
1680
1681 /**
1682  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1683  * it can take multiple paths. Each path is composed of one or more hops through the network.
1684  */
1685 typedef struct MUST_USE_STRUCT LDKRoute {
1686    /**
1687     * A pointer to the opaque Rust object.
1688     * Nearly everywhere, inner must be non-null, however in places where
1689     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1690     */
1691    LDKnativeRoute *inner;
1692    /**
1693     * Indicates that this is the only struct which contains the same pointer.
1694     * Rust functions which take ownership of an object provided via an argument require
1695     * this to be true and invalidate the object pointed to by inner.
1696     */
1697    bool is_owned;
1698 } LDKRoute;
1699
1700 /**
1701  * The contents of CResult_RouteDecodeErrorZ
1702  */
1703 typedef union LDKCResult_RouteDecodeErrorZPtr {
1704    /**
1705     * A pointer to the contents in the success state.
1706     * Reading from this pointer when `result_ok` is not set is undefined.
1707     */
1708    struct LDKRoute *result;
1709    /**
1710     * A pointer to the contents in the error state.
1711     * Reading from this pointer when `result_ok` is set is undefined.
1712     */
1713    struct LDKDecodeError *err;
1714 } LDKCResult_RouteDecodeErrorZPtr;
1715
1716 /**
1717  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1718  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1719  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1720  */
1721 typedef struct LDKCResult_RouteDecodeErrorZ {
1722    /**
1723     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1724     * `err` or `result` depending on the state of `result_ok`.
1725     */
1726    union LDKCResult_RouteDecodeErrorZPtr contents;
1727    /**
1728     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1729     */
1730    bool result_ok;
1731 } LDKCResult_RouteDecodeErrorZ;
1732
1733
1734
1735 /**
1736  * Parameters needed to find a [`Route`].
1737  *
1738  * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
1739  * [`Event::PaymentPathFailed`] for retrying a failed payment path.
1740  *
1741  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
1742  */
1743 typedef struct MUST_USE_STRUCT LDKRouteParameters {
1744    /**
1745     * A pointer to the opaque Rust object.
1746     * Nearly everywhere, inner must be non-null, however in places where
1747     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1748     */
1749    LDKnativeRouteParameters *inner;
1750    /**
1751     * Indicates that this is the only struct which contains the same pointer.
1752     * Rust functions which take ownership of an object provided via an argument require
1753     * this to be true and invalidate the object pointed to by inner.
1754     */
1755    bool is_owned;
1756 } LDKRouteParameters;
1757
1758 /**
1759  * The contents of CResult_RouteParametersDecodeErrorZ
1760  */
1761 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
1762    /**
1763     * A pointer to the contents in the success state.
1764     * Reading from this pointer when `result_ok` is not set is undefined.
1765     */
1766    struct LDKRouteParameters *result;
1767    /**
1768     * A pointer to the contents in the error state.
1769     * Reading from this pointer when `result_ok` is set is undefined.
1770     */
1771    struct LDKDecodeError *err;
1772 } LDKCResult_RouteParametersDecodeErrorZPtr;
1773
1774 /**
1775  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1776  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1777  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1778  */
1779 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
1780    /**
1781     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1782     * `err` or `result` depending on the state of `result_ok`.
1783     */
1784    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
1785    /**
1786     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1787     */
1788    bool result_ok;
1789 } LDKCResult_RouteParametersDecodeErrorZ;
1790
1791
1792
1793 /**
1794  * A list of hops along a payment path terminating with a channel to the recipient.
1795  */
1796 typedef struct MUST_USE_STRUCT LDKRouteHint {
1797    /**
1798     * A pointer to the opaque Rust object.
1799     * Nearly everywhere, inner must be non-null, however in places where
1800     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1801     */
1802    LDKnativeRouteHint *inner;
1803    /**
1804     * Indicates that this is the only struct which contains the same pointer.
1805     * Rust functions which take ownership of an object provided via an argument require
1806     * this to be true and invalidate the object pointed to by inner.
1807     */
1808    bool is_owned;
1809 } LDKRouteHint;
1810
1811 /**
1812  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1813  * This corresponds to std::vector in C++
1814  */
1815 typedef struct LDKCVec_RouteHintZ {
1816    /**
1817     * The elements in the array.
1818     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1819     */
1820    struct LDKRouteHint *data;
1821    /**
1822     * The number of elements pointed to by `data`.
1823     */
1824    uintptr_t datalen;
1825 } LDKCVec_RouteHintZ;
1826
1827 /**
1828  * An enum which can either contain a u64 or not
1829  */
1830 typedef enum LDKCOption_u64Z_Tag {
1831    /**
1832     * When we're in this state, this COption_u64Z contains a u64
1833     */
1834    LDKCOption_u64Z_Some,
1835    /**
1836     * When we're in this state, this COption_u64Z contains nothing
1837     */
1838    LDKCOption_u64Z_None,
1839    /**
1840     * Must be last for serialization purposes
1841     */
1842    LDKCOption_u64Z_Sentinel,
1843 } LDKCOption_u64Z_Tag;
1844
1845 typedef struct LDKCOption_u64Z {
1846    LDKCOption_u64Z_Tag tag;
1847    union {
1848       struct {
1849          uint64_t some;
1850       };
1851    };
1852 } LDKCOption_u64Z;
1853
1854
1855
1856 /**
1857  * The recipient of a payment.
1858  */
1859 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
1860    /**
1861     * A pointer to the opaque Rust object.
1862     * Nearly everywhere, inner must be non-null, however in places where
1863     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1864     */
1865    LDKnativePaymentParameters *inner;
1866    /**
1867     * Indicates that this is the only struct which contains the same pointer.
1868     * Rust functions which take ownership of an object provided via an argument require
1869     * this to be true and invalidate the object pointed to by inner.
1870     */
1871    bool is_owned;
1872 } LDKPaymentParameters;
1873
1874 /**
1875  * The contents of CResult_PaymentParametersDecodeErrorZ
1876  */
1877 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
1878    /**
1879     * A pointer to the contents in the success state.
1880     * Reading from this pointer when `result_ok` is not set is undefined.
1881     */
1882    struct LDKPaymentParameters *result;
1883    /**
1884     * A pointer to the contents in the error state.
1885     * Reading from this pointer when `result_ok` is set is undefined.
1886     */
1887    struct LDKDecodeError *err;
1888 } LDKCResult_PaymentParametersDecodeErrorZPtr;
1889
1890 /**
1891  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
1892  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1893  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1894  */
1895 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
1896    /**
1897     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
1898     * `err` or `result` depending on the state of `result_ok`.
1899     */
1900    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
1901    /**
1902     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
1903     */
1904    bool result_ok;
1905 } LDKCResult_PaymentParametersDecodeErrorZ;
1906
1907
1908
1909 /**
1910  * A channel descriptor for a hop along a payment path.
1911  */
1912 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1913    /**
1914     * A pointer to the opaque Rust object.
1915     * Nearly everywhere, inner must be non-null, however in places where
1916     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1917     */
1918    LDKnativeRouteHintHop *inner;
1919    /**
1920     * Indicates that this is the only struct which contains the same pointer.
1921     * Rust functions which take ownership of an object provided via an argument require
1922     * this to be true and invalidate the object pointed to by inner.
1923     */
1924    bool is_owned;
1925 } LDKRouteHintHop;
1926
1927 /**
1928  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1929  * This corresponds to std::vector in C++
1930  */
1931 typedef struct LDKCVec_RouteHintHopZ {
1932    /**
1933     * The elements in the array.
1934     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1935     */
1936    struct LDKRouteHintHop *data;
1937    /**
1938     * The number of elements pointed to by `data`.
1939     */
1940    uintptr_t datalen;
1941 } LDKCVec_RouteHintHopZ;
1942
1943 /**
1944  * The contents of CResult_RouteHintDecodeErrorZ
1945  */
1946 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
1947    /**
1948     * A pointer to the contents in the success state.
1949     * Reading from this pointer when `result_ok` is not set is undefined.
1950     */
1951    struct LDKRouteHint *result;
1952    /**
1953     * A pointer to the contents in the error state.
1954     * Reading from this pointer when `result_ok` is set is undefined.
1955     */
1956    struct LDKDecodeError *err;
1957 } LDKCResult_RouteHintDecodeErrorZPtr;
1958
1959 /**
1960  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
1961  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
1962  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1963  */
1964 typedef struct LDKCResult_RouteHintDecodeErrorZ {
1965    /**
1966     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
1967     * `err` or `result` depending on the state of `result_ok`.
1968     */
1969    union LDKCResult_RouteHintDecodeErrorZPtr contents;
1970    /**
1971     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
1972     */
1973    bool result_ok;
1974 } LDKCResult_RouteHintDecodeErrorZ;
1975
1976 /**
1977  * The contents of CResult_RouteHintHopDecodeErrorZ
1978  */
1979 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
1980    /**
1981     * A pointer to the contents in the success state.
1982     * Reading from this pointer when `result_ok` is not set is undefined.
1983     */
1984    struct LDKRouteHintHop *result;
1985    /**
1986     * A pointer to the contents in the error state.
1987     * Reading from this pointer when `result_ok` is set is undefined.
1988     */
1989    struct LDKDecodeError *err;
1990 } LDKCResult_RouteHintHopDecodeErrorZPtr;
1991
1992 /**
1993  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
1994  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1995  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1996  */
1997 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
1998    /**
1999     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2000     * `err` or `result` depending on the state of `result_ok`.
2001     */
2002    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
2003    /**
2004     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2005     */
2006    bool result_ok;
2007 } LDKCResult_RouteHintHopDecodeErrorZ;
2008
2009
2010
2011 /**
2012  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2013  */
2014 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2015    /**
2016     * A pointer to the opaque Rust object.
2017     * Nearly everywhere, inner must be non-null, however in places where
2018     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2019     */
2020    LDKnativeChannelDetails *inner;
2021    /**
2022     * Indicates that this is the only struct which contains the same pointer.
2023     * Rust functions which take ownership of an object provided via an argument require
2024     * this to be true and invalidate the object pointed to by inner.
2025     */
2026    bool is_owned;
2027 } LDKChannelDetails;
2028
2029 /**
2030  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2031  * This corresponds to std::vector in C++
2032  */
2033 typedef struct LDKCVec_ChannelDetailsZ {
2034    /**
2035     * The elements in the array.
2036     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2037     */
2038    struct LDKChannelDetails *data;
2039    /**
2040     * The number of elements pointed to by `data`.
2041     */
2042    uintptr_t datalen;
2043 } LDKCVec_ChannelDetailsZ;
2044
2045
2046
2047 /**
2048  * An Err type for failure to process messages.
2049  */
2050 typedef struct MUST_USE_STRUCT LDKLightningError {
2051    /**
2052     * A pointer to the opaque Rust object.
2053     * Nearly everywhere, inner must be non-null, however in places where
2054     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2055     */
2056    LDKnativeLightningError *inner;
2057    /**
2058     * Indicates that this is the only struct which contains the same pointer.
2059     * Rust functions which take ownership of an object provided via an argument require
2060     * this to be true and invalidate the object pointed to by inner.
2061     */
2062    bool is_owned;
2063 } LDKLightningError;
2064
2065 /**
2066  * The contents of CResult_RouteLightningErrorZ
2067  */
2068 typedef union LDKCResult_RouteLightningErrorZPtr {
2069    /**
2070     * A pointer to the contents in the success state.
2071     * Reading from this pointer when `result_ok` is not set is undefined.
2072     */
2073    struct LDKRoute *result;
2074    /**
2075     * A pointer to the contents in the error state.
2076     * Reading from this pointer when `result_ok` is set is undefined.
2077     */
2078    struct LDKLightningError *err;
2079 } LDKCResult_RouteLightningErrorZPtr;
2080
2081 /**
2082  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2083  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2084  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2085  */
2086 typedef struct LDKCResult_RouteLightningErrorZ {
2087    /**
2088     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2089     * `err` or `result` depending on the state of `result_ok`.
2090     */
2091    union LDKCResult_RouteLightningErrorZPtr contents;
2092    /**
2093     * Whether this CResult_RouteLightningErrorZ represents a success state.
2094     */
2095    bool result_ok;
2096 } LDKCResult_RouteLightningErrorZ;
2097
2098 /**
2099  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2100  * This corresponds to std::vector in C++
2101  */
2102 typedef struct LDKCVec_PublicKeyZ {
2103    /**
2104     * The elements in the array.
2105     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2106     */
2107    struct LDKPublicKey *data;
2108    /**
2109     * The number of elements pointed to by `data`.
2110     */
2111    uintptr_t datalen;
2112 } LDKCVec_PublicKeyZ;
2113
2114 /**
2115  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
2116  * look up the corresponding function in rust-lightning's docs.
2117  */
2118 typedef struct LDKThirtyTwoBytes {
2119    /**
2120     * The thirty-two bytes
2121     */
2122    uint8_t data[32];
2123 } LDKThirtyTwoBytes;
2124
2125 /**
2126  * Some information provided on receipt of payment depends on whether the payment received is a
2127  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2128  */
2129 typedef enum LDKPaymentPurpose_Tag {
2130    /**
2131     * Information for receiving a payment that we generated an invoice for.
2132     */
2133    LDKPaymentPurpose_InvoicePayment,
2134    /**
2135     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2136     * (the payee) providing a preimage.
2137     */
2138    LDKPaymentPurpose_SpontaneousPayment,
2139    /**
2140     * Must be last for serialization purposes
2141     */
2142    LDKPaymentPurpose_Sentinel,
2143 } LDKPaymentPurpose_Tag;
2144
2145 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2146    /**
2147     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2148     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2149     * [`ChannelManager::claim_funds`].
2150     *
2151     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2152     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2153     *
2154     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2155     */
2156    struct LDKThirtyTwoBytes payment_preimage;
2157    /**
2158     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2159     * number of deanonymization attacks during the routing process.
2160     * It is provided here for your reference, however its accuracy is enforced directly by
2161     * [`ChannelManager`] using the values you previously provided to
2162     * [`ChannelManager::create_inbound_payment`] or
2163     * [`ChannelManager::create_inbound_payment_for_hash`].
2164     *
2165     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2166     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2167     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2168     */
2169    struct LDKThirtyTwoBytes payment_secret;
2170 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2171
2172 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2173    LDKPaymentPurpose_Tag tag;
2174    union {
2175       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2176       struct {
2177          struct LDKThirtyTwoBytes spontaneous_payment;
2178       };
2179    };
2180 } LDKPaymentPurpose;
2181
2182 /**
2183  * The contents of CResult_PaymentPurposeDecodeErrorZ
2184  */
2185 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
2186    /**
2187     * A pointer to the contents in the success state.
2188     * Reading from this pointer when `result_ok` is not set is undefined.
2189     */
2190    struct LDKPaymentPurpose *result;
2191    /**
2192     * A pointer to the contents in the error state.
2193     * Reading from this pointer when `result_ok` is set is undefined.
2194     */
2195    struct LDKDecodeError *err;
2196 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
2197
2198 /**
2199  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2200  * containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2201  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2202  */
2203 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
2204    /**
2205     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2206     * `err` or `result` depending on the state of `result_ok`.
2207     */
2208    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
2209    /**
2210     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2211     */
2212    bool result_ok;
2213 } LDKCResult_PaymentPurposeDecodeErrorZ;
2214
2215 /**
2216  * The reason the channel was closed. See individual variants more details.
2217  */
2218 typedef enum LDKClosureReason_Tag {
2219    /**
2220     * Closure generated from receiving a peer error message.
2221     *
2222     * Our counterparty may have broadcasted their latest commitment state, and we have
2223     * as well.
2224     */
2225    LDKClosureReason_CounterpartyForceClosed,
2226    /**
2227     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2228     *
2229     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2230     */
2231    LDKClosureReason_HolderForceClosed,
2232    /**
2233     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2234     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2235     */
2236    LDKClosureReason_CooperativeClosure,
2237    /**
2238     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2239     * commitment transaction came from our counterparty, but it may also have come from
2240     * a copy of our own `ChannelMonitor`.
2241     */
2242    LDKClosureReason_CommitmentTxConfirmed,
2243    /**
2244     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2245     */
2246    LDKClosureReason_FundingTimedOut,
2247    /**
2248     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2249     */
2250    LDKClosureReason_ProcessingError,
2251    /**
2252     * The peer disconnected prior to funding completing. In this case the spec mandates that we
2253     * forget the channel entirely - we can attempt again if the peer reconnects.
2254     *
2255     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
2256     * peer because of mutual incompatibility between us and our channel counterparty.
2257     */
2258    LDKClosureReason_DisconnectedPeer,
2259    /**
2260     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
2261     * the ChannelManager deserialized.
2262     */
2263    LDKClosureReason_OutdatedChannelManager,
2264    /**
2265     * Must be last for serialization purposes
2266     */
2267    LDKClosureReason_Sentinel,
2268 } LDKClosureReason_Tag;
2269
2270 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2271    /**
2272     * The error which the peer sent us.
2273     *
2274     * The string should be sanitized before it is used (e.g emitted to logs
2275     * or printed to stdout). Otherwise, a well crafted error message may exploit
2276     * a security vulnerability in the terminal emulator or the logging subsystem.
2277     */
2278    struct LDKStr peer_msg;
2279 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2280
2281 typedef struct LDKClosureReason_LDKProcessingError_Body {
2282    /**
2283     * A developer-readable error message which we generated.
2284     */
2285    struct LDKStr err;
2286 } LDKClosureReason_LDKProcessingError_Body;
2287
2288 typedef struct MUST_USE_STRUCT LDKClosureReason {
2289    LDKClosureReason_Tag tag;
2290    union {
2291       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2292       LDKClosureReason_LDKProcessingError_Body processing_error;
2293    };
2294 } LDKClosureReason;
2295
2296 /**
2297  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2298  */
2299 typedef enum LDKCOption_ClosureReasonZ_Tag {
2300    /**
2301     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2302     */
2303    LDKCOption_ClosureReasonZ_Some,
2304    /**
2305     * When we're in this state, this COption_ClosureReasonZ contains nothing
2306     */
2307    LDKCOption_ClosureReasonZ_None,
2308    /**
2309     * Must be last for serialization purposes
2310     */
2311    LDKCOption_ClosureReasonZ_Sentinel,
2312 } LDKCOption_ClosureReasonZ_Tag;
2313
2314 typedef struct LDKCOption_ClosureReasonZ {
2315    LDKCOption_ClosureReasonZ_Tag tag;
2316    union {
2317       struct {
2318          struct LDKClosureReason some;
2319       };
2320    };
2321 } LDKCOption_ClosureReasonZ;
2322
2323 /**
2324  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2325  */
2326 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2327    /**
2328     * A pointer to the contents in the success state.
2329     * Reading from this pointer when `result_ok` is not set is undefined.
2330     */
2331    struct LDKCOption_ClosureReasonZ *result;
2332    /**
2333     * A pointer to the contents in the error state.
2334     * Reading from this pointer when `result_ok` is set is undefined.
2335     */
2336    struct LDKDecodeError *err;
2337 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2338
2339 /**
2340  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2341  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2342  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2343  */
2344 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2345    /**
2346     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2347     * `err` or `result` depending on the state of `result_ok`.
2348     */
2349    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2350    /**
2351     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2352     */
2353    bool result_ok;
2354 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2355
2356
2357
2358 /**
2359  * A channel_update message to be sent or received from a peer
2360  */
2361 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2362    /**
2363     * A pointer to the opaque Rust object.
2364     * Nearly everywhere, inner must be non-null, however in places where
2365     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2366     */
2367    LDKnativeChannelUpdate *inner;
2368    /**
2369     * Indicates that this is the only struct which contains the same pointer.
2370     * Rust functions which take ownership of an object provided via an argument require
2371     * this to be true and invalidate the object pointed to by inner.
2372     */
2373    bool is_owned;
2374 } LDKChannelUpdate;
2375
2376 /**
2377  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2378  * return packet by a node along the route. See [BOLT #4] for details.
2379  *
2380  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
2381  */
2382 typedef enum LDKNetworkUpdate_Tag {
2383    /**
2384     * An error indicating a `channel_update` messages should be applied via
2385     * [`NetworkGraph::update_channel`].
2386     */
2387    LDKNetworkUpdate_ChannelUpdateMessage,
2388    /**
2389     * An error indicating that a channel failed to route a payment, which should be applied via
2390     * [`NetworkGraph::channel_failed`].
2391     */
2392    LDKNetworkUpdate_ChannelFailure,
2393    /**
2394     * An error indicating that a node failed to route a payment, which should be applied via
2395     * [`NetworkGraph::node_failed`].
2396     */
2397    LDKNetworkUpdate_NodeFailure,
2398    /**
2399     * Must be last for serialization purposes
2400     */
2401    LDKNetworkUpdate_Sentinel,
2402 } LDKNetworkUpdate_Tag;
2403
2404 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2405    /**
2406     * The update to apply via [`NetworkGraph::update_channel`].
2407     */
2408    struct LDKChannelUpdate msg;
2409 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2410
2411 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
2412    /**
2413     * The short channel id of the closed channel.
2414     */
2415    uint64_t short_channel_id;
2416    /**
2417     * Whether the channel should be permanently removed or temporarily disabled until a new
2418     * `channel_update` message is received.
2419     */
2420    bool is_permanent;
2421 } LDKNetworkUpdate_LDKChannelFailure_Body;
2422
2423 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2424    /**
2425     * The node id of the failed node.
2426     */
2427    struct LDKPublicKey node_id;
2428    /**
2429     * Whether the node should be permanently removed from consideration or can be restored
2430     * when a new `channel_update` message is received.
2431     */
2432    bool is_permanent;
2433 } LDKNetworkUpdate_LDKNodeFailure_Body;
2434
2435 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2436    LDKNetworkUpdate_Tag tag;
2437    union {
2438       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2439       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
2440       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2441    };
2442 } LDKNetworkUpdate;
2443
2444 /**
2445  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
2446  */
2447 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2448    /**
2449     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
2450     */
2451    LDKCOption_NetworkUpdateZ_Some,
2452    /**
2453     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2454     */
2455    LDKCOption_NetworkUpdateZ_None,
2456    /**
2457     * Must be last for serialization purposes
2458     */
2459    LDKCOption_NetworkUpdateZ_Sentinel,
2460 } LDKCOption_NetworkUpdateZ_Tag;
2461
2462 typedef struct LDKCOption_NetworkUpdateZ {
2463    LDKCOption_NetworkUpdateZ_Tag tag;
2464    union {
2465       struct {
2466          struct LDKNetworkUpdate some;
2467       };
2468    };
2469 } LDKCOption_NetworkUpdateZ;
2470
2471
2472
2473 /**
2474  * A reference to a transaction output.
2475  *
2476  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2477  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2478  */
2479 typedef struct MUST_USE_STRUCT LDKOutPoint {
2480    /**
2481     * A pointer to the opaque Rust object.
2482     * Nearly everywhere, inner must be non-null, however in places where
2483     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2484     */
2485    LDKnativeOutPoint *inner;
2486    /**
2487     * Indicates that this is the only struct which contains the same pointer.
2488     * Rust functions which take ownership of an object provided via an argument require
2489     * this to be true and invalidate the object pointed to by inner.
2490     */
2491    bool is_owned;
2492 } LDKOutPoint;
2493
2494
2495
2496 /**
2497  * Information about a spendable output to a P2WSH script. See
2498  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2499  */
2500 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2501    /**
2502     * A pointer to the opaque Rust object.
2503     * Nearly everywhere, inner must be non-null, however in places where
2504     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2505     */
2506    LDKnativeDelayedPaymentOutputDescriptor *inner;
2507    /**
2508     * Indicates that this is the only struct which contains the same pointer.
2509     * Rust functions which take ownership of an object provided via an argument require
2510     * this to be true and invalidate the object pointed to by inner.
2511     */
2512    bool is_owned;
2513 } LDKDelayedPaymentOutputDescriptor;
2514
2515
2516
2517 /**
2518  * Information about a spendable output to our \"payment key\". See
2519  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2520  */
2521 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2522    /**
2523     * A pointer to the opaque Rust object.
2524     * Nearly everywhere, inner must be non-null, however in places where
2525     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2526     */
2527    LDKnativeStaticPaymentOutputDescriptor *inner;
2528    /**
2529     * Indicates that this is the only struct which contains the same pointer.
2530     * Rust functions which take ownership of an object provided via an argument require
2531     * this to be true and invalidate the object pointed to by inner.
2532     */
2533    bool is_owned;
2534 } LDKStaticPaymentOutputDescriptor;
2535
2536 /**
2537  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2538  * claim at any point in the future) an event is generated which you must track and be able to
2539  * spend on-chain. The information needed to do this is provided in this enum, including the
2540  * outpoint describing which txid and output index is available, the full output which exists at
2541  * that txid/index, and any keys or other information required to sign.
2542  */
2543 typedef enum LDKSpendableOutputDescriptor_Tag {
2544    /**
2545     * An output to a script which was provided via KeysInterface directly, either from
2546     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2547     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2548     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2549     * on-chain using the payment preimage or after it has timed out.
2550     */
2551    LDKSpendableOutputDescriptor_StaticOutput,
2552    /**
2553     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2554     *
2555     * The witness in the spending input should be:
2556     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2557     *
2558     * Note that the nSequence field in the spending input must be set to to_self_delay
2559     * (which means the transaction is not broadcastable until at least to_self_delay
2560     * blocks after the outpoint confirms).
2561     *
2562     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2563     * it is an output from an old state which we broadcast (which should never happen).
2564     *
2565     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2566     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2567     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2568     * chan_utils::derive_private_key. The public key can be generated without the secret key
2569     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2570     * Sign::pubkeys().
2571     *
2572     * To derive the revocation_pubkey provided here (which is used in the witness
2573     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2574     * call to Sign::ready_channel) and the provided per_commitment point
2575     * to chan_utils::derive_public_revocation_key.
2576     *
2577     * The witness script which is hashed and included in the output script_pubkey may be
2578     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2579     * (derived as above), and the to_self_delay contained here to
2580     * chan_utils::get_revokeable_redeemscript.
2581     */
2582    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2583    /**
2584     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2585     * corresponds to the public key in Sign::pubkeys().payment_point).
2586     * The witness in the spending input, is, thus, simply:
2587     * <BIP 143 signature> <payment key>
2588     *
2589     * These are generally the result of our counterparty having broadcast the current state,
2590     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2591     */
2592    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2593    /**
2594     * Must be last for serialization purposes
2595     */
2596    LDKSpendableOutputDescriptor_Sentinel,
2597 } LDKSpendableOutputDescriptor_Tag;
2598
2599 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2600    /**
2601     * The outpoint which is spendable
2602     */
2603    struct LDKOutPoint outpoint;
2604    /**
2605     * The output which is referenced by the given outpoint.
2606     */
2607    struct LDKTxOut output;
2608 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2609
2610 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2611    LDKSpendableOutputDescriptor_Tag tag;
2612    union {
2613       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2614       struct {
2615          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2616       };
2617       struct {
2618          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2619       };
2620    };
2621 } LDKSpendableOutputDescriptor;
2622
2623 /**
2624  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2625  * This corresponds to std::vector in C++
2626  */
2627 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2628    /**
2629     * The elements in the array.
2630     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2631     */
2632    struct LDKSpendableOutputDescriptor *data;
2633    /**
2634     * The number of elements pointed to by `data`.
2635     */
2636    uintptr_t datalen;
2637 } LDKCVec_SpendableOutputDescriptorZ;
2638
2639
2640
2641 /**
2642  * Features used within the channel_type field in an OpenChannel message.
2643  *
2644  * A channel is always of some known \"type\", describing the transaction formats used and the exact
2645  * semantics of our interaction with our peer.
2646  *
2647  * Note that because a channel is a specific type which is proposed by the opener and accepted by
2648  * the counterparty, only required features are allowed here.
2649  *
2650  * This is serialized differently from other feature types - it is not prefixed by a length, and
2651  * thus must only appear inside a TLV where its length is known in advance.
2652  */
2653 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
2654    /**
2655     * A pointer to the opaque Rust object.
2656     * Nearly everywhere, inner must be non-null, however in places where
2657     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2658     */
2659    LDKnativeChannelTypeFeatures *inner;
2660    /**
2661     * Indicates that this is the only struct which contains the same pointer.
2662     * Rust functions which take ownership of an object provided via an argument require
2663     * this to be true and invalidate the object pointed to by inner.
2664     */
2665    bool is_owned;
2666 } LDKChannelTypeFeatures;
2667
2668 /**
2669  * An Event which you should probably take some action in response to.
2670  *
2671  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2672  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2673  * written as it makes no sense to respond to it after reconnecting to peers).
2674  */
2675 typedef enum LDKEvent_Tag {
2676    /**
2677     * Used to indicate that the client should generate a funding transaction with the given
2678     * parameters and then call [`ChannelManager::funding_transaction_generated`].
2679     * Generated in [`ChannelManager`] message handling.
2680     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2681     * counterparty can steal your funds!
2682     *
2683     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2684     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2685     */
2686    LDKEvent_FundingGenerationReady,
2687    /**
2688     * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
2689     * feed it to [`ChannelManager::claim_funds`] to get it....
2690     *
2691     * Note that if the preimage is not known, you should call
2692     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
2693     * network congestion.
2694     * If you fail to call either [`ChannelManager::claim_funds`] or
2695     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
2696     * automatically failed.
2697     *
2698     * # Note
2699     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2700     * `PaymentReceived` events may be generated for the same payment.
2701     *
2702     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2703     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
2704     */
2705    LDKEvent_PaymentReceived,
2706    /**
2707     * Indicates a payment has been claimed and we've received money!
2708     *
2709     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
2710     * to an [`Event::PaymentReceived`]. However, if we previously crashed during a
2711     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
2712     * [`Event::PaymentReceived`] event.
2713     *
2714     * # Note
2715     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2716     * `PaymentReceived` events may be generated for the same payment. If you then call
2717     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
2718     * multiple `PaymentClaimed` events.
2719     *
2720     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2721     */
2722    LDKEvent_PaymentClaimed,
2723    /**
2724     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
2725     * and we got back the payment preimage for it).
2726     *
2727     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
2728     * event. In this situation, you SHOULD treat this payment as having succeeded.
2729     */
2730    LDKEvent_PaymentSent,
2731    /**
2732     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
2733     * provide failure information for each MPP part in the payment.
2734     *
2735     * This event is provided once there are no further pending HTLCs for the payment and the
2736     * payment is no longer retryable, either due to a several-block timeout or because
2737     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
2738     *
2739     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2740     */
2741    LDKEvent_PaymentFailed,
2742    /**
2743     * Indicates that a path for an outbound payment was successful.
2744     *
2745     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
2746     * [`Event::PaymentSent`] for obtaining the payment preimage.
2747     */
2748    LDKEvent_PaymentPathSuccessful,
2749    /**
2750     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
2751     * something. You may wish to retry with a different route.
2752     *
2753     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
2754     * [`Event::PaymentFailed`] and [`all_paths_failed`].
2755     *
2756     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
2757     */
2758    LDKEvent_PaymentPathFailed,
2759    /**
2760     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
2761     * a time in the future.
2762     *
2763     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
2764     */
2765    LDKEvent_PendingHTLCsForwardable,
2766    /**
2767     * Used to indicate that an output which you should know how to spend was confirmed on chain
2768     * and is now spendable.
2769     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2770     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2771     * somewhere and spend them when you create on-chain transactions.
2772     */
2773    LDKEvent_SpendableOutputs,
2774    /**
2775     * This event is generated when a payment has been successfully forwarded through us and a
2776     * forwarding fee earned.
2777     */
2778    LDKEvent_PaymentForwarded,
2779    /**
2780     * Used to indicate that a previously opened channel with the given `channel_id` is in the
2781     * process of closure.
2782     */
2783    LDKEvent_ChannelClosed,
2784    /**
2785     * Used to indicate to the user that they can abandon the funding transaction and recycle the
2786     * inputs for another purpose.
2787     */
2788    LDKEvent_DiscardFunding,
2789    /**
2790     * Indicates a request to open a new channel by a peer.
2791     *
2792     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
2793     * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
2794     *
2795     * The event is only triggered when a new open channel request is received and the
2796     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
2797     *
2798     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
2799     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
2800     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
2801     */
2802    LDKEvent_OpenChannelRequest,
2803    /**
2804     * Must be last for serialization purposes
2805     */
2806    LDKEvent_Sentinel,
2807 } LDKEvent_Tag;
2808
2809 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2810    /**
2811     * The random channel_id we picked which you'll need to pass into
2812     * [`ChannelManager::funding_transaction_generated`].
2813     *
2814     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2815     */
2816    struct LDKThirtyTwoBytes temporary_channel_id;
2817    /**
2818     * The counterparty's node_id, which you'll need to pass back into
2819     * [`ChannelManager::funding_transaction_generated`].
2820     *
2821     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2822     */
2823    struct LDKPublicKey counterparty_node_id;
2824    /**
2825     * The value, in satoshis, that the output should have.
2826     */
2827    uint64_t channel_value_satoshis;
2828    /**
2829     * The script which should be used in the transaction output.
2830     */
2831    struct LDKCVec_u8Z output_script;
2832    /**
2833     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2834     * an inbound channel.
2835     *
2836     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2837     */
2838    uint64_t user_channel_id;
2839 } LDKEvent_LDKFundingGenerationReady_Body;
2840
2841 typedef struct LDKEvent_LDKPaymentReceived_Body {
2842    /**
2843     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
2844     * not stop you from registering duplicate payment hashes for inbound payments.
2845     */
2846    struct LDKThirtyTwoBytes payment_hash;
2847    /**
2848     * The value, in thousandths of a satoshi, that this payment is for.
2849     */
2850    uint64_t amount_msat;
2851    /**
2852     * Information for claiming this received payment, based on whether the purpose of the
2853     * payment is to pay an invoice or to send a spontaneous payment.
2854     */
2855    struct LDKPaymentPurpose purpose;
2856 } LDKEvent_LDKPaymentReceived_Body;
2857
2858 typedef struct LDKEvent_LDKPaymentClaimed_Body {
2859    /**
2860     * The payment hash of the claimed payment. Note that LDK will not stop you from
2861     * registering duplicate payment hashes for inbound payments.
2862     */
2863    struct LDKThirtyTwoBytes payment_hash;
2864    /**
2865     * The value, in thousandths of a satoshi, that this payment is for.
2866     */
2867    uint64_t amount_msat;
2868    /**
2869     * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
2870     * spontaneous payment.
2871     */
2872    struct LDKPaymentPurpose purpose;
2873 } LDKEvent_LDKPaymentClaimed_Body;
2874
2875 typedef struct LDKEvent_LDKPaymentSent_Body {
2876    /**
2877     * The id returned by [`ChannelManager::send_payment`] and used with
2878     * [`ChannelManager::retry_payment`].
2879     *
2880     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2881     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2882     *
2883     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2884     */
2885    struct LDKThirtyTwoBytes payment_id;
2886    /**
2887     * The preimage to the hash given to ChannelManager::send_payment.
2888     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2889     * store it somehow!
2890     */
2891    struct LDKThirtyTwoBytes payment_preimage;
2892    /**
2893     * The hash that was given to [`ChannelManager::send_payment`].
2894     *
2895     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2896     */
2897    struct LDKThirtyTwoBytes payment_hash;
2898    /**
2899     * The total fee which was spent at intermediate hops in this payment, across all paths.
2900     *
2901     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
2902     * overpayment to the recipient node.
2903     *
2904     * If the recipient or an intermediate node misbehaves and gives us free money, this may
2905     * overstate the amount paid, though this is unlikely.
2906     *
2907     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
2908     */
2909    struct LDKCOption_u64Z fee_paid_msat;
2910 } LDKEvent_LDKPaymentSent_Body;
2911
2912 typedef struct LDKEvent_LDKPaymentFailed_Body {
2913    /**
2914     * The id returned by [`ChannelManager::send_payment`] and used with
2915     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
2916     *
2917     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2918     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2919     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2920     */
2921    struct LDKThirtyTwoBytes payment_id;
2922    /**
2923     * The hash that was given to [`ChannelManager::send_payment`].
2924     *
2925     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2926     */
2927    struct LDKThirtyTwoBytes payment_hash;
2928 } LDKEvent_LDKPaymentFailed_Body;
2929
2930 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
2931    /**
2932     * The id returned by [`ChannelManager::send_payment`] and used with
2933     * [`ChannelManager::retry_payment`].
2934     *
2935     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2936     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2937     */
2938    struct LDKThirtyTwoBytes payment_id;
2939    /**
2940     * The hash that was given to [`ChannelManager::send_payment`].
2941     *
2942     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2943     *
2944     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2945     */
2946    struct LDKThirtyTwoBytes payment_hash;
2947    /**
2948     * The payment path that was successful.
2949     *
2950     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
2951     */
2952    struct LDKCVec_RouteHopZ path;
2953 } LDKEvent_LDKPaymentPathSuccessful_Body;
2954
2955 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
2956    /**
2957     * The id returned by [`ChannelManager::send_payment`] and used with
2958     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
2959     *
2960     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2961     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2962     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2963     *
2964     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2965     */
2966    struct LDKThirtyTwoBytes payment_id;
2967    /**
2968     * The hash that was given to [`ChannelManager::send_payment`].
2969     *
2970     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2971     */
2972    struct LDKThirtyTwoBytes payment_hash;
2973    /**
2974     * Indicates the payment was rejected for some reason by the recipient. This implies that
2975     * the payment has failed, not just the route in question. If this is not set, you may
2976     * retry the payment via a different route.
2977     */
2978    bool rejected_by_dest;
2979    /**
2980     * Any failure information conveyed via the Onion return packet by a node along the failed
2981     * payment route.
2982     *
2983     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
2984     * account the update.
2985     *
2986     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
2987     */
2988    struct LDKCOption_NetworkUpdateZ network_update;
2989    /**
2990     * For both single-path and multi-path payments, this is set if all paths of the payment have
2991     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
2992     * larger MPP payment were still in flight when this event was generated.
2993     *
2994     * Note that if you are retrying individual MPP parts, using this value to determine if a
2995     * payment has fully failed is race-y. Because multiple failures can happen prior to events
2996     * being processed, you may retry in response to a first failure, with a second failure
2997     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
2998     * you will see `all_paths_failed` set even though the retry of the first failure still
2999     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3000     *
3001     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3002     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3003     *
3004     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3005     *
3006     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3007     */
3008    bool all_paths_failed;
3009    /**
3010     * The payment path that failed.
3011     */
3012    struct LDKCVec_RouteHopZ path;
3013    /**
3014     * The channel responsible for the failed payment path.
3015     *
3016     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3017     * may not refer to a channel in the public network graph. These aliases may also collide
3018     * with channels in the public network graph.
3019     *
3020     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3021     * retried. May be `None` for older [`Event`] serializations.
3022     */
3023    struct LDKCOption_u64Z short_channel_id;
3024    /**
3025     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3026     *
3027     * See [`find_route`] for details.
3028     *
3029     * [`Route`]: crate::routing::router::Route
3030     * [`find_route`]: crate::routing::router::find_route
3031     *
3032     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3033     */
3034    struct LDKRouteParameters retry;
3035 } LDKEvent_LDKPaymentPathFailed_Body;
3036
3037 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3038    /**
3039     * The minimum amount of time that should be waited prior to calling
3040     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3041     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3042     * now + 5*time_forwardable).
3043     */
3044    uint64_t time_forwardable;
3045 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3046
3047 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3048    /**
3049     * The outputs which you should store as spendable by you.
3050     */
3051    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3052 } LDKEvent_LDKSpendableOutputs_Body;
3053
3054 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3055    /**
3056     * The incoming channel between the previous node and us. This is only `None` for events
3057     * generated or serialized by versions prior to 0.0.107.
3058     *
3059     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3060     */
3061    struct LDKThirtyTwoBytes prev_channel_id;
3062    /**
3063     * The outgoing channel between the next node and us. This is only `None` for events
3064     * generated or serialized by versions prior to 0.0.107.
3065     *
3066     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3067     */
3068    struct LDKThirtyTwoBytes next_channel_id;
3069    /**
3070     * The fee, in milli-satoshis, which was earned as a result of the payment.
3071     *
3072     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3073     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3074     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3075     * claimed the full value in millisatoshis from the source. In this case,
3076     * `claim_from_onchain_tx` will be set.
3077     *
3078     * If the channel which sent us the payment has been force-closed, we will claim the funds
3079     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3080     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3081     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3082     * `None`.
3083     */
3084    struct LDKCOption_u64Z fee_earned_msat;
3085    /**
3086     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3087     * transaction.
3088     */
3089    bool claim_from_onchain_tx;
3090 } LDKEvent_LDKPaymentForwarded_Body;
3091
3092 typedef struct LDKEvent_LDKChannelClosed_Body {
3093    /**
3094     * The channel_id of the channel which has been closed. Note that on-chain transactions
3095     * resolving the channel are likely still awaiting confirmation.
3096     */
3097    struct LDKThirtyTwoBytes channel_id;
3098    /**
3099     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
3100     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
3101     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
3102     * `user_channel_id` will be 0 for an inbound channel.
3103     * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
3104     *
3105     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3106     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3107     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3108     */
3109    uint64_t user_channel_id;
3110    /**
3111     * The reason the channel was closed.
3112     */
3113    struct LDKClosureReason reason;
3114 } LDKEvent_LDKChannelClosed_Body;
3115
3116 typedef struct LDKEvent_LDKDiscardFunding_Body {
3117    /**
3118     * The channel_id of the channel which has been closed.
3119     */
3120    struct LDKThirtyTwoBytes channel_id;
3121    /**
3122     * The full transaction received from the user
3123     */
3124    struct LDKTransaction transaction;
3125 } LDKEvent_LDKDiscardFunding_Body;
3126
3127 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3128    /**
3129     * The temporary channel ID of the channel requested to be opened.
3130     *
3131     * When responding to the request, the `temporary_channel_id` should be passed
3132     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
3133     * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
3134     *
3135     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3136     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3137     */
3138    struct LDKThirtyTwoBytes temporary_channel_id;
3139    /**
3140     * The node_id of the counterparty requesting to open the channel.
3141     *
3142     * When responding to the request, the `counterparty_node_id` should be passed
3143     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
3144     * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
3145     * request.
3146     *
3147     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3148     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3149     */
3150    struct LDKPublicKey counterparty_node_id;
3151    /**
3152     * The channel value of the requested channel.
3153     */
3154    uint64_t funding_satoshis;
3155    /**
3156     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3157     */
3158    uint64_t push_msat;
3159    /**
3160     * The features that this channel will operate with. If you reject the channel, a
3161     * well-behaved counterparty may automatically re-attempt the channel with a new set of
3162     * feature flags.
3163     *
3164     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
3165     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3166     * 0.0.106.
3167     *
3168     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
3169     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3170     * 0.0.107. Channels setting this type also need to get manually accepted via
3171     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
3172     * or will be rejected otherwise.
3173     *
3174     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3175     */
3176    struct LDKChannelTypeFeatures channel_type;
3177 } LDKEvent_LDKOpenChannelRequest_Body;
3178
3179 typedef struct MUST_USE_STRUCT LDKEvent {
3180    LDKEvent_Tag tag;
3181    union {
3182       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3183       LDKEvent_LDKPaymentReceived_Body payment_received;
3184       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
3185       LDKEvent_LDKPaymentSent_Body payment_sent;
3186       LDKEvent_LDKPaymentFailed_Body payment_failed;
3187       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3188       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3189       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3190       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3191       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3192       LDKEvent_LDKChannelClosed_Body channel_closed;
3193       LDKEvent_LDKDiscardFunding_Body discard_funding;
3194       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
3195    };
3196 } LDKEvent;
3197
3198 /**
3199  * An enum which can either contain a crate::lightning::util::events::Event or not
3200  */
3201 typedef enum LDKCOption_EventZ_Tag {
3202    /**
3203     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3204     */
3205    LDKCOption_EventZ_Some,
3206    /**
3207     * When we're in this state, this COption_EventZ contains nothing
3208     */
3209    LDKCOption_EventZ_None,
3210    /**
3211     * Must be last for serialization purposes
3212     */
3213    LDKCOption_EventZ_Sentinel,
3214 } LDKCOption_EventZ_Tag;
3215
3216 typedef struct LDKCOption_EventZ {
3217    LDKCOption_EventZ_Tag tag;
3218    union {
3219       struct {
3220          struct LDKEvent some;
3221       };
3222    };
3223 } LDKCOption_EventZ;
3224
3225 /**
3226  * The contents of CResult_COption_EventZDecodeErrorZ
3227  */
3228 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
3229    /**
3230     * A pointer to the contents in the success state.
3231     * Reading from this pointer when `result_ok` is not set is undefined.
3232     */
3233    struct LDKCOption_EventZ *result;
3234    /**
3235     * A pointer to the contents in the error state.
3236     * Reading from this pointer when `result_ok` is set is undefined.
3237     */
3238    struct LDKDecodeError *err;
3239 } LDKCResult_COption_EventZDecodeErrorZPtr;
3240
3241 /**
3242  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3243  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3244  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3245  */
3246 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3247    /**
3248     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3249     * `err` or `result` depending on the state of `result_ok`.
3250     */
3251    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3252    /**
3253     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3254     */
3255    bool result_ok;
3256 } LDKCResult_COption_EventZDecodeErrorZ;
3257
3258
3259
3260 /**
3261  * An accept_channel message to be sent or received from a peer
3262  */
3263 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3264    /**
3265     * A pointer to the opaque Rust object.
3266     * Nearly everywhere, inner must be non-null, however in places where
3267     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3268     */
3269    LDKnativeAcceptChannel *inner;
3270    /**
3271     * Indicates that this is the only struct which contains the same pointer.
3272     * Rust functions which take ownership of an object provided via an argument require
3273     * this to be true and invalidate the object pointed to by inner.
3274     */
3275    bool is_owned;
3276 } LDKAcceptChannel;
3277
3278
3279
3280 /**
3281  * An open_channel message to be sent or received from a peer
3282  */
3283 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3284    /**
3285     * A pointer to the opaque Rust object.
3286     * Nearly everywhere, inner must be non-null, however in places where
3287     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3288     */
3289    LDKnativeOpenChannel *inner;
3290    /**
3291     * Indicates that this is the only struct which contains the same pointer.
3292     * Rust functions which take ownership of an object provided via an argument require
3293     * this to be true and invalidate the object pointed to by inner.
3294     */
3295    bool is_owned;
3296 } LDKOpenChannel;
3297
3298
3299
3300 /**
3301  * A funding_created message to be sent or received from a peer
3302  */
3303 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3304    /**
3305     * A pointer to the opaque Rust object.
3306     * Nearly everywhere, inner must be non-null, however in places where
3307     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3308     */
3309    LDKnativeFundingCreated *inner;
3310    /**
3311     * Indicates that this is the only struct which contains the same pointer.
3312     * Rust functions which take ownership of an object provided via an argument require
3313     * this to be true and invalidate the object pointed to by inner.
3314     */
3315    bool is_owned;
3316 } LDKFundingCreated;
3317
3318
3319
3320 /**
3321  * A funding_signed message to be sent or received from a peer
3322  */
3323 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3324    /**
3325     * A pointer to the opaque Rust object.
3326     * Nearly everywhere, inner must be non-null, however in places where
3327     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3328     */
3329    LDKnativeFundingSigned *inner;
3330    /**
3331     * Indicates that this is the only struct which contains the same pointer.
3332     * Rust functions which take ownership of an object provided via an argument require
3333     * this to be true and invalidate the object pointed to by inner.
3334     */
3335    bool is_owned;
3336 } LDKFundingSigned;
3337
3338
3339
3340 /**
3341  * A channel_ready message to be sent or received from a peer
3342  */
3343 typedef struct MUST_USE_STRUCT LDKChannelReady {
3344    /**
3345     * A pointer to the opaque Rust object.
3346     * Nearly everywhere, inner must be non-null, however in places where
3347     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3348     */
3349    LDKnativeChannelReady *inner;
3350    /**
3351     * Indicates that this is the only struct which contains the same pointer.
3352     * Rust functions which take ownership of an object provided via an argument require
3353     * this to be true and invalidate the object pointed to by inner.
3354     */
3355    bool is_owned;
3356 } LDKChannelReady;
3357
3358
3359
3360 /**
3361  * An announcement_signatures message to be sent or received from a peer
3362  */
3363 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3364    /**
3365     * A pointer to the opaque Rust object.
3366     * Nearly everywhere, inner must be non-null, however in places where
3367     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3368     */
3369    LDKnativeAnnouncementSignatures *inner;
3370    /**
3371     * Indicates that this is the only struct which contains the same pointer.
3372     * Rust functions which take ownership of an object provided via an argument require
3373     * this to be true and invalidate the object pointed to by inner.
3374     */
3375    bool is_owned;
3376 } LDKAnnouncementSignatures;
3377
3378
3379
3380 /**
3381  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3382  * transaction updates if they were pending.
3383  */
3384 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3385    /**
3386     * A pointer to the opaque Rust object.
3387     * Nearly everywhere, inner must be non-null, however in places where
3388     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3389     */
3390    LDKnativeCommitmentUpdate *inner;
3391    /**
3392     * Indicates that this is the only struct which contains the same pointer.
3393     * Rust functions which take ownership of an object provided via an argument require
3394     * this to be true and invalidate the object pointed to by inner.
3395     */
3396    bool is_owned;
3397 } LDKCommitmentUpdate;
3398
3399
3400
3401 /**
3402  * A revoke_and_ack message to be sent or received from a peer
3403  */
3404 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3405    /**
3406     * A pointer to the opaque Rust object.
3407     * Nearly everywhere, inner must be non-null, however in places where
3408     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3409     */
3410    LDKnativeRevokeAndACK *inner;
3411    /**
3412     * Indicates that this is the only struct which contains the same pointer.
3413     * Rust functions which take ownership of an object provided via an argument require
3414     * this to be true and invalidate the object pointed to by inner.
3415     */
3416    bool is_owned;
3417 } LDKRevokeAndACK;
3418
3419
3420
3421 /**
3422  * A closing_signed message to be sent or received from a peer
3423  */
3424 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3425    /**
3426     * A pointer to the opaque Rust object.
3427     * Nearly everywhere, inner must be non-null, however in places where
3428     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3429     */
3430    LDKnativeClosingSigned *inner;
3431    /**
3432     * Indicates that this is the only struct which contains the same pointer.
3433     * Rust functions which take ownership of an object provided via an argument require
3434     * this to be true and invalidate the object pointed to by inner.
3435     */
3436    bool is_owned;
3437 } LDKClosingSigned;
3438
3439
3440
3441 /**
3442  * A shutdown message to be sent or received from a peer
3443  */
3444 typedef struct MUST_USE_STRUCT LDKShutdown {
3445    /**
3446     * A pointer to the opaque Rust object.
3447     * Nearly everywhere, inner must be non-null, however in places where
3448     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3449     */
3450    LDKnativeShutdown *inner;
3451    /**
3452     * Indicates that this is the only struct which contains the same pointer.
3453     * Rust functions which take ownership of an object provided via an argument require
3454     * this to be true and invalidate the object pointed to by inner.
3455     */
3456    bool is_owned;
3457 } LDKShutdown;
3458
3459
3460
3461 /**
3462  * A channel_reestablish message to be sent or received from a peer
3463  */
3464 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3465    /**
3466     * A pointer to the opaque Rust object.
3467     * Nearly everywhere, inner must be non-null, however in places where
3468     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3469     */
3470    LDKnativeChannelReestablish *inner;
3471    /**
3472     * Indicates that this is the only struct which contains the same pointer.
3473     * Rust functions which take ownership of an object provided via an argument require
3474     * this to be true and invalidate the object pointed to by inner.
3475     */
3476    bool is_owned;
3477 } LDKChannelReestablish;
3478
3479
3480
3481 /**
3482  * A channel_announcement message to be sent or received from a peer
3483  */
3484 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3485    /**
3486     * A pointer to the opaque Rust object.
3487     * Nearly everywhere, inner must be non-null, however in places where
3488     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3489     */
3490    LDKnativeChannelAnnouncement *inner;
3491    /**
3492     * Indicates that this is the only struct which contains the same pointer.
3493     * Rust functions which take ownership of an object provided via an argument require
3494     * this to be true and invalidate the object pointed to by inner.
3495     */
3496    bool is_owned;
3497 } LDKChannelAnnouncement;
3498
3499
3500
3501 /**
3502  * A node_announcement message to be sent or received from a peer
3503  */
3504 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3505    /**
3506     * A pointer to the opaque Rust object.
3507     * Nearly everywhere, inner must be non-null, however in places where
3508     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3509     */
3510    LDKnativeNodeAnnouncement *inner;
3511    /**
3512     * Indicates that this is the only struct which contains the same pointer.
3513     * Rust functions which take ownership of an object provided via an argument require
3514     * this to be true and invalidate the object pointed to by inner.
3515     */
3516    bool is_owned;
3517 } LDKNodeAnnouncement;
3518
3519
3520
3521 /**
3522  * An error message to be sent or received from a peer
3523  */
3524 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3525    /**
3526     * A pointer to the opaque Rust object.
3527     * Nearly everywhere, inner must be non-null, however in places where
3528     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3529     */
3530    LDKnativeErrorMessage *inner;
3531    /**
3532     * Indicates that this is the only struct which contains the same pointer.
3533     * Rust functions which take ownership of an object provided via an argument require
3534     * this to be true and invalidate the object pointed to by inner.
3535     */
3536    bool is_owned;
3537 } LDKErrorMessage;
3538
3539
3540
3541 /**
3542  * A warning message to be sent or received from a peer
3543  */
3544 typedef struct MUST_USE_STRUCT LDKWarningMessage {
3545    /**
3546     * A pointer to the opaque Rust object.
3547     * Nearly everywhere, inner must be non-null, however in places where
3548     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3549     */
3550    LDKnativeWarningMessage *inner;
3551    /**
3552     * Indicates that this is the only struct which contains the same pointer.
3553     * Rust functions which take ownership of an object provided via an argument require
3554     * this to be true and invalidate the object pointed to by inner.
3555     */
3556    bool is_owned;
3557 } LDKWarningMessage;
3558
3559 /**
3560  * Used to put an error message in a LightningError
3561  */
3562 typedef enum LDKErrorAction_Tag {
3563    /**
3564     * The peer took some action which made us think they were useless. Disconnect them.
3565     */
3566    LDKErrorAction_DisconnectPeer,
3567    /**
3568     * The peer did something harmless that we weren't able to process, just log and ignore
3569     */
3570    LDKErrorAction_IgnoreError,
3571    /**
3572     * The peer did something harmless that we weren't able to meaningfully process.
3573     * If the error is logged, log it at the given level.
3574     */
3575    LDKErrorAction_IgnoreAndLog,
3576    /**
3577     * The peer provided us with a gossip message which we'd already seen. In most cases this
3578     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
3579     * our own channel announcements.
3580     */
3581    LDKErrorAction_IgnoreDuplicateGossip,
3582    /**
3583     * The peer did something incorrect. Tell them.
3584     */
3585    LDKErrorAction_SendErrorMessage,
3586    /**
3587     * The peer did something incorrect. Tell them without closing any channels.
3588     */
3589    LDKErrorAction_SendWarningMessage,
3590    /**
3591     * Must be last for serialization purposes
3592     */
3593    LDKErrorAction_Sentinel,
3594 } LDKErrorAction_Tag;
3595
3596 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3597    /**
3598     * An error message which we should make an effort to send before we disconnect.
3599     *
3600     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3601     */
3602    struct LDKErrorMessage msg;
3603 } LDKErrorAction_LDKDisconnectPeer_Body;
3604
3605 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3606    /**
3607     * The message to send.
3608     */
3609    struct LDKErrorMessage msg;
3610 } LDKErrorAction_LDKSendErrorMessage_Body;
3611
3612 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
3613    /**
3614     * The message to send.
3615     */
3616    struct LDKWarningMessage msg;
3617    /**
3618     * The peer may have done something harmless that we weren't able to meaningfully process,
3619     * though we should still tell them about it.
3620     * If this event is logged, log it at the given level.
3621     */
3622    enum LDKLevel log_level;
3623 } LDKErrorAction_LDKSendWarningMessage_Body;
3624
3625 typedef struct MUST_USE_STRUCT LDKErrorAction {
3626    LDKErrorAction_Tag tag;
3627    union {
3628       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3629       struct {
3630          enum LDKLevel ignore_and_log;
3631       };
3632       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3633       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
3634    };
3635 } LDKErrorAction;
3636
3637
3638
3639 /**
3640  * A query_channel_range message is used to query a peer for channel
3641  * UTXOs in a range of blocks. The recipient of a query makes a best
3642  * effort to reply to the query using one or more reply_channel_range
3643  * messages.
3644  */
3645 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3646    /**
3647     * A pointer to the opaque Rust object.
3648     * Nearly everywhere, inner must be non-null, however in places where
3649     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3650     */
3651    LDKnativeQueryChannelRange *inner;
3652    /**
3653     * Indicates that this is the only struct which contains the same pointer.
3654     * Rust functions which take ownership of an object provided via an argument require
3655     * this to be true and invalidate the object pointed to by inner.
3656     */
3657    bool is_owned;
3658 } LDKQueryChannelRange;
3659
3660
3661
3662 /**
3663  * A query_short_channel_ids message is used to query a peer for
3664  * routing gossip messages related to one or more short_channel_ids.
3665  * The query recipient will reply with the latest, if available,
3666  * channel_announcement, channel_update and node_announcement messages
3667  * it maintains for the requested short_channel_ids followed by a
3668  * reply_short_channel_ids_end message. The short_channel_ids sent in
3669  * this query are encoded. We only support encoding_type=0 uncompressed
3670  * serialization and do not support encoding_type=1 zlib serialization.
3671  */
3672 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3673    /**
3674     * A pointer to the opaque Rust object.
3675     * Nearly everywhere, inner must be non-null, however in places where
3676     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3677     */
3678    LDKnativeQueryShortChannelIds *inner;
3679    /**
3680     * Indicates that this is the only struct which contains the same pointer.
3681     * Rust functions which take ownership of an object provided via an argument require
3682     * this to be true and invalidate the object pointed to by inner.
3683     */
3684    bool is_owned;
3685 } LDKQueryShortChannelIds;
3686
3687
3688
3689 /**
3690  * A reply_channel_range message is a reply to a query_channel_range
3691  * message. Multiple reply_channel_range messages can be sent in reply
3692  * to a single query_channel_range message. The query recipient makes a
3693  * best effort to respond based on their local network view which may
3694  * not be a perfect view of the network. The short_channel_ids in the
3695  * reply are encoded. We only support encoding_type=0 uncompressed
3696  * serialization and do not support encoding_type=1 zlib serialization.
3697  */
3698 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3699    /**
3700     * A pointer to the opaque Rust object.
3701     * Nearly everywhere, inner must be non-null, however in places where
3702     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3703     */
3704    LDKnativeReplyChannelRange *inner;
3705    /**
3706     * Indicates that this is the only struct which contains the same pointer.
3707     * Rust functions which take ownership of an object provided via an argument require
3708     * this to be true and invalidate the object pointed to by inner.
3709     */
3710    bool is_owned;
3711 } LDKReplyChannelRange;
3712
3713
3714
3715 /**
3716  * A gossip_timestamp_filter message is used by a node to request
3717  * gossip relay for messages in the requested time range when the
3718  * gossip_queries feature has been negotiated.
3719  */
3720 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
3721    /**
3722     * A pointer to the opaque Rust object.
3723     * Nearly everywhere, inner must be non-null, however in places where
3724     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3725     */
3726    LDKnativeGossipTimestampFilter *inner;
3727    /**
3728     * Indicates that this is the only struct which contains the same pointer.
3729     * Rust functions which take ownership of an object provided via an argument require
3730     * this to be true and invalidate the object pointed to by inner.
3731     */
3732    bool is_owned;
3733 } LDKGossipTimestampFilter;
3734
3735 /**
3736  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3737  * broadcast to most peers).
3738  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3739  */
3740 typedef enum LDKMessageSendEvent_Tag {
3741    /**
3742     * Used to indicate that we've accepted a channel open and should send the accept_channel
3743     * message provided to the given peer.
3744     */
3745    LDKMessageSendEvent_SendAcceptChannel,
3746    /**
3747     * Used to indicate that we've initiated a channel open and should send the open_channel
3748     * message provided to the given peer.
3749     */
3750    LDKMessageSendEvent_SendOpenChannel,
3751    /**
3752     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3753     */
3754    LDKMessageSendEvent_SendFundingCreated,
3755    /**
3756     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3757     */
3758    LDKMessageSendEvent_SendFundingSigned,
3759    /**
3760     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
3761     */
3762    LDKMessageSendEvent_SendChannelReady,
3763    /**
3764     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3765     */
3766    LDKMessageSendEvent_SendAnnouncementSignatures,
3767    /**
3768     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3769     * message should be sent to the peer with the given node_id.
3770     */
3771    LDKMessageSendEvent_UpdateHTLCs,
3772    /**
3773     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3774     */
3775    LDKMessageSendEvent_SendRevokeAndACK,
3776    /**
3777     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3778     */
3779    LDKMessageSendEvent_SendClosingSigned,
3780    /**
3781     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3782     */
3783    LDKMessageSendEvent_SendShutdown,
3784    /**
3785     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3786     */
3787    LDKMessageSendEvent_SendChannelReestablish,
3788    /**
3789     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3790     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3791     *
3792     * Note that after doing so, you very likely (unless you did so very recently) want to call
3793     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3794     * This ensures that any nodes which see our channel_announcement also have a relevant
3795     * node_announcement, including relevant feature flags which may be important for routing
3796     * through or to us.
3797     */
3798    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3799    /**
3800     * Used to indicate that a node_announcement should be broadcast to all peers.
3801     */
3802    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3803    /**
3804     * Used to indicate that a channel_update should be broadcast to all peers.
3805     */
3806    LDKMessageSendEvent_BroadcastChannelUpdate,
3807    /**
3808     * Used to indicate that a channel_update should be sent to a single peer.
3809     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
3810     * private channel and we shouldn't be informing all of our peers of channel parameters.
3811     */
3812    LDKMessageSendEvent_SendChannelUpdate,
3813    /**
3814     * Broadcast an error downstream to be handled
3815     */
3816    LDKMessageSendEvent_HandleError,
3817    /**
3818     * Query a peer for channels with funding transaction UTXOs in a block range.
3819     */
3820    LDKMessageSendEvent_SendChannelRangeQuery,
3821    /**
3822     * Request routing gossip messages from a peer for a list of channels identified by
3823     * their short_channel_ids.
3824     */
3825    LDKMessageSendEvent_SendShortIdsQuery,
3826    /**
3827     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3828     * emitted during processing of the query.
3829     */
3830    LDKMessageSendEvent_SendReplyChannelRange,
3831    /**
3832     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
3833     * enable receiving gossip messages from the peer.
3834     */
3835    LDKMessageSendEvent_SendGossipTimestampFilter,
3836    /**
3837     * Must be last for serialization purposes
3838     */
3839    LDKMessageSendEvent_Sentinel,
3840 } LDKMessageSendEvent_Tag;
3841
3842 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3843    /**
3844     * The node_id of the node which should receive this message
3845     */
3846    struct LDKPublicKey node_id;
3847    /**
3848     * The message which should be sent.
3849     */
3850    struct LDKAcceptChannel msg;
3851 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3852
3853 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3854    /**
3855     * The node_id of the node which should receive this message
3856     */
3857    struct LDKPublicKey node_id;
3858    /**
3859     * The message which should be sent.
3860     */
3861    struct LDKOpenChannel msg;
3862 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3863
3864 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3865    /**
3866     * The node_id of the node which should receive this message
3867     */
3868    struct LDKPublicKey node_id;
3869    /**
3870     * The message which should be sent.
3871     */
3872    struct LDKFundingCreated msg;
3873 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3874
3875 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3876    /**
3877     * The node_id of the node which should receive this message
3878     */
3879    struct LDKPublicKey node_id;
3880    /**
3881     * The message which should be sent.
3882     */
3883    struct LDKFundingSigned msg;
3884 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3885
3886 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
3887    /**
3888     * The node_id of the node which should receive these message(s)
3889     */
3890    struct LDKPublicKey node_id;
3891    /**
3892     * The channel_ready message which should be sent.
3893     */
3894    struct LDKChannelReady msg;
3895 } LDKMessageSendEvent_LDKSendChannelReady_Body;
3896
3897 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3898    /**
3899     * The node_id of the node which should receive these message(s)
3900     */
3901    struct LDKPublicKey node_id;
3902    /**
3903     * The announcement_signatures message which should be sent.
3904     */
3905    struct LDKAnnouncementSignatures msg;
3906 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3907
3908 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3909    /**
3910     * The node_id of the node which should receive these message(s)
3911     */
3912    struct LDKPublicKey node_id;
3913    /**
3914     * The update messages which should be sent. ALL messages in the struct should be sent!
3915     */
3916    struct LDKCommitmentUpdate updates;
3917 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3918
3919 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3920    /**
3921     * The node_id of the node which should receive this message
3922     */
3923    struct LDKPublicKey node_id;
3924    /**
3925     * The message which should be sent.
3926     */
3927    struct LDKRevokeAndACK msg;
3928 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3929
3930 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3931    /**
3932     * The node_id of the node which should receive this message
3933     */
3934    struct LDKPublicKey node_id;
3935    /**
3936     * The message which should be sent.
3937     */
3938    struct LDKClosingSigned msg;
3939 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3940
3941 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3942    /**
3943     * The node_id of the node which should receive this message
3944     */
3945    struct LDKPublicKey node_id;
3946    /**
3947     * The message which should be sent.
3948     */
3949    struct LDKShutdown msg;
3950 } LDKMessageSendEvent_LDKSendShutdown_Body;
3951
3952 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
3953    /**
3954     * The node_id of the node which should receive this message
3955     */
3956    struct LDKPublicKey node_id;
3957    /**
3958     * The message which should be sent.
3959     */
3960    struct LDKChannelReestablish msg;
3961 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
3962
3963 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
3964    /**
3965     * The channel_announcement which should be sent.
3966     */
3967    struct LDKChannelAnnouncement msg;
3968    /**
3969     * The followup channel_update which should be sent.
3970     */
3971    struct LDKChannelUpdate update_msg;
3972 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
3973
3974 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
3975    /**
3976     * The node_announcement which should be sent.
3977     */
3978    struct LDKNodeAnnouncement msg;
3979 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
3980
3981 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
3982    /**
3983     * The channel_update which should be sent.
3984     */
3985    struct LDKChannelUpdate msg;
3986 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
3987
3988 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
3989    /**
3990     * The node_id of the node which should receive this message
3991     */
3992    struct LDKPublicKey node_id;
3993    /**
3994     * The channel_update which should be sent.
3995     */
3996    struct LDKChannelUpdate msg;
3997 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
3998
3999 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4000    /**
4001     * The node_id of the node which should receive this message
4002     */
4003    struct LDKPublicKey node_id;
4004    /**
4005     * The action which should be taken.
4006     */
4007    struct LDKErrorAction action;
4008 } LDKMessageSendEvent_LDKHandleError_Body;
4009
4010 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4011    /**
4012     * The node_id of this message recipient
4013     */
4014    struct LDKPublicKey node_id;
4015    /**
4016     * The query_channel_range which should be sent.
4017     */
4018    struct LDKQueryChannelRange msg;
4019 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4020
4021 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4022    /**
4023     * The node_id of this message recipient
4024     */
4025    struct LDKPublicKey node_id;
4026    /**
4027     * The query_short_channel_ids which should be sent.
4028     */
4029    struct LDKQueryShortChannelIds msg;
4030 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4031
4032 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4033    /**
4034     * The node_id of this message recipient
4035     */
4036    struct LDKPublicKey node_id;
4037    /**
4038     * The reply_channel_range which should be sent.
4039     */
4040    struct LDKReplyChannelRange msg;
4041 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4042
4043 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
4044    /**
4045     * The node_id of this message recipient
4046     */
4047    struct LDKPublicKey node_id;
4048    /**
4049     * The gossip_timestamp_filter which should be sent.
4050     */
4051    struct LDKGossipTimestampFilter msg;
4052 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
4053
4054 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4055    LDKMessageSendEvent_Tag tag;
4056    union {
4057       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4058       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4059       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4060       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4061       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
4062       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4063       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4064       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4065       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4066       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4067       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4068       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4069       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4070       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4071       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4072       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4073       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4074       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4075       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4076       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
4077    };
4078 } LDKMessageSendEvent;
4079
4080 /**
4081  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4082  * This corresponds to std::vector in C++
4083  */
4084 typedef struct LDKCVec_MessageSendEventZ {
4085    /**
4086     * The elements in the array.
4087     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4088     */
4089    struct LDKMessageSendEvent *data;
4090    /**
4091     * The number of elements pointed to by `data`.
4092     */
4093    uintptr_t datalen;
4094 } LDKCVec_MessageSendEventZ;
4095
4096 /**
4097  * The contents of CResult_TxOutAccessErrorZ
4098  */
4099 typedef union LDKCResult_TxOutAccessErrorZPtr {
4100    /**
4101     * A pointer to the contents in the success state.
4102     * Reading from this pointer when `result_ok` is not set is undefined.
4103     */
4104    struct LDKTxOut *result;
4105    /**
4106     * A pointer to the contents in the error state.
4107     * Reading from this pointer when `result_ok` is set is undefined.
4108     */
4109    enum LDKAccessError *err;
4110 } LDKCResult_TxOutAccessErrorZPtr;
4111
4112 /**
4113  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4114  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4115  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4116  */
4117 typedef struct LDKCResult_TxOutAccessErrorZ {
4118    /**
4119     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4120     * `err` or `result` depending on the state of `result_ok`.
4121     */
4122    union LDKCResult_TxOutAccessErrorZPtr contents;
4123    /**
4124     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4125     */
4126    bool result_ok;
4127 } LDKCResult_TxOutAccessErrorZ;
4128
4129 /**
4130  * A tuple of 2 elements. See the individual fields for the types contained.
4131  */
4132 typedef struct LDKC2Tuple_usizeTransactionZ {
4133    /**
4134     * The element at position 0
4135     */
4136    uintptr_t a;
4137    /**
4138     * The element at position 1
4139     */
4140    struct LDKTransaction b;
4141 } LDKC2Tuple_usizeTransactionZ;
4142
4143 /**
4144  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4145  * This corresponds to std::vector in C++
4146  */
4147 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
4148    /**
4149     * The elements in the array.
4150     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4151     */
4152    struct LDKC2Tuple_usizeTransactionZ *data;
4153    /**
4154     * The number of elements pointed to by `data`.
4155     */
4156    uintptr_t datalen;
4157 } LDKCVec_C2Tuple_usizeTransactionZZ;
4158
4159 /**
4160  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4161  * This corresponds to std::vector in C++
4162  */
4163 typedef struct LDKCVec_TxidZ {
4164    /**
4165     * The elements in the array.
4166     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4167     */
4168    struct LDKThirtyTwoBytes *data;
4169    /**
4170     * The number of elements pointed to by `data`.
4171     */
4172    uintptr_t datalen;
4173 } LDKCVec_TxidZ;
4174
4175 /**
4176  * The contents of CResult_NoneChannelMonitorUpdateErrZ
4177  */
4178 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
4179    /**
4180     * Note that this value is always NULL, as there are no contents in the OK variant
4181     */
4182    void *result;
4183    /**
4184     * A pointer to the contents in the error state.
4185     * Reading from this pointer when `result_ok` is set is undefined.
4186     */
4187    enum LDKChannelMonitorUpdateErr *err;
4188 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
4189
4190 /**
4191  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
4192  * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
4193  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4194  */
4195 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
4196    /**
4197     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
4198     * `err` or `result` depending on the state of `result_ok`.
4199     */
4200    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
4201    /**
4202     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
4203     */
4204    bool result_ok;
4205 } LDKCResult_NoneChannelMonitorUpdateErrZ;
4206
4207
4208
4209 /**
4210  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
4211  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
4212  * preimage claim backward will lead to loss of funds.
4213  */
4214 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
4215    /**
4216     * A pointer to the opaque Rust object.
4217     * Nearly everywhere, inner must be non-null, however in places where
4218     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4219     */
4220    LDKnativeHTLCUpdate *inner;
4221    /**
4222     * Indicates that this is the only struct which contains the same pointer.
4223     * Rust functions which take ownership of an object provided via an argument require
4224     * this to be true and invalidate the object pointed to by inner.
4225     */
4226    bool is_owned;
4227 } LDKHTLCUpdate;
4228
4229 /**
4230  * An event to be processed by the ChannelManager.
4231  */
4232 typedef enum LDKMonitorEvent_Tag {
4233    /**
4234     * A monitor event containing an HTLCUpdate.
4235     */
4236    LDKMonitorEvent_HTLCEvent,
4237    /**
4238     * A monitor event that the Channel's commitment transaction was confirmed.
4239     */
4240    LDKMonitorEvent_CommitmentTxConfirmed,
4241    /**
4242     * Indicates a [`ChannelMonitor`] update has completed. See
4243     * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
4244     *
4245     * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
4246     */
4247    LDKMonitorEvent_UpdateCompleted,
4248    /**
4249     * Indicates a [`ChannelMonitor`] update has failed. See
4250     * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
4251     *
4252     * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
4253     */
4254    LDKMonitorEvent_UpdateFailed,
4255    /**
4256     * Must be last for serialization purposes
4257     */
4258    LDKMonitorEvent_Sentinel,
4259 } LDKMonitorEvent_Tag;
4260
4261 typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
4262    /**
4263     * The funding outpoint of the [`ChannelMonitor`] that was updated
4264     */
4265    struct LDKOutPoint funding_txo;
4266    /**
4267     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
4268     * [`ChannelMonitor::get_latest_update_id`].
4269     *
4270     * Note that this should only be set to a given update's ID if all previous updates for the
4271     * same [`ChannelMonitor`] have been applied and persisted.
4272     */
4273    uint64_t monitor_update_id;
4274 } LDKMonitorEvent_LDKUpdateCompleted_Body;
4275
4276 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
4277    LDKMonitorEvent_Tag tag;
4278    union {
4279       struct {
4280          struct LDKHTLCUpdate htlc_event;
4281       };
4282       struct {
4283          struct LDKOutPoint commitment_tx_confirmed;
4284       };
4285       LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
4286       struct {
4287          struct LDKOutPoint update_failed;
4288       };
4289    };
4290 } LDKMonitorEvent;
4291
4292 /**
4293  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4294  * This corresponds to std::vector in C++
4295  */
4296 typedef struct LDKCVec_MonitorEventZ {
4297    /**
4298     * The elements in the array.
4299     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4300     */
4301    struct LDKMonitorEvent *data;
4302    /**
4303     * The number of elements pointed to by `data`.
4304     */
4305    uintptr_t datalen;
4306 } LDKCVec_MonitorEventZ;
4307
4308 /**
4309  * A tuple of 2 elements. See the individual fields for the types contained.
4310  */
4311 typedef struct LDKC2Tuple_OutPointCVec_MonitorEventZZ {
4312    /**
4313     * The element at position 0
4314     */
4315    struct LDKOutPoint a;
4316    /**
4317     * The element at position 1
4318     */
4319    struct LDKCVec_MonitorEventZ b;
4320 } LDKC2Tuple_OutPointCVec_MonitorEventZZ;
4321
4322 /**
4323  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
4324  * This corresponds to std::vector in C++
4325  */
4326 typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
4327    /**
4328     * The elements in the array.
4329     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4330     */
4331    struct LDKC2Tuple_OutPointCVec_MonitorEventZZ *data;
4332    /**
4333     * The number of elements pointed to by `data`.
4334     */
4335    uintptr_t datalen;
4336 } LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ;
4337
4338 /**
4339  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4340  */
4341 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
4342    /**
4343     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4344     */
4345    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
4346    /**
4347     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4348     */
4349    LDKCOption_C2Tuple_usizeTransactionZZ_None,
4350    /**
4351     * Must be last for serialization purposes
4352     */
4353    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
4354 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
4355
4356 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
4357    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
4358    union {
4359       struct {
4360          struct LDKC2Tuple_usizeTransactionZ some;
4361       };
4362    };
4363 } LDKCOption_C2Tuple_usizeTransactionZZ;
4364
4365
4366
4367 /**
4368  * [`Score`] implementation that uses a fixed penalty.
4369  */
4370 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
4371    /**
4372     * A pointer to the opaque Rust object.
4373     * Nearly everywhere, inner must be non-null, however in places where
4374     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4375     */
4376    LDKnativeFixedPenaltyScorer *inner;
4377    /**
4378     * Indicates that this is the only struct which contains the same pointer.
4379     * Rust functions which take ownership of an object provided via an argument require
4380     * this to be true and invalidate the object pointed to by inner.
4381     */
4382    bool is_owned;
4383 } LDKFixedPenaltyScorer;
4384
4385 /**
4386  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4387  */
4388 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
4389    /**
4390     * A pointer to the contents in the success state.
4391     * Reading from this pointer when `result_ok` is not set is undefined.
4392     */
4393    struct LDKFixedPenaltyScorer *result;
4394    /**
4395     * A pointer to the contents in the error state.
4396     * Reading from this pointer when `result_ok` is set is undefined.
4397     */
4398    struct LDKDecodeError *err;
4399 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
4400
4401 /**
4402  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4403  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4404  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4405  */
4406 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
4407    /**
4408     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4409     * `err` or `result` depending on the state of `result_ok`.
4410     */
4411    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
4412    /**
4413     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4414     */
4415    bool result_ok;
4416 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
4417
4418 /**
4419  * A tuple of 2 elements. See the individual fields for the types contained.
4420  */
4421 typedef struct LDKC2Tuple_u64u64Z {
4422    /**
4423     * The element at position 0
4424     */
4425    uint64_t a;
4426    /**
4427     * The element at position 1
4428     */
4429    uint64_t b;
4430 } LDKC2Tuple_u64u64Z;
4431
4432 /**
4433  * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4434  */
4435 typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
4436    /**
4437     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4438     */
4439    LDKCOption_C2Tuple_u64u64ZZ_Some,
4440    /**
4441     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4442     */
4443    LDKCOption_C2Tuple_u64u64ZZ_None,
4444    /**
4445     * Must be last for serialization purposes
4446     */
4447    LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
4448 } LDKCOption_C2Tuple_u64u64ZZ_Tag;
4449
4450 typedef struct LDKCOption_C2Tuple_u64u64ZZ {
4451    LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
4452    union {
4453       struct {
4454          struct LDKC2Tuple_u64u64Z some;
4455       };
4456    };
4457 } LDKCOption_C2Tuple_u64u64ZZ;
4458
4459
4460
4461 /**
4462  * Represents the compressed public key of a node
4463  */
4464 typedef struct MUST_USE_STRUCT LDKNodeId {
4465    /**
4466     * A pointer to the opaque Rust object.
4467     * Nearly everywhere, inner must be non-null, however in places where
4468     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4469     */
4470    LDKnativeNodeId *inner;
4471    /**
4472     * Indicates that this is the only struct which contains the same pointer.
4473     * Rust functions which take ownership of an object provided via an argument require
4474     * this to be true and invalidate the object pointed to by inner.
4475     */
4476    bool is_owned;
4477 } LDKNodeId;
4478
4479 /**
4480  * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4481  * This corresponds to std::vector in C++
4482  */
4483 typedef struct LDKCVec_NodeIdZ {
4484    /**
4485     * The elements in the array.
4486     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4487     */
4488    struct LDKNodeId *data;
4489    /**
4490     * The number of elements pointed to by `data`.
4491     */
4492    uintptr_t datalen;
4493 } LDKCVec_NodeIdZ;
4494
4495
4496
4497 /**
4498  * A Record, unit of logging output with Metadata to enable filtering
4499  * Module_path, file, line to inform on log's source
4500  */
4501 typedef struct MUST_USE_STRUCT LDKRecord {
4502    /**
4503     * A pointer to the opaque Rust object.
4504     * Nearly everywhere, inner must be non-null, however in places where
4505     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4506     */
4507    LDKnativeRecord *inner;
4508    /**
4509     * Indicates that this is the only struct which contains the same pointer.
4510     * Rust functions which take ownership of an object provided via an argument require
4511     * this to be true and invalidate the object pointed to by inner.
4512     */
4513    bool is_owned;
4514 } LDKRecord;
4515
4516 /**
4517  * A trait encapsulating the operations required of a logger
4518  */
4519 typedef struct LDKLogger {
4520    /**
4521     * An opaque pointer which is passed to your function implementations as an argument.
4522     * This has no meaning in the LDK, and can be NULL or any other value.
4523     */
4524    void *this_arg;
4525    /**
4526     * Logs the `Record`
4527     */
4528    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
4529    /**
4530     * Frees any resources associated with this object given its this_arg pointer.
4531     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4532     */
4533    void (*free)(void *this_arg);
4534 } LDKLogger;
4535
4536
4537
4538 /**
4539  * Represents the network as nodes and channels between them
4540  */
4541 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4542    /**
4543     * A pointer to the opaque Rust object.
4544     * Nearly everywhere, inner must be non-null, however in places where
4545     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4546     */
4547    LDKnativeNetworkGraph *inner;
4548    /**
4549     * Indicates that this is the only struct which contains the same pointer.
4550     * Rust functions which take ownership of an object provided via an argument require
4551     * this to be true and invalidate the object pointed to by inner.
4552     */
4553    bool is_owned;
4554 } LDKNetworkGraph;
4555
4556
4557
4558 /**
4559  * [`Score`] implementation using channel success probability distributions.
4560  *
4561  * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
4562  * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
4563  * distributions are defined based on knowledge learned from successful and unsuccessful attempts.
4564  * Then the negative `log10` of the success probability is used to determine the cost of routing a
4565  * specific HTLC amount through a channel.
4566  *
4567  * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
4568  * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
4569  * [`ProbabilisticScoringParameters`] for details.
4570  *
4571  * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
4572  * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
4573  * volume are more likely to experience failed payment paths, which would need to be retried.
4574  *
4575  * # Note
4576  *
4577  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4578  * behavior.
4579  *
4580  * [1]: https://arxiv.org/abs/2107.05322
4581  */
4582 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
4583    /**
4584     * A pointer to the opaque Rust object.
4585     * Nearly everywhere, inner must be non-null, however in places where
4586     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4587     */
4588    LDKnativeProbabilisticScorer *inner;
4589    /**
4590     * Indicates that this is the only struct which contains the same pointer.
4591     * Rust functions which take ownership of an object provided via an argument require
4592     * this to be true and invalidate the object pointed to by inner.
4593     */
4594    bool is_owned;
4595 } LDKProbabilisticScorer;
4596
4597 /**
4598  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
4599  */
4600 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
4601    /**
4602     * A pointer to the contents in the success state.
4603     * Reading from this pointer when `result_ok` is not set is undefined.
4604     */
4605    struct LDKProbabilisticScorer *result;
4606    /**
4607     * A pointer to the contents in the error state.
4608     * Reading from this pointer when `result_ok` is set is undefined.
4609     */
4610    struct LDKDecodeError *err;
4611 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
4612
4613 /**
4614  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4615  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4616  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4617  */
4618 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
4619    /**
4620     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4621     * `err` or `result` depending on the state of `result_ok`.
4622     */
4623    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
4624    /**
4625     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4626     */
4627    bool result_ok;
4628 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
4629
4630
4631
4632 /**
4633  * Features used within an `init` message.
4634  */
4635 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4636    /**
4637     * A pointer to the opaque Rust object.
4638     * Nearly everywhere, inner must be non-null, however in places where
4639     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4640     */
4641    LDKnativeInitFeatures *inner;
4642    /**
4643     * Indicates that this is the only struct which contains the same pointer.
4644     * Rust functions which take ownership of an object provided via an argument require
4645     * this to be true and invalidate the object pointed to by inner.
4646     */
4647    bool is_owned;
4648 } LDKInitFeatures;
4649
4650 /**
4651  * The contents of CResult_InitFeaturesDecodeErrorZ
4652  */
4653 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4654    /**
4655     * A pointer to the contents in the success state.
4656     * Reading from this pointer when `result_ok` is not set is undefined.
4657     */
4658    struct LDKInitFeatures *result;
4659    /**
4660     * A pointer to the contents in the error state.
4661     * Reading from this pointer when `result_ok` is set is undefined.
4662     */
4663    struct LDKDecodeError *err;
4664 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4665
4666 /**
4667  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4668  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4669  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4670  */
4671 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4672    /**
4673     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4674     * `err` or `result` depending on the state of `result_ok`.
4675     */
4676    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4677    /**
4678     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4679     */
4680    bool result_ok;
4681 } LDKCResult_InitFeaturesDecodeErrorZ;
4682
4683
4684
4685 /**
4686  * Features used within a `channel_announcement` message.
4687  */
4688 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4689    /**
4690     * A pointer to the opaque Rust object.
4691     * Nearly everywhere, inner must be non-null, however in places where
4692     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4693     */
4694    LDKnativeChannelFeatures *inner;
4695    /**
4696     * Indicates that this is the only struct which contains the same pointer.
4697     * Rust functions which take ownership of an object provided via an argument require
4698     * this to be true and invalidate the object pointed to by inner.
4699     */
4700    bool is_owned;
4701 } LDKChannelFeatures;
4702
4703 /**
4704  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4705  */
4706 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4707    /**
4708     * A pointer to the contents in the success state.
4709     * Reading from this pointer when `result_ok` is not set is undefined.
4710     */
4711    struct LDKChannelFeatures *result;
4712    /**
4713     * A pointer to the contents in the error state.
4714     * Reading from this pointer when `result_ok` is set is undefined.
4715     */
4716    struct LDKDecodeError *err;
4717 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4718
4719 /**
4720  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4721  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4722  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4723  */
4724 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4725    /**
4726     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4727     * `err` or `result` depending on the state of `result_ok`.
4728     */
4729    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4730    /**
4731     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4732     */
4733    bool result_ok;
4734 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4735
4736
4737
4738 /**
4739  * Features used within a `node_announcement` message.
4740  */
4741 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4742    /**
4743     * A pointer to the opaque Rust object.
4744     * Nearly everywhere, inner must be non-null, however in places where
4745     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4746     */
4747    LDKnativeNodeFeatures *inner;
4748    /**
4749     * Indicates that this is the only struct which contains the same pointer.
4750     * Rust functions which take ownership of an object provided via an argument require
4751     * this to be true and invalidate the object pointed to by inner.
4752     */
4753    bool is_owned;
4754 } LDKNodeFeatures;
4755
4756 /**
4757  * The contents of CResult_NodeFeaturesDecodeErrorZ
4758  */
4759 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4760    /**
4761     * A pointer to the contents in the success state.
4762     * Reading from this pointer when `result_ok` is not set is undefined.
4763     */
4764    struct LDKNodeFeatures *result;
4765    /**
4766     * A pointer to the contents in the error state.
4767     * Reading from this pointer when `result_ok` is set is undefined.
4768     */
4769    struct LDKDecodeError *err;
4770 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4771
4772 /**
4773  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4774  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4775  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4776  */
4777 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4778    /**
4779     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4780     * `err` or `result` depending on the state of `result_ok`.
4781     */
4782    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4783    /**
4784     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4785     */
4786    bool result_ok;
4787 } LDKCResult_NodeFeaturesDecodeErrorZ;
4788
4789
4790
4791 /**
4792  * Features used within an invoice.
4793  */
4794 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4795    /**
4796     * A pointer to the opaque Rust object.
4797     * Nearly everywhere, inner must be non-null, however in places where
4798     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4799     */
4800    LDKnativeInvoiceFeatures *inner;
4801    /**
4802     * Indicates that this is the only struct which contains the same pointer.
4803     * Rust functions which take ownership of an object provided via an argument require
4804     * this to be true and invalidate the object pointed to by inner.
4805     */
4806    bool is_owned;
4807 } LDKInvoiceFeatures;
4808
4809 /**
4810  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4811  */
4812 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4813    /**
4814     * A pointer to the contents in the success state.
4815     * Reading from this pointer when `result_ok` is not set is undefined.
4816     */
4817    struct LDKInvoiceFeatures *result;
4818    /**
4819     * A pointer to the contents in the error state.
4820     * Reading from this pointer when `result_ok` is set is undefined.
4821     */
4822    struct LDKDecodeError *err;
4823 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4824
4825 /**
4826  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4827  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4828  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4829  */
4830 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4831    /**
4832     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4833     * `err` or `result` depending on the state of `result_ok`.
4834     */
4835    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4836    /**
4837     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4838     */
4839    bool result_ok;
4840 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4841
4842 /**
4843  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4844  */
4845 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
4846    /**
4847     * A pointer to the contents in the success state.
4848     * Reading from this pointer when `result_ok` is not set is undefined.
4849     */
4850    struct LDKChannelTypeFeatures *result;
4851    /**
4852     * A pointer to the contents in the error state.
4853     * Reading from this pointer when `result_ok` is set is undefined.
4854     */
4855    struct LDKDecodeError *err;
4856 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
4857
4858 /**
4859  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4860  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4861  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4862  */
4863 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
4864    /**
4865     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4866     * `err` or `result` depending on the state of `result_ok`.
4867     */
4868    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
4869    /**
4870     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4871     */
4872    bool result_ok;
4873 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
4874
4875 /**
4876  * The contents of CResult_NodeIdDecodeErrorZ
4877  */
4878 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
4879    /**
4880     * A pointer to the contents in the success state.
4881     * Reading from this pointer when `result_ok` is not set is undefined.
4882     */
4883    struct LDKNodeId *result;
4884    /**
4885     * A pointer to the contents in the error state.
4886     * Reading from this pointer when `result_ok` is set is undefined.
4887     */
4888    struct LDKDecodeError *err;
4889 } LDKCResult_NodeIdDecodeErrorZPtr;
4890
4891 /**
4892  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4893  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4894  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4895  */
4896 typedef struct LDKCResult_NodeIdDecodeErrorZ {
4897    /**
4898     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4899     * `err` or `result` depending on the state of `result_ok`.
4900     */
4901    union LDKCResult_NodeIdDecodeErrorZPtr contents;
4902    /**
4903     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4904     */
4905    bool result_ok;
4906 } LDKCResult_NodeIdDecodeErrorZ;
4907
4908 /**
4909  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4910  */
4911 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
4912    /**
4913     * A pointer to the contents in the success state.
4914     * Reading from this pointer when `result_ok` is not set is undefined.
4915     */
4916    struct LDKCOption_NetworkUpdateZ *result;
4917    /**
4918     * A pointer to the contents in the error state.
4919     * Reading from this pointer when `result_ok` is set is undefined.
4920     */
4921    struct LDKDecodeError *err;
4922 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
4923
4924 /**
4925  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
4926  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4927  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4928  */
4929 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
4930    /**
4931     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
4932     * `err` or `result` depending on the state of `result_ok`.
4933     */
4934    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
4935    /**
4936     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
4937     */
4938    bool result_ok;
4939 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
4940
4941 /**
4942  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
4943  * UTXOs.
4944  */
4945 typedef struct LDKAccess {
4946    /**
4947     * An opaque pointer which is passed to your function implementations as an argument.
4948     * This has no meaning in the LDK, and can be NULL or any other value.
4949     */
4950    void *this_arg;
4951    /**
4952     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
4953     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
4954     * is unknown.
4955     *
4956     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
4957     */
4958    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
4959    /**
4960     * Frees any resources associated with this object given its this_arg pointer.
4961     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4962     */
4963    void (*free)(void *this_arg);
4964 } LDKAccess;
4965
4966 /**
4967  * An enum which can either contain a crate::lightning::chain::Access or not
4968  */
4969 typedef enum LDKCOption_AccessZ_Tag {
4970    /**
4971     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
4972     */
4973    LDKCOption_AccessZ_Some,
4974    /**
4975     * When we're in this state, this COption_AccessZ contains nothing
4976     */
4977    LDKCOption_AccessZ_None,
4978    /**
4979     * Must be last for serialization purposes
4980     */
4981    LDKCOption_AccessZ_Sentinel,
4982 } LDKCOption_AccessZ_Tag;
4983
4984 typedef struct LDKCOption_AccessZ {
4985    LDKCOption_AccessZ_Tag tag;
4986    union {
4987       struct {
4988          struct LDKAccess some;
4989       };
4990    };
4991 } LDKCOption_AccessZ;
4992
4993 /**
4994  * The contents of CResult_boolLightningErrorZ
4995  */
4996 typedef union LDKCResult_boolLightningErrorZPtr {
4997    /**
4998     * A pointer to the contents in the success state.
4999     * Reading from this pointer when `result_ok` is not set is undefined.
5000     */
5001    bool *result;
5002    /**
5003     * A pointer to the contents in the error state.
5004     * Reading from this pointer when `result_ok` is set is undefined.
5005     */
5006    struct LDKLightningError *err;
5007 } LDKCResult_boolLightningErrorZPtr;
5008
5009 /**
5010  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5011  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5012  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5013  */
5014 typedef struct LDKCResult_boolLightningErrorZ {
5015    /**
5016     * The contents of this CResult_boolLightningErrorZ, accessible via either
5017     * `err` or `result` depending on the state of `result_ok`.
5018     */
5019    union LDKCResult_boolLightningErrorZPtr contents;
5020    /**
5021     * Whether this CResult_boolLightningErrorZ represents a success state.
5022     */
5023    bool result_ok;
5024 } LDKCResult_boolLightningErrorZ;
5025
5026 /**
5027  * A tuple of 3 elements. See the individual fields for the types contained.
5028  */
5029 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5030    /**
5031     * The element at position 0
5032     */
5033    struct LDKChannelAnnouncement a;
5034    /**
5035     * The element at position 1
5036     */
5037    struct LDKChannelUpdate b;
5038    /**
5039     * The element at position 2
5040     */
5041    struct LDKChannelUpdate c;
5042 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5043
5044 /**
5045  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5046  * This corresponds to std::vector in C++
5047  */
5048 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5049    /**
5050     * The elements in the array.
5051     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5052     */
5053    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
5054    /**
5055     * The number of elements pointed to by `data`.
5056     */
5057    uintptr_t datalen;
5058 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5059
5060 /**
5061  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5062  * This corresponds to std::vector in C++
5063  */
5064 typedef struct LDKCVec_NodeAnnouncementZ {
5065    /**
5066     * The elements in the array.
5067     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5068     */
5069    struct LDKNodeAnnouncement *data;
5070    /**
5071     * The number of elements pointed to by `data`.
5072     */
5073    uintptr_t datalen;
5074 } LDKCVec_NodeAnnouncementZ;
5075
5076 /**
5077  * The contents of CResult_NoneLightningErrorZ
5078  */
5079 typedef union LDKCResult_NoneLightningErrorZPtr {
5080    /**
5081     * Note that this value is always NULL, as there are no contents in the OK variant
5082     */
5083    void *result;
5084    /**
5085     * A pointer to the contents in the error state.
5086     * Reading from this pointer when `result_ok` is set is undefined.
5087     */
5088    struct LDKLightningError *err;
5089 } LDKCResult_NoneLightningErrorZPtr;
5090
5091 /**
5092  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5093  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5094  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5095  */
5096 typedef struct LDKCResult_NoneLightningErrorZ {
5097    /**
5098     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5099     * `err` or `result` depending on the state of `result_ok`.
5100     */
5101    union LDKCResult_NoneLightningErrorZPtr contents;
5102    /**
5103     * Whether this CResult_NoneLightningErrorZ represents a success state.
5104     */
5105    bool result_ok;
5106 } LDKCResult_NoneLightningErrorZ;
5107
5108
5109
5110 /**
5111  * Details about one direction of a channel as received within a [`ChannelUpdate`].
5112  */
5113 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
5114    /**
5115     * A pointer to the opaque Rust object.
5116     * Nearly everywhere, inner must be non-null, however in places where
5117     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5118     */
5119    LDKnativeChannelUpdateInfo *inner;
5120    /**
5121     * Indicates that this is the only struct which contains the same pointer.
5122     * Rust functions which take ownership of an object provided via an argument require
5123     * this to be true and invalidate the object pointed to by inner.
5124     */
5125    bool is_owned;
5126 } LDKChannelUpdateInfo;
5127
5128 /**
5129  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5130  */
5131 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
5132    /**
5133     * A pointer to the contents in the success state.
5134     * Reading from this pointer when `result_ok` is not set is undefined.
5135     */
5136    struct LDKChannelUpdateInfo *result;
5137    /**
5138     * A pointer to the contents in the error state.
5139     * Reading from this pointer when `result_ok` is set is undefined.
5140     */
5141    struct LDKDecodeError *err;
5142 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
5143
5144 /**
5145  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5146  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5147  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5148  */
5149 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
5150    /**
5151     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5152     * `err` or `result` depending on the state of `result_ok`.
5153     */
5154    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
5155    /**
5156     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5157     */
5158    bool result_ok;
5159 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
5160
5161
5162
5163 /**
5164  * Details about a channel (both directions).
5165  * Received within a channel announcement.
5166  */
5167 typedef struct MUST_USE_STRUCT LDKChannelInfo {
5168    /**
5169     * A pointer to the opaque Rust object.
5170     * Nearly everywhere, inner must be non-null, however in places where
5171     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5172     */
5173    LDKnativeChannelInfo *inner;
5174    /**
5175     * Indicates that this is the only struct which contains the same pointer.
5176     * Rust functions which take ownership of an object provided via an argument require
5177     * this to be true and invalidate the object pointed to by inner.
5178     */
5179    bool is_owned;
5180 } LDKChannelInfo;
5181
5182 /**
5183  * The contents of CResult_ChannelInfoDecodeErrorZ
5184  */
5185 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
5186    /**
5187     * A pointer to the contents in the success state.
5188     * Reading from this pointer when `result_ok` is not set is undefined.
5189     */
5190    struct LDKChannelInfo *result;
5191    /**
5192     * A pointer to the contents in the error state.
5193     * Reading from this pointer when `result_ok` is set is undefined.
5194     */
5195    struct LDKDecodeError *err;
5196 } LDKCResult_ChannelInfoDecodeErrorZPtr;
5197
5198 /**
5199  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5200  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5201  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5202  */
5203 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
5204    /**
5205     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5206     * `err` or `result` depending on the state of `result_ok`.
5207     */
5208    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
5209    /**
5210     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5211     */
5212    bool result_ok;
5213 } LDKCResult_ChannelInfoDecodeErrorZ;
5214
5215
5216
5217 /**
5218  * Fees for routing via a given channel or a node
5219  */
5220 typedef struct MUST_USE_STRUCT LDKRoutingFees {
5221    /**
5222     * A pointer to the opaque Rust object.
5223     * Nearly everywhere, inner must be non-null, however in places where
5224     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5225     */
5226    LDKnativeRoutingFees *inner;
5227    /**
5228     * Indicates that this is the only struct which contains the same pointer.
5229     * Rust functions which take ownership of an object provided via an argument require
5230     * this to be true and invalidate the object pointed to by inner.
5231     */
5232    bool is_owned;
5233 } LDKRoutingFees;
5234
5235 /**
5236  * The contents of CResult_RoutingFeesDecodeErrorZ
5237  */
5238 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
5239    /**
5240     * A pointer to the contents in the success state.
5241     * Reading from this pointer when `result_ok` is not set is undefined.
5242     */
5243    struct LDKRoutingFees *result;
5244    /**
5245     * A pointer to the contents in the error state.
5246     * Reading from this pointer when `result_ok` is set is undefined.
5247     */
5248    struct LDKDecodeError *err;
5249 } LDKCResult_RoutingFeesDecodeErrorZPtr;
5250
5251 /**
5252  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5253  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5254  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5255  */
5256 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
5257    /**
5258     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5259     * `err` or `result` depending on the state of `result_ok`.
5260     */
5261    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
5262    /**
5263     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5264     */
5265    bool result_ok;
5266 } LDKCResult_RoutingFeesDecodeErrorZ;
5267
5268 /**
5269  * A 4-byte byte array.
5270  */
5271 typedef struct LDKFourBytes {
5272    /**
5273     * The four bytes
5274     */
5275    uint8_t data[4];
5276 } LDKFourBytes;
5277
5278 /**
5279  * A 16-byte byte array.
5280  */
5281 typedef struct LDKSixteenBytes {
5282    /**
5283     * The sixteen bytes
5284     */
5285    uint8_t data[16];
5286 } LDKSixteenBytes;
5287
5288 /**
5289  * A 12-byte byte array.
5290  */
5291 typedef struct LDKTwelveBytes {
5292    /**
5293     * The twelve bytes
5294     */
5295    uint8_t data[12];
5296 } LDKTwelveBytes;
5297
5298 /**
5299  * An address which can be used to connect to a remote peer
5300  */
5301 typedef enum LDKNetAddress_Tag {
5302    /**
5303     * An IPv4 address/port on which the peer is listening.
5304     */
5305    LDKNetAddress_IPv4,
5306    /**
5307     * An IPv6 address/port on which the peer is listening.
5308     */
5309    LDKNetAddress_IPv6,
5310    /**
5311     * An old-style Tor onion address/port on which the peer is listening.
5312     *
5313     * This field is deprecated and the Tor network generally no longer supports V2 Onion
5314     * addresses. Thus, the details are not parsed here.
5315     */
5316    LDKNetAddress_OnionV2,
5317    /**
5318     * A new-style Tor onion address/port on which the peer is listening.
5319     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
5320     * wrap as base32 and append \".onion\".
5321     */
5322    LDKNetAddress_OnionV3,
5323    /**
5324     * Must be last for serialization purposes
5325     */
5326    LDKNetAddress_Sentinel,
5327 } LDKNetAddress_Tag;
5328
5329 typedef struct LDKNetAddress_LDKIPv4_Body {
5330    /**
5331     * The 4-byte IPv4 address
5332     */
5333    struct LDKFourBytes addr;
5334    /**
5335     * The port on which the node is listening
5336     */
5337    uint16_t port;
5338 } LDKNetAddress_LDKIPv4_Body;
5339
5340 typedef struct LDKNetAddress_LDKIPv6_Body {
5341    /**
5342     * The 16-byte IPv6 address
5343     */
5344    struct LDKSixteenBytes addr;
5345    /**
5346     * The port on which the node is listening
5347     */
5348    uint16_t port;
5349 } LDKNetAddress_LDKIPv6_Body;
5350
5351 typedef struct LDKNetAddress_LDKOnionV3_Body {
5352    /**
5353     * The ed25519 long-term public key of the peer
5354     */
5355    struct LDKThirtyTwoBytes ed25519_pubkey;
5356    /**
5357     * The checksum of the pubkey and version, as included in the onion address
5358     */
5359    uint16_t checksum;
5360    /**
5361     * The version byte, as defined by the Tor Onion v3 spec.
5362     */
5363    uint8_t version;
5364    /**
5365     * The port on which the node is listening
5366     */
5367    uint16_t port;
5368 } LDKNetAddress_LDKOnionV3_Body;
5369
5370 typedef struct MUST_USE_STRUCT LDKNetAddress {
5371    LDKNetAddress_Tag tag;
5372    union {
5373       LDKNetAddress_LDKIPv4_Body i_pv4;
5374       LDKNetAddress_LDKIPv6_Body i_pv6;
5375       struct {
5376          struct LDKTwelveBytes onion_v2;
5377       };
5378       LDKNetAddress_LDKOnionV3_Body onion_v3;
5379    };
5380 } LDKNetAddress;
5381
5382 /**
5383  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5384  * This corresponds to std::vector in C++
5385  */
5386 typedef struct LDKCVec_NetAddressZ {
5387    /**
5388     * The elements in the array.
5389     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5390     */
5391    struct LDKNetAddress *data;
5392    /**
5393     * The number of elements pointed to by `data`.
5394     */
5395    uintptr_t datalen;
5396 } LDKCVec_NetAddressZ;
5397
5398
5399
5400 /**
5401  * Information received in the latest node_announcement from this node.
5402  */
5403 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
5404    /**
5405     * A pointer to the opaque Rust object.
5406     * Nearly everywhere, inner must be non-null, however in places where
5407     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5408     */
5409    LDKnativeNodeAnnouncementInfo *inner;
5410    /**
5411     * Indicates that this is the only struct which contains the same pointer.
5412     * Rust functions which take ownership of an object provided via an argument require
5413     * this to be true and invalidate the object pointed to by inner.
5414     */
5415    bool is_owned;
5416 } LDKNodeAnnouncementInfo;
5417
5418 /**
5419  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5420  */
5421 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
5422    /**
5423     * A pointer to the contents in the success state.
5424     * Reading from this pointer when `result_ok` is not set is undefined.
5425     */
5426    struct LDKNodeAnnouncementInfo *result;
5427    /**
5428     * A pointer to the contents in the error state.
5429     * Reading from this pointer when `result_ok` is set is undefined.
5430     */
5431    struct LDKDecodeError *err;
5432 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
5433
5434 /**
5435  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5436  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5437  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5438  */
5439 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
5440    /**
5441     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5442     * `err` or `result` depending on the state of `result_ok`.
5443     */
5444    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
5445    /**
5446     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5447     */
5448    bool result_ok;
5449 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
5450
5451
5452
5453 /**
5454  * A user-defined name for a node, which may be used when displaying the node in a graph.
5455  *
5456  * Since node aliases are provided by third parties, they are a potential avenue for injection
5457  * attacks. Care must be taken when processing.
5458  */
5459 typedef struct MUST_USE_STRUCT LDKNodeAlias {
5460    /**
5461     * A pointer to the opaque Rust object.
5462     * Nearly everywhere, inner must be non-null, however in places where
5463     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5464     */
5465    LDKnativeNodeAlias *inner;
5466    /**
5467     * Indicates that this is the only struct which contains the same pointer.
5468     * Rust functions which take ownership of an object provided via an argument require
5469     * this to be true and invalidate the object pointed to by inner.
5470     */
5471    bool is_owned;
5472 } LDKNodeAlias;
5473
5474 /**
5475  * The contents of CResult_NodeAliasDecodeErrorZ
5476  */
5477 typedef union LDKCResult_NodeAliasDecodeErrorZPtr {
5478    /**
5479     * A pointer to the contents in the success state.
5480     * Reading from this pointer when `result_ok` is not set is undefined.
5481     */
5482    struct LDKNodeAlias *result;
5483    /**
5484     * A pointer to the contents in the error state.
5485     * Reading from this pointer when `result_ok` is set is undefined.
5486     */
5487    struct LDKDecodeError *err;
5488 } LDKCResult_NodeAliasDecodeErrorZPtr;
5489
5490 /**
5491  * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
5492  * containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
5493  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5494  */
5495 typedef struct LDKCResult_NodeAliasDecodeErrorZ {
5496    /**
5497     * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
5498     * `err` or `result` depending on the state of `result_ok`.
5499     */
5500    union LDKCResult_NodeAliasDecodeErrorZPtr contents;
5501    /**
5502     * Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
5503     */
5504    bool result_ok;
5505 } LDKCResult_NodeAliasDecodeErrorZ;
5506
5507 /**
5508  * A dynamically-allocated array of u64s of arbitrary size.
5509  * This corresponds to std::vector in C++
5510  */
5511 typedef struct LDKCVec_u64Z {
5512    /**
5513     * The elements in the array.
5514     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5515     */
5516    uint64_t *data;
5517    /**
5518     * The number of elements pointed to by `data`.
5519     */
5520    uintptr_t datalen;
5521 } LDKCVec_u64Z;
5522
5523
5524
5525 /**
5526  * Details about a node in the network, known from the network announcement.
5527  */
5528 typedef struct MUST_USE_STRUCT LDKNodeInfo {
5529    /**
5530     * A pointer to the opaque Rust object.
5531     * Nearly everywhere, inner must be non-null, however in places where
5532     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5533     */
5534    LDKnativeNodeInfo *inner;
5535    /**
5536     * Indicates that this is the only struct which contains the same pointer.
5537     * Rust functions which take ownership of an object provided via an argument require
5538     * this to be true and invalidate the object pointed to by inner.
5539     */
5540    bool is_owned;
5541 } LDKNodeInfo;
5542
5543 /**
5544  * The contents of CResult_NodeInfoDecodeErrorZ
5545  */
5546 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
5547    /**
5548     * A pointer to the contents in the success state.
5549     * Reading from this pointer when `result_ok` is not set is undefined.
5550     */
5551    struct LDKNodeInfo *result;
5552    /**
5553     * A pointer to the contents in the error state.
5554     * Reading from this pointer when `result_ok` is set is undefined.
5555     */
5556    struct LDKDecodeError *err;
5557 } LDKCResult_NodeInfoDecodeErrorZPtr;
5558
5559 /**
5560  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5561  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5562  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5563  */
5564 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
5565    /**
5566     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5567     * `err` or `result` depending on the state of `result_ok`.
5568     */
5569    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
5570    /**
5571     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5572     */
5573    bool result_ok;
5574 } LDKCResult_NodeInfoDecodeErrorZ;
5575
5576 /**
5577  * The contents of CResult_NetworkGraphDecodeErrorZ
5578  */
5579 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
5580    /**
5581     * A pointer to the contents in the success state.
5582     * Reading from this pointer when `result_ok` is not set is undefined.
5583     */
5584    struct LDKNetworkGraph *result;
5585    /**
5586     * A pointer to the contents in the error state.
5587     * Reading from this pointer when `result_ok` is set is undefined.
5588     */
5589    struct LDKDecodeError *err;
5590 } LDKCResult_NetworkGraphDecodeErrorZPtr;
5591
5592 /**
5593  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5594  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5595  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5596  */
5597 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
5598    /**
5599     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5600     * `err` or `result` depending on the state of `result_ok`.
5601     */
5602    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
5603    /**
5604     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5605     */
5606    bool result_ok;
5607 } LDKCResult_NetworkGraphDecodeErrorZ;
5608
5609 /**
5610  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
5611  */
5612 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
5613    /**
5614     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
5615     */
5616    LDKCOption_CVec_NetAddressZZ_Some,
5617    /**
5618     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
5619     */
5620    LDKCOption_CVec_NetAddressZZ_None,
5621    /**
5622     * Must be last for serialization purposes
5623     */
5624    LDKCOption_CVec_NetAddressZZ_Sentinel,
5625 } LDKCOption_CVec_NetAddressZZ_Tag;
5626
5627 typedef struct LDKCOption_CVec_NetAddressZZ {
5628    LDKCOption_CVec_NetAddressZZ_Tag tag;
5629    union {
5630       struct {
5631          struct LDKCVec_NetAddressZ some;
5632       };
5633    };
5634 } LDKCOption_CVec_NetAddressZZ;
5635
5636 /**
5637  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
5638  */
5639 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5640    /**
5641     * A pointer to the contents in the success state.
5642     * Reading from this pointer when `result_ok` is not set is undefined.
5643     */
5644    struct LDKDelayedPaymentOutputDescriptor *result;
5645    /**
5646     * A pointer to the contents in the error state.
5647     * Reading from this pointer when `result_ok` is set is undefined.
5648     */
5649    struct LDKDecodeError *err;
5650 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
5651
5652 /**
5653  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5654  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5655  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5656  */
5657 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5658    /**
5659     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
5660     * `err` or `result` depending on the state of `result_ok`.
5661     */
5662    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
5663    /**
5664     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
5665     */
5666    bool result_ok;
5667 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
5668
5669 /**
5670  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
5671  */
5672 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5673    /**
5674     * A pointer to the contents in the success state.
5675     * Reading from this pointer when `result_ok` is not set is undefined.
5676     */
5677    struct LDKStaticPaymentOutputDescriptor *result;
5678    /**
5679     * A pointer to the contents in the error state.
5680     * Reading from this pointer when `result_ok` is set is undefined.
5681     */
5682    struct LDKDecodeError *err;
5683 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
5684
5685 /**
5686  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5687  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5688  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5689  */
5690 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5691    /**
5692     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
5693     * `err` or `result` depending on the state of `result_ok`.
5694     */
5695    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
5696    /**
5697     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
5698     */
5699    bool result_ok;
5700 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
5701
5702 /**
5703  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5704  */
5705 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
5706    /**
5707     * A pointer to the contents in the success state.
5708     * Reading from this pointer when `result_ok` is not set is undefined.
5709     */
5710    struct LDKSpendableOutputDescriptor *result;
5711    /**
5712     * A pointer to the contents in the error state.
5713     * Reading from this pointer when `result_ok` is set is undefined.
5714     */
5715    struct LDKDecodeError *err;
5716 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
5717
5718 /**
5719  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5720  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5721  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5722  */
5723 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
5724    /**
5725     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5726     * `err` or `result` depending on the state of `result_ok`.
5727     */
5728    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
5729    /**
5730     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5731     */
5732    bool result_ok;
5733 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
5734
5735 /**
5736  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
5737  * This corresponds to std::vector in C++
5738  */
5739 typedef struct LDKCVec_PaymentPreimageZ {
5740    /**
5741     * The elements in the array.
5742     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5743     */
5744    struct LDKThirtyTwoBytes *data;
5745    /**
5746     * The number of elements pointed to by `data`.
5747     */
5748    uintptr_t datalen;
5749 } LDKCVec_PaymentPreimageZ;
5750
5751 /**
5752  * A tuple of 2 elements. See the individual fields for the types contained.
5753  */
5754 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
5755    /**
5756     * The element at position 0
5757     */
5758    struct LDKSignature a;
5759    /**
5760     * The element at position 1
5761     */
5762    struct LDKCVec_SignatureZ b;
5763 } LDKC2Tuple_SignatureCVec_SignatureZZ;
5764
5765 /**
5766  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
5767  */
5768 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
5769    /**
5770     * A pointer to the contents in the success state.
5771     * Reading from this pointer when `result_ok` is not set is undefined.
5772     */
5773    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
5774    /**
5775     * Note that this value is always NULL, as there are no contents in the Err variant
5776     */
5777    void *err;
5778 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
5779
5780 /**
5781  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
5782  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
5783  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5784  */
5785 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
5786    /**
5787     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
5788     * `err` or `result` depending on the state of `result_ok`.
5789     */
5790    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
5791    /**
5792     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
5793     */
5794    bool result_ok;
5795 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
5796
5797 /**
5798  * The contents of CResult_SignatureNoneZ
5799  */
5800 typedef union LDKCResult_SignatureNoneZPtr {
5801    /**
5802     * A pointer to the contents in the success state.
5803     * Reading from this pointer when `result_ok` is not set is undefined.
5804     */
5805    struct LDKSignature *result;
5806    /**
5807     * Note that this value is always NULL, as there are no contents in the Err variant
5808     */
5809    void *err;
5810 } LDKCResult_SignatureNoneZPtr;
5811
5812 /**
5813  * A CResult_SignatureNoneZ represents the result of a fallible operation,
5814  * containing a crate::c_types::Signature on success and a () on failure.
5815  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5816  */
5817 typedef struct LDKCResult_SignatureNoneZ {
5818    /**
5819     * The contents of this CResult_SignatureNoneZ, accessible via either
5820     * `err` or `result` depending on the state of `result_ok`.
5821     */
5822    union LDKCResult_SignatureNoneZPtr contents;
5823    /**
5824     * Whether this CResult_SignatureNoneZ represents a success state.
5825     */
5826    bool result_ok;
5827 } LDKCResult_SignatureNoneZ;
5828
5829 /**
5830  * A tuple of 2 elements. See the individual fields for the types contained.
5831  */
5832 typedef struct LDKC2Tuple_SignatureSignatureZ {
5833    /**
5834     * The element at position 0
5835     */
5836    struct LDKSignature a;
5837    /**
5838     * The element at position 1
5839     */
5840    struct LDKSignature b;
5841 } LDKC2Tuple_SignatureSignatureZ;
5842
5843 /**
5844  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
5845  */
5846 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
5847    /**
5848     * A pointer to the contents in the success state.
5849     * Reading from this pointer when `result_ok` is not set is undefined.
5850     */
5851    struct LDKC2Tuple_SignatureSignatureZ *result;
5852    /**
5853     * Note that this value is always NULL, as there are no contents in the Err variant
5854     */
5855    void *err;
5856 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
5857
5858 /**
5859  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
5860  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
5861  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5862  */
5863 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
5864    /**
5865     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
5866     * `err` or `result` depending on the state of `result_ok`.
5867     */
5868    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
5869    /**
5870     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
5871     */
5872    bool result_ok;
5873 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
5874
5875 /**
5876  * The contents of CResult_SecretKeyNoneZ
5877  */
5878 typedef union LDKCResult_SecretKeyNoneZPtr {
5879    /**
5880     * A pointer to the contents in the success state.
5881     * Reading from this pointer when `result_ok` is not set is undefined.
5882     */
5883    struct LDKSecretKey *result;
5884    /**
5885     * Note that this value is always NULL, as there are no contents in the Err variant
5886     */
5887    void *err;
5888 } LDKCResult_SecretKeyNoneZPtr;
5889
5890 /**
5891  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5892  * containing a crate::c_types::SecretKey on success and a () on failure.
5893  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5894  */
5895 typedef struct LDKCResult_SecretKeyNoneZ {
5896    /**
5897     * The contents of this CResult_SecretKeyNoneZ, accessible via either
5898     * `err` or `result` depending on the state of `result_ok`.
5899     */
5900    union LDKCResult_SecretKeyNoneZPtr contents;
5901    /**
5902     * Whether this CResult_SecretKeyNoneZ represents a success state.
5903     */
5904    bool result_ok;
5905 } LDKCResult_SecretKeyNoneZ;
5906
5907
5908
5909 /**
5910  * This class tracks the per-transaction information needed to build a closing transaction and will
5911  * actually build it and sign.
5912  *
5913  * This class can be used inside a signer implementation to generate a signature given the relevant
5914  * secret key.
5915  */
5916 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
5917    /**
5918     * A pointer to the opaque Rust object.
5919     * Nearly everywhere, inner must be non-null, however in places where
5920     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5921     */
5922    LDKnativeClosingTransaction *inner;
5923    /**
5924     * Indicates that this is the only struct which contains the same pointer.
5925     * Rust functions which take ownership of an object provided via an argument require
5926     * this to be true and invalidate the object pointed to by inner.
5927     */
5928    bool is_owned;
5929 } LDKClosingTransaction;
5930
5931
5932
5933 /**
5934  * The unsigned part of a channel_announcement
5935  */
5936 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
5937    /**
5938     * A pointer to the opaque Rust object.
5939     * Nearly everywhere, inner must be non-null, however in places where
5940     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5941     */
5942    LDKnativeUnsignedChannelAnnouncement *inner;
5943    /**
5944     * Indicates that this is the only struct which contains the same pointer.
5945     * Rust functions which take ownership of an object provided via an argument require
5946     * this to be true and invalidate the object pointed to by inner.
5947     */
5948    bool is_owned;
5949 } LDKUnsignedChannelAnnouncement;
5950
5951 /**
5952  * A trait to sign lightning channel transactions as described in BOLT 3.
5953  *
5954  * Signing services could be implemented on a hardware wallet. In this case,
5955  * the current Sign would be a front-end on top of a communication
5956  * channel connected to your secure device and lightning key material wouldn't
5957  * reside on a hot server. Nevertheless, a this deployment would still need
5958  * to trust the ChannelManager to avoid loss of funds as this latest component
5959  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
5960  *
5961  * A more secure iteration would be to use hashlock (or payment points) to pair
5962  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
5963  * at the price of more state and computation on the hardware wallet side. In the future,
5964  * we are looking forward to design such interface.
5965  *
5966  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
5967  * to act, as liveness and breach reply correctness are always going to be hard requirements
5968  * of LN security model, orthogonal of key management issues.
5969  */
5970 typedef struct LDKBaseSign {
5971    /**
5972     * An opaque pointer which is passed to your function implementations as an argument.
5973     * This has no meaning in the LDK, and can be NULL or any other value.
5974     */
5975    void *this_arg;
5976    /**
5977     * Gets the per-commitment point for a specific commitment number
5978     *
5979     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
5980     */
5981    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
5982    /**
5983     * Gets the commitment secret for a specific commitment number as part of the revocation process
5984     *
5985     * An external signer implementation should error here if the commitment was already signed
5986     * and should refuse to sign it in the future.
5987     *
5988     * May be called more than once for the same index.
5989     *
5990     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
5991     */
5992    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
5993    /**
5994     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
5995     *
5996     * This is required in order for the signer to make sure that releasing a commitment
5997     * secret won't leave us without a broadcastable holder transaction.
5998     * Policy checks should be implemented in this function, including checking the amount
5999     * sent to us and checking the HTLCs.
6000     *
6001     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6002     * A validating signer should ensure that an HTLC output is removed only when the matching
6003     * preimage is provided, or when the value to holder is restored.
6004     *
6005     * NOTE: all the relevant preimages will be provided, but there may also be additional
6006     * irrelevant or duplicate preimages.
6007     */
6008    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
6009    /**
6010     * Gets the holder's channel public keys and basepoints
6011     */
6012    struct LDKChannelPublicKeys pubkeys;
6013    /**
6014     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
6015     * Note that this takes a pointer to this object, not the this_ptr like other methods do
6016     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
6017     */
6018    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
6019    /**
6020     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
6021     * some SpendableOutputDescriptor types. This should be sufficient to identify this
6022     * Sign object uniquely and lookup or re-derive its keys.
6023     */
6024    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
6025    /**
6026     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
6027     *
6028     * Note that if signing fails or is rejected, the channel will be force-closed.
6029     *
6030     * Policy checks should be implemented in this function, including checking the amount
6031     * sent to us and checking the HTLCs.
6032     *
6033     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6034     * A validating signer should ensure that an HTLC output is removed only when the matching
6035     * preimage is provided, or when the value to holder is restored.
6036     *
6037     * NOTE: all the relevant preimages will be provided, but there may also be additional
6038     * irrelevant or duplicate preimages.
6039     */
6040    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
6041    /**
6042     * Validate the counterparty's revocation.
6043     *
6044     * This is required in order for the signer to make sure that the state has moved
6045     * forward and it is safe to sign the next counterparty commitment.
6046     */
6047    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
6048    /**
6049     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
6050     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
6051     * latest commitment_tx when we initiate a force-close.
6052     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
6053     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
6054     * the latest.
6055     * This may be called multiple times for the same transaction.
6056     *
6057     * An external signer implementation should check that the commitment has not been revoked.
6058     *
6059     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
6060     */
6061    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
6062    /**
6063     * Create a signature for the given input in a transaction spending an HTLC transaction output
6064     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
6065     *
6066     * A justice transaction may claim multiple outputs at the same time if timelocks are
6067     * similar, but only a signature for the input at index `input` should be signed for here.
6068     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
6069     * to an upcoming timelock expiration.
6070     *
6071     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6072     *
6073     * per_commitment_key is revocation secret which was provided by our counterparty when they
6074     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
6075     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
6076     * so).
6077     */
6078    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]);
6079    /**
6080     * Create a signature for the given input in a transaction spending a commitment transaction
6081     * HTLC output when our counterparty broadcasts an old state.
6082     *
6083     * A justice transaction may claim multiple outputs at the same time if timelocks are
6084     * similar, but only a signature for the input at index `input` should be signed for here.
6085     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
6086     * to an upcoming timelock expiration.
6087     *
6088     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6089     *
6090     * per_commitment_key is revocation secret which was provided by our counterparty when they
6091     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
6092     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
6093     * so).
6094     *
6095     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
6096     * (which is committed to in the BIP 143 signatures).
6097     */
6098    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);
6099    /**
6100     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
6101     * transaction, either offered or received.
6102     *
6103     * Such a transaction may claim multiples offered outputs at same time if we know the
6104     * preimage for each when we create it, but only the input at index `input` should be
6105     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
6106     * needed with regards to an upcoming timelock expiration.
6107     *
6108     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
6109     * outputs.
6110     *
6111     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6112     *
6113     * Per_commitment_point is the dynamic point corresponding to the channel state
6114     * detected onchain. It has been generated by our counterparty and is used to derive
6115     * channel state keys, which are then included in the witness script and committed to in the
6116     * BIP 143 signature.
6117     */
6118    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);
6119    /**
6120     * Create a signature for a (proposed) closing transaction.
6121     *
6122     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
6123     * chosen to forgo their output as dust.
6124     */
6125    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
6126    /**
6127     * Signs a channel announcement message with our funding key and our node secret key (aka
6128     * node_id or network_key), proving it comes from one of the channel participants.
6129     *
6130     * The first returned signature should be from our node secret key, the second from our
6131     * funding key.
6132     *
6133     * Note that if this fails or is rejected, the channel will not be publicly announced and
6134     * our counterparty may (though likely will not) close the channel on us for violating the
6135     * protocol.
6136     */
6137    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
6138    /**
6139     * Set the counterparty static channel data, including basepoints,
6140     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
6141     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
6142     * they MUST NOT be allowed to change to different values once set.
6143     *
6144     * channel_parameters.is_populated() MUST be true.
6145     *
6146     * We bind holder_selected_contest_delay late here for API convenience.
6147     *
6148     * Will be called before any signatures are applied.
6149     */
6150    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
6151    /**
6152     * Frees any resources associated with this object given its this_arg pointer.
6153     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6154     */
6155    void (*free)(void *this_arg);
6156 } LDKBaseSign;
6157
6158 /**
6159  * A cloneable signer.
6160  *
6161  * Although we require signers to be cloneable, it may be useful for developers to be able to use
6162  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
6163  * which implies Sized, into this derived trait.
6164  */
6165 typedef struct LDKSign {
6166    /**
6167     * An opaque pointer which is passed to your function implementations as an argument.
6168     * This has no meaning in the LDK, and can be NULL or any other value.
6169     */
6170    void *this_arg;
6171    /**
6172     * Implementation of BaseSign for this object.
6173     */
6174    struct LDKBaseSign BaseSign;
6175    /**
6176     * Serialize the object into a byte array
6177     */
6178    struct LDKCVec_u8Z (*write)(const void *this_arg);
6179    /**
6180     * Called, if set, after this Sign has been cloned into a duplicate object.
6181     * The new Sign is provided, and should be mutated as needed to perform a
6182     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
6183     */
6184    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
6185    /**
6186     * Frees any resources associated with this object given its this_arg pointer.
6187     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6188     */
6189    void (*free)(void *this_arg);
6190 } LDKSign;
6191
6192 /**
6193  * The contents of CResult_SignDecodeErrorZ
6194  */
6195 typedef union LDKCResult_SignDecodeErrorZPtr {
6196    /**
6197     * A pointer to the contents in the success state.
6198     * Reading from this pointer when `result_ok` is not set is undefined.
6199     */
6200    struct LDKSign *result;
6201    /**
6202     * A pointer to the contents in the error state.
6203     * Reading from this pointer when `result_ok` is set is undefined.
6204     */
6205    struct LDKDecodeError *err;
6206 } LDKCResult_SignDecodeErrorZPtr;
6207
6208 /**
6209  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6210  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6211  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6212  */
6213 typedef struct LDKCResult_SignDecodeErrorZ {
6214    /**
6215     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6216     * `err` or `result` depending on the state of `result_ok`.
6217     */
6218    union LDKCResult_SignDecodeErrorZPtr contents;
6219    /**
6220     * Whether this CResult_SignDecodeErrorZ represents a success state.
6221     */
6222    bool result_ok;
6223 } LDKCResult_SignDecodeErrorZ;
6224
6225 /**
6226  * Integer in the range `0..32`
6227  */
6228 typedef struct LDKu5 {
6229    uint8_t _0;
6230 } LDKu5;
6231
6232 /**
6233  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6234  * This corresponds to std::vector in C++
6235  */
6236 typedef struct LDKCVec_u5Z {
6237    /**
6238     * The elements in the array.
6239     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6240     */
6241    struct LDKu5 *data;
6242    /**
6243     * The number of elements pointed to by `data`.
6244     */
6245    uintptr_t datalen;
6246 } LDKCVec_u5Z;
6247
6248 /**
6249  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
6250  * allows recovering the exact public key which created the signature given the message.
6251  */
6252 typedef struct LDKRecoverableSignature {
6253    /**
6254     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
6255     * recovery.
6256     */
6257    uint8_t serialized_form[68];
6258 } LDKRecoverableSignature;
6259
6260 /**
6261  * The contents of CResult_RecoverableSignatureNoneZ
6262  */
6263 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
6264    /**
6265     * A pointer to the contents in the success state.
6266     * Reading from this pointer when `result_ok` is not set is undefined.
6267     */
6268    struct LDKRecoverableSignature *result;
6269    /**
6270     * Note that this value is always NULL, as there are no contents in the Err variant
6271     */
6272    void *err;
6273 } LDKCResult_RecoverableSignatureNoneZPtr;
6274
6275 /**
6276  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6277  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
6278  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6279  */
6280 typedef struct LDKCResult_RecoverableSignatureNoneZ {
6281    /**
6282     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6283     * `err` or `result` depending on the state of `result_ok`.
6284     */
6285    union LDKCResult_RecoverableSignatureNoneZPtr contents;
6286    /**
6287     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6288     */
6289    bool result_ok;
6290 } LDKCResult_RecoverableSignatureNoneZ;
6291
6292 /**
6293  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6294  * This corresponds to std::vector in C++
6295  */
6296 typedef struct LDKCVec_CVec_u8ZZ {
6297    /**
6298     * The elements in the array.
6299     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6300     */
6301    struct LDKCVec_u8Z *data;
6302    /**
6303     * The number of elements pointed to by `data`.
6304     */
6305    uintptr_t datalen;
6306 } LDKCVec_CVec_u8ZZ;
6307
6308 /**
6309  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6310  */
6311 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6312    /**
6313     * A pointer to the contents in the success state.
6314     * Reading from this pointer when `result_ok` is not set is undefined.
6315     */
6316    struct LDKCVec_CVec_u8ZZ *result;
6317    /**
6318     * Note that this value is always NULL, as there are no contents in the Err variant
6319     */
6320    void *err;
6321 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6322
6323 /**
6324  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6325  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6326  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6327  */
6328 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6329    /**
6330     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6331     * `err` or `result` depending on the state of `result_ok`.
6332     */
6333    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6334    /**
6335     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6336     */
6337    bool result_ok;
6338 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6339
6340
6341
6342 /**
6343  * A simple implementation of Sign that just keeps the private keys in memory.
6344  *
6345  * This implementation performs no policy checks and is insufficient by itself as
6346  * a secure external signer.
6347  */
6348 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
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    LDKnativeInMemorySigner *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 } LDKInMemorySigner;
6362
6363 /**
6364  * The contents of CResult_InMemorySignerDecodeErrorZ
6365  */
6366 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
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 LDKInMemorySigner *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_InMemorySignerDecodeErrorZPtr;
6378
6379 /**
6380  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6381  * containing a crate::lightning::chain::keysinterface::InMemorySigner 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_InMemorySignerDecodeErrorZ {
6385    /**
6386     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6387     * `err` or `result` depending on the state of `result_ok`.
6388     */
6389    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
6390    /**
6391     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6392     */
6393    bool result_ok;
6394 } LDKCResult_InMemorySignerDecodeErrorZ;
6395
6396 /**
6397  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6398  * This corresponds to std::vector in C++
6399  */
6400 typedef struct LDKCVec_TxOutZ {
6401    /**
6402     * The elements in the array.
6403     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6404     */
6405    struct LDKTxOut *data;
6406    /**
6407     * The number of elements pointed to by `data`.
6408     */
6409    uintptr_t datalen;
6410 } LDKCVec_TxOutZ;
6411
6412 /**
6413  * The contents of CResult_TransactionNoneZ
6414  */
6415 typedef union LDKCResult_TransactionNoneZPtr {
6416    /**
6417     * A pointer to the contents in the success state.
6418     * Reading from this pointer when `result_ok` is not set is undefined.
6419     */
6420    struct LDKTransaction *result;
6421    /**
6422     * Note that this value is always NULL, as there are no contents in the Err variant
6423     */
6424    void *err;
6425 } LDKCResult_TransactionNoneZPtr;
6426
6427 /**
6428  * A CResult_TransactionNoneZ represents the result of a fallible operation,
6429  * containing a crate::c_types::Transaction on success and a () on failure.
6430  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6431  */
6432 typedef struct LDKCResult_TransactionNoneZ {
6433    /**
6434     * The contents of this CResult_TransactionNoneZ, accessible via either
6435     * `err` or `result` depending on the state of `result_ok`.
6436     */
6437    union LDKCResult_TransactionNoneZPtr contents;
6438    /**
6439     * Whether this CResult_TransactionNoneZ represents a success state.
6440     */
6441    bool result_ok;
6442 } LDKCResult_TransactionNoneZ;
6443
6444
6445
6446 /**
6447  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
6448  * on-chain transactions to ensure no loss of funds occurs.
6449  *
6450  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
6451  * information and are actively monitoring the chain.
6452  *
6453  * Pending Events or updated HTLCs which have not yet been read out by
6454  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
6455  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
6456  * gotten are fully handled before re-serializing the new state.
6457  *
6458  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
6459  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6460  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
6461  * returned block hash and the the current chain and then reconnecting blocks to get to the
6462  * best chain) upon deserializing the object!
6463  */
6464 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
6465    /**
6466     * A pointer to the opaque Rust object.
6467     * Nearly everywhere, inner must be non-null, however in places where
6468     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6469     */
6470    LDKnativeChannelMonitor *inner;
6471    /**
6472     * Indicates that this is the only struct which contains the same pointer.
6473     * Rust functions which take ownership of an object provided via an argument require
6474     * this to be true and invalidate the object pointed to by inner.
6475     */
6476    bool is_owned;
6477 } LDKChannelMonitor;
6478
6479 /**
6480  * A tuple of 2 elements. See the individual fields for the types contained.
6481  */
6482 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
6483    /**
6484     * The element at position 0
6485     */
6486    struct LDKThirtyTwoBytes a;
6487    /**
6488     * The element at position 1
6489     */
6490    struct LDKChannelMonitor b;
6491 } LDKC2Tuple_BlockHashChannelMonitorZ;
6492
6493 /**
6494  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
6495  * This corresponds to std::vector in C++
6496  */
6497 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
6498    /**
6499     * The elements in the array.
6500     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6501     */
6502    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
6503    /**
6504     * The number of elements pointed to by `data`.
6505     */
6506    uintptr_t datalen;
6507 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
6508
6509 /**
6510  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
6511  */
6512 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6513    /**
6514     * A pointer to the contents in the success state.
6515     * Reading from this pointer when `result_ok` is not set is undefined.
6516     */
6517    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
6518    /**
6519     * A pointer to the contents in the error state.
6520     * Reading from this pointer when `result_ok` is set is undefined.
6521     */
6522    enum LDKIOError *err;
6523 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
6524
6525 /**
6526  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
6527  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
6528  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6529  */
6530 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6531    /**
6532     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
6533     * `err` or `result` depending on the state of `result_ok`.
6534     */
6535    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
6536    /**
6537     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6538     */
6539    bool result_ok;
6540 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
6541
6542 /**
6543  * An enum which can either contain a u16 or not
6544  */
6545 typedef enum LDKCOption_u16Z_Tag {
6546    /**
6547     * When we're in this state, this COption_u16Z contains a u16
6548     */
6549    LDKCOption_u16Z_Some,
6550    /**
6551     * When we're in this state, this COption_u16Z contains nothing
6552     */
6553    LDKCOption_u16Z_None,
6554    /**
6555     * Must be last for serialization purposes
6556     */
6557    LDKCOption_u16Z_Sentinel,
6558 } LDKCOption_u16Z_Tag;
6559
6560 typedef struct LDKCOption_u16Z {
6561    LDKCOption_u16Z_Tag tag;
6562    union {
6563       struct {
6564          uint16_t some;
6565       };
6566    };
6567 } LDKCOption_u16Z;
6568
6569 /**
6570  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
6571  * too-high values)
6572  */
6573 typedef enum LDKAPIError_Tag {
6574    /**
6575     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
6576     * are documented, but generally indicates some precondition of a function was violated.
6577     */
6578    LDKAPIError_APIMisuseError,
6579    /**
6580     * Due to a high feerate, we were unable to complete the request.
6581     * For example, this may be returned if the feerate implies we cannot open a channel at the
6582     * requested value, but opening a larger channel would succeed.
6583     */
6584    LDKAPIError_FeeRateTooHigh,
6585    /**
6586     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
6587     * too-many-hops, etc).
6588     */
6589    LDKAPIError_RouteError,
6590    /**
6591     * We were unable to complete the request as the Channel required to do so is unable to
6592     * complete the request (or was not found). This can take many forms, including disconnected
6593     * peer, channel at capacity, channel shutting down, etc.
6594     */
6595    LDKAPIError_ChannelUnavailable,
6596    /**
6597     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
6598     * attempted action to fail.
6599     */
6600    LDKAPIError_MonitorUpdateFailed,
6601    /**
6602     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
6603     * with the channel counterparty as negotiated in [`InitFeatures`].
6604     *
6605     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
6606     * a channel or cooperatively close one with this peer (and will have to force-close instead).
6607     *
6608     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
6609     * [`InitFeatures`]: crate::ln::features::InitFeatures
6610     */
6611    LDKAPIError_IncompatibleShutdownScript,
6612    /**
6613     * Must be last for serialization purposes
6614     */
6615    LDKAPIError_Sentinel,
6616 } LDKAPIError_Tag;
6617
6618 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
6619    /**
6620     * A human-readable error message
6621     */
6622    struct LDKStr err;
6623 } LDKAPIError_LDKAPIMisuseError_Body;
6624
6625 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
6626    /**
6627     * A human-readable error message
6628     */
6629    struct LDKStr err;
6630    /**
6631     * The feerate which was too high.
6632     */
6633    uint32_t feerate;
6634 } LDKAPIError_LDKFeeRateTooHigh_Body;
6635
6636 typedef struct LDKAPIError_LDKRouteError_Body {
6637    /**
6638     * A human-readable error message
6639     */
6640    struct LDKStr err;
6641 } LDKAPIError_LDKRouteError_Body;
6642
6643 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
6644    /**
6645     * A human-readable error message
6646     */
6647    struct LDKStr err;
6648 } LDKAPIError_LDKChannelUnavailable_Body;
6649
6650 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
6651    /**
6652     * The incompatible shutdown script.
6653     */
6654    struct LDKShutdownScript script;
6655 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
6656
6657 typedef struct MUST_USE_STRUCT LDKAPIError {
6658    LDKAPIError_Tag tag;
6659    union {
6660       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
6661       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
6662       LDKAPIError_LDKRouteError_Body route_error;
6663       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
6664       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
6665    };
6666 } LDKAPIError;
6667
6668 /**
6669  * The contents of CResult_NoneAPIErrorZ
6670  */
6671 typedef union LDKCResult_NoneAPIErrorZPtr {
6672    /**
6673     * Note that this value is always NULL, as there are no contents in the OK variant
6674     */
6675    void *result;
6676    /**
6677     * A pointer to the contents in the error state.
6678     * Reading from this pointer when `result_ok` is set is undefined.
6679     */
6680    struct LDKAPIError *err;
6681 } LDKCResult_NoneAPIErrorZPtr;
6682
6683 /**
6684  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6685  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
6686  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6687  */
6688 typedef struct LDKCResult_NoneAPIErrorZ {
6689    /**
6690     * The contents of this CResult_NoneAPIErrorZ, accessible via either
6691     * `err` or `result` depending on the state of `result_ok`.
6692     */
6693    union LDKCResult_NoneAPIErrorZPtr contents;
6694    /**
6695     * Whether this CResult_NoneAPIErrorZ represents a success state.
6696     */
6697    bool result_ok;
6698 } LDKCResult_NoneAPIErrorZ;
6699
6700 /**
6701  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6702  * This corresponds to std::vector in C++
6703  */
6704 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
6705    /**
6706     * The elements in the array.
6707     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6708     */
6709    struct LDKCResult_NoneAPIErrorZ *data;
6710    /**
6711     * The number of elements pointed to by `data`.
6712     */
6713    uintptr_t datalen;
6714 } LDKCVec_CResult_NoneAPIErrorZZ;
6715
6716 /**
6717  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6718  * This corresponds to std::vector in C++
6719  */
6720 typedef struct LDKCVec_APIErrorZ {
6721    /**
6722     * The elements in the array.
6723     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6724     */
6725    struct LDKAPIError *data;
6726    /**
6727     * The number of elements pointed to by `data`.
6728     */
6729    uintptr_t datalen;
6730 } LDKCVec_APIErrorZ;
6731
6732 /**
6733  * The contents of CResult__u832APIErrorZ
6734  */
6735 typedef union LDKCResult__u832APIErrorZPtr {
6736    /**
6737     * A pointer to the contents in the success state.
6738     * Reading from this pointer when `result_ok` is not set is undefined.
6739     */
6740    struct LDKThirtyTwoBytes *result;
6741    /**
6742     * A pointer to the contents in the error state.
6743     * Reading from this pointer when `result_ok` is set is undefined.
6744     */
6745    struct LDKAPIError *err;
6746 } LDKCResult__u832APIErrorZPtr;
6747
6748 /**
6749  * A CResult__u832APIErrorZ represents the result of a fallible operation,
6750  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6752  */
6753 typedef struct LDKCResult__u832APIErrorZ {
6754    /**
6755     * The contents of this CResult__u832APIErrorZ, accessible via either
6756     * `err` or `result` depending on the state of `result_ok`.
6757     */
6758    union LDKCResult__u832APIErrorZPtr contents;
6759    /**
6760     * Whether this CResult__u832APIErrorZ represents a success state.
6761     */
6762    bool result_ok;
6763 } LDKCResult__u832APIErrorZ;
6764
6765 /**
6766  * If a payment fails to send, it can be in one of several states. This enum is returned as the
6767  * Err() type describing which state the payment is in, see the description of individual enum
6768  * states for more.
6769  */
6770 typedef enum LDKPaymentSendFailure_Tag {
6771    /**
6772     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
6773     * send the payment at all. No channel state has been changed or messages sent to peers, and
6774     * once you've changed the parameter at error, you can freely retry the payment in full.
6775     */
6776    LDKPaymentSendFailure_ParameterError,
6777    /**
6778     * A parameter in a single path which was passed to send_payment was invalid, preventing us
6779     * from attempting to send the payment at all. No channel state has been changed or messages
6780     * sent to peers, and once you've changed the parameter at error, you can freely retry the
6781     * payment in full.
6782     *
6783     * The results here are ordered the same as the paths in the route object which was passed to
6784     * send_payment.
6785     */
6786    LDKPaymentSendFailure_PathParameterError,
6787    /**
6788     * All paths which were attempted failed to send, with no channel state change taking place.
6789     * You can freely retry the payment in full (though you probably want to do so over different
6790     * paths than the ones selected).
6791     */
6792    LDKPaymentSendFailure_AllFailedRetrySafe,
6793    /**
6794     * Some paths which were attempted failed to send, though possibly not all. At least some
6795     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
6796     * in over-/re-payment.
6797     *
6798     * The results here are ordered the same as the paths in the route object which was passed to
6799     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
6800     * retried (though there is currently no API with which to do so).
6801     *
6802     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
6803     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
6804     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
6805     * with the latest update_id.
6806     */
6807    LDKPaymentSendFailure_PartialFailure,
6808    /**
6809     * Must be last for serialization purposes
6810     */
6811    LDKPaymentSendFailure_Sentinel,
6812 } LDKPaymentSendFailure_Tag;
6813
6814 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
6815    /**
6816     * The errors themselves, in the same order as the route hops.
6817     */
6818    struct LDKCVec_CResult_NoneAPIErrorZZ results;
6819    /**
6820     * If some paths failed without irrevocably committing to the new HTLC(s), this will
6821     * contain a [`RouteParameters`] object which can be used to calculate a new route that
6822     * will pay all remaining unpaid balance.
6823     *
6824     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6825     */
6826    struct LDKRouteParameters failed_paths_retry;
6827    /**
6828     * The payment id for the payment, which is now at least partially pending.
6829     */
6830    struct LDKThirtyTwoBytes payment_id;
6831 } LDKPaymentSendFailure_LDKPartialFailure_Body;
6832
6833 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
6834    LDKPaymentSendFailure_Tag tag;
6835    union {
6836       struct {
6837          struct LDKAPIError parameter_error;
6838       };
6839       struct {
6840          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
6841       };
6842       struct {
6843          struct LDKCVec_APIErrorZ all_failed_retry_safe;
6844       };
6845       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
6846    };
6847 } LDKPaymentSendFailure;
6848
6849 /**
6850  * The contents of CResult_PaymentIdPaymentSendFailureZ
6851  */
6852 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
6853    /**
6854     * A pointer to the contents in the success state.
6855     * Reading from this pointer when `result_ok` is not set is undefined.
6856     */
6857    struct LDKThirtyTwoBytes *result;
6858    /**
6859     * A pointer to the contents in the error state.
6860     * Reading from this pointer when `result_ok` is set is undefined.
6861     */
6862    struct LDKPaymentSendFailure *err;
6863 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
6864
6865 /**
6866  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6867  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6868  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6869  */
6870 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
6871    /**
6872     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6873     * `err` or `result` depending on the state of `result_ok`.
6874     */
6875    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
6876    /**
6877     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6878     */
6879    bool result_ok;
6880 } LDKCResult_PaymentIdPaymentSendFailureZ;
6881
6882 /**
6883  * The contents of CResult_NonePaymentSendFailureZ
6884  */
6885 typedef union LDKCResult_NonePaymentSendFailureZPtr {
6886    /**
6887     * Note that this value is always NULL, as there are no contents in the OK variant
6888     */
6889    void *result;
6890    /**
6891     * A pointer to the contents in the error state.
6892     * Reading from this pointer when `result_ok` is set is undefined.
6893     */
6894    struct LDKPaymentSendFailure *err;
6895 } LDKCResult_NonePaymentSendFailureZPtr;
6896
6897 /**
6898  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6899  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6900  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6901  */
6902 typedef struct LDKCResult_NonePaymentSendFailureZ {
6903    /**
6904     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6905     * `err` or `result` depending on the state of `result_ok`.
6906     */
6907    union LDKCResult_NonePaymentSendFailureZPtr contents;
6908    /**
6909     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
6910     */
6911    bool result_ok;
6912 } LDKCResult_NonePaymentSendFailureZ;
6913
6914 /**
6915  * A tuple of 2 elements. See the individual fields for the types contained.
6916  */
6917 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
6918    /**
6919     * The element at position 0
6920     */
6921    struct LDKThirtyTwoBytes a;
6922    /**
6923     * The element at position 1
6924     */
6925    struct LDKThirtyTwoBytes b;
6926 } LDKC2Tuple_PaymentHashPaymentIdZ;
6927
6928 /**
6929  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6930  */
6931 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6932    /**
6933     * A pointer to the contents in the success state.
6934     * Reading from this pointer when `result_ok` is not set is undefined.
6935     */
6936    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
6937    /**
6938     * A pointer to the contents in the error state.
6939     * Reading from this pointer when `result_ok` is set is undefined.
6940     */
6941    struct LDKPaymentSendFailure *err;
6942 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
6943
6944 /**
6945  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6946  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6947  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6948  */
6949 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6950    /**
6951     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6952     * `err` or `result` depending on the state of `result_ok`.
6953     */
6954    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
6955    /**
6956     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6957     */
6958    bool result_ok;
6959 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
6960
6961 /**
6962  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
6963  * This corresponds to std::vector in C++
6964  */
6965 typedef struct LDKCVec_ThirtyTwoBytesZ {
6966    /**
6967     * The elements in the array.
6968     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6969     */
6970    struct LDKThirtyTwoBytes *data;
6971    /**
6972     * The number of elements pointed to by `data`.
6973     */
6974    uintptr_t datalen;
6975 } LDKCVec_ThirtyTwoBytesZ;
6976
6977 /**
6978  * A tuple of 2 elements. See the individual fields for the types contained.
6979  */
6980 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
6981    /**
6982     * The element at position 0
6983     */
6984    struct LDKThirtyTwoBytes a;
6985    /**
6986     * The element at position 1
6987     */
6988    struct LDKThirtyTwoBytes b;
6989 } LDKC2Tuple_PaymentHashPaymentSecretZ;
6990
6991 /**
6992  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6993  */
6994 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
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 LDKC2Tuple_PaymentHashPaymentSecretZ *result;
7000    /**
7001     * Note that this value is always NULL, as there are no contents in the Err variant
7002     */
7003    void *err;
7004 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
7005
7006 /**
7007  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
7008  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
7009  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7010  */
7011 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
7012    /**
7013     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
7014     * `err` or `result` depending on the state of `result_ok`.
7015     */
7016    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
7017    /**
7018     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
7019     */
7020    bool result_ok;
7021 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
7022
7023 /**
7024  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
7025  */
7026 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
7027    /**
7028     * A pointer to the contents in the success state.
7029     * Reading from this pointer when `result_ok` is not set is undefined.
7030     */
7031    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
7032    /**
7033     * A pointer to the contents in the error state.
7034     * Reading from this pointer when `result_ok` is set is undefined.
7035     */
7036    struct LDKAPIError *err;
7037 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
7038
7039 /**
7040  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
7041  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
7042  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7043  */
7044 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
7045    /**
7046     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
7047     * `err` or `result` depending on the state of `result_ok`.
7048     */
7049    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
7050    /**
7051     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
7052     */
7053    bool result_ok;
7054 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
7055
7056 /**
7057  * The contents of CResult_PaymentSecretNoneZ
7058  */
7059 typedef union LDKCResult_PaymentSecretNoneZPtr {
7060    /**
7061     * A pointer to the contents in the success state.
7062     * Reading from this pointer when `result_ok` is not set is undefined.
7063     */
7064    struct LDKThirtyTwoBytes *result;
7065    /**
7066     * Note that this value is always NULL, as there are no contents in the Err variant
7067     */
7068    void *err;
7069 } LDKCResult_PaymentSecretNoneZPtr;
7070
7071 /**
7072  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
7073  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7074  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7075  */
7076 typedef struct LDKCResult_PaymentSecretNoneZ {
7077    /**
7078     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
7079     * `err` or `result` depending on the state of `result_ok`.
7080     */
7081    union LDKCResult_PaymentSecretNoneZPtr contents;
7082    /**
7083     * Whether this CResult_PaymentSecretNoneZ represents a success state.
7084     */
7085    bool result_ok;
7086 } LDKCResult_PaymentSecretNoneZ;
7087
7088 /**
7089  * The contents of CResult_PaymentSecretAPIErrorZ
7090  */
7091 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
7092    /**
7093     * A pointer to the contents in the success state.
7094     * Reading from this pointer when `result_ok` is not set is undefined.
7095     */
7096    struct LDKThirtyTwoBytes *result;
7097    /**
7098     * A pointer to the contents in the error state.
7099     * Reading from this pointer when `result_ok` is set is undefined.
7100     */
7101    struct LDKAPIError *err;
7102 } LDKCResult_PaymentSecretAPIErrorZPtr;
7103
7104 /**
7105  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7106  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7107  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7108  */
7109 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
7110    /**
7111     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7112     * `err` or `result` depending on the state of `result_ok`.
7113     */
7114    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
7115    /**
7116     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7117     */
7118    bool result_ok;
7119 } LDKCResult_PaymentSecretAPIErrorZ;
7120
7121 /**
7122  * The contents of CResult_PaymentPreimageAPIErrorZ
7123  */
7124 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
7125    /**
7126     * A pointer to the contents in the success state.
7127     * Reading from this pointer when `result_ok` is not set is undefined.
7128     */
7129    struct LDKThirtyTwoBytes *result;
7130    /**
7131     * A pointer to the contents in the error state.
7132     * Reading from this pointer when `result_ok` is set is undefined.
7133     */
7134    struct LDKAPIError *err;
7135 } LDKCResult_PaymentPreimageAPIErrorZPtr;
7136
7137 /**
7138  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7139  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7140  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7141  */
7142 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
7143    /**
7144     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7145     * `err` or `result` depending on the state of `result_ok`.
7146     */
7147    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
7148    /**
7149     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7150     */
7151    bool result_ok;
7152 } LDKCResult_PaymentPreimageAPIErrorZ;
7153
7154
7155
7156 /**
7157  * Information needed for constructing an invoice route hint for this channel.
7158  */
7159 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
7160    /**
7161     * A pointer to the opaque Rust object.
7162     * Nearly everywhere, inner must be non-null, however in places where
7163     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7164     */
7165    LDKnativeCounterpartyForwardingInfo *inner;
7166    /**
7167     * Indicates that this is the only struct which contains the same pointer.
7168     * Rust functions which take ownership of an object provided via an argument require
7169     * this to be true and invalidate the object pointed to by inner.
7170     */
7171    bool is_owned;
7172 } LDKCounterpartyForwardingInfo;
7173
7174 /**
7175  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7176  */
7177 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7178    /**
7179     * A pointer to the contents in the success state.
7180     * Reading from this pointer when `result_ok` is not set is undefined.
7181     */
7182    struct LDKCounterpartyForwardingInfo *result;
7183    /**
7184     * A pointer to the contents in the error state.
7185     * Reading from this pointer when `result_ok` is set is undefined.
7186     */
7187    struct LDKDecodeError *err;
7188 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
7189
7190 /**
7191  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7192  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7193  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7194  */
7195 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
7196    /**
7197     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7198     * `err` or `result` depending on the state of `result_ok`.
7199     */
7200    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
7201    /**
7202     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7203     */
7204    bool result_ok;
7205 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
7206
7207
7208
7209 /**
7210  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
7211  * to better separate parameters.
7212  */
7213 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
7214    /**
7215     * A pointer to the opaque Rust object.
7216     * Nearly everywhere, inner must be non-null, however in places where
7217     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7218     */
7219    LDKnativeChannelCounterparty *inner;
7220    /**
7221     * Indicates that this is the only struct which contains the same pointer.
7222     * Rust functions which take ownership of an object provided via an argument require
7223     * this to be true and invalidate the object pointed to by inner.
7224     */
7225    bool is_owned;
7226 } LDKChannelCounterparty;
7227
7228 /**
7229  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
7230  */
7231 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
7232    /**
7233     * A pointer to the contents in the success state.
7234     * Reading from this pointer when `result_ok` is not set is undefined.
7235     */
7236    struct LDKChannelCounterparty *result;
7237    /**
7238     * A pointer to the contents in the error state.
7239     * Reading from this pointer when `result_ok` is set is undefined.
7240     */
7241    struct LDKDecodeError *err;
7242 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
7243
7244 /**
7245  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7246  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7247  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7248  */
7249 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
7250    /**
7251     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7252     * `err` or `result` depending on the state of `result_ok`.
7253     */
7254    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
7255    /**
7256     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7257     */
7258    bool result_ok;
7259 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
7260
7261 /**
7262  * The contents of CResult_ChannelDetailsDecodeErrorZ
7263  */
7264 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
7265    /**
7266     * A pointer to the contents in the success state.
7267     * Reading from this pointer when `result_ok` is not set is undefined.
7268     */
7269    struct LDKChannelDetails *result;
7270    /**
7271     * A pointer to the contents in the error state.
7272     * Reading from this pointer when `result_ok` is set is undefined.
7273     */
7274    struct LDKDecodeError *err;
7275 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
7276
7277 /**
7278  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7279  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7280  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7281  */
7282 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
7283    /**
7284     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7285     * `err` or `result` depending on the state of `result_ok`.
7286     */
7287    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
7288    /**
7289     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7290     */
7291    bool result_ok;
7292 } LDKCResult_ChannelDetailsDecodeErrorZ;
7293
7294
7295
7296 /**
7297  * Route hints used in constructing invoices for [phantom node payents].
7298  *
7299  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
7300  */
7301 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
7302    /**
7303     * A pointer to the opaque Rust object.
7304     * Nearly everywhere, inner must be non-null, however in places where
7305     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7306     */
7307    LDKnativePhantomRouteHints *inner;
7308    /**
7309     * Indicates that this is the only struct which contains the same pointer.
7310     * Rust functions which take ownership of an object provided via an argument require
7311     * this to be true and invalidate the object pointed to by inner.
7312     */
7313    bool is_owned;
7314 } LDKPhantomRouteHints;
7315
7316 /**
7317  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
7318  */
7319 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
7320    /**
7321     * A pointer to the contents in the success state.
7322     * Reading from this pointer when `result_ok` is not set is undefined.
7323     */
7324    struct LDKPhantomRouteHints *result;
7325    /**
7326     * A pointer to the contents in the error state.
7327     * Reading from this pointer when `result_ok` is set is undefined.
7328     */
7329    struct LDKDecodeError *err;
7330 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
7331
7332 /**
7333  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7334  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7335  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7336  */
7337 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
7338    /**
7339     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7340     * `err` or `result` depending on the state of `result_ok`.
7341     */
7342    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
7343    /**
7344     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7345     */
7346    bool result_ok;
7347 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
7348
7349 /**
7350  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7351  * This corresponds to std::vector in C++
7352  */
7353 typedef struct LDKCVec_ChannelMonitorZ {
7354    /**
7355     * The elements in the array.
7356     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7357     */
7358    struct LDKChannelMonitor *data;
7359    /**
7360     * The number of elements pointed to by `data`.
7361     */
7362    uintptr_t datalen;
7363 } LDKCVec_ChannelMonitorZ;
7364
7365
7366
7367 /**
7368  * An update generated by the underlying Channel itself which contains some new information the
7369  * ChannelMonitor should be made aware of.
7370  */
7371 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
7372    /**
7373     * A pointer to the opaque Rust object.
7374     * Nearly everywhere, inner must be non-null, however in places where
7375     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7376     */
7377    LDKnativeChannelMonitorUpdate *inner;
7378    /**
7379     * Indicates that this is the only struct which contains the same pointer.
7380     * Rust functions which take ownership of an object provided via an argument require
7381     * this to be true and invalidate the object pointed to by inner.
7382     */
7383    bool is_owned;
7384 } LDKChannelMonitorUpdate;
7385
7386 /**
7387  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
7388  * blocks are connected and disconnected.
7389  *
7390  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
7391  * responsible for maintaining a set of monitors such that they can be updated accordingly as
7392  * channel state changes and HTLCs are resolved. See method documentation for specific
7393  * requirements.
7394  *
7395  * Implementations **must** ensure that updates are successfully applied and persisted upon method
7396  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
7397  * without taking any further action such as persisting the current state.
7398  *
7399  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
7400  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
7401  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
7402  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
7403  * multiple instances.
7404  *
7405  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
7406  */
7407 typedef struct LDKWatch {
7408    /**
7409     * An opaque pointer which is passed to your function implementations as an argument.
7410     * This has no meaning in the LDK, and can be NULL or any other value.
7411     */
7412    void *this_arg;
7413    /**
7414     * Watches a channel identified by `funding_txo` using `monitor`.
7415     *
7416     * Implementations are responsible for watching the chain for the funding transaction along
7417     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
7418     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
7419     *
7420     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
7421     * the given `funding_txo` has previously been registered via `watch_channel`.
7422     *
7423     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
7424     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
7425     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
7426     */
7427    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
7428    /**
7429     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
7430     *
7431     * Implementations must call [`update_monitor`] with the given update. See
7432     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
7433     *
7434     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
7435     */
7436    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
7437    /**
7438     * Returns any monitor events since the last call. Subsequent calls must only return new
7439     * events.
7440     *
7441     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
7442     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
7443     * to disk.
7444     *
7445     * For details on asynchronous [`ChannelMonitor`] updating and returning
7446     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
7447     */
7448    struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ (*release_pending_monitor_events)(const void *this_arg);
7449    /**
7450     * Frees any resources associated with this object given its this_arg pointer.
7451     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7452     */
7453    void (*free)(void *this_arg);
7454 } LDKWatch;
7455
7456 /**
7457  * An interface to send a transaction to the Bitcoin network.
7458  */
7459 typedef struct LDKBroadcasterInterface {
7460    /**
7461     * An opaque pointer which is passed to your function implementations as an argument.
7462     * This has no meaning in the LDK, and can be NULL or any other value.
7463     */
7464    void *this_arg;
7465    /**
7466     * Sends a transaction out to (hopefully) be mined.
7467     */
7468    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
7469    /**
7470     * Frees any resources associated with this object given its this_arg pointer.
7471     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7472     */
7473    void (*free)(void *this_arg);
7474 } LDKBroadcasterInterface;
7475
7476 /**
7477  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
7478  * own the memory pointed to by data.
7479  */
7480 typedef struct LDKu8slice {
7481    /**
7482     * A pointer to the byte buffer
7483     */
7484    const uint8_t *data;
7485    /**
7486     * The number of bytes pointed to by `data`.
7487     */
7488    uintptr_t datalen;
7489 } LDKu8slice;
7490
7491 /**
7492  * A trait to describe an object which can get user secrets and key material.
7493  */
7494 typedef struct LDKKeysInterface {
7495    /**
7496     * An opaque pointer which is passed to your function implementations as an argument.
7497     * This has no meaning in the LDK, and can be NULL or any other value.
7498     */
7499    void *this_arg;
7500    /**
7501     * Get node secret key based on the provided [`Recipient`].
7502     *
7503     * The node_id/network_key is the public key that corresponds to this secret key.
7504     *
7505     * This method must return the same value each time it is called with a given `Recipient`
7506     * parameter.
7507     */
7508    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
7509    /**
7510     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
7511     *
7512     * This method should return a different value each time it is called, to avoid linking
7513     * on-chain funds across channels as controlled to the same user.
7514     */
7515    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
7516    /**
7517     * Get a script pubkey which we will send funds to when closing a channel.
7518     *
7519     * This method should return a different value each time it is called, to avoid linking
7520     * on-chain funds across channels as controlled to the same user.
7521     */
7522    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
7523    /**
7524     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
7525     * restarted with some stale data!
7526     *
7527     * This method must return a different value each time it is called.
7528     */
7529    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
7530    /**
7531     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
7532     * onion packets and for temporary channel IDs. There is no requirement that these be
7533     * persisted anywhere, though they must be unique across restarts.
7534     *
7535     * This method must return a different value each time it is called.
7536     */
7537    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
7538    /**
7539     * Reads a `Signer` for this `KeysInterface` from the given input stream.
7540     * This is only called during deserialization of other objects which contain
7541     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
7542     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
7543     * contain no versioning scheme. You may wish to include your own version prefix and ensure
7544     * you've read all of the provided bytes to ensure no corruption occurred.
7545     */
7546    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
7547    /**
7548     * Sign an invoice.
7549     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
7550     * this trait to parse the invoice and make sure they're signing what they expect, rather than
7551     * blindly signing the hash.
7552     * The hrp is ascii bytes, while the invoice data is base32.
7553     *
7554     * The secret key used to sign the invoice is dependent on the [`Recipient`].
7555     */
7556    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
7557    /**
7558     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
7559     *
7560     * If the implementor of this trait supports [phantom node payments], then every node that is
7561     * intended to be included in the phantom invoice route hints must return the same value from
7562     * this method.
7563     *
7564     * This method must return the same value each time it is called.
7565     *
7566     * [phantom node payments]: PhantomKeysManager
7567     */
7568    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
7569    /**
7570     * Frees any resources associated with this object given its this_arg pointer.
7571     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7572     */
7573    void (*free)(void *this_arg);
7574 } LDKKeysInterface;
7575
7576 /**
7577  * A trait which should be implemented to provide feerate information on a number of time
7578  * horizons.
7579  *
7580  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
7581  * called from inside the library in response to chain events, P2P events, or timer events).
7582  */
7583 typedef struct LDKFeeEstimator {
7584    /**
7585     * An opaque pointer which is passed to your function implementations as an argument.
7586     * This has no meaning in the LDK, and can be NULL or any other value.
7587     */
7588    void *this_arg;
7589    /**
7590     * Gets estimated satoshis of fee required per 1000 Weight-Units.
7591     *
7592     * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
7593     * round-downs don't put us below 1 satoshi-per-byte).
7594     *
7595     * This method can be implemented with the following unit conversions:
7596     *  * max(satoshis-per-byte * 250, 253)
7597     *  * max(satoshis-per-kbyte / 4, 253)
7598     */
7599    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
7600    /**
7601     * Frees any resources associated with this object given its this_arg pointer.
7602     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7603     */
7604    void (*free)(void *this_arg);
7605 } LDKFeeEstimator;
7606
7607
7608
7609 /**
7610  * Manager which keeps track of a number of channels and sends messages to the appropriate
7611  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
7612  *
7613  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
7614  * to individual Channels.
7615  *
7616  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
7617  * all peers during write/read (though does not modify this instance, only the instance being
7618  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
7619  * called funding_transaction_generated for outbound channels).
7620  *
7621  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
7622  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
7623  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
7624  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
7625  * the serialization process). If the deserialized version is out-of-date compared to the
7626  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
7627  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
7628  *
7629  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
7630  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7631  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
7632  * block_connected() to step towards your best block) upon deserialization before using the
7633  * object!
7634  *
7635  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
7636  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
7637  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
7638  * offline for a full minute. In order to track this, you must call
7639  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
7640  *
7641  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
7642  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
7643  * essentially you should default to using a SimpleRefChannelManager, and use a
7644  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
7645  * you're using lightning-net-tokio.
7646  */
7647 typedef struct MUST_USE_STRUCT LDKChannelManager {
7648    /**
7649     * A pointer to the opaque Rust object.
7650     * Nearly everywhere, inner must be non-null, however in places where
7651     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7652     */
7653    LDKnativeChannelManager *inner;
7654    /**
7655     * Indicates that this is the only struct which contains the same pointer.
7656     * Rust functions which take ownership of an object provided via an argument require
7657     * this to be true and invalidate the object pointed to by inner.
7658     */
7659    bool is_owned;
7660 } LDKChannelManager;
7661
7662 /**
7663  * A tuple of 2 elements. See the individual fields for the types contained.
7664  */
7665 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
7666    /**
7667     * The element at position 0
7668     */
7669    struct LDKThirtyTwoBytes a;
7670    /**
7671     * The element at position 1
7672     */
7673    struct LDKChannelManager b;
7674 } LDKC2Tuple_BlockHashChannelManagerZ;
7675
7676 /**
7677  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7678  */
7679 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7680    /**
7681     * A pointer to the contents in the success state.
7682     * Reading from this pointer when `result_ok` is not set is undefined.
7683     */
7684    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
7685    /**
7686     * A pointer to the contents in the error state.
7687     * Reading from this pointer when `result_ok` is set is undefined.
7688     */
7689    struct LDKDecodeError *err;
7690 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
7691
7692 /**
7693  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7694  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7695  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7696  */
7697 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7698    /**
7699     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7700     * `err` or `result` depending on the state of `result_ok`.
7701     */
7702    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
7703    /**
7704     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7705     */
7706    bool result_ok;
7707 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
7708
7709
7710
7711 /**
7712  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
7713  * with our counterparty.
7714  */
7715 typedef struct MUST_USE_STRUCT LDKChannelConfig {
7716    /**
7717     * A pointer to the opaque Rust object.
7718     * Nearly everywhere, inner must be non-null, however in places where
7719     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7720     */
7721    LDKnativeChannelConfig *inner;
7722    /**
7723     * Indicates that this is the only struct which contains the same pointer.
7724     * Rust functions which take ownership of an object provided via an argument require
7725     * this to be true and invalidate the object pointed to by inner.
7726     */
7727    bool is_owned;
7728 } LDKChannelConfig;
7729
7730 /**
7731  * The contents of CResult_ChannelConfigDecodeErrorZ
7732  */
7733 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
7734    /**
7735     * A pointer to the contents in the success state.
7736     * Reading from this pointer when `result_ok` is not set is undefined.
7737     */
7738    struct LDKChannelConfig *result;
7739    /**
7740     * A pointer to the contents in the error state.
7741     * Reading from this pointer when `result_ok` is set is undefined.
7742     */
7743    struct LDKDecodeError *err;
7744 } LDKCResult_ChannelConfigDecodeErrorZPtr;
7745
7746 /**
7747  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7748  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7749  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7750  */
7751 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
7752    /**
7753     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7754     * `err` or `result` depending on the state of `result_ok`.
7755     */
7756    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
7757    /**
7758     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7759     */
7760    bool result_ok;
7761 } LDKCResult_ChannelConfigDecodeErrorZ;
7762
7763 /**
7764  * The contents of CResult_OutPointDecodeErrorZ
7765  */
7766 typedef union LDKCResult_OutPointDecodeErrorZPtr {
7767    /**
7768     * A pointer to the contents in the success state.
7769     * Reading from this pointer when `result_ok` is not set is undefined.
7770     */
7771    struct LDKOutPoint *result;
7772    /**
7773     * A pointer to the contents in the error state.
7774     * Reading from this pointer when `result_ok` is set is undefined.
7775     */
7776    struct LDKDecodeError *err;
7777 } LDKCResult_OutPointDecodeErrorZPtr;
7778
7779 /**
7780  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7781  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7782  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7783  */
7784 typedef struct LDKCResult_OutPointDecodeErrorZ {
7785    /**
7786     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7787     * `err` or `result` depending on the state of `result_ok`.
7788     */
7789    union LDKCResult_OutPointDecodeErrorZPtr contents;
7790    /**
7791     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
7792     */
7793    bool result_ok;
7794 } LDKCResult_OutPointDecodeErrorZ;
7795
7796 /**
7797  * Defines a type identifier for sending messages over the wire.
7798  *
7799  * Messages implementing this trait specify a type and must be [`Writeable`].
7800  */
7801 typedef struct LDKType {
7802    /**
7803     * An opaque pointer which is passed to your function implementations as an argument.
7804     * This has no meaning in the LDK, and can be NULL or any other value.
7805     */
7806    void *this_arg;
7807    /**
7808     * Returns the type identifying the message payload.
7809     */
7810    uint16_t (*type_id)(const void *this_arg);
7811    /**
7812     * Return a human-readable "debug" string describing this object
7813     */
7814    struct LDKStr (*debug_str)(const void *this_arg);
7815    /**
7816     * Serialize the object into a byte array
7817     */
7818    struct LDKCVec_u8Z (*write)(const void *this_arg);
7819    /**
7820     * Frees any resources associated with this object given its this_arg pointer.
7821     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7822     */
7823    void (*free)(void *this_arg);
7824 } LDKType;
7825
7826 /**
7827  * An enum which can either contain a crate::lightning::ln::wire::Type or not
7828  */
7829 typedef enum LDKCOption_TypeZ_Tag {
7830    /**
7831     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7832     */
7833    LDKCOption_TypeZ_Some,
7834    /**
7835     * When we're in this state, this COption_TypeZ contains nothing
7836     */
7837    LDKCOption_TypeZ_None,
7838    /**
7839     * Must be last for serialization purposes
7840     */
7841    LDKCOption_TypeZ_Sentinel,
7842 } LDKCOption_TypeZ_Tag;
7843
7844 typedef struct LDKCOption_TypeZ {
7845    LDKCOption_TypeZ_Tag tag;
7846    union {
7847       struct {
7848          struct LDKType some;
7849       };
7850    };
7851 } LDKCOption_TypeZ;
7852
7853 /**
7854  * The contents of CResult_COption_TypeZDecodeErrorZ
7855  */
7856 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
7857    /**
7858     * A pointer to the contents in the success state.
7859     * Reading from this pointer when `result_ok` is not set is undefined.
7860     */
7861    struct LDKCOption_TypeZ *result;
7862    /**
7863     * A pointer to the contents in the error state.
7864     * Reading from this pointer when `result_ok` is set is undefined.
7865     */
7866    struct LDKDecodeError *err;
7867 } LDKCResult_COption_TypeZDecodeErrorZPtr;
7868
7869 /**
7870  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7871  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7872  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7873  */
7874 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
7875    /**
7876     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7877     * `err` or `result` depending on the state of `result_ok`.
7878     */
7879    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
7880    /**
7881     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7882     */
7883    bool result_ok;
7884 } LDKCResult_COption_TypeZDecodeErrorZ;
7885
7886 /**
7887  * An error that may occur when making a payment.
7888  */
7889 typedef enum LDKPaymentError_Tag {
7890    /**
7891     * An error resulting from the provided [`Invoice`] or payment hash.
7892     */
7893    LDKPaymentError_Invoice,
7894    /**
7895     * An error occurring when finding a route.
7896     */
7897    LDKPaymentError_Routing,
7898    /**
7899     * An error occurring when sending a payment.
7900     */
7901    LDKPaymentError_Sending,
7902    /**
7903     * Must be last for serialization purposes
7904     */
7905    LDKPaymentError_Sentinel,
7906 } LDKPaymentError_Tag;
7907
7908 typedef struct MUST_USE_STRUCT LDKPaymentError {
7909    LDKPaymentError_Tag tag;
7910    union {
7911       struct {
7912          struct LDKStr invoice;
7913       };
7914       struct {
7915          struct LDKLightningError routing;
7916       };
7917       struct {
7918          struct LDKPaymentSendFailure sending;
7919       };
7920    };
7921 } LDKPaymentError;
7922
7923 /**
7924  * The contents of CResult_PaymentIdPaymentErrorZ
7925  */
7926 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
7927    /**
7928     * A pointer to the contents in the success state.
7929     * Reading from this pointer when `result_ok` is not set is undefined.
7930     */
7931    struct LDKThirtyTwoBytes *result;
7932    /**
7933     * A pointer to the contents in the error state.
7934     * Reading from this pointer when `result_ok` is set is undefined.
7935     */
7936    struct LDKPaymentError *err;
7937 } LDKCResult_PaymentIdPaymentErrorZPtr;
7938
7939 /**
7940  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
7941  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7942  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7943  */
7944 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
7945    /**
7946     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7947     * `err` or `result` depending on the state of `result_ok`.
7948     */
7949    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
7950    /**
7951     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7952     */
7953    bool result_ok;
7954 } LDKCResult_PaymentIdPaymentErrorZ;
7955
7956 /**
7957  * Sub-errors which don't have specific information in them use this type.
7958  */
7959 typedef struct LDKError {
7960    /**
7961     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
7962     */
7963    uint8_t _dummy;
7964 } LDKError;
7965
7966 /**
7967  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
7968  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
7969  */
7970 typedef enum LDKParseError_Tag {
7971    LDKParseError_Bech32Error,
7972    LDKParseError_ParseAmountError,
7973    LDKParseError_MalformedSignature,
7974    LDKParseError_BadPrefix,
7975    LDKParseError_UnknownCurrency,
7976    LDKParseError_UnknownSiPrefix,
7977    LDKParseError_MalformedHRP,
7978    LDKParseError_TooShortDataPart,
7979    LDKParseError_UnexpectedEndOfTaggedFields,
7980    LDKParseError_DescriptionDecodeError,
7981    LDKParseError_PaddingError,
7982    LDKParseError_IntegerOverflowError,
7983    LDKParseError_InvalidSegWitProgramLength,
7984    LDKParseError_InvalidPubKeyHashLength,
7985    LDKParseError_InvalidScriptHashLength,
7986    LDKParseError_InvalidRecoveryId,
7987    LDKParseError_InvalidSliceLength,
7988    /**
7989     * Not an error, but used internally to signal that a part of the invoice should be ignored
7990     * according to BOLT11
7991     */
7992    LDKParseError_Skip,
7993    /**
7994     * Must be last for serialization purposes
7995     */
7996    LDKParseError_Sentinel,
7997 } LDKParseError_Tag;
7998
7999 typedef struct MUST_USE_STRUCT LDKParseError {
8000    LDKParseError_Tag tag;
8001    union {
8002       struct {
8003          struct LDKBech32Error bech32_error;
8004       };
8005       struct {
8006          struct LDKError parse_amount_error;
8007       };
8008       struct {
8009          enum LDKSecp256k1Error malformed_signature;
8010       };
8011       struct {
8012          struct LDKError description_decode_error;
8013       };
8014       struct {
8015          struct LDKStr invalid_slice_length;
8016       };
8017    };
8018 } LDKParseError;
8019
8020 /**
8021  * The contents of CResult_SiPrefixParseErrorZ
8022  */
8023 typedef union LDKCResult_SiPrefixParseErrorZPtr {
8024    /**
8025     * A pointer to the contents in the success state.
8026     * Reading from this pointer when `result_ok` is not set is undefined.
8027     */
8028    enum LDKSiPrefix *result;
8029    /**
8030     * A pointer to the contents in the error state.
8031     * Reading from this pointer when `result_ok` is set is undefined.
8032     */
8033    struct LDKParseError *err;
8034 } LDKCResult_SiPrefixParseErrorZPtr;
8035
8036 /**
8037  * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
8038  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
8039  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8040  */
8041 typedef struct LDKCResult_SiPrefixParseErrorZ {
8042    /**
8043     * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
8044     * `err` or `result` depending on the state of `result_ok`.
8045     */
8046    union LDKCResult_SiPrefixParseErrorZPtr contents;
8047    /**
8048     * Whether this CResult_SiPrefixParseErrorZ represents a success state.
8049     */
8050    bool result_ok;
8051 } LDKCResult_SiPrefixParseErrorZ;
8052
8053
8054
8055 /**
8056  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
8057  *
8058  * There are three ways to construct an `Invoice`:
8059  *  1. using `InvoiceBuilder`
8060  *  2. using `Invoice::from_signed(SignedRawInvoice)`
8061  *  3. using `str::parse::<Invoice>(&str)`
8062  */
8063 typedef struct MUST_USE_STRUCT LDKInvoice {
8064    /**
8065     * A pointer to the opaque Rust object.
8066     * Nearly everywhere, inner must be non-null, however in places where
8067     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8068     */
8069    LDKnativeInvoice *inner;
8070    /**
8071     * Indicates that this is the only struct which contains the same pointer.
8072     * Rust functions which take ownership of an object provided via an argument require
8073     * this to be true and invalidate the object pointed to by inner.
8074     */
8075    bool is_owned;
8076 } LDKInvoice;
8077
8078 /**
8079  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
8080  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
8081  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
8082  */
8083 typedef enum LDKParseOrSemanticError_Tag {
8084    /**
8085     * The invoice couldn't be decoded
8086     */
8087    LDKParseOrSemanticError_ParseError,
8088    /**
8089     * The invoice could be decoded but violates the BOLT11 standard
8090     */
8091    LDKParseOrSemanticError_SemanticError,
8092    /**
8093     * Must be last for serialization purposes
8094     */
8095    LDKParseOrSemanticError_Sentinel,
8096 } LDKParseOrSemanticError_Tag;
8097
8098 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
8099    LDKParseOrSemanticError_Tag tag;
8100    union {
8101       struct {
8102          struct LDKParseError parse_error;
8103       };
8104       struct {
8105          enum LDKSemanticError semantic_error;
8106       };
8107    };
8108 } LDKParseOrSemanticError;
8109
8110 /**
8111  * The contents of CResult_InvoiceParseOrSemanticErrorZ
8112  */
8113 typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
8114    /**
8115     * A pointer to the contents in the success state.
8116     * Reading from this pointer when `result_ok` is not set is undefined.
8117     */
8118    struct LDKInvoice *result;
8119    /**
8120     * A pointer to the contents in the error state.
8121     * Reading from this pointer when `result_ok` is set is undefined.
8122     */
8123    struct LDKParseOrSemanticError *err;
8124 } LDKCResult_InvoiceParseOrSemanticErrorZPtr;
8125
8126 /**
8127  * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
8128  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
8129  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8130  */
8131 typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
8132    /**
8133     * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
8134     * `err` or `result` depending on the state of `result_ok`.
8135     */
8136    union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
8137    /**
8138     * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
8139     */
8140    bool result_ok;
8141 } LDKCResult_InvoiceParseOrSemanticErrorZ;
8142
8143
8144
8145 /**
8146  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
8147  * invalid.
8148  *
8149  * # Invariants
8150  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
8151  */
8152 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
8153    /**
8154     * A pointer to the opaque Rust object.
8155     * Nearly everywhere, inner must be non-null, however in places where
8156     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8157     */
8158    LDKnativeSignedRawInvoice *inner;
8159    /**
8160     * Indicates that this is the only struct which contains the same pointer.
8161     * Rust functions which take ownership of an object provided via an argument require
8162     * this to be true and invalidate the object pointed to by inner.
8163     */
8164    bool is_owned;
8165 } LDKSignedRawInvoice;
8166
8167 /**
8168  * The contents of CResult_SignedRawInvoiceParseErrorZ
8169  */
8170 typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
8171    /**
8172     * A pointer to the contents in the success state.
8173     * Reading from this pointer when `result_ok` is not set is undefined.
8174     */
8175    struct LDKSignedRawInvoice *result;
8176    /**
8177     * A pointer to the contents in the error state.
8178     * Reading from this pointer when `result_ok` is set is undefined.
8179     */
8180    struct LDKParseError *err;
8181 } LDKCResult_SignedRawInvoiceParseErrorZPtr;
8182
8183 /**
8184  * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
8185  * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
8186  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8187  */
8188 typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
8189    /**
8190     * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
8191     * `err` or `result` depending on the state of `result_ok`.
8192     */
8193    union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
8194    /**
8195     * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
8196     */
8197    bool result_ok;
8198 } LDKCResult_SignedRawInvoiceParseErrorZ;
8199
8200
8201
8202 /**
8203  * Represents an syntactically correct Invoice for a payment on the lightning network,
8204  * but without the signature information.
8205  * De- and encoding should not lead to information loss but may lead to different hashes.
8206  *
8207  * For methods without docs see the corresponding methods in `Invoice`.
8208  */
8209 typedef struct MUST_USE_STRUCT LDKRawInvoice {
8210    /**
8211     * A pointer to the opaque Rust object.
8212     * Nearly everywhere, inner must be non-null, however in places where
8213     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8214     */
8215    LDKnativeRawInvoice *inner;
8216    /**
8217     * Indicates that this is the only struct which contains the same pointer.
8218     * Rust functions which take ownership of an object provided via an argument require
8219     * this to be true and invalidate the object pointed to by inner.
8220     */
8221    bool is_owned;
8222 } LDKRawInvoice;
8223
8224
8225
8226 /**
8227  * Recoverable signature
8228  */
8229 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
8230    /**
8231     * A pointer to the opaque Rust object.
8232     * Nearly everywhere, inner must be non-null, however in places where
8233     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8234     */
8235    LDKnativeInvoiceSignature *inner;
8236    /**
8237     * Indicates that this is the only struct which contains the same pointer.
8238     * Rust functions which take ownership of an object provided via an argument require
8239     * this to be true and invalidate the object pointed to by inner.
8240     */
8241    bool is_owned;
8242 } LDKInvoiceSignature;
8243
8244 /**
8245  * A tuple of 3 elements. See the individual fields for the types contained.
8246  */
8247 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
8248    /**
8249     * The element at position 0
8250     */
8251    struct LDKRawInvoice a;
8252    /**
8253     * The element at position 1
8254     */
8255    struct LDKThirtyTwoBytes b;
8256    /**
8257     * The element at position 2
8258     */
8259    struct LDKInvoiceSignature c;
8260 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
8261
8262
8263
8264 /**
8265  * Payee public key
8266  */
8267 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
8268    /**
8269     * A pointer to the opaque Rust object.
8270     * Nearly everywhere, inner must be non-null, however in places where
8271     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8272     */
8273    LDKnativePayeePubKey *inner;
8274    /**
8275     * Indicates that this is the only struct which contains the same pointer.
8276     * Rust functions which take ownership of an object provided via an argument require
8277     * this to be true and invalidate the object pointed to by inner.
8278     */
8279    bool is_owned;
8280 } LDKPayeePubKey;
8281
8282 /**
8283  * The contents of CResult_PayeePubKeyErrorZ
8284  */
8285 typedef union LDKCResult_PayeePubKeyErrorZPtr {
8286    /**
8287     * A pointer to the contents in the success state.
8288     * Reading from this pointer when `result_ok` is not set is undefined.
8289     */
8290    struct LDKPayeePubKey *result;
8291    /**
8292     * A pointer to the contents in the error state.
8293     * Reading from this pointer when `result_ok` is set is undefined.
8294     */
8295    enum LDKSecp256k1Error *err;
8296 } LDKCResult_PayeePubKeyErrorZPtr;
8297
8298 /**
8299  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8300  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8301  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8302  */
8303 typedef struct LDKCResult_PayeePubKeyErrorZ {
8304    /**
8305     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8306     * `err` or `result` depending on the state of `result_ok`.
8307     */
8308    union LDKCResult_PayeePubKeyErrorZPtr contents;
8309    /**
8310     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
8311     */
8312    bool result_ok;
8313 } LDKCResult_PayeePubKeyErrorZ;
8314
8315
8316
8317 /**
8318  * Private routing information
8319  *
8320  * # Invariants
8321  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
8322  *
8323  */
8324 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
8325    /**
8326     * A pointer to the opaque Rust object.
8327     * Nearly everywhere, inner must be non-null, however in places where
8328     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8329     */
8330    LDKnativePrivateRoute *inner;
8331    /**
8332     * Indicates that this is the only struct which contains the same pointer.
8333     * Rust functions which take ownership of an object provided via an argument require
8334     * this to be true and invalidate the object pointed to by inner.
8335     */
8336    bool is_owned;
8337 } LDKPrivateRoute;
8338
8339 /**
8340  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8341  * This corresponds to std::vector in C++
8342  */
8343 typedef struct LDKCVec_PrivateRouteZ {
8344    /**
8345     * The elements in the array.
8346     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8347     */
8348    struct LDKPrivateRoute *data;
8349    /**
8350     * The number of elements pointed to by `data`.
8351     */
8352    uintptr_t datalen;
8353 } LDKCVec_PrivateRouteZ;
8354
8355
8356
8357 /**
8358  * A timestamp that refers to a date after 1 January 1970.
8359  *
8360  * # Invariants
8361  *
8362  * The Unix timestamp representing the stored time has to be positive and no greater than
8363  * [`MAX_TIMESTAMP`].
8364  */
8365 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
8366    /**
8367     * A pointer to the opaque Rust object.
8368     * Nearly everywhere, inner must be non-null, however in places where
8369     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8370     */
8371    LDKnativePositiveTimestamp *inner;
8372    /**
8373     * Indicates that this is the only struct which contains the same pointer.
8374     * Rust functions which take ownership of an object provided via an argument require
8375     * this to be true and invalidate the object pointed to by inner.
8376     */
8377    bool is_owned;
8378 } LDKPositiveTimestamp;
8379
8380 /**
8381  * The contents of CResult_PositiveTimestampCreationErrorZ
8382  */
8383 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
8384    /**
8385     * A pointer to the contents in the success state.
8386     * Reading from this pointer when `result_ok` is not set is undefined.
8387     */
8388    struct LDKPositiveTimestamp *result;
8389    /**
8390     * A pointer to the contents in the error state.
8391     * Reading from this pointer when `result_ok` is set is undefined.
8392     */
8393    enum LDKCreationError *err;
8394 } LDKCResult_PositiveTimestampCreationErrorZPtr;
8395
8396 /**
8397  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8398  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8399  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8400  */
8401 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
8402    /**
8403     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8404     * `err` or `result` depending on the state of `result_ok`.
8405     */
8406    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
8407    /**
8408     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8409     */
8410    bool result_ok;
8411 } LDKCResult_PositiveTimestampCreationErrorZ;
8412
8413 /**
8414  * The contents of CResult_NoneSemanticErrorZ
8415  */
8416 typedef union LDKCResult_NoneSemanticErrorZPtr {
8417    /**
8418     * Note that this value is always NULL, as there are no contents in the OK variant
8419     */
8420    void *result;
8421    /**
8422     * A pointer to the contents in the error state.
8423     * Reading from this pointer when `result_ok` is set is undefined.
8424     */
8425    enum LDKSemanticError *err;
8426 } LDKCResult_NoneSemanticErrorZPtr;
8427
8428 /**
8429  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8430  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8431  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8432  */
8433 typedef struct LDKCResult_NoneSemanticErrorZ {
8434    /**
8435     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
8436     * `err` or `result` depending on the state of `result_ok`.
8437     */
8438    union LDKCResult_NoneSemanticErrorZPtr contents;
8439    /**
8440     * Whether this CResult_NoneSemanticErrorZ represents a success state.
8441     */
8442    bool result_ok;
8443 } LDKCResult_NoneSemanticErrorZ;
8444
8445 /**
8446  * The contents of CResult_InvoiceSemanticErrorZ
8447  */
8448 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
8449    /**
8450     * A pointer to the contents in the success state.
8451     * Reading from this pointer when `result_ok` is not set is undefined.
8452     */
8453    struct LDKInvoice *result;
8454    /**
8455     * A pointer to the contents in the error state.
8456     * Reading from this pointer when `result_ok` is set is undefined.
8457     */
8458    enum LDKSemanticError *err;
8459 } LDKCResult_InvoiceSemanticErrorZPtr;
8460
8461 /**
8462  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8463  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8464  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8465  */
8466 typedef struct LDKCResult_InvoiceSemanticErrorZ {
8467    /**
8468     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8469     * `err` or `result` depending on the state of `result_ok`.
8470     */
8471    union LDKCResult_InvoiceSemanticErrorZPtr contents;
8472    /**
8473     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8474     */
8475    bool result_ok;
8476 } LDKCResult_InvoiceSemanticErrorZ;
8477
8478
8479
8480 /**
8481  * Description string
8482  *
8483  * # Invariants
8484  * The description can be at most 639 __bytes__ long
8485  */
8486 typedef struct MUST_USE_STRUCT LDKDescription {
8487    /**
8488     * A pointer to the opaque Rust object.
8489     * Nearly everywhere, inner must be non-null, however in places where
8490     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8491     */
8492    LDKnativeDescription *inner;
8493    /**
8494     * Indicates that this is the only struct which contains the same pointer.
8495     * Rust functions which take ownership of an object provided via an argument require
8496     * this to be true and invalidate the object pointed to by inner.
8497     */
8498    bool is_owned;
8499 } LDKDescription;
8500
8501 /**
8502  * The contents of CResult_DescriptionCreationErrorZ
8503  */
8504 typedef union LDKCResult_DescriptionCreationErrorZPtr {
8505    /**
8506     * A pointer to the contents in the success state.
8507     * Reading from this pointer when `result_ok` is not set is undefined.
8508     */
8509    struct LDKDescription *result;
8510    /**
8511     * A pointer to the contents in the error state.
8512     * Reading from this pointer when `result_ok` is set is undefined.
8513     */
8514    enum LDKCreationError *err;
8515 } LDKCResult_DescriptionCreationErrorZPtr;
8516
8517 /**
8518  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8519  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8520  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8521  */
8522 typedef struct LDKCResult_DescriptionCreationErrorZ {
8523    /**
8524     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8525     * `err` or `result` depending on the state of `result_ok`.
8526     */
8527    union LDKCResult_DescriptionCreationErrorZPtr contents;
8528    /**
8529     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
8530     */
8531    bool result_ok;
8532 } LDKCResult_DescriptionCreationErrorZ;
8533
8534 /**
8535  * The contents of CResult_PrivateRouteCreationErrorZ
8536  */
8537 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
8538    /**
8539     * A pointer to the contents in the success state.
8540     * Reading from this pointer when `result_ok` is not set is undefined.
8541     */
8542    struct LDKPrivateRoute *result;
8543    /**
8544     * A pointer to the contents in the error state.
8545     * Reading from this pointer when `result_ok` is set is undefined.
8546     */
8547    enum LDKCreationError *err;
8548 } LDKCResult_PrivateRouteCreationErrorZPtr;
8549
8550 /**
8551  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8552  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8554  */
8555 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
8556    /**
8557     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8558     * `err` or `result` depending on the state of `result_ok`.
8559     */
8560    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
8561    /**
8562     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8563     */
8564    bool result_ok;
8565 } LDKCResult_PrivateRouteCreationErrorZ;
8566
8567 /**
8568  * The contents of CResult_StringErrorZ
8569  */
8570 typedef union LDKCResult_StringErrorZPtr {
8571    /**
8572     * A pointer to the contents in the success state.
8573     * Reading from this pointer when `result_ok` is not set is undefined.
8574     */
8575    struct LDKStr *result;
8576    /**
8577     * A pointer to the contents in the error state.
8578     * Reading from this pointer when `result_ok` is set is undefined.
8579     */
8580    enum LDKSecp256k1Error *err;
8581 } LDKCResult_StringErrorZPtr;
8582
8583 /**
8584  * A CResult_StringErrorZ represents the result of a fallible operation,
8585  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
8586  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8587  */
8588 typedef struct LDKCResult_StringErrorZ {
8589    /**
8590     * The contents of this CResult_StringErrorZ, accessible via either
8591     * `err` or `result` depending on the state of `result_ok`.
8592     */
8593    union LDKCResult_StringErrorZPtr contents;
8594    /**
8595     * Whether this CResult_StringErrorZ represents a success state.
8596     */
8597    bool result_ok;
8598 } LDKCResult_StringErrorZ;
8599
8600 /**
8601  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
8602  */
8603 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
8604    /**
8605     * A pointer to the contents in the success state.
8606     * Reading from this pointer when `result_ok` is not set is undefined.
8607     */
8608    struct LDKChannelMonitorUpdate *result;
8609    /**
8610     * A pointer to the contents in the error state.
8611     * Reading from this pointer when `result_ok` is set is undefined.
8612     */
8613    struct LDKDecodeError *err;
8614 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
8615
8616 /**
8617  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
8618  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8619  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8620  */
8621 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
8622    /**
8623     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
8624     * `err` or `result` depending on the state of `result_ok`.
8625     */
8626    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
8627    /**
8628     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
8629     */
8630    bool result_ok;
8631 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
8632
8633 /**
8634  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
8635  */
8636 typedef enum LDKCOption_MonitorEventZ_Tag {
8637    /**
8638     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
8639     */
8640    LDKCOption_MonitorEventZ_Some,
8641    /**
8642     * When we're in this state, this COption_MonitorEventZ contains nothing
8643     */
8644    LDKCOption_MonitorEventZ_None,
8645    /**
8646     * Must be last for serialization purposes
8647     */
8648    LDKCOption_MonitorEventZ_Sentinel,
8649 } LDKCOption_MonitorEventZ_Tag;
8650
8651 typedef struct LDKCOption_MonitorEventZ {
8652    LDKCOption_MonitorEventZ_Tag tag;
8653    union {
8654       struct {
8655          struct LDKMonitorEvent some;
8656       };
8657    };
8658 } LDKCOption_MonitorEventZ;
8659
8660 /**
8661  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
8662  */
8663 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
8664    /**
8665     * A pointer to the contents in the success state.
8666     * Reading from this pointer when `result_ok` is not set is undefined.
8667     */
8668    struct LDKCOption_MonitorEventZ *result;
8669    /**
8670     * A pointer to the contents in the error state.
8671     * Reading from this pointer when `result_ok` is set is undefined.
8672     */
8673    struct LDKDecodeError *err;
8674 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
8675
8676 /**
8677  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
8678  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8679  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8680  */
8681 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
8682    /**
8683     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
8684     * `err` or `result` depending on the state of `result_ok`.
8685     */
8686    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
8687    /**
8688     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
8689     */
8690    bool result_ok;
8691 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
8692
8693 /**
8694  * The contents of CResult_HTLCUpdateDecodeErrorZ
8695  */
8696 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
8697    /**
8698     * A pointer to the contents in the success state.
8699     * Reading from this pointer when `result_ok` is not set is undefined.
8700     */
8701    struct LDKHTLCUpdate *result;
8702    /**
8703     * A pointer to the contents in the error state.
8704     * Reading from this pointer when `result_ok` is set is undefined.
8705     */
8706    struct LDKDecodeError *err;
8707 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
8708
8709 /**
8710  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
8711  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8712  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8713  */
8714 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
8715    /**
8716     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
8717     * `err` or `result` depending on the state of `result_ok`.
8718     */
8719    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
8720    /**
8721     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
8722     */
8723    bool result_ok;
8724 } LDKCResult_HTLCUpdateDecodeErrorZ;
8725
8726 /**
8727  * A tuple of 2 elements. See the individual fields for the types contained.
8728  */
8729 typedef struct LDKC2Tuple_OutPointScriptZ {
8730    /**
8731     * The element at position 0
8732     */
8733    struct LDKOutPoint a;
8734    /**
8735     * The element at position 1
8736     */
8737    struct LDKCVec_u8Z b;
8738 } LDKC2Tuple_OutPointScriptZ;
8739
8740 /**
8741  * A tuple of 2 elements. See the individual fields for the types contained.
8742  */
8743 typedef struct LDKC2Tuple_u32ScriptZ {
8744    /**
8745     * The element at position 0
8746     */
8747    uint32_t a;
8748    /**
8749     * The element at position 1
8750     */
8751    struct LDKCVec_u8Z b;
8752 } LDKC2Tuple_u32ScriptZ;
8753
8754 /**
8755  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
8756  * This corresponds to std::vector in C++
8757  */
8758 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
8759    /**
8760     * The elements in the array.
8761     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8762     */
8763    struct LDKC2Tuple_u32ScriptZ *data;
8764    /**
8765     * The number of elements pointed to by `data`.
8766     */
8767    uintptr_t datalen;
8768 } LDKCVec_C2Tuple_u32ScriptZZ;
8769
8770 /**
8771  * A tuple of 2 elements. See the individual fields for the types contained.
8772  */
8773 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8774    /**
8775     * The element at position 0
8776     */
8777    struct LDKThirtyTwoBytes a;
8778    /**
8779     * The element at position 1
8780     */
8781    struct LDKCVec_C2Tuple_u32ScriptZZ b;
8782 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
8783
8784 /**
8785  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
8786  * This corresponds to std::vector in C++
8787  */
8788 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8789    /**
8790     * The elements in the array.
8791     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8792     */
8793    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
8794    /**
8795     * The number of elements pointed to by `data`.
8796     */
8797    uintptr_t datalen;
8798 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
8799
8800 /**
8801  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
8802  * This corresponds to std::vector in C++
8803  */
8804 typedef struct LDKCVec_EventZ {
8805    /**
8806     * The elements in the array.
8807     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8808     */
8809    struct LDKEvent *data;
8810    /**
8811     * The number of elements pointed to by `data`.
8812     */
8813    uintptr_t datalen;
8814 } LDKCVec_EventZ;
8815
8816 /**
8817  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8818  * This corresponds to std::vector in C++
8819  */
8820 typedef struct LDKCVec_TransactionZ {
8821    /**
8822     * The elements in the array.
8823     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8824     */
8825    struct LDKTransaction *data;
8826    /**
8827     * The number of elements pointed to by `data`.
8828     */
8829    uintptr_t datalen;
8830 } LDKCVec_TransactionZ;
8831
8832 /**
8833  * A tuple of 2 elements. See the individual fields for the types contained.
8834  */
8835 typedef struct LDKC2Tuple_u32TxOutZ {
8836    /**
8837     * The element at position 0
8838     */
8839    uint32_t a;
8840    /**
8841     * The element at position 1
8842     */
8843    struct LDKTxOut b;
8844 } LDKC2Tuple_u32TxOutZ;
8845
8846 /**
8847  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
8848  * This corresponds to std::vector in C++
8849  */
8850 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
8851    /**
8852     * The elements in the array.
8853     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8854     */
8855    struct LDKC2Tuple_u32TxOutZ *data;
8856    /**
8857     * The number of elements pointed to by `data`.
8858     */
8859    uintptr_t datalen;
8860 } LDKCVec_C2Tuple_u32TxOutZZ;
8861
8862 /**
8863  * A tuple of 2 elements. See the individual fields for the types contained.
8864  */
8865 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8866    /**
8867     * The element at position 0
8868     */
8869    struct LDKThirtyTwoBytes a;
8870    /**
8871     * The element at position 1
8872     */
8873    struct LDKCVec_C2Tuple_u32TxOutZZ b;
8874 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
8875
8876 /**
8877  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
8878  * This corresponds to std::vector in C++
8879  */
8880 typedef struct LDKCVec_TransactionOutputsZ {
8881    /**
8882     * The elements in the array.
8883     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8884     */
8885    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
8886    /**
8887     * The number of elements pointed to by `data`.
8888     */
8889    uintptr_t datalen;
8890 } LDKCVec_TransactionOutputsZ;
8891
8892 /**
8893  * Details about the balance(s) available for spending once the channel appears on chain.
8894  *
8895  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
8896  * be provided.
8897  */
8898 typedef enum LDKBalance_Tag {
8899    /**
8900     * The channel is not yet closed (or the commitment or closing transaction has not yet
8901     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
8902     * force-closed now.
8903     */
8904    LDKBalance_ClaimableOnChannelClose,
8905    /**
8906     * The channel has been closed, and the given balance is ours but awaiting confirmations until
8907     * we consider it spendable.
8908     */
8909    LDKBalance_ClaimableAwaitingConfirmations,
8910    /**
8911     * The channel has been closed, and the given balance should be ours but awaiting spending
8912     * transaction confirmation. If the spending transaction does not confirm in time, it is
8913     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
8914     *
8915     * Once the spending transaction confirms, before it has reached enough confirmations to be
8916     * considered safe from chain reorganizations, the balance will instead be provided via
8917     * [`Balance::ClaimableAwaitingConfirmations`].
8918     */
8919    LDKBalance_ContentiousClaimable,
8920    /**
8921     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
8922     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
8923     * likely to be claimed by our counterparty before we do.
8924     */
8925    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
8926    /**
8927     * Must be last for serialization purposes
8928     */
8929    LDKBalance_Sentinel,
8930 } LDKBalance_Tag;
8931
8932 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
8933    /**
8934     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8935     * required to do so.
8936     */
8937    uint64_t claimable_amount_satoshis;
8938 } LDKBalance_LDKClaimableOnChannelClose_Body;
8939
8940 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
8941    /**
8942     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
8943     * were spent in broadcasting the transaction.
8944     */
8945    uint64_t claimable_amount_satoshis;
8946    /**
8947     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
8948     * amount.
8949     */
8950    uint32_t confirmation_height;
8951 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
8952
8953 typedef struct LDKBalance_LDKContentiousClaimable_Body {
8954    /**
8955     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8956     * required to do so.
8957     */
8958    uint64_t claimable_amount_satoshis;
8959    /**
8960     * The height at which the counterparty may be able to claim the balance if we have not
8961     * done so.
8962     */
8963    uint32_t timeout_height;
8964 } LDKBalance_LDKContentiousClaimable_Body;
8965
8966 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
8967    /**
8968     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8969     * required to do so.
8970     */
8971    uint64_t claimable_amount_satoshis;
8972    /**
8973     * The height at which we will be able to claim the balance if our counterparty has not
8974     * done so.
8975     */
8976    uint32_t claimable_height;
8977 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
8978
8979 typedef struct MUST_USE_STRUCT LDKBalance {
8980    LDKBalance_Tag tag;
8981    union {
8982       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
8983       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
8984       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
8985       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
8986    };
8987 } LDKBalance;
8988
8989 /**
8990  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
8991  * This corresponds to std::vector in C++
8992  */
8993 typedef struct LDKCVec_BalanceZ {
8994    /**
8995     * The elements in the array.
8996     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8997     */
8998    struct LDKBalance *data;
8999    /**
9000     * The number of elements pointed to by `data`.
9001     */
9002    uintptr_t datalen;
9003 } LDKCVec_BalanceZ;
9004
9005 /**
9006  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9007  */
9008 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9009    /**
9010     * A pointer to the contents in the success state.
9011     * Reading from this pointer when `result_ok` is not set is undefined.
9012     */
9013    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
9014    /**
9015     * A pointer to the contents in the error state.
9016     * Reading from this pointer when `result_ok` is set is undefined.
9017     */
9018    struct LDKDecodeError *err;
9019 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
9020
9021 /**
9022  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9023  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9024  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9025  */
9026 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9027    /**
9028     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9029     * `err` or `result` depending on the state of `result_ok`.
9030     */
9031    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
9032    /**
9033     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9034     */
9035    bool result_ok;
9036 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
9037
9038 /**
9039  * A tuple of 2 elements. See the individual fields for the types contained.
9040  */
9041 typedef struct LDKC2Tuple_PublicKeyTypeZ {
9042    /**
9043     * The element at position 0
9044     */
9045    struct LDKPublicKey a;
9046    /**
9047     * The element at position 1
9048     */
9049    struct LDKType b;
9050 } LDKC2Tuple_PublicKeyTypeZ;
9051
9052 /**
9053  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9054  * This corresponds to std::vector in C++
9055  */
9056 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
9057    /**
9058     * The elements in the array.
9059     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9060     */
9061    struct LDKC2Tuple_PublicKeyTypeZ *data;
9062    /**
9063     * The number of elements pointed to by `data`.
9064     */
9065    uintptr_t datalen;
9066 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
9067
9068 /**
9069  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
9070  */
9071 typedef enum LDKCOption_NetAddressZ_Tag {
9072    /**
9073     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
9074     */
9075    LDKCOption_NetAddressZ_Some,
9076    /**
9077     * When we're in this state, this COption_NetAddressZ contains nothing
9078     */
9079    LDKCOption_NetAddressZ_None,
9080    /**
9081     * Must be last for serialization purposes
9082     */
9083    LDKCOption_NetAddressZ_Sentinel,
9084 } LDKCOption_NetAddressZ_Tag;
9085
9086 typedef struct LDKCOption_NetAddressZ {
9087    LDKCOption_NetAddressZ_Tag tag;
9088    union {
9089       struct {
9090          struct LDKNetAddress some;
9091       };
9092    };
9093 } LDKCOption_NetAddressZ;
9094
9095
9096
9097 /**
9098  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
9099  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
9100  * descriptor.
9101  */
9102 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
9103    /**
9104     * A pointer to the opaque Rust object.
9105     * Nearly everywhere, inner must be non-null, however in places where
9106     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9107     */
9108    LDKnativePeerHandleError *inner;
9109    /**
9110     * Indicates that this is the only struct which contains the same pointer.
9111     * Rust functions which take ownership of an object provided via an argument require
9112     * this to be true and invalidate the object pointed to by inner.
9113     */
9114    bool is_owned;
9115 } LDKPeerHandleError;
9116
9117 /**
9118  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
9119  */
9120 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
9121    /**
9122     * A pointer to the contents in the success state.
9123     * Reading from this pointer when `result_ok` is not set is undefined.
9124     */
9125    struct LDKCVec_u8Z *result;
9126    /**
9127     * A pointer to the contents in the error state.
9128     * Reading from this pointer when `result_ok` is set is undefined.
9129     */
9130    struct LDKPeerHandleError *err;
9131 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
9132
9133 /**
9134  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9135  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9136  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9137  */
9138 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
9139    /**
9140     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9141     * `err` or `result` depending on the state of `result_ok`.
9142     */
9143    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
9144    /**
9145     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9146     */
9147    bool result_ok;
9148 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
9149
9150 /**
9151  * The contents of CResult_NonePeerHandleErrorZ
9152  */
9153 typedef union LDKCResult_NonePeerHandleErrorZPtr {
9154    /**
9155     * Note that this value is always NULL, as there are no contents in the OK variant
9156     */
9157    void *result;
9158    /**
9159     * A pointer to the contents in the error state.
9160     * Reading from this pointer when `result_ok` is set is undefined.
9161     */
9162    struct LDKPeerHandleError *err;
9163 } LDKCResult_NonePeerHandleErrorZPtr;
9164
9165 /**
9166  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9167  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9168  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9169  */
9170 typedef struct LDKCResult_NonePeerHandleErrorZ {
9171    /**
9172     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9173     * `err` or `result` depending on the state of `result_ok`.
9174     */
9175    union LDKCResult_NonePeerHandleErrorZPtr contents;
9176    /**
9177     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
9178     */
9179    bool result_ok;
9180 } LDKCResult_NonePeerHandleErrorZ;
9181
9182 /**
9183  * The contents of CResult_boolPeerHandleErrorZ
9184  */
9185 typedef union LDKCResult_boolPeerHandleErrorZPtr {
9186    /**
9187     * A pointer to the contents in the success state.
9188     * Reading from this pointer when `result_ok` is not set is undefined.
9189     */
9190    bool *result;
9191    /**
9192     * A pointer to the contents in the error state.
9193     * Reading from this pointer when `result_ok` is set is undefined.
9194     */
9195    struct LDKPeerHandleError *err;
9196 } LDKCResult_boolPeerHandleErrorZPtr;
9197
9198 /**
9199  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9200  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9201  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9202  */
9203 typedef struct LDKCResult_boolPeerHandleErrorZ {
9204    /**
9205     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9206     * `err` or `result` depending on the state of `result_ok`.
9207     */
9208    union LDKCResult_boolPeerHandleErrorZPtr contents;
9209    /**
9210     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
9211     */
9212    bool result_ok;
9213 } LDKCResult_boolPeerHandleErrorZ;
9214
9215 /**
9216  * All-encompassing standard error type that processing can return
9217  */
9218 typedef enum LDKGraphSyncError_Tag {
9219    /**
9220     * Error trying to read the update data, typically due to an erroneous data length indication
9221     * that is greater than the actual amount of data provided
9222     */
9223    LDKGraphSyncError_DecodeError,
9224    /**
9225     * Error applying the patch to the network graph, usually the result of updates that are too
9226     * old or missing prerequisite data to the application of updates out of order
9227     */
9228    LDKGraphSyncError_LightningError,
9229    /**
9230     * Must be last for serialization purposes
9231     */
9232    LDKGraphSyncError_Sentinel,
9233 } LDKGraphSyncError_Tag;
9234
9235 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
9236    LDKGraphSyncError_Tag tag;
9237    union {
9238       struct {
9239          struct LDKDecodeError decode_error;
9240       };
9241       struct {
9242          struct LDKLightningError lightning_error;
9243       };
9244    };
9245 } LDKGraphSyncError;
9246
9247 /**
9248  * The contents of CResult_u32GraphSyncErrorZ
9249  */
9250 typedef union LDKCResult_u32GraphSyncErrorZPtr {
9251    /**
9252     * A pointer to the contents in the success state.
9253     * Reading from this pointer when `result_ok` is not set is undefined.
9254     */
9255    uint32_t *result;
9256    /**
9257     * A pointer to the contents in the error state.
9258     * Reading from this pointer when `result_ok` is set is undefined.
9259     */
9260    struct LDKGraphSyncError *err;
9261 } LDKCResult_u32GraphSyncErrorZPtr;
9262
9263 /**
9264  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
9265  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
9266  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9267  */
9268 typedef struct LDKCResult_u32GraphSyncErrorZ {
9269    /**
9270     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
9271     * `err` or `result` depending on the state of `result_ok`.
9272     */
9273    union LDKCResult_u32GraphSyncErrorZPtr contents;
9274    /**
9275     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
9276     */
9277    bool result_ok;
9278 } LDKCResult_u32GraphSyncErrorZ;
9279
9280 /**
9281  * The contents of CResult_NetAddressDecodeErrorZ
9282  */
9283 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
9284    /**
9285     * A pointer to the contents in the success state.
9286     * Reading from this pointer when `result_ok` is not set is undefined.
9287     */
9288    struct LDKNetAddress *result;
9289    /**
9290     * A pointer to the contents in the error state.
9291     * Reading from this pointer when `result_ok` is set is undefined.
9292     */
9293    struct LDKDecodeError *err;
9294 } LDKCResult_NetAddressDecodeErrorZPtr;
9295
9296 /**
9297  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9298  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9299  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9300  */
9301 typedef struct LDKCResult_NetAddressDecodeErrorZ {
9302    /**
9303     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9304     * `err` or `result` depending on the state of `result_ok`.
9305     */
9306    union LDKCResult_NetAddressDecodeErrorZPtr contents;
9307    /**
9308     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9309     */
9310    bool result_ok;
9311 } LDKCResult_NetAddressDecodeErrorZ;
9312
9313
9314
9315 /**
9316  * An update_add_htlc message to be sent or received from a peer
9317  */
9318 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
9319    /**
9320     * A pointer to the opaque Rust object.
9321     * Nearly everywhere, inner must be non-null, however in places where
9322     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9323     */
9324    LDKnativeUpdateAddHTLC *inner;
9325    /**
9326     * Indicates that this is the only struct which contains the same pointer.
9327     * Rust functions which take ownership of an object provided via an argument require
9328     * this to be true and invalidate the object pointed to by inner.
9329     */
9330    bool is_owned;
9331 } LDKUpdateAddHTLC;
9332
9333 /**
9334  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9335  * This corresponds to std::vector in C++
9336  */
9337 typedef struct LDKCVec_UpdateAddHTLCZ {
9338    /**
9339     * The elements in the array.
9340     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9341     */
9342    struct LDKUpdateAddHTLC *data;
9343    /**
9344     * The number of elements pointed to by `data`.
9345     */
9346    uintptr_t datalen;
9347 } LDKCVec_UpdateAddHTLCZ;
9348
9349
9350
9351 /**
9352  * An update_fulfill_htlc message to be sent or received from a peer
9353  */
9354 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
9355    /**
9356     * A pointer to the opaque Rust object.
9357     * Nearly everywhere, inner must be non-null, however in places where
9358     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9359     */
9360    LDKnativeUpdateFulfillHTLC *inner;
9361    /**
9362     * Indicates that this is the only struct which contains the same pointer.
9363     * Rust functions which take ownership of an object provided via an argument require
9364     * this to be true and invalidate the object pointed to by inner.
9365     */
9366    bool is_owned;
9367 } LDKUpdateFulfillHTLC;
9368
9369 /**
9370  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9371  * This corresponds to std::vector in C++
9372  */
9373 typedef struct LDKCVec_UpdateFulfillHTLCZ {
9374    /**
9375     * The elements in the array.
9376     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9377     */
9378    struct LDKUpdateFulfillHTLC *data;
9379    /**
9380     * The number of elements pointed to by `data`.
9381     */
9382    uintptr_t datalen;
9383 } LDKCVec_UpdateFulfillHTLCZ;
9384
9385
9386
9387 /**
9388  * An update_fail_htlc message to be sent or received from a peer
9389  */
9390 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
9391    /**
9392     * A pointer to the opaque Rust object.
9393     * Nearly everywhere, inner must be non-null, however in places where
9394     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9395     */
9396    LDKnativeUpdateFailHTLC *inner;
9397    /**
9398     * Indicates that this is the only struct which contains the same pointer.
9399     * Rust functions which take ownership of an object provided via an argument require
9400     * this to be true and invalidate the object pointed to by inner.
9401     */
9402    bool is_owned;
9403 } LDKUpdateFailHTLC;
9404
9405 /**
9406  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9407  * This corresponds to std::vector in C++
9408  */
9409 typedef struct LDKCVec_UpdateFailHTLCZ {
9410    /**
9411     * The elements in the array.
9412     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9413     */
9414    struct LDKUpdateFailHTLC *data;
9415    /**
9416     * The number of elements pointed to by `data`.
9417     */
9418    uintptr_t datalen;
9419 } LDKCVec_UpdateFailHTLCZ;
9420
9421
9422
9423 /**
9424  * An update_fail_malformed_htlc message to be sent or received from a peer
9425  */
9426 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
9427    /**
9428     * A pointer to the opaque Rust object.
9429     * Nearly everywhere, inner must be non-null, however in places where
9430     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9431     */
9432    LDKnativeUpdateFailMalformedHTLC *inner;
9433    /**
9434     * Indicates that this is the only struct which contains the same pointer.
9435     * Rust functions which take ownership of an object provided via an argument require
9436     * this to be true and invalidate the object pointed to by inner.
9437     */
9438    bool is_owned;
9439 } LDKUpdateFailMalformedHTLC;
9440
9441 /**
9442  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9443  * This corresponds to std::vector in C++
9444  */
9445 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
9446    /**
9447     * The elements in the array.
9448     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9449     */
9450    struct LDKUpdateFailMalformedHTLC *data;
9451    /**
9452     * The number of elements pointed to by `data`.
9453     */
9454    uintptr_t datalen;
9455 } LDKCVec_UpdateFailMalformedHTLCZ;
9456
9457 /**
9458  * The contents of CResult_AcceptChannelDecodeErrorZ
9459  */
9460 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
9461    /**
9462     * A pointer to the contents in the success state.
9463     * Reading from this pointer when `result_ok` is not set is undefined.
9464     */
9465    struct LDKAcceptChannel *result;
9466    /**
9467     * A pointer to the contents in the error state.
9468     * Reading from this pointer when `result_ok` is set is undefined.
9469     */
9470    struct LDKDecodeError *err;
9471 } LDKCResult_AcceptChannelDecodeErrorZPtr;
9472
9473 /**
9474  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9475  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9476  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9477  */
9478 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
9479    /**
9480     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9481     * `err` or `result` depending on the state of `result_ok`.
9482     */
9483    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
9484    /**
9485     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9486     */
9487    bool result_ok;
9488 } LDKCResult_AcceptChannelDecodeErrorZ;
9489
9490 /**
9491  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9492  */
9493 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
9494    /**
9495     * A pointer to the contents in the success state.
9496     * Reading from this pointer when `result_ok` is not set is undefined.
9497     */
9498    struct LDKAnnouncementSignatures *result;
9499    /**
9500     * A pointer to the contents in the error state.
9501     * Reading from this pointer when `result_ok` is set is undefined.
9502     */
9503    struct LDKDecodeError *err;
9504 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
9505
9506 /**
9507  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9508  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9509  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9510  */
9511 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
9512    /**
9513     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9514     * `err` or `result` depending on the state of `result_ok`.
9515     */
9516    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
9517    /**
9518     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9519     */
9520    bool result_ok;
9521 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
9522
9523 /**
9524  * The contents of CResult_ChannelReestablishDecodeErrorZ
9525  */
9526 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
9527    /**
9528     * A pointer to the contents in the success state.
9529     * Reading from this pointer when `result_ok` is not set is undefined.
9530     */
9531    struct LDKChannelReestablish *result;
9532    /**
9533     * A pointer to the contents in the error state.
9534     * Reading from this pointer when `result_ok` is set is undefined.
9535     */
9536    struct LDKDecodeError *err;
9537 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
9538
9539 /**
9540  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9541  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9542  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9543  */
9544 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
9545    /**
9546     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9547     * `err` or `result` depending on the state of `result_ok`.
9548     */
9549    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
9550    /**
9551     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9552     */
9553    bool result_ok;
9554 } LDKCResult_ChannelReestablishDecodeErrorZ;
9555
9556 /**
9557  * The contents of CResult_ClosingSignedDecodeErrorZ
9558  */
9559 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
9560    /**
9561     * A pointer to the contents in the success state.
9562     * Reading from this pointer when `result_ok` is not set is undefined.
9563     */
9564    struct LDKClosingSigned *result;
9565    /**
9566     * A pointer to the contents in the error state.
9567     * Reading from this pointer when `result_ok` is set is undefined.
9568     */
9569    struct LDKDecodeError *err;
9570 } LDKCResult_ClosingSignedDecodeErrorZPtr;
9571
9572 /**
9573  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9574  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9575  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9576  */
9577 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
9578    /**
9579     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9580     * `err` or `result` depending on the state of `result_ok`.
9581     */
9582    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
9583    /**
9584     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9585     */
9586    bool result_ok;
9587 } LDKCResult_ClosingSignedDecodeErrorZ;
9588
9589
9590
9591 /**
9592  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
9593  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
9594  * to use.
9595  */
9596 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
9597    /**
9598     * A pointer to the opaque Rust object.
9599     * Nearly everywhere, inner must be non-null, however in places where
9600     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9601     */
9602    LDKnativeClosingSignedFeeRange *inner;
9603    /**
9604     * Indicates that this is the only struct which contains the same pointer.
9605     * Rust functions which take ownership of an object provided via an argument require
9606     * this to be true and invalidate the object pointed to by inner.
9607     */
9608    bool is_owned;
9609 } LDKClosingSignedFeeRange;
9610
9611 /**
9612  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9613  */
9614 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9615    /**
9616     * A pointer to the contents in the success state.
9617     * Reading from this pointer when `result_ok` is not set is undefined.
9618     */
9619    struct LDKClosingSignedFeeRange *result;
9620    /**
9621     * A pointer to the contents in the error state.
9622     * Reading from this pointer when `result_ok` is set is undefined.
9623     */
9624    struct LDKDecodeError *err;
9625 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
9626
9627 /**
9628  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9629  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9630  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9631  */
9632 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
9633    /**
9634     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9635     * `err` or `result` depending on the state of `result_ok`.
9636     */
9637    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
9638    /**
9639     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9640     */
9641    bool result_ok;
9642 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
9643
9644
9645
9646 /**
9647  * A commitment_signed message to be sent or received from a peer
9648  */
9649 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
9650    /**
9651     * A pointer to the opaque Rust object.
9652     * Nearly everywhere, inner must be non-null, however in places where
9653     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9654     */
9655    LDKnativeCommitmentSigned *inner;
9656    /**
9657     * Indicates that this is the only struct which contains the same pointer.
9658     * Rust functions which take ownership of an object provided via an argument require
9659     * this to be true and invalidate the object pointed to by inner.
9660     */
9661    bool is_owned;
9662 } LDKCommitmentSigned;
9663
9664 /**
9665  * The contents of CResult_CommitmentSignedDecodeErrorZ
9666  */
9667 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
9668    /**
9669     * A pointer to the contents in the success state.
9670     * Reading from this pointer when `result_ok` is not set is undefined.
9671     */
9672    struct LDKCommitmentSigned *result;
9673    /**
9674     * A pointer to the contents in the error state.
9675     * Reading from this pointer when `result_ok` is set is undefined.
9676     */
9677    struct LDKDecodeError *err;
9678 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
9679
9680 /**
9681  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9682  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9683  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9684  */
9685 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
9686    /**
9687     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9688     * `err` or `result` depending on the state of `result_ok`.
9689     */
9690    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
9691    /**
9692     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9693     */
9694    bool result_ok;
9695 } LDKCResult_CommitmentSignedDecodeErrorZ;
9696
9697 /**
9698  * The contents of CResult_FundingCreatedDecodeErrorZ
9699  */
9700 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
9701    /**
9702     * A pointer to the contents in the success state.
9703     * Reading from this pointer when `result_ok` is not set is undefined.
9704     */
9705    struct LDKFundingCreated *result;
9706    /**
9707     * A pointer to the contents in the error state.
9708     * Reading from this pointer when `result_ok` is set is undefined.
9709     */
9710    struct LDKDecodeError *err;
9711 } LDKCResult_FundingCreatedDecodeErrorZPtr;
9712
9713 /**
9714  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9715  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9716  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9717  */
9718 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
9719    /**
9720     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9721     * `err` or `result` depending on the state of `result_ok`.
9722     */
9723    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
9724    /**
9725     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9726     */
9727    bool result_ok;
9728 } LDKCResult_FundingCreatedDecodeErrorZ;
9729
9730 /**
9731  * The contents of CResult_FundingSignedDecodeErrorZ
9732  */
9733 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
9734    /**
9735     * A pointer to the contents in the success state.
9736     * Reading from this pointer when `result_ok` is not set is undefined.
9737     */
9738    struct LDKFundingSigned *result;
9739    /**
9740     * A pointer to the contents in the error state.
9741     * Reading from this pointer when `result_ok` is set is undefined.
9742     */
9743    struct LDKDecodeError *err;
9744 } LDKCResult_FundingSignedDecodeErrorZPtr;
9745
9746 /**
9747  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9748  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9749  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9750  */
9751 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
9752    /**
9753     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9754     * `err` or `result` depending on the state of `result_ok`.
9755     */
9756    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
9757    /**
9758     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9759     */
9760    bool result_ok;
9761 } LDKCResult_FundingSignedDecodeErrorZ;
9762
9763 /**
9764  * The contents of CResult_ChannelReadyDecodeErrorZ
9765  */
9766 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
9767    /**
9768     * A pointer to the contents in the success state.
9769     * Reading from this pointer when `result_ok` is not set is undefined.
9770     */
9771    struct LDKChannelReady *result;
9772    /**
9773     * A pointer to the contents in the error state.
9774     * Reading from this pointer when `result_ok` is set is undefined.
9775     */
9776    struct LDKDecodeError *err;
9777 } LDKCResult_ChannelReadyDecodeErrorZPtr;
9778
9779 /**
9780  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
9781  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
9782  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9783  */
9784 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
9785    /**
9786     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
9787     * `err` or `result` depending on the state of `result_ok`.
9788     */
9789    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
9790    /**
9791     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
9792     */
9793    bool result_ok;
9794 } LDKCResult_ChannelReadyDecodeErrorZ;
9795
9796
9797
9798 /**
9799  * An init message to be sent or received from a peer
9800  */
9801 typedef struct MUST_USE_STRUCT LDKInit {
9802    /**
9803     * A pointer to the opaque Rust object.
9804     * Nearly everywhere, inner must be non-null, however in places where
9805     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9806     */
9807    LDKnativeInit *inner;
9808    /**
9809     * Indicates that this is the only struct which contains the same pointer.
9810     * Rust functions which take ownership of an object provided via an argument require
9811     * this to be true and invalidate the object pointed to by inner.
9812     */
9813    bool is_owned;
9814 } LDKInit;
9815
9816 /**
9817  * The contents of CResult_InitDecodeErrorZ
9818  */
9819 typedef union LDKCResult_InitDecodeErrorZPtr {
9820    /**
9821     * A pointer to the contents in the success state.
9822     * Reading from this pointer when `result_ok` is not set is undefined.
9823     */
9824    struct LDKInit *result;
9825    /**
9826     * A pointer to the contents in the error state.
9827     * Reading from this pointer when `result_ok` is set is undefined.
9828     */
9829    struct LDKDecodeError *err;
9830 } LDKCResult_InitDecodeErrorZPtr;
9831
9832 /**
9833  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9834  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9835  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9836  */
9837 typedef struct LDKCResult_InitDecodeErrorZ {
9838    /**
9839     * The contents of this CResult_InitDecodeErrorZ, accessible via either
9840     * `err` or `result` depending on the state of `result_ok`.
9841     */
9842    union LDKCResult_InitDecodeErrorZPtr contents;
9843    /**
9844     * Whether this CResult_InitDecodeErrorZ represents a success state.
9845     */
9846    bool result_ok;
9847 } LDKCResult_InitDecodeErrorZ;
9848
9849 /**
9850  * The contents of CResult_OpenChannelDecodeErrorZ
9851  */
9852 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
9853    /**
9854     * A pointer to the contents in the success state.
9855     * Reading from this pointer when `result_ok` is not set is undefined.
9856     */
9857    struct LDKOpenChannel *result;
9858    /**
9859     * A pointer to the contents in the error state.
9860     * Reading from this pointer when `result_ok` is set is undefined.
9861     */
9862    struct LDKDecodeError *err;
9863 } LDKCResult_OpenChannelDecodeErrorZPtr;
9864
9865 /**
9866  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9867  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9868  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9869  */
9870 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
9871    /**
9872     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9873     * `err` or `result` depending on the state of `result_ok`.
9874     */
9875    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
9876    /**
9877     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9878     */
9879    bool result_ok;
9880 } LDKCResult_OpenChannelDecodeErrorZ;
9881
9882 /**
9883  * The contents of CResult_RevokeAndACKDecodeErrorZ
9884  */
9885 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
9886    /**
9887     * A pointer to the contents in the success state.
9888     * Reading from this pointer when `result_ok` is not set is undefined.
9889     */
9890    struct LDKRevokeAndACK *result;
9891    /**
9892     * A pointer to the contents in the error state.
9893     * Reading from this pointer when `result_ok` is set is undefined.
9894     */
9895    struct LDKDecodeError *err;
9896 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
9897
9898 /**
9899  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9900  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9901  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9902  */
9903 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
9904    /**
9905     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9906     * `err` or `result` depending on the state of `result_ok`.
9907     */
9908    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
9909    /**
9910     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9911     */
9912    bool result_ok;
9913 } LDKCResult_RevokeAndACKDecodeErrorZ;
9914
9915 /**
9916  * The contents of CResult_ShutdownDecodeErrorZ
9917  */
9918 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
9919    /**
9920     * A pointer to the contents in the success state.
9921     * Reading from this pointer when `result_ok` is not set is undefined.
9922     */
9923    struct LDKShutdown *result;
9924    /**
9925     * A pointer to the contents in the error state.
9926     * Reading from this pointer when `result_ok` is set is undefined.
9927     */
9928    struct LDKDecodeError *err;
9929 } LDKCResult_ShutdownDecodeErrorZPtr;
9930
9931 /**
9932  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9933  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9934  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9935  */
9936 typedef struct LDKCResult_ShutdownDecodeErrorZ {
9937    /**
9938     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9939     * `err` or `result` depending on the state of `result_ok`.
9940     */
9941    union LDKCResult_ShutdownDecodeErrorZPtr contents;
9942    /**
9943     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9944     */
9945    bool result_ok;
9946 } LDKCResult_ShutdownDecodeErrorZ;
9947
9948 /**
9949  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
9950  */
9951 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
9952    /**
9953     * A pointer to the contents in the success state.
9954     * Reading from this pointer when `result_ok` is not set is undefined.
9955     */
9956    struct LDKUpdateFailHTLC *result;
9957    /**
9958     * A pointer to the contents in the error state.
9959     * Reading from this pointer when `result_ok` is set is undefined.
9960     */
9961    struct LDKDecodeError *err;
9962 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
9963
9964 /**
9965  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9966  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9967  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9968  */
9969 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
9970    /**
9971     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9972     * `err` or `result` depending on the state of `result_ok`.
9973     */
9974    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
9975    /**
9976     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9977     */
9978    bool result_ok;
9979 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
9980
9981 /**
9982  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9983  */
9984 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9985    /**
9986     * A pointer to the contents in the success state.
9987     * Reading from this pointer when `result_ok` is not set is undefined.
9988     */
9989    struct LDKUpdateFailMalformedHTLC *result;
9990    /**
9991     * A pointer to the contents in the error state.
9992     * Reading from this pointer when `result_ok` is set is undefined.
9993     */
9994    struct LDKDecodeError *err;
9995 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
9996
9997 /**
9998  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9999  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10000  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10001  */
10002 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
10003    /**
10004     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10005     * `err` or `result` depending on the state of `result_ok`.
10006     */
10007    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
10008    /**
10009     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10010     */
10011    bool result_ok;
10012 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
10013
10014
10015
10016 /**
10017  * An update_fee message to be sent or received from a peer
10018  */
10019 typedef struct MUST_USE_STRUCT LDKUpdateFee {
10020    /**
10021     * A pointer to the opaque Rust object.
10022     * Nearly everywhere, inner must be non-null, however in places where
10023     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10024     */
10025    LDKnativeUpdateFee *inner;
10026    /**
10027     * Indicates that this is the only struct which contains the same pointer.
10028     * Rust functions which take ownership of an object provided via an argument require
10029     * this to be true and invalidate the object pointed to by inner.
10030     */
10031    bool is_owned;
10032 } LDKUpdateFee;
10033
10034 /**
10035  * The contents of CResult_UpdateFeeDecodeErrorZ
10036  */
10037 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
10038    /**
10039     * A pointer to the contents in the success state.
10040     * Reading from this pointer when `result_ok` is not set is undefined.
10041     */
10042    struct LDKUpdateFee *result;
10043    /**
10044     * A pointer to the contents in the error state.
10045     * Reading from this pointer when `result_ok` is set is undefined.
10046     */
10047    struct LDKDecodeError *err;
10048 } LDKCResult_UpdateFeeDecodeErrorZPtr;
10049
10050 /**
10051  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10052  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10053  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10054  */
10055 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
10056    /**
10057     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10058     * `err` or `result` depending on the state of `result_ok`.
10059     */
10060    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
10061    /**
10062     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10063     */
10064    bool result_ok;
10065 } LDKCResult_UpdateFeeDecodeErrorZ;
10066
10067 /**
10068  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
10069  */
10070 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
10071    /**
10072     * A pointer to the contents in the success state.
10073     * Reading from this pointer when `result_ok` is not set is undefined.
10074     */
10075    struct LDKUpdateFulfillHTLC *result;
10076    /**
10077     * A pointer to the contents in the error state.
10078     * Reading from this pointer when `result_ok` is set is undefined.
10079     */
10080    struct LDKDecodeError *err;
10081 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
10082
10083 /**
10084  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
10085  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10086  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10087  */
10088 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
10089    /**
10090     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
10091     * `err` or `result` depending on the state of `result_ok`.
10092     */
10093    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
10094    /**
10095     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
10096     */
10097    bool result_ok;
10098 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
10099
10100 /**
10101  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
10102  */
10103 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
10104    /**
10105     * A pointer to the contents in the success state.
10106     * Reading from this pointer when `result_ok` is not set is undefined.
10107     */
10108    struct LDKUpdateAddHTLC *result;
10109    /**
10110     * A pointer to the contents in the error state.
10111     * Reading from this pointer when `result_ok` is set is undefined.
10112     */
10113    struct LDKDecodeError *err;
10114 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
10115
10116 /**
10117  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
10118  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10119  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10120  */
10121 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
10122    /**
10123     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
10124     * `err` or `result` depending on the state of `result_ok`.
10125     */
10126    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
10127    /**
10128     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
10129     */
10130    bool result_ok;
10131 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
10132
10133
10134
10135 /**
10136  * A ping message to be sent or received from a peer
10137  */
10138 typedef struct MUST_USE_STRUCT LDKPing {
10139    /**
10140     * A pointer to the opaque Rust object.
10141     * Nearly everywhere, inner must be non-null, however in places where
10142     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10143     */
10144    LDKnativePing *inner;
10145    /**
10146     * Indicates that this is the only struct which contains the same pointer.
10147     * Rust functions which take ownership of an object provided via an argument require
10148     * this to be true and invalidate the object pointed to by inner.
10149     */
10150    bool is_owned;
10151 } LDKPing;
10152
10153 /**
10154  * The contents of CResult_PingDecodeErrorZ
10155  */
10156 typedef union LDKCResult_PingDecodeErrorZPtr {
10157    /**
10158     * A pointer to the contents in the success state.
10159     * Reading from this pointer when `result_ok` is not set is undefined.
10160     */
10161    struct LDKPing *result;
10162    /**
10163     * A pointer to the contents in the error state.
10164     * Reading from this pointer when `result_ok` is set is undefined.
10165     */
10166    struct LDKDecodeError *err;
10167 } LDKCResult_PingDecodeErrorZPtr;
10168
10169 /**
10170  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10171  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10172  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10173  */
10174 typedef struct LDKCResult_PingDecodeErrorZ {
10175    /**
10176     * The contents of this CResult_PingDecodeErrorZ, accessible via either
10177     * `err` or `result` depending on the state of `result_ok`.
10178     */
10179    union LDKCResult_PingDecodeErrorZPtr contents;
10180    /**
10181     * Whether this CResult_PingDecodeErrorZ represents a success state.
10182     */
10183    bool result_ok;
10184 } LDKCResult_PingDecodeErrorZ;
10185
10186
10187
10188 /**
10189  * A pong message to be sent or received from a peer
10190  */
10191 typedef struct MUST_USE_STRUCT LDKPong {
10192    /**
10193     * A pointer to the opaque Rust object.
10194     * Nearly everywhere, inner must be non-null, however in places where
10195     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10196     */
10197    LDKnativePong *inner;
10198    /**
10199     * Indicates that this is the only struct which contains the same pointer.
10200     * Rust functions which take ownership of an object provided via an argument require
10201     * this to be true and invalidate the object pointed to by inner.
10202     */
10203    bool is_owned;
10204 } LDKPong;
10205
10206 /**
10207  * The contents of CResult_PongDecodeErrorZ
10208  */
10209 typedef union LDKCResult_PongDecodeErrorZPtr {
10210    /**
10211     * A pointer to the contents in the success state.
10212     * Reading from this pointer when `result_ok` is not set is undefined.
10213     */
10214    struct LDKPong *result;
10215    /**
10216     * A pointer to the contents in the error state.
10217     * Reading from this pointer when `result_ok` is set is undefined.
10218     */
10219    struct LDKDecodeError *err;
10220 } LDKCResult_PongDecodeErrorZPtr;
10221
10222 /**
10223  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
10224  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
10225  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10226  */
10227 typedef struct LDKCResult_PongDecodeErrorZ {
10228    /**
10229     * The contents of this CResult_PongDecodeErrorZ, accessible via either
10230     * `err` or `result` depending on the state of `result_ok`.
10231     */
10232    union LDKCResult_PongDecodeErrorZPtr contents;
10233    /**
10234     * Whether this CResult_PongDecodeErrorZ represents a success state.
10235     */
10236    bool result_ok;
10237 } LDKCResult_PongDecodeErrorZ;
10238
10239 /**
10240  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
10241  */
10242 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10243    /**
10244     * A pointer to the contents in the success state.
10245     * Reading from this pointer when `result_ok` is not set is undefined.
10246     */
10247    struct LDKUnsignedChannelAnnouncement *result;
10248    /**
10249     * A pointer to the contents in the error state.
10250     * Reading from this pointer when `result_ok` is set is undefined.
10251     */
10252    struct LDKDecodeError *err;
10253 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
10254
10255 /**
10256  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10257  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10258  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10259  */
10260 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
10261    /**
10262     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10263     * `err` or `result` depending on the state of `result_ok`.
10264     */
10265    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
10266    /**
10267     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10268     */
10269    bool result_ok;
10270 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
10271
10272 /**
10273  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
10274  */
10275 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
10276    /**
10277     * A pointer to the contents in the success state.
10278     * Reading from this pointer when `result_ok` is not set is undefined.
10279     */
10280    struct LDKChannelAnnouncement *result;
10281    /**
10282     * A pointer to the contents in the error state.
10283     * Reading from this pointer when `result_ok` is set is undefined.
10284     */
10285    struct LDKDecodeError *err;
10286 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
10287
10288 /**
10289  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10290  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10291  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10292  */
10293 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
10294    /**
10295     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10296     * `err` or `result` depending on the state of `result_ok`.
10297     */
10298    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
10299    /**
10300     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10301     */
10302    bool result_ok;
10303 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
10304
10305
10306
10307 /**
10308  * The unsigned part of a channel_update
10309  */
10310 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
10311    /**
10312     * A pointer to the opaque Rust object.
10313     * Nearly everywhere, inner must be non-null, however in places where
10314     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10315     */
10316    LDKnativeUnsignedChannelUpdate *inner;
10317    /**
10318     * Indicates that this is the only struct which contains the same pointer.
10319     * Rust functions which take ownership of an object provided via an argument require
10320     * this to be true and invalidate the object pointed to by inner.
10321     */
10322    bool is_owned;
10323 } LDKUnsignedChannelUpdate;
10324
10325 /**
10326  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10327  */
10328 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
10329    /**
10330     * A pointer to the contents in the success state.
10331     * Reading from this pointer when `result_ok` is not set is undefined.
10332     */
10333    struct LDKUnsignedChannelUpdate *result;
10334    /**
10335     * A pointer to the contents in the error state.
10336     * Reading from this pointer when `result_ok` is set is undefined.
10337     */
10338    struct LDKDecodeError *err;
10339 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
10340
10341 /**
10342  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10343  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10344  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10345  */
10346 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
10347    /**
10348     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10349     * `err` or `result` depending on the state of `result_ok`.
10350     */
10351    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
10352    /**
10353     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10354     */
10355    bool result_ok;
10356 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
10357
10358 /**
10359  * The contents of CResult_ChannelUpdateDecodeErrorZ
10360  */
10361 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
10362    /**
10363     * A pointer to the contents in the success state.
10364     * Reading from this pointer when `result_ok` is not set is undefined.
10365     */
10366    struct LDKChannelUpdate *result;
10367    /**
10368     * A pointer to the contents in the error state.
10369     * Reading from this pointer when `result_ok` is set is undefined.
10370     */
10371    struct LDKDecodeError *err;
10372 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
10373
10374 /**
10375  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10376  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10377  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10378  */
10379 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
10380    /**
10381     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10382     * `err` or `result` depending on the state of `result_ok`.
10383     */
10384    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
10385    /**
10386     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10387     */
10388    bool result_ok;
10389 } LDKCResult_ChannelUpdateDecodeErrorZ;
10390
10391 /**
10392  * The contents of CResult_ErrorMessageDecodeErrorZ
10393  */
10394 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
10395    /**
10396     * A pointer to the contents in the success state.
10397     * Reading from this pointer when `result_ok` is not set is undefined.
10398     */
10399    struct LDKErrorMessage *result;
10400    /**
10401     * A pointer to the contents in the error state.
10402     * Reading from this pointer when `result_ok` is set is undefined.
10403     */
10404    struct LDKDecodeError *err;
10405 } LDKCResult_ErrorMessageDecodeErrorZPtr;
10406
10407 /**
10408  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10409  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10410  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10411  */
10412 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
10413    /**
10414     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10415     * `err` or `result` depending on the state of `result_ok`.
10416     */
10417    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
10418    /**
10419     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10420     */
10421    bool result_ok;
10422 } LDKCResult_ErrorMessageDecodeErrorZ;
10423
10424 /**
10425  * The contents of CResult_WarningMessageDecodeErrorZ
10426  */
10427 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
10428    /**
10429     * A pointer to the contents in the success state.
10430     * Reading from this pointer when `result_ok` is not set is undefined.
10431     */
10432    struct LDKWarningMessage *result;
10433    /**
10434     * A pointer to the contents in the error state.
10435     * Reading from this pointer when `result_ok` is set is undefined.
10436     */
10437    struct LDKDecodeError *err;
10438 } LDKCResult_WarningMessageDecodeErrorZPtr;
10439
10440 /**
10441  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
10442  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10443  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10444  */
10445 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
10446    /**
10447     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
10448     * `err` or `result` depending on the state of `result_ok`.
10449     */
10450    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
10451    /**
10452     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
10453     */
10454    bool result_ok;
10455 } LDKCResult_WarningMessageDecodeErrorZ;
10456
10457
10458
10459 /**
10460  * The unsigned part of a node_announcement
10461  */
10462 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
10463    /**
10464     * A pointer to the opaque Rust object.
10465     * Nearly everywhere, inner must be non-null, however in places where
10466     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10467     */
10468    LDKnativeUnsignedNodeAnnouncement *inner;
10469    /**
10470     * Indicates that this is the only struct which contains the same pointer.
10471     * Rust functions which take ownership of an object provided via an argument require
10472     * this to be true and invalidate the object pointed to by inner.
10473     */
10474    bool is_owned;
10475 } LDKUnsignedNodeAnnouncement;
10476
10477 /**
10478  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10479  */
10480 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10481    /**
10482     * A pointer to the contents in the success state.
10483     * Reading from this pointer when `result_ok` is not set is undefined.
10484     */
10485    struct LDKUnsignedNodeAnnouncement *result;
10486    /**
10487     * A pointer to the contents in the error state.
10488     * Reading from this pointer when `result_ok` is set is undefined.
10489     */
10490    struct LDKDecodeError *err;
10491 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
10492
10493 /**
10494  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10495  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10496  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10497  */
10498 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
10499    /**
10500     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10501     * `err` or `result` depending on the state of `result_ok`.
10502     */
10503    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
10504    /**
10505     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10506     */
10507    bool result_ok;
10508 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
10509
10510 /**
10511  * The contents of CResult_NodeAnnouncementDecodeErrorZ
10512  */
10513 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
10514    /**
10515     * A pointer to the contents in the success state.
10516     * Reading from this pointer when `result_ok` is not set is undefined.
10517     */
10518    struct LDKNodeAnnouncement *result;
10519    /**
10520     * A pointer to the contents in the error state.
10521     * Reading from this pointer when `result_ok` is set is undefined.
10522     */
10523    struct LDKDecodeError *err;
10524 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
10525
10526 /**
10527  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10528  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10529  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10530  */
10531 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
10532    /**
10533     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10534     * `err` or `result` depending on the state of `result_ok`.
10535     */
10536    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
10537    /**
10538     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10539     */
10540    bool result_ok;
10541 } LDKCResult_NodeAnnouncementDecodeErrorZ;
10542
10543 /**
10544  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10545  */
10546 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
10547    /**
10548     * A pointer to the contents in the success state.
10549     * Reading from this pointer when `result_ok` is not set is undefined.
10550     */
10551    struct LDKQueryShortChannelIds *result;
10552    /**
10553     * A pointer to the contents in the error state.
10554     * Reading from this pointer when `result_ok` is set is undefined.
10555     */
10556    struct LDKDecodeError *err;
10557 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
10558
10559 /**
10560  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10561  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10562  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10563  */
10564 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
10565    /**
10566     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10567     * `err` or `result` depending on the state of `result_ok`.
10568     */
10569    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
10570    /**
10571     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10572     */
10573    bool result_ok;
10574 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
10575
10576
10577
10578 /**
10579  * A reply_short_channel_ids_end message is sent as a reply to a
10580  * query_short_channel_ids message. The query recipient makes a best
10581  * effort to respond based on their local network view which may not be
10582  * a perfect view of the network.
10583  */
10584 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
10585    /**
10586     * A pointer to the opaque Rust object.
10587     * Nearly everywhere, inner must be non-null, however in places where
10588     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10589     */
10590    LDKnativeReplyShortChannelIdsEnd *inner;
10591    /**
10592     * Indicates that this is the only struct which contains the same pointer.
10593     * Rust functions which take ownership of an object provided via an argument require
10594     * this to be true and invalidate the object pointed to by inner.
10595     */
10596    bool is_owned;
10597 } LDKReplyShortChannelIdsEnd;
10598
10599 /**
10600  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10601  */
10602 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10603    /**
10604     * A pointer to the contents in the success state.
10605     * Reading from this pointer when `result_ok` is not set is undefined.
10606     */
10607    struct LDKReplyShortChannelIdsEnd *result;
10608    /**
10609     * A pointer to the contents in the error state.
10610     * Reading from this pointer when `result_ok` is set is undefined.
10611     */
10612    struct LDKDecodeError *err;
10613 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
10614
10615 /**
10616  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10617  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10618  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10619  */
10620 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
10621    /**
10622     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10623     * `err` or `result` depending on the state of `result_ok`.
10624     */
10625    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
10626    /**
10627     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10628     */
10629    bool result_ok;
10630 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
10631
10632 /**
10633  * The contents of CResult_QueryChannelRangeDecodeErrorZ
10634  */
10635 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
10636    /**
10637     * A pointer to the contents in the success state.
10638     * Reading from this pointer when `result_ok` is not set is undefined.
10639     */
10640    struct LDKQueryChannelRange *result;
10641    /**
10642     * A pointer to the contents in the error state.
10643     * Reading from this pointer when `result_ok` is set is undefined.
10644     */
10645    struct LDKDecodeError *err;
10646 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
10647
10648 /**
10649  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10650  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10651  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10652  */
10653 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
10654    /**
10655     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10656     * `err` or `result` depending on the state of `result_ok`.
10657     */
10658    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
10659    /**
10660     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10661     */
10662    bool result_ok;
10663 } LDKCResult_QueryChannelRangeDecodeErrorZ;
10664
10665 /**
10666  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
10667  */
10668 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
10669    /**
10670     * A pointer to the contents in the success state.
10671     * Reading from this pointer when `result_ok` is not set is undefined.
10672     */
10673    struct LDKReplyChannelRange *result;
10674    /**
10675     * A pointer to the contents in the error state.
10676     * Reading from this pointer when `result_ok` is set is undefined.
10677     */
10678    struct LDKDecodeError *err;
10679 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
10680
10681 /**
10682  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10683  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10684  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10685  */
10686 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
10687    /**
10688     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10689     * `err` or `result` depending on the state of `result_ok`.
10690     */
10691    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
10692    /**
10693     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10694     */
10695    bool result_ok;
10696 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
10697
10698 /**
10699  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
10700  */
10701 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
10702    /**
10703     * A pointer to the contents in the success state.
10704     * Reading from this pointer when `result_ok` is not set is undefined.
10705     */
10706    struct LDKGossipTimestampFilter *result;
10707    /**
10708     * A pointer to the contents in the error state.
10709     * Reading from this pointer when `result_ok` is set is undefined.
10710     */
10711    struct LDKDecodeError *err;
10712 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
10713
10714 /**
10715  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10716  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10717  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10718  */
10719 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
10720    /**
10721     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10722     * `err` or `result` depending on the state of `result_ok`.
10723     */
10724    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
10725    /**
10726     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10727     */
10728    bool result_ok;
10729 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
10730
10731 /**
10732  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
10733  * This corresponds to std::vector in C++
10734  */
10735 typedef struct LDKCVec_PhantomRouteHintsZ {
10736    /**
10737     * The elements in the array.
10738     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10739     */
10740    struct LDKPhantomRouteHints *data;
10741    /**
10742     * The number of elements pointed to by `data`.
10743     */
10744    uintptr_t datalen;
10745 } LDKCVec_PhantomRouteHintsZ;
10746
10747 /**
10748  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
10749  * may occur.
10750  */
10751 typedef enum LDKSignOrCreationError_Tag {
10752    /**
10753     * An error occurred during signing
10754     */
10755    LDKSignOrCreationError_SignError,
10756    /**
10757     * An error occurred while building the transaction
10758     */
10759    LDKSignOrCreationError_CreationError,
10760    /**
10761     * Must be last for serialization purposes
10762     */
10763    LDKSignOrCreationError_Sentinel,
10764 } LDKSignOrCreationError_Tag;
10765
10766 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
10767    LDKSignOrCreationError_Tag tag;
10768    union {
10769       struct {
10770          enum LDKCreationError creation_error;
10771       };
10772    };
10773 } LDKSignOrCreationError;
10774
10775 /**
10776  * The contents of CResult_InvoiceSignOrCreationErrorZ
10777  */
10778 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
10779    /**
10780     * A pointer to the contents in the success state.
10781     * Reading from this pointer when `result_ok` is not set is undefined.
10782     */
10783    struct LDKInvoice *result;
10784    /**
10785     * A pointer to the contents in the error state.
10786     * Reading from this pointer when `result_ok` is set is undefined.
10787     */
10788    struct LDKSignOrCreationError *err;
10789 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
10790
10791 /**
10792  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10793  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10794  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10795  */
10796 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
10797    /**
10798     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
10799     * `err` or `result` depending on the state of `result_ok`.
10800     */
10801    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
10802    /**
10803     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
10804     */
10805    bool result_ok;
10806 } LDKCResult_InvoiceSignOrCreationErrorZ;
10807
10808
10809
10810 /**
10811  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
10812  *
10813  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
10814  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
10815  * the return value of [`Filter::register_output`].
10816  *
10817  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
10818  * may have been spent there. See [`Filter::register_output`] for details.
10819  *
10820  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
10821  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
10822  */
10823 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
10824    /**
10825     * A pointer to the opaque Rust object.
10826     * Nearly everywhere, inner must be non-null, however in places where
10827     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10828     */
10829    LDKnativeWatchedOutput *inner;
10830    /**
10831     * Indicates that this is the only struct which contains the same pointer.
10832     * Rust functions which take ownership of an object provided via an argument require
10833     * this to be true and invalidate the object pointed to by inner.
10834     */
10835    bool is_owned;
10836 } LDKWatchedOutput;
10837
10838 /**
10839  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
10840  * channels.
10841  *
10842  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
10843  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
10844  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
10845  * receiving full blocks from a chain source, any further filtering is unnecessary.
10846  *
10847  * After an output has been registered, subsequent block retrievals from the chain source must not
10848  * exclude any transactions matching the new criteria nor any in-block descendants of such
10849  * transactions.
10850  *
10851  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
10852  * should not block on I/O. Implementations should instead queue the newly monitored data to be
10853  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
10854  * invocation that has called the `Filter` must return [`TemporaryFailure`].
10855  *
10856  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
10857  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
10858  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
10859  */
10860 typedef struct LDKFilter {
10861    /**
10862     * An opaque pointer which is passed to your function implementations as an argument.
10863     * This has no meaning in the LDK, and can be NULL or any other value.
10864     */
10865    void *this_arg;
10866    /**
10867     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
10868     * a spending condition.
10869     */
10870    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
10871    /**
10872     * Registers interest in spends of a transaction output.
10873     *
10874     * Optionally, when `output.block_hash` is set, should return any transaction spending the
10875     * output that is found in the corresponding block along with its index.
10876     *
10877     * This return value is useful for Electrum clients in order to supply in-block descendant
10878     * transactions which otherwise were not included. This is not necessary for other clients if
10879     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
10880     * full block).
10881     */
10882    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
10883    /**
10884     * Frees any resources associated with this object given its this_arg pointer.
10885     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10886     */
10887    void (*free)(void *this_arg);
10888 } LDKFilter;
10889
10890 /**
10891  * An enum which can either contain a crate::lightning::chain::Filter or not
10892  */
10893 typedef enum LDKCOption_FilterZ_Tag {
10894    /**
10895     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
10896     */
10897    LDKCOption_FilterZ_Some,
10898    /**
10899     * When we're in this state, this COption_FilterZ contains nothing
10900     */
10901    LDKCOption_FilterZ_None,
10902    /**
10903     * Must be last for serialization purposes
10904     */
10905    LDKCOption_FilterZ_Sentinel,
10906 } LDKCOption_FilterZ_Tag;
10907
10908 typedef struct LDKCOption_FilterZ {
10909    LDKCOption_FilterZ_Tag tag;
10910    union {
10911       struct {
10912          struct LDKFilter some;
10913       };
10914    };
10915 } LDKCOption_FilterZ;
10916
10917
10918
10919 /**
10920  * A read-only reference to a current ChannelMonitor.
10921  *
10922  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
10923  * released.
10924  */
10925 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
10926    /**
10927     * A pointer to the opaque Rust object.
10928     * Nearly everywhere, inner must be non-null, however in places where
10929     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10930     */
10931    LDKnativeLockedChannelMonitor *inner;
10932    /**
10933     * Indicates that this is the only struct which contains the same pointer.
10934     * Rust functions which take ownership of an object provided via an argument require
10935     * this to be true and invalidate the object pointed to by inner.
10936     */
10937    bool is_owned;
10938 } LDKLockedChannelMonitor;
10939
10940 /**
10941  * The contents of CResult_LockedChannelMonitorNoneZ
10942  */
10943 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
10944    /**
10945     * A pointer to the contents in the success state.
10946     * Reading from this pointer when `result_ok` is not set is undefined.
10947     */
10948    struct LDKLockedChannelMonitor *result;
10949    /**
10950     * Note that this value is always NULL, as there are no contents in the Err variant
10951     */
10952    void *err;
10953 } LDKCResult_LockedChannelMonitorNoneZPtr;
10954
10955 /**
10956  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
10957  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
10958  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10959  */
10960 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
10961    /**
10962     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
10963     * `err` or `result` depending on the state of `result_ok`.
10964     */
10965    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
10966    /**
10967     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
10968     */
10969    bool result_ok;
10970 } LDKCResult_LockedChannelMonitorNoneZ;
10971
10972 /**
10973  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
10974  * This corresponds to std::vector in C++
10975  */
10976 typedef struct LDKCVec_OutPointZ {
10977    /**
10978     * The elements in the array.
10979     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10980     */
10981    struct LDKOutPoint *data;
10982    /**
10983     * The number of elements pointed to by `data`.
10984     */
10985    uintptr_t datalen;
10986 } LDKCVec_OutPointZ;
10987
10988 /**
10989  * A trait indicating an object may generate message send events
10990  */
10991 typedef struct LDKMessageSendEventsProvider {
10992    /**
10993     * An opaque pointer which is passed to your function implementations as an argument.
10994     * This has no meaning in the LDK, and can be NULL or any other value.
10995     */
10996    void *this_arg;
10997    /**
10998     * Gets the list of pending events which were generated by previous actions, clearing the list
10999     * in the process.
11000     */
11001    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
11002    /**
11003     * Frees any resources associated with this object given its this_arg pointer.
11004     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11005     */
11006    void (*free)(void *this_arg);
11007 } LDKMessageSendEventsProvider;
11008
11009 /**
11010  * A trait implemented for objects handling events from [`EventsProvider`].
11011  */
11012 typedef struct LDKEventHandler {
11013    /**
11014     * An opaque pointer which is passed to your function implementations as an argument.
11015     * This has no meaning in the LDK, and can be NULL or any other value.
11016     */
11017    void *this_arg;
11018    /**
11019     * Handles the given [`Event`].
11020     *
11021     * See [`EventsProvider`] for details that must be considered when implementing this method.
11022     */
11023    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
11024    /**
11025     * Frees any resources associated with this object given its this_arg pointer.
11026     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11027     */
11028    void (*free)(void *this_arg);
11029 } LDKEventHandler;
11030
11031 /**
11032  * A trait indicating an object may generate events.
11033  *
11034  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
11035  *
11036  * # Requirements
11037  *
11038  * See [`process_pending_events`] for requirements around event processing.
11039  *
11040  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
11041  * event since the last invocation. The handler must either act upon the event immediately
11042  * or preserve it for later handling.
11043  *
11044  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
11045  * consult the provider's documentation on the implication of processing events and how a handler
11046  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
11047  * [`ChainMonitor::process_pending_events`]).
11048  *
11049  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
11050  * own type(s).
11051  *
11052  * [`process_pending_events`]: Self::process_pending_events
11053  * [`handle_event`]: EventHandler::handle_event
11054  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
11055  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
11056  */
11057 typedef struct LDKEventsProvider {
11058    /**
11059     * An opaque pointer which is passed to your function implementations as an argument.
11060     * This has no meaning in the LDK, and can be NULL or any other value.
11061     */
11062    void *this_arg;
11063    /**
11064     * Processes any events generated since the last call using the given event handler.
11065     *
11066     * Subsequent calls must only process new events. However, handlers must be capable of handling
11067     * duplicate events across process restarts. This may occur if the provider was recovered from
11068     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
11069     */
11070    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
11071    /**
11072     * Frees any resources associated with this object given its this_arg pointer.
11073     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11074     */
11075    void (*free)(void *this_arg);
11076 } LDKEventsProvider;
11077
11078
11079
11080 /**
11081  * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's
11082  * variable-length integers except that it is serialized in big-endian instead of little-endian.
11083  *
11084  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
11085  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
11086  * you're looking for an example of a variable-length integer to use for your own project, move
11087  * along, this is a rather poor design.
11088  */
11089 typedef struct MUST_USE_STRUCT LDKBigSize {
11090    /**
11091     * A pointer to the opaque Rust object.
11092     * Nearly everywhere, inner must be non-null, however in places where
11093     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11094     */
11095    LDKnativeBigSize *inner;
11096    /**
11097     * Indicates that this is the only struct which contains the same pointer.
11098     * Rust functions which take ownership of an object provided via an argument require
11099     * this to be true and invalidate the object pointed to by inner.
11100     */
11101    bool is_owned;
11102 } LDKBigSize;
11103
11104
11105
11106 /**
11107  * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
11108  */
11109 typedef struct MUST_USE_STRUCT LDKChannelUsage {
11110    /**
11111     * A pointer to the opaque Rust object.
11112     * Nearly everywhere, inner must be non-null, however in places where
11113     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11114     */
11115    LDKnativeChannelUsage *inner;
11116    /**
11117     * Indicates that this is the only struct which contains the same pointer.
11118     * Rust functions which take ownership of an object provided via an argument require
11119     * this to be true and invalidate the object pointed to by inner.
11120     */
11121    bool is_owned;
11122 } LDKChannelUsage;
11123
11124 /**
11125  * An interface used to score payment channels for path finding.
11126  *
11127  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
11128  */
11129 typedef struct LDKScore {
11130    /**
11131     * An opaque pointer which is passed to your function implementations as an argument.
11132     * This has no meaning in the LDK, and can be NULL or any other value.
11133     */
11134    void *this_arg;
11135    /**
11136     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
11137     * given channel in the direction from `source` to `target`.
11138     *
11139     * The channel's capacity (less any other MPP parts that are also being considered for use in
11140     * the same payment) is given by `capacity_msat`. It may be determined from various sources
11141     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
11142     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
11143     * Thus, implementations should be overflow-safe.
11144     */
11145    uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage);
11146    /**
11147     * Handles updating channel penalties after failing to route through a channel.
11148     */
11149    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
11150    /**
11151     * Handles updating channel penalties after successfully routing along a path.
11152     */
11153    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
11154    /**
11155     * Serialize the object into a byte array
11156     */
11157    struct LDKCVec_u8Z (*write)(const void *this_arg);
11158    /**
11159     * Frees any resources associated with this object given its this_arg pointer.
11160     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11161     */
11162    void (*free)(void *this_arg);
11163 } LDKScore;
11164
11165
11166
11167 /**
11168  * A concrete implementation of [`LockableScore`] which supports multi-threading.
11169  */
11170 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
11171    /**
11172     * A pointer to the opaque Rust object.
11173     * Nearly everywhere, inner must be non-null, however in places where
11174     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11175     */
11176    LDKnativeMultiThreadedLockableScore *inner;
11177    /**
11178     * Indicates that this is the only struct which contains the same pointer.
11179     * Rust functions which take ownership of an object provided via an argument require
11180     * this to be true and invalidate the object pointed to by inner.
11181     */
11182    bool is_owned;
11183 } LDKMultiThreadedLockableScore;
11184
11185 /**
11186  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`MultiThreadedLockableScore`] to disk.
11187  */
11188 typedef struct LDKPersister {
11189    /**
11190     * An opaque pointer which is passed to your function implementations as an argument.
11191     * This has no meaning in the LDK, and can be NULL or any other value.
11192     */
11193    void *this_arg;
11194    /**
11195     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
11196     */
11197    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
11198    /**
11199     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
11200     */
11201    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
11202    /**
11203     * Persist the given [`MultiThreadedLockableScore`] to disk, returning an error if persistence failed.
11204     */
11205    struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer);
11206    /**
11207     * Frees any resources associated with this object given its this_arg pointer.
11208     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11209     */
11210    void (*free)(void *this_arg);
11211 } LDKPersister;
11212
11213
11214
11215 /**
11216  * Configuration we set when applicable.
11217  *
11218  * Default::default() provides sane defaults.
11219  */
11220 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
11221    /**
11222     * A pointer to the opaque Rust object.
11223     * Nearly everywhere, inner must be non-null, however in places where
11224     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11225     */
11226    LDKnativeChannelHandshakeConfig *inner;
11227    /**
11228     * Indicates that this is the only struct which contains the same pointer.
11229     * Rust functions which take ownership of an object provided via an argument require
11230     * this to be true and invalidate the object pointed to by inner.
11231     */
11232    bool is_owned;
11233 } LDKChannelHandshakeConfig;
11234
11235
11236
11237 /**
11238  * Optional channel limits which are applied during channel creation.
11239  *
11240  * These limits are only applied to our counterparty's limits, not our own.
11241  *
11242  * Use 0/<type>::max_value() as appropriate to skip checking.
11243  *
11244  * Provides sane defaults for most configurations.
11245  *
11246  * Most additional limits are disabled except those with which specify a default in individual
11247  * field documentation. Note that this may result in barely-usable channels, but since they
11248  * are applied mostly only to incoming channels that's not much of a problem.
11249  */
11250 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
11251    /**
11252     * A pointer to the opaque Rust object.
11253     * Nearly everywhere, inner must be non-null, however in places where
11254     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11255     */
11256    LDKnativeChannelHandshakeLimits *inner;
11257    /**
11258     * Indicates that this is the only struct which contains the same pointer.
11259     * Rust functions which take ownership of an object provided via an argument require
11260     * this to be true and invalidate the object pointed to by inner.
11261     */
11262    bool is_owned;
11263 } LDKChannelHandshakeLimits;
11264
11265
11266
11267 /**
11268  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
11269  *
11270  * Default::default() provides sane defaults for most configurations
11271  * (but currently with 0 relay fees!)
11272  */
11273 typedef struct MUST_USE_STRUCT LDKUserConfig {
11274    /**
11275     * A pointer to the opaque Rust object.
11276     * Nearly everywhere, inner must be non-null, however in places where
11277     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11278     */
11279    LDKnativeUserConfig *inner;
11280    /**
11281     * Indicates that this is the only struct which contains the same pointer.
11282     * Rust functions which take ownership of an object provided via an argument require
11283     * this to be true and invalidate the object pointed to by inner.
11284     */
11285    bool is_owned;
11286 } LDKUserConfig;
11287
11288
11289
11290 /**
11291  * The best known block as identified by its hash and height.
11292  */
11293 typedef struct MUST_USE_STRUCT LDKBestBlock {
11294    /**
11295     * A pointer to the opaque Rust object.
11296     * Nearly everywhere, inner must be non-null, however in places where
11297     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11298     */
11299    LDKnativeBestBlock *inner;
11300    /**
11301     * Indicates that this is the only struct which contains the same pointer.
11302     * Rust functions which take ownership of an object provided via an argument require
11303     * this to be true and invalidate the object pointed to by inner.
11304     */
11305    bool is_owned;
11306 } LDKBestBlock;
11307
11308 /**
11309  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
11310  * chain.
11311  *
11312  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
11313  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
11314  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
11315  * when needed.
11316  *
11317  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
11318  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
11319  * other similar filtering.
11320  */
11321 typedef struct LDKListen {
11322    /**
11323     * An opaque pointer which is passed to your function implementations as an argument.
11324     * This has no meaning in the LDK, and can be NULL or any other value.
11325     */
11326    void *this_arg;
11327    /**
11328     * Notifies the listener that a block was added at the given height, with the transaction data
11329     * possibly filtered.
11330     */
11331    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
11332    /**
11333     * Notifies the listener that a block was added at the given height.
11334     */
11335    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
11336    /**
11337     * Notifies the listener that a block was removed at the given height.
11338     */
11339    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
11340    /**
11341     * Frees any resources associated with this object given its this_arg pointer.
11342     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11343     */
11344    void (*free)(void *this_arg);
11345 } LDKListen;
11346
11347 /**
11348  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
11349  * unconfirmed during a chain reorganization.
11350  *
11351  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
11352  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
11353  * related to registered transactions and outputs. Upon notification, it would pass along the
11354  * matching transactions using this interface.
11355  *
11356  * # Use
11357  *
11358  * The intended use is as follows:
11359  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
11360  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
11361  *   that has been reorganized out of the chain.
11362  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
11363  *
11364  * # Order
11365  *
11366  * Clients must call these methods in chain order. Specifically:
11367  * - Transactions confirmed in a block must be given before transactions confirmed in a later
11368  *   block.
11369  * - Dependent transactions within the same block must be given in topological order, possibly in
11370  *   separate calls.
11371  * - Unconfirmed transactions must be given after the original confirmations and before any
11372  *   reconfirmation.
11373  *
11374  * See individual method documentation for further details.
11375  *
11376  * [`transactions_confirmed`]: Self::transactions_confirmed
11377  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11378  * [`best_block_updated`]: Self::best_block_updated
11379  * [`get_relevant_txids`]: Self::get_relevant_txids
11380  */
11381 typedef struct LDKConfirm {
11382    /**
11383     * An opaque pointer which is passed to your function implementations as an argument.
11384     * This has no meaning in the LDK, and can be NULL or any other value.
11385     */
11386    void *this_arg;
11387    /**
11388     * Processes transactions confirmed in a block with a given header and height.
11389     *
11390     * Should be called for any transactions registered by [`Filter::register_tx`] or any
11391     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
11392     * appearing in the same block do not need to be included in the same call; instead, multiple
11393     * calls with additional transactions may be made so long as they are made in [chain order].
11394     *
11395     * May be called before or after [`best_block_updated`] for the corresponding block. However,
11396     * in the event of a chain reorganization, it must not be called with a `header` that is no
11397     * longer in the chain as of the last call to [`best_block_updated`].
11398     *
11399     * [chain order]: Confirm#Order
11400     * [`best_block_updated`]: Self::best_block_updated
11401     */
11402    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
11403    /**
11404     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
11405     *
11406     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
11407     * reorganized out of the best chain. Once called, the given transaction should not be returned
11408     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
11409     *
11410     * [`get_relevant_txids`]: Self::get_relevant_txids
11411     * [`transactions_confirmed`]: Self::transactions_confirmed
11412     */
11413    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
11414    /**
11415     * Processes an update to the best header connected at the given height.
11416     *
11417     * Should be called when a new header is available but may be skipped for intermediary blocks
11418     * if they become available at the same time.
11419     */
11420    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
11421    /**
11422     * Returns transactions that should be monitored for reorganization out of the chain.
11423     *
11424     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
11425     * confirmations to be safe from a chain reorganization. Should not include any transactions
11426     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
11427     *
11428     * May be called to determine the subset of transactions that must still be monitored for
11429     * reorganization. Will be idempotent between calls but may change as a result of calls to the
11430     * other interface methods. Thus, this is useful to determine which transactions may need to be
11431     * given to [`transaction_unconfirmed`].
11432     *
11433     * [`transactions_confirmed`]: Self::transactions_confirmed
11434     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11435     */
11436    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
11437    /**
11438     * Frees any resources associated with this object given its this_arg pointer.
11439     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11440     */
11441    void (*free)(void *this_arg);
11442 } LDKConfirm;
11443
11444
11445
11446 /**
11447  * An opaque identifier describing a specific [`Persist`] method call.
11448  */
11449 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
11450    /**
11451     * A pointer to the opaque Rust object.
11452     * Nearly everywhere, inner must be non-null, however in places where
11453     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11454     */
11455    LDKnativeMonitorUpdateId *inner;
11456    /**
11457     * Indicates that this is the only struct which contains the same pointer.
11458     * Rust functions which take ownership of an object provided via an argument require
11459     * this to be true and invalidate the object pointed to by inner.
11460     */
11461    bool is_owned;
11462 } LDKMonitorUpdateId;
11463
11464 /**
11465  * `Persist` defines behavior for persisting channel monitors: this could mean
11466  * writing once to disk, and/or uploading to one or more backup services.
11467  *
11468  * Each method can return three possible values:
11469  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
11470  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
11471  *  * If persistence happens asynchronously, implementations should first ensure the
11472  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
11473  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
11474  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
11475  *    called with the corresponding [`MonitorUpdateId`].
11476  *
11477  *    Note that unlike the direct [`chain::Watch`] interface,
11478  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
11479  *
11480  *  * If persistence fails for some reason, implementations should return
11481  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
11482  *    closed without broadcasting the latest state. See
11483  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
11484  */
11485 typedef struct LDKPersist {
11486    /**
11487     * An opaque pointer which is passed to your function implementations as an argument.
11488     * This has no meaning in the LDK, and can be NULL or any other value.
11489     */
11490    void *this_arg;
11491    /**
11492     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
11493     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
11494     *
11495     * The data can be stored any way you want, but the identifier provided by LDK is the
11496     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
11497     * and the stored channel data). Note that you **must** persist every new monitor to disk.
11498     *
11499     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11500     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11501     *
11502     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
11503     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11504     *
11505     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11506     * [`Writeable::write`]: crate::util::ser::Writeable::write
11507     */
11508    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
11509    /**
11510     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
11511     * update.
11512     *
11513     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
11514     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
11515     * details.
11516     *
11517     * During blockchain synchronization operations, this may be called with no
11518     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
11519     * Note that after the full [`ChannelMonitor`] is persisted any previous
11520     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
11521     * applied to the persisted [`ChannelMonitor`] as they were already applied.
11522     *
11523     * If an implementer chooses to persist the updates only, they need to make
11524     * sure that all the updates are applied to the `ChannelMonitors` *before*
11525     * the set of channel monitors is given to the `ChannelManager`
11526     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
11527     * applying a monitor update to a monitor. If full `ChannelMonitors` are
11528     * persisted, then there is no need to persist individual updates.
11529     *
11530     * Note that there could be a performance tradeoff between persisting complete
11531     * channel monitors on every update vs. persisting only updates and applying
11532     * them in batches. The size of each monitor grows `O(number of state updates)`
11533     * whereas updates are small and `O(1)`.
11534     *
11535     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11536     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11537     *
11538     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
11539     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
11540     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11541     *
11542     * [`Writeable::write`]: crate::util::ser::Writeable::write
11543     *
11544     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
11545     */
11546    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);
11547    /**
11548     * Frees any resources associated with this object given its this_arg pointer.
11549     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11550     */
11551    void (*free)(void *this_arg);
11552 } LDKPersist;
11553
11554
11555
11556 /**
11557  * An implementation of [`chain::Watch`] for monitoring channels.
11558  *
11559  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
11560  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
11561  * or used independently to monitor channels remotely. See the [module-level documentation] for
11562  * details.
11563  *
11564  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11565  * [module-level documentation]: crate::chain::chainmonitor
11566  */
11567 typedef struct MUST_USE_STRUCT LDKChainMonitor {
11568    /**
11569     * A pointer to the opaque Rust object.
11570     * Nearly everywhere, inner must be non-null, however in places where
11571     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11572     */
11573    LDKnativeChainMonitor *inner;
11574    /**
11575     * Indicates that this is the only struct which contains the same pointer.
11576     * Rust functions which take ownership of an object provided via an argument require
11577     * this to be true and invalidate the object pointed to by inner.
11578     */
11579    bool is_owned;
11580 } LDKChainMonitor;
11581
11582
11583
11584 /**
11585  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
11586  * and derives keys from that.
11587  *
11588  * Your node_id is seed/0'
11589  * ChannelMonitor closes may use seed/1'
11590  * Cooperative closes may use seed/2'
11591  * The two close keys may be needed to claim on-chain funds!
11592  *
11593  * This struct cannot be used for nodes that wish to support receiving phantom payments;
11594  * [`PhantomKeysManager`] must be used instead.
11595  *
11596  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
11597  * previously issued invoices and attempts to pay previous invoices will fail.
11598  */
11599 typedef struct MUST_USE_STRUCT LDKKeysManager {
11600    /**
11601     * A pointer to the opaque Rust object.
11602     * Nearly everywhere, inner must be non-null, however in places where
11603     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11604     */
11605    LDKnativeKeysManager *inner;
11606    /**
11607     * Indicates that this is the only struct which contains the same pointer.
11608     * Rust functions which take ownership of an object provided via an argument require
11609     * this to be true and invalidate the object pointed to by inner.
11610     */
11611    bool is_owned;
11612 } LDKKeysManager;
11613
11614
11615
11616 /**
11617  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
11618  * payments.
11619  *
11620  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
11621  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
11622  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
11623  * itself without ever needing to forward to this fake node.
11624  *
11625  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
11626  * provide some fault tolerance, because payers will automatically retry paying other provided
11627  * nodes in the case that one node goes down.
11628  *
11629  * Note that multi-path payments are not supported in phantom invoices for security reasons.
11630  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
11631  * invoices and attempts to pay previous invoices will fail.
11632  */
11633 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
11634    /**
11635     * A pointer to the opaque Rust object.
11636     * Nearly everywhere, inner must be non-null, however in places where
11637     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11638     */
11639    LDKnativePhantomKeysManager *inner;
11640    /**
11641     * Indicates that this is the only struct which contains the same pointer.
11642     * Rust functions which take ownership of an object provided via an argument require
11643     * this to be true and invalidate the object pointed to by inner.
11644     */
11645    bool is_owned;
11646 } LDKPhantomKeysManager;
11647
11648
11649
11650 /**
11651  * Chain-related parameters used to construct a new `ChannelManager`.
11652  *
11653  * Typically, the block-specific parameters are derived from the best block hash for the network,
11654  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
11655  * are not needed when deserializing a previously constructed `ChannelManager`.
11656  */
11657 typedef struct MUST_USE_STRUCT LDKChainParameters {
11658    /**
11659     * A pointer to the opaque Rust object.
11660     * Nearly everywhere, inner must be non-null, however in places where
11661     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11662     */
11663    LDKnativeChainParameters *inner;
11664    /**
11665     * Indicates that this is the only struct which contains the same pointer.
11666     * Rust functions which take ownership of an object provided via an argument require
11667     * this to be true and invalidate the object pointed to by inner.
11668     */
11669    bool is_owned;
11670 } LDKChainParameters;
11671
11672 /**
11673  * A 3-byte byte array.
11674  */
11675 typedef struct LDKThreeBytes {
11676    /**
11677     * The three bytes
11678     */
11679    uint8_t data[3];
11680 } LDKThreeBytes;
11681
11682 /**
11683  * A trait to describe an object which can receive channel messages.
11684  *
11685  * Messages MAY be called in parallel when they originate from different their_node_ids, however
11686  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
11687  */
11688 typedef struct LDKChannelMessageHandler {
11689    /**
11690     * An opaque pointer which is passed to your function implementations as an argument.
11691     * This has no meaning in the LDK, and can be NULL or any other value.
11692     */
11693    void *this_arg;
11694    /**
11695     * Handle an incoming open_channel message from the given peer.
11696     */
11697    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
11698    /**
11699     * Handle an incoming accept_channel message from the given peer.
11700     */
11701    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
11702    /**
11703     * Handle an incoming funding_created message from the given peer.
11704     */
11705    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
11706    /**
11707     * Handle an incoming funding_signed message from the given peer.
11708     */
11709    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
11710    /**
11711     * Handle an incoming channel_ready message from the given peer.
11712     */
11713    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
11714    /**
11715     * Handle an incoming shutdown message from the given peer.
11716     */
11717    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);
11718    /**
11719     * Handle an incoming closing_signed message from the given peer.
11720     */
11721    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
11722    /**
11723     * Handle an incoming update_add_htlc message from the given peer.
11724     */
11725    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
11726    /**
11727     * Handle an incoming update_fulfill_htlc message from the given peer.
11728     */
11729    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
11730    /**
11731     * Handle an incoming update_fail_htlc message from the given peer.
11732     */
11733    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
11734    /**
11735     * Handle an incoming update_fail_malformed_htlc message from the given peer.
11736     */
11737    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
11738    /**
11739     * Handle an incoming commitment_signed message from the given peer.
11740     */
11741    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
11742    /**
11743     * Handle an incoming revoke_and_ack message from the given peer.
11744     */
11745    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
11746    /**
11747     * Handle an incoming update_fee message from the given peer.
11748     */
11749    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
11750    /**
11751     * Handle an incoming announcement_signatures message from the given peer.
11752     */
11753    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
11754    /**
11755     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
11756     * is believed to be possible in the future (eg they're sending us messages we don't
11757     * understand or indicate they require unknown feature bits), no_connection_possible is set
11758     * and any outstanding channels should be failed.
11759     */
11760    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
11761    /**
11762     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
11763     */
11764    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
11765    /**
11766     * Handle an incoming channel_reestablish message from the given peer.
11767     */
11768    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
11769    /**
11770     * Handle an incoming channel update from the given peer.
11771     */
11772    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
11773    /**
11774     * Handle an incoming error message from the given peer.
11775     */
11776    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
11777    /**
11778     * Implementation of MessageSendEventsProvider for this object.
11779     */
11780    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11781    /**
11782     * Frees any resources associated with this object given its this_arg pointer.
11783     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11784     */
11785    void (*free)(void *this_arg);
11786 } LDKChannelMessageHandler;
11787
11788
11789
11790 /**
11791  * Arguments for the creation of a ChannelManager that are not deserialized.
11792  *
11793  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
11794  * is:
11795  * 1) Deserialize all stored [`ChannelMonitor`]s.
11796  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
11797  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
11798  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
11799  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
11800  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
11801  *    same way you would handle a [`chain::Filter`] call using
11802  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
11803  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
11804  * 5) Disconnect/connect blocks on the [`ChannelManager`].
11805  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
11806  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
11807  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
11808  *    the next step.
11809  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
11810  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
11811  *
11812  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
11813  * call any other methods on the newly-deserialized [`ChannelManager`].
11814  *
11815  * Note that because some channels may be closed during deserialization, it is critical that you
11816  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
11817  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
11818  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
11819  * not force-close the same channels but consider them live), you may end up revoking a state for
11820  * which you've already broadcasted the transaction.
11821  *
11822  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
11823  */
11824 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
11825    /**
11826     * A pointer to the opaque Rust object.
11827     * Nearly everywhere, inner must be non-null, however in places where
11828     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11829     */
11830    LDKnativeChannelManagerReadArgs *inner;
11831    /**
11832     * Indicates that this is the only struct which contains the same pointer.
11833     * Rust functions which take ownership of an object provided via an argument require
11834     * this to be true and invalidate the object pointed to by inner.
11835     */
11836    bool is_owned;
11837 } LDKChannelManagerReadArgs;
11838
11839
11840
11841 /**
11842  * A set of keys that were HKDF-expanded from an initial call to
11843  * [`KeysInterface::get_inbound_payment_key_material`].
11844  *
11845  * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material
11846  */
11847 typedef struct MUST_USE_STRUCT LDKExpandedKey {
11848    /**
11849     * A pointer to the opaque Rust object.
11850     * Nearly everywhere, inner must be non-null, however in places where
11851     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11852     */
11853    LDKnativeExpandedKey *inner;
11854    /**
11855     * Indicates that this is the only struct which contains the same pointer.
11856     * Rust functions which take ownership of an object provided via an argument require
11857     * this to be true and invalidate the object pointed to by inner.
11858     */
11859    bool is_owned;
11860 } LDKExpandedKey;
11861
11862
11863
11864 /**
11865  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
11866  * This is used to convince the recipient that the channel is at a certain commitment
11867  * number even if they lost that data due to a local failure.  Of course, the peer may lie
11868  * and even later commitments may have been revoked.
11869  */
11870 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
11871    /**
11872     * A pointer to the opaque Rust object.
11873     * Nearly everywhere, inner must be non-null, however in places where
11874     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11875     */
11876    LDKnativeDataLossProtect *inner;
11877    /**
11878     * Indicates that this is the only struct which contains the same pointer.
11879     * Rust functions which take ownership of an object provided via an argument require
11880     * this to be true and invalidate the object pointed to by inner.
11881     */
11882    bool is_owned;
11883 } LDKDataLossProtect;
11884
11885 /**
11886  * A trait to describe an object which can receive routing messages.
11887  *
11888  * # Implementor DoS Warnings
11889  *
11890  * For `gossip_queries` messages there are potential DoS vectors when handling
11891  * inbound queries. Implementors using an on-disk network graph should be aware of
11892  * repeated disk I/O for queries accessing different parts of the network graph.
11893  */
11894 typedef struct LDKRoutingMessageHandler {
11895    /**
11896     * An opaque pointer which is passed to your function implementations as an argument.
11897     * This has no meaning in the LDK, and can be NULL or any other value.
11898     */
11899    void *this_arg;
11900    /**
11901     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
11902     * false or returning an Err otherwise.
11903     */
11904    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
11905    /**
11906     * Handle a channel_announcement message, returning true if it should be forwarded on, false
11907     * or returning an Err otherwise.
11908     */
11909    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
11910    /**
11911     * Handle an incoming channel_update message, returning true if it should be forwarded on,
11912     * false or returning an Err otherwise.
11913     */
11914    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
11915    /**
11916     * Gets a subset of the channel announcements and updates required to dump our routing table
11917     * to a remote node, starting at the short_channel_id indicated by starting_point and
11918     * including the batch_amount entries immediately higher in numerical value than starting_point.
11919     */
11920    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
11921    /**
11922     * Gets a subset of the node announcements required to dump our routing table to a remote node,
11923     * starting at the node *after* the provided publickey and including batch_amount entries
11924     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
11925     * If None is provided for starting_point, we start at the first node.
11926     *
11927     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
11928     */
11929    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
11930    /**
11931     * Called when a connection is established with a peer. This can be used to
11932     * perform routing table synchronization using a strategy defined by the
11933     * implementor.
11934     */
11935    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
11936    /**
11937     * Handles the reply of a query we initiated to learn about channels
11938     * for a given range of blocks. We can expect to receive one or more
11939     * replies to a single query.
11940     */
11941    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
11942    /**
11943     * Handles the reply of a query we initiated asking for routing gossip
11944     * messages for a list of channels. We should receive this message when
11945     * a node has completed its best effort to send us the pertaining routing
11946     * gossip messages.
11947     */
11948    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
11949    /**
11950     * Handles when a peer asks us to send a list of short_channel_ids
11951     * for the requested range of blocks.
11952     */
11953    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
11954    /**
11955     * Handles when a peer asks us to send routing gossip messages for a
11956     * list of short_channel_ids.
11957     */
11958    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
11959    /**
11960     * Implementation of MessageSendEventsProvider for this object.
11961     */
11962    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11963    /**
11964     * Frees any resources associated with this object given its this_arg pointer.
11965     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11966     */
11967    void (*free)(void *this_arg);
11968 } LDKRoutingMessageHandler;
11969
11970 /**
11971  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
11972  * decoders.
11973  */
11974 typedef struct LDKCustomMessageReader {
11975    /**
11976     * An opaque pointer which is passed to your function implementations as an argument.
11977     * This has no meaning in the LDK, and can be NULL or any other value.
11978     */
11979    void *this_arg;
11980    /**
11981     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
11982     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
11983     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
11984     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
11985     */
11986    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
11987    /**
11988     * Frees any resources associated with this object given its this_arg pointer.
11989     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11990     */
11991    void (*free)(void *this_arg);
11992 } LDKCustomMessageReader;
11993
11994 /**
11995  * Handler for BOLT1-compliant messages.
11996  */
11997 typedef struct LDKCustomMessageHandler {
11998    /**
11999     * An opaque pointer which is passed to your function implementations as an argument.
12000     * This has no meaning in the LDK, and can be NULL or any other value.
12001     */
12002    void *this_arg;
12003    /**
12004     * Called with the message type that was received and the buffer to be read.
12005     * Can return a `MessageHandlingError` if the message could not be handled.
12006     */
12007    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
12008    /**
12009     * Gets the list of pending messages which were generated by the custom message
12010     * handler, clearing the list in the process. The first tuple element must
12011     * correspond to the intended recipients node ids. If no connection to one of the
12012     * specified node does not exist, the message is simply not sent to it.
12013     */
12014    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
12015    /**
12016     * Implementation of CustomMessageReader for this object.
12017     */
12018    struct LDKCustomMessageReader CustomMessageReader;
12019    /**
12020     * Frees any resources associated with this object given its this_arg pointer.
12021     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12022     */
12023    void (*free)(void *this_arg);
12024 } LDKCustomMessageHandler;
12025
12026
12027
12028 /**
12029  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
12030  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
12031  */
12032 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
12033    /**
12034     * A pointer to the opaque Rust object.
12035     * Nearly everywhere, inner must be non-null, however in places where
12036     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12037     */
12038    LDKnativeIgnoringMessageHandler *inner;
12039    /**
12040     * Indicates that this is the only struct which contains the same pointer.
12041     * Rust functions which take ownership of an object provided via an argument require
12042     * this to be true and invalidate the object pointed to by inner.
12043     */
12044    bool is_owned;
12045 } LDKIgnoringMessageHandler;
12046
12047
12048
12049 /**
12050  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
12051  * You can provide one of these as the route_handler in a MessageHandler.
12052  */
12053 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
12054    /**
12055     * A pointer to the opaque Rust object.
12056     * Nearly everywhere, inner must be non-null, however in places where
12057     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12058     */
12059    LDKnativeErroringMessageHandler *inner;
12060    /**
12061     * Indicates that this is the only struct which contains the same pointer.
12062     * Rust functions which take ownership of an object provided via an argument require
12063     * this to be true and invalidate the object pointed to by inner.
12064     */
12065    bool is_owned;
12066 } LDKErroringMessageHandler;
12067
12068
12069
12070 /**
12071  * Provides references to trait impls which handle different types of messages.
12072  */
12073 typedef struct MUST_USE_STRUCT LDKMessageHandler {
12074    /**
12075     * A pointer to the opaque Rust object.
12076     * Nearly everywhere, inner must be non-null, however in places where
12077     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12078     */
12079    LDKnativeMessageHandler *inner;
12080    /**
12081     * Indicates that this is the only struct which contains the same pointer.
12082     * Rust functions which take ownership of an object provided via an argument require
12083     * this to be true and invalidate the object pointed to by inner.
12084     */
12085    bool is_owned;
12086 } LDKMessageHandler;
12087
12088 /**
12089  * Provides an object which can be used to send data to and which uniquely identifies a connection
12090  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
12091  * implement Hash to meet the PeerManager API.
12092  *
12093  * For efficiency, Clone should be relatively cheap for this type.
12094  *
12095  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
12096  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
12097  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
12098  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
12099  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
12100  * to simply use another value which is guaranteed to be globally unique instead.
12101  */
12102 typedef struct LDKSocketDescriptor {
12103    /**
12104     * An opaque pointer which is passed to your function implementations as an argument.
12105     * This has no meaning in the LDK, and can be NULL or any other value.
12106     */
12107    void *this_arg;
12108    /**
12109     * Attempts to send some data from the given slice to the peer.
12110     *
12111     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
12112     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
12113     * called and further write attempts may occur until that time.
12114     *
12115     * If the returned size is smaller than `data.len()`, a
12116     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
12117     * written. Additionally, until a `send_data` event completes fully, no further
12118     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
12119     * prevent denial-of-service issues, you should not read or buffer any data from the socket
12120     * until then.
12121     *
12122     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
12123     * (indicating that read events should be paused to prevent DoS in the send buffer),
12124     * `resume_read` may be set indicating that read events on this descriptor should resume. A
12125     * `resume_read` of false carries no meaning, and should not cause any action.
12126     */
12127    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
12128    /**
12129     * Disconnect the socket pointed to by this SocketDescriptor.
12130     *
12131     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
12132     * call (doing so is a noop).
12133     */
12134    void (*disconnect_socket)(void *this_arg);
12135    /**
12136     * Checks if two objects are equal given this object's this_arg pointer and another object.
12137     */
12138    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
12139    /**
12140     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
12141     * This is used, for example, for inclusion of this object in a hash map.
12142     */
12143    uint64_t (*hash)(const void *this_arg);
12144    /**
12145     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
12146     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
12147     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
12148     */
12149    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
12150    /**
12151     * Frees any resources associated with this object given its this_arg pointer.
12152     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12153     */
12154    void (*free)(void *this_arg);
12155 } LDKSocketDescriptor;
12156
12157
12158
12159 /**
12160  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
12161  * socket events into messages which it passes on to its [`MessageHandler`].
12162  *
12163  * Locks are taken internally, so you must never assume that reentrancy from a
12164  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
12165  *
12166  * Calls to [`read_event`] will decode relevant messages and pass them to the
12167  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
12168  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
12169  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
12170  * calls only after previous ones have returned.
12171  *
12172  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
12173  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
12174  * essentially you should default to using a SimpleRefPeerManager, and use a
12175  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
12176  * you're using lightning-net-tokio.
12177  *
12178  * [`read_event`]: PeerManager::read_event
12179  */
12180 typedef struct MUST_USE_STRUCT LDKPeerManager {
12181    /**
12182     * A pointer to the opaque Rust object.
12183     * Nearly everywhere, inner must be non-null, however in places where
12184     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12185     */
12186    LDKnativePeerManager *inner;
12187    /**
12188     * Indicates that this is the only struct which contains the same pointer.
12189     * Rust functions which take ownership of an object provided via an argument require
12190     * this to be true and invalidate the object pointed to by inner.
12191     */
12192    bool is_owned;
12193 } LDKPeerManager;
12194
12195
12196
12197 /**
12198  * Static channel fields used to build transactions given per-commitment fields, organized by
12199  * broadcaster/countersignatory.
12200  *
12201  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
12202  * as_holder_broadcastable and as_counterparty_broadcastable functions.
12203  */
12204 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
12205    /**
12206     * A pointer to the opaque Rust object.
12207     * Nearly everywhere, inner must be non-null, however in places where
12208     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12209     */
12210    LDKnativeDirectedChannelTransactionParameters *inner;
12211    /**
12212     * Indicates that this is the only struct which contains the same pointer.
12213     * Rust functions which take ownership of an object provided via an argument require
12214     * this to be true and invalidate the object pointed to by inner.
12215     */
12216    bool is_owned;
12217 } LDKDirectedChannelTransactionParameters;
12218
12219 /**
12220  * Integer in the range `0..=16`
12221  */
12222 typedef struct LDKWitnessVersion {
12223    uint8_t _0;
12224 } LDKWitnessVersion;
12225
12226
12227
12228 /**
12229  * A read-only view of [`NetworkGraph`].
12230  */
12231 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
12232    /**
12233     * A pointer to the opaque Rust object.
12234     * Nearly everywhere, inner must be non-null, however in places where
12235     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12236     */
12237    LDKnativeReadOnlyNetworkGraph *inner;
12238    /**
12239     * Indicates that this is the only struct which contains the same pointer.
12240     * Rust functions which take ownership of an object provided via an argument require
12241     * this to be true and invalidate the object pointed to by inner.
12242     */
12243    bool is_owned;
12244 } LDKReadOnlyNetworkGraph;
12245
12246
12247
12248 /**
12249  * Receives and validates network updates from peers,
12250  * stores authentic and relevant data as a network graph.
12251  * This network graph is then used for routing payments.
12252  * Provides interface to help with initial routing sync by
12253  * serving historical announcements.
12254  *
12255  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
12256  * [`NetworkGraph`].
12257  */
12258 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
12259    /**
12260     * A pointer to the opaque Rust object.
12261     * Nearly everywhere, inner must be non-null, however in places where
12262     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12263     */
12264    LDKnativeP2PGossipSync *inner;
12265    /**
12266     * Indicates that this is the only struct which contains the same pointer.
12267     * Rust functions which take ownership of an object provided via an argument require
12268     * this to be true and invalidate the object pointed to by inner.
12269     */
12270    bool is_owned;
12271 } LDKP2PGossipSync;
12272
12273
12274
12275 /**
12276  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
12277  * source node to a target node.
12278  */
12279 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
12280    /**
12281     * A pointer to the opaque Rust object.
12282     * Nearly everywhere, inner must be non-null, however in places where
12283     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12284     */
12285    LDKnativeDirectedChannelInfo *inner;
12286    /**
12287     * Indicates that this is the only struct which contains the same pointer.
12288     * Rust functions which take ownership of an object provided via an argument require
12289     * this to be true and invalidate the object pointed to by inner.
12290     */
12291    bool is_owned;
12292 } LDKDirectedChannelInfo;
12293
12294 /**
12295  * The effective capacity of a channel for routing purposes.
12296  *
12297  * While this may be smaller than the actual channel capacity, amounts greater than
12298  * [`Self::as_msat`] should not be routed through the channel.
12299  */
12300 typedef enum LDKEffectiveCapacity_Tag {
12301    /**
12302     * The available liquidity in the channel known from being a channel counterparty, and thus a
12303     * direct hop.
12304     */
12305    LDKEffectiveCapacity_ExactLiquidity,
12306    /**
12307     * The maximum HTLC amount in one direction as advertised on the gossip network.
12308     */
12309    LDKEffectiveCapacity_MaximumHTLC,
12310    /**
12311     * The total capacity of the channel as determined by the funding transaction.
12312     */
12313    LDKEffectiveCapacity_Total,
12314    /**
12315     * A capacity sufficient to route any payment, typically used for private channels provided by
12316     * an invoice.
12317     */
12318    LDKEffectiveCapacity_Infinite,
12319    /**
12320     * A capacity that is unknown possibly because either the chain state is unavailable to know
12321     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
12322     */
12323    LDKEffectiveCapacity_Unknown,
12324    /**
12325     * Must be last for serialization purposes
12326     */
12327    LDKEffectiveCapacity_Sentinel,
12328 } LDKEffectiveCapacity_Tag;
12329
12330 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
12331    /**
12332     * Either the inbound or outbound liquidity depending on the direction, denominated in
12333     * millisatoshi.
12334     */
12335    uint64_t liquidity_msat;
12336 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
12337
12338 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
12339    /**
12340     * The maximum HTLC amount denominated in millisatoshi.
12341     */
12342    uint64_t amount_msat;
12343 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
12344
12345 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
12346    /**
12347     * The funding amount denominated in millisatoshi.
12348     */
12349    uint64_t capacity_msat;
12350    /**
12351     * The maximum HTLC amount denominated in millisatoshi.
12352     */
12353    struct LDKCOption_u64Z htlc_maximum_msat;
12354 } LDKEffectiveCapacity_LDKTotal_Body;
12355
12356 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
12357    LDKEffectiveCapacity_Tag tag;
12358    union {
12359       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
12360       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
12361       LDKEffectiveCapacity_LDKTotal_Body total;
12362    };
12363 } LDKEffectiveCapacity;
12364
12365 /**
12366  * A scorer that is accessed under a lock.
12367  *
12368  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
12369  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
12370  * implementations. Internal locking would be detrimental to route finding performance and could
12371  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
12372  *
12373  * [`find_route`]: crate::routing::router::find_route
12374  */
12375 typedef struct LDKLockableScore {
12376    /**
12377     * An opaque pointer which is passed to your function implementations as an argument.
12378     * This has no meaning in the LDK, and can be NULL or any other value.
12379     */
12380    void *this_arg;
12381    /**
12382     * Returns the locked scorer.
12383     */
12384    struct LDKScore (*lock)(const void *this_arg);
12385    /**
12386     * Frees any resources associated with this object given its this_arg pointer.
12387     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12388     */
12389    void (*free)(void *this_arg);
12390 } LDKLockableScore;
12391
12392
12393
12394 /**
12395  * Parameters for configuring [`ProbabilisticScorer`].
12396  *
12397  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
12398  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
12399  */
12400 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
12401    /**
12402     * A pointer to the opaque Rust object.
12403     * Nearly everywhere, inner must be non-null, however in places where
12404     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12405     */
12406    LDKnativeProbabilisticScoringParameters *inner;
12407    /**
12408     * Indicates that this is the only struct which contains the same pointer.
12409     * Rust functions which take ownership of an object provided via an argument require
12410     * this to be true and invalidate the object pointed to by inner.
12411     */
12412    bool is_owned;
12413 } LDKProbabilisticScoringParameters;
12414
12415
12416
12417 /**
12418  * FilesystemPersister persists channel data on disk, where each channel's
12419  * data is stored in a file named after its funding outpoint.
12420  *
12421  * Warning: this module does the best it can with calls to persist data, but it
12422  * can only guarantee that the data is passed to the drive. It is up to the
12423  * drive manufacturers to do the actual persistence properly, which they often
12424  * don't (especially on consumer-grade hardware). Therefore, it is up to the
12425  * user to validate their entire storage stack, to ensure the writes are
12426  * persistent.
12427  * Corollary: especially when dealing with larger amounts of money, it is best
12428  * practice to have multiple channel data backups and not rely only on one
12429  * FilesystemPersister.
12430  */
12431 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
12432    /**
12433     * A pointer to the opaque Rust object.
12434     * Nearly everywhere, inner must be non-null, however in places where
12435     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12436     */
12437    LDKnativeFilesystemPersister *inner;
12438    /**
12439     * Indicates that this is the only struct which contains the same pointer.
12440     * Rust functions which take ownership of an object provided via an argument require
12441     * this to be true and invalidate the object pointed to by inner.
12442     */
12443    bool is_owned;
12444 } LDKFilesystemPersister;
12445
12446
12447
12448 /**
12449  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
12450  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
12451  * responsibilities are:
12452  * * Processing [`Event`]s with a user-provided [`EventHandler`].
12453  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
12454  *   writing it to disk/backups by invoking the callback given to it at startup.
12455  *   [`ChannelManager`] persistence should be done in the background.
12456  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
12457  *   at the appropriate intervals.
12458  * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
12459  *   is provided to [`BackgroundProcessor::start`]).
12460  *
12461  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
12462  * upon as doing so may result in high latency.
12463  *
12464  * # Note
12465  *
12466  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
12467  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
12468  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
12469  * unilateral chain closure fees are at risk.
12470  *
12471  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
12472  * [`Event`]: lightning::util::events::Event
12473  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
12474  */
12475 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
12476    /**
12477     * A pointer to the opaque Rust object.
12478     * Nearly everywhere, inner must be non-null, however in places where
12479     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12480     */
12481    LDKnativeBackgroundProcessor *inner;
12482    /**
12483     * Indicates that this is the only struct which contains the same pointer.
12484     * Rust functions which take ownership of an object provided via an argument require
12485     * this to be true and invalidate the object pointed to by inner.
12486     */
12487    bool is_owned;
12488 } LDKBackgroundProcessor;
12489
12490
12491
12492 /**
12493  * Rapid Gossip Sync struct
12494  * See [crate-level documentation] for usage.
12495  *
12496  * [crate-level documentation]: crate
12497  */
12498 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
12499    /**
12500     * A pointer to the opaque Rust object.
12501     * Nearly everywhere, inner must be non-null, however in places where
12502     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12503     */
12504    LDKnativeRapidGossipSync *inner;
12505    /**
12506     * Indicates that this is the only struct which contains the same pointer.
12507     * Rust functions which take ownership of an object provided via an argument require
12508     * this to be true and invalidate the object pointed to by inner.
12509     */
12510    bool is_owned;
12511 } LDKRapidGossipSync;
12512
12513 /**
12514  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
12515  */
12516 typedef enum LDKGossipSync_Tag {
12517    /**
12518     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
12519     */
12520    LDKGossipSync_P2P,
12521    /**
12522     * Rapid gossip sync from a trusted server.
12523     */
12524    LDKGossipSync_Rapid,
12525    /**
12526     * No gossip sync.
12527     */
12528    LDKGossipSync_None,
12529    /**
12530     * Must be last for serialization purposes
12531     */
12532    LDKGossipSync_Sentinel,
12533 } LDKGossipSync_Tag;
12534
12535 typedef struct MUST_USE_STRUCT LDKGossipSync {
12536    LDKGossipSync_Tag tag;
12537    union {
12538       struct {
12539          /**
12540           * Note that this field is expected to be a reference.
12541           */
12542          struct LDKP2PGossipSync p2p;
12543       };
12544       struct {
12545          /**
12546           * Note that this field is expected to be a reference.
12547           */
12548          struct LDKRapidGossipSync rapid;
12549       };
12550    };
12551 } LDKGossipSync;
12552
12553
12554
12555 /**
12556  * Data of the `RawInvoice` that is encoded in the data part
12557  */
12558 typedef struct MUST_USE_STRUCT LDKRawDataPart {
12559    /**
12560     * A pointer to the opaque Rust object.
12561     * Nearly everywhere, inner must be non-null, however in places where
12562     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12563     */
12564    LDKnativeRawDataPart *inner;
12565    /**
12566     * Indicates that this is the only struct which contains the same pointer.
12567     * Rust functions which take ownership of an object provided via an argument require
12568     * this to be true and invalidate the object pointed to by inner.
12569     */
12570    bool is_owned;
12571 } LDKRawDataPart;
12572
12573
12574
12575 /**
12576  * SHA-256 hash
12577  */
12578 typedef struct MUST_USE_STRUCT LDKSha256 {
12579    /**
12580     * A pointer to the opaque Rust object.
12581     * Nearly everywhere, inner must be non-null, however in places where
12582     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12583     */
12584    LDKnativeSha256 *inner;
12585    /**
12586     * Indicates that this is the only struct which contains the same pointer.
12587     * Rust functions which take ownership of an object provided via an argument require
12588     * this to be true and invalidate the object pointed to by inner.
12589     */
12590    bool is_owned;
12591 } LDKSha256;
12592
12593
12594
12595 /**
12596  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
12597  * expires
12598  */
12599 typedef struct MUST_USE_STRUCT LDKExpiryTime {
12600    /**
12601     * A pointer to the opaque Rust object.
12602     * Nearly everywhere, inner must be non-null, however in places where
12603     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12604     */
12605    LDKnativeExpiryTime *inner;
12606    /**
12607     * Indicates that this is the only struct which contains the same pointer.
12608     * Rust functions which take ownership of an object provided via an argument require
12609     * this to be true and invalidate the object pointed to by inner.
12610     */
12611    bool is_owned;
12612 } LDKExpiryTime;
12613
12614
12615
12616 /**
12617  * `min_final_cltv_expiry` to use for the last HTLC in the route
12618  */
12619 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
12620    /**
12621     * A pointer to the opaque Rust object.
12622     * Nearly everywhere, inner must be non-null, however in places where
12623     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12624     */
12625    LDKnativeMinFinalCltvExpiry *inner;
12626    /**
12627     * Indicates that this is the only struct which contains the same pointer.
12628     * Rust functions which take ownership of an object provided via an argument require
12629     * this to be true and invalidate the object pointed to by inner.
12630     */
12631    bool is_owned;
12632 } LDKMinFinalCltvExpiry;
12633
12634 /**
12635  * A 20-byte byte array.
12636  */
12637 typedef struct LDKTwentyBytes {
12638    /**
12639     * The twenty bytes
12640     */
12641    uint8_t data[20];
12642 } LDKTwentyBytes;
12643
12644 /**
12645  * Fallback address in case no LN payment is possible
12646  */
12647 typedef enum LDKFallback_Tag {
12648    LDKFallback_SegWitProgram,
12649    LDKFallback_PubKeyHash,
12650    LDKFallback_ScriptHash,
12651    /**
12652     * Must be last for serialization purposes
12653     */
12654    LDKFallback_Sentinel,
12655 } LDKFallback_Tag;
12656
12657 typedef struct LDKFallback_LDKSegWitProgram_Body {
12658    struct LDKu5 version;
12659    struct LDKCVec_u8Z program;
12660 } LDKFallback_LDKSegWitProgram_Body;
12661
12662 typedef struct MUST_USE_STRUCT LDKFallback {
12663    LDKFallback_Tag tag;
12664    union {
12665       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
12666       struct {
12667          struct LDKTwentyBytes pub_key_hash;
12668       };
12669       struct {
12670          struct LDKTwentyBytes script_hash;
12671       };
12672    };
12673 } LDKFallback;
12674
12675 /**
12676  * A trait defining behavior of an [`Invoice`] payer.
12677  */
12678 typedef struct LDKPayer {
12679    /**
12680     * An opaque pointer which is passed to your function implementations as an argument.
12681     * This has no meaning in the LDK, and can be NULL or any other value.
12682     */
12683    void *this_arg;
12684    /**
12685     * Returns the payer's node id.
12686     */
12687    struct LDKPublicKey (*node_id)(const void *this_arg);
12688    /**
12689     * Returns the payer's channels.
12690     */
12691    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
12692    /**
12693     * Sends a payment over the Lightning Network using the given [`Route`].
12694     *
12695     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
12696     */
12697    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
12698    /**
12699     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
12700     */
12701    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
12702    /**
12703     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
12704     */
12705    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
12706    /**
12707     * Signals that no further retries for the given payment will occur.
12708     */
12709    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
12710    /**
12711     * Frees any resources associated with this object given its this_arg pointer.
12712     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12713     */
12714    void (*free)(void *this_arg);
12715 } LDKPayer;
12716
12717 /**
12718  * A trait defining behavior for routing an [`Invoice`] payment.
12719  */
12720 typedef struct LDKRouter {
12721    /**
12722     * An opaque pointer which is passed to your function implementations as an argument.
12723     * This has no meaning in the LDK, and can be NULL or any other value.
12724     */
12725    void *this_arg;
12726    /**
12727     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
12728     *
12729     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
12730     */
12731    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);
12732    /**
12733     * Frees any resources associated with this object given its this_arg pointer.
12734     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12735     */
12736    void (*free)(void *this_arg);
12737 } LDKRouter;
12738
12739
12740
12741 /**
12742  * A utility for paying [`Invoice`]s and sending spontaneous payments.
12743  *
12744  * See [module-level documentation] for details.
12745  *
12746  * [module-level documentation]: crate::payment
12747  */
12748 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
12749    /**
12750     * A pointer to the opaque Rust object.
12751     * Nearly everywhere, inner must be non-null, however in places where
12752     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12753     */
12754    LDKnativeInvoicePayer *inner;
12755    /**
12756     * Indicates that this is the only struct which contains the same pointer.
12757     * Rust functions which take ownership of an object provided via an argument require
12758     * this to be true and invalidate the object pointed to by inner.
12759     */
12760    bool is_owned;
12761 } LDKInvoicePayer;
12762
12763 /**
12764  * Strategies available to retry payment path failures for an [`Invoice`].
12765  *
12766  */
12767 typedef enum LDKRetry_Tag {
12768    /**
12769     * Max number of attempts to retry payment.
12770     *
12771     * Note that this is the number of *path* failures, not full payment retries. For multi-path
12772     * payments, if this is less than the total number of paths, we will never even retry all of the
12773     * payment's paths.
12774     */
12775    LDKRetry_Attempts,
12776    /**
12777     * Time elapsed before abandoning retries for a payment.
12778     */
12779    LDKRetry_Timeout,
12780    /**
12781     * Must be last for serialization purposes
12782     */
12783    LDKRetry_Sentinel,
12784 } LDKRetry_Tag;
12785
12786 typedef struct MUST_USE_STRUCT LDKRetry {
12787    LDKRetry_Tag tag;
12788    union {
12789       struct {
12790          uintptr_t attempts;
12791       };
12792       struct {
12793          uint64_t timeout;
12794       };
12795    };
12796 } LDKRetry;
12797
12798
12799
12800 /**
12801  * A [`Router`] implemented using [`find_route`].
12802  */
12803 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
12804    /**
12805     * A pointer to the opaque Rust object.
12806     * Nearly everywhere, inner must be non-null, however in places where
12807     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12808     */
12809    LDKnativeDefaultRouter *inner;
12810    /**
12811     * Indicates that this is the only struct which contains the same pointer.
12812     * Rust functions which take ownership of an object provided via an argument require
12813     * this to be true and invalidate the object pointed to by inner.
12814     */
12815    bool is_owned;
12816 } LDKDefaultRouter;
12817
12818 extern const uintptr_t MAX_BUF_SIZE;
12819
12820 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
12821
12822 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
12823
12824 extern const uint32_t ANTI_REORG_DELAY;
12825
12826 extern const uint16_t BREAKDOWN_TIMEOUT;
12827
12828 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
12829
12830 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
12831
12832 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
12833
12834 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
12835
12836 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
12837
12838 extern const uint8_t DEFAULT_MAX_MPP_PATH_COUNT;
12839
12840 extern const uint64_t MAX_TIMESTAMP;
12841
12842 extern const uint64_t DEFAULT_EXPIRY_TIME;
12843
12844 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
12845
12846 extern const uint8_t TAG_PAYMENT_HASH;
12847
12848 extern const uint8_t TAG_DESCRIPTION;
12849
12850 extern const uint8_t TAG_PAYEE_PUB_KEY;
12851
12852 extern const uint8_t TAG_DESCRIPTION_HASH;
12853
12854 extern const uint8_t TAG_EXPIRY_TIME;
12855
12856 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
12857
12858 extern const uint8_t TAG_FALLBACK;
12859
12860 extern const uint8_t TAG_PRIVATE_ROUTE;
12861
12862 extern const uint8_t TAG_PAYMENT_SECRET;
12863
12864 extern const uint8_t TAG_FEATURES;
12865
12866 struct LDKStr _ldk_get_compiled_version(void);
12867
12868 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
12869
12870 /**
12871  * Creates a new Bech32Error which has the same data as `orig`
12872  */
12873 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
12874
12875 /**
12876  * Releases any memory held by the given `Bech32Error` (which is currently none)
12877  */
12878 void Bech32Error_free(struct LDKBech32Error o);
12879
12880 /**
12881  * Frees the data buffer, if data_is_owned is set and datalen > 0.
12882  */
12883 void Transaction_free(struct LDKTransaction _res);
12884
12885 /**
12886  * Convenience function for constructing a new TxOut
12887  */
12888 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
12889
12890 /**
12891  * Frees the data pointed to by script_pubkey.
12892  */
12893 void TxOut_free(struct LDKTxOut _res);
12894
12895 /**
12896  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
12897  */
12898 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
12899
12900 /**
12901  * Frees the data buffer, if chars_is_owned is set and len > 0.
12902  */
12903 void Str_free(struct LDKStr _res);
12904
12905 #if defined(LDK_DEBUG_BUILD)
12906 /**
12907  * This function exists for memory safety testing purposes. It should never be used in production
12908  * code
12909  */
12910 const void *__unmangle_inner_ptr(const void *ptr);
12911 #endif
12912
12913 /**
12914  * Creates a new CResult_NoneNoneZ in the success state.
12915  */
12916 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
12917
12918 /**
12919  * Creates a new CResult_NoneNoneZ in the error state.
12920  */
12921 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
12922
12923 /**
12924  * Checks if the given object is currently in the success state
12925  */
12926 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
12927
12928 /**
12929  * Frees any resources used by the CResult_NoneNoneZ.
12930  */
12931 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
12932
12933 /**
12934  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
12935  * but with all dynamically-allocated buffers duplicated in new buffers.
12936  */
12937 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
12938
12939 /**
12940  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
12941  */
12942 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
12943
12944 /**
12945  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
12946  */
12947 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
12948
12949 /**
12950  * Checks if the given object is currently in the success state
12951  */
12952 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
12953
12954 /**
12955  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
12956  */
12957 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
12958
12959 /**
12960  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
12961  * but with all dynamically-allocated buffers duplicated in new buffers.
12962  */
12963 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
12964
12965 /**
12966  * Creates a new CResult_SecretKeyErrorZ in the success state.
12967  */
12968 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
12969
12970 /**
12971  * Creates a new CResult_SecretKeyErrorZ in the error state.
12972  */
12973 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
12974
12975 /**
12976  * Checks if the given object is currently in the success state
12977  */
12978 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
12979
12980 /**
12981  * Frees any resources used by the CResult_SecretKeyErrorZ.
12982  */
12983 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
12984
12985 /**
12986  * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
12987  * but with all dynamically-allocated buffers duplicated in new buffers.
12988  */
12989 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
12990
12991 /**
12992  * Creates a new CResult_PublicKeyErrorZ in the success state.
12993  */
12994 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
12995
12996 /**
12997  * Creates a new CResult_PublicKeyErrorZ in the error state.
12998  */
12999 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
13000
13001 /**
13002  * Checks if the given object is currently in the success state
13003  */
13004 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
13005
13006 /**
13007  * Frees any resources used by the CResult_PublicKeyErrorZ.
13008  */
13009 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
13010
13011 /**
13012  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
13013  * but with all dynamically-allocated buffers duplicated in new buffers.
13014  */
13015 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
13016
13017 /**
13018  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
13019  */
13020 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
13021
13022 /**
13023  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
13024  */
13025 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
13026
13027 /**
13028  * Checks if the given object is currently in the success state
13029  */
13030 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
13031
13032 /**
13033  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
13034  */
13035 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
13036
13037 /**
13038  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
13039  * but with all dynamically-allocated buffers duplicated in new buffers.
13040  */
13041 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
13042
13043 /**
13044  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
13045  */
13046 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
13047
13048 /**
13049  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
13050  */
13051 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
13052
13053 /**
13054  * Checks if the given object is currently in the success state
13055  */
13056 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
13057
13058 /**
13059  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
13060  */
13061 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
13062
13063 /**
13064  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
13065  * but with all dynamically-allocated buffers duplicated in new buffers.
13066  */
13067 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
13068
13069 /**
13070  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
13071  */
13072 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
13073
13074 /**
13075  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
13076  */
13077 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
13078
13079 /**
13080  * Checks if the given object is currently in the success state
13081  */
13082 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
13083
13084 /**
13085  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
13086  */
13087 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
13088
13089 /**
13090  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
13091  * but with all dynamically-allocated buffers duplicated in new buffers.
13092  */
13093 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
13094
13095 /**
13096  * Constructs a new COption_u32Z containing a u32
13097  */
13098 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
13099
13100 /**
13101  * Constructs a new COption_u32Z containing nothing
13102  */
13103 struct LDKCOption_u32Z COption_u32Z_none(void);
13104
13105 /**
13106  * Frees any resources associated with the u32, if we are in the Some state
13107  */
13108 void COption_u32Z_free(struct LDKCOption_u32Z _res);
13109
13110 /**
13111  * Creates a new COption_u32Z which has the same data as `orig`
13112  * but with all dynamically-allocated buffers duplicated in new buffers.
13113  */
13114 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
13115
13116 /**
13117  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
13118  */
13119 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
13120
13121 /**
13122  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
13123  */
13124 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
13125
13126 /**
13127  * Checks if the given object is currently in the success state
13128  */
13129 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
13130
13131 /**
13132  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
13133  */
13134 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
13135
13136 /**
13137  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
13138  * but with all dynamically-allocated buffers duplicated in new buffers.
13139  */
13140 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
13141
13142 /**
13143  * Constructs a new COption_NoneZ containing a
13144  */
13145 enum LDKCOption_NoneZ COption_NoneZ_some(void);
13146
13147 /**
13148  * Constructs a new COption_NoneZ containing nothing
13149  */
13150 enum LDKCOption_NoneZ COption_NoneZ_none(void);
13151
13152 /**
13153  * Frees any resources associated with the , if we are in the Some state
13154  */
13155 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
13156
13157 /**
13158  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
13159  */
13160 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
13161
13162 /**
13163  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
13164  */
13165 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
13166
13167 /**
13168  * Checks if the given object is currently in the success state
13169  */
13170 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
13171
13172 /**
13173  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
13174  */
13175 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
13176
13177 /**
13178  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
13179  * but with all dynamically-allocated buffers duplicated in new buffers.
13180  */
13181 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
13182
13183 /**
13184  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
13185  */
13186 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
13187
13188 /**
13189  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
13190  */
13191 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
13192
13193 /**
13194  * Checks if the given object is currently in the success state
13195  */
13196 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
13197
13198 /**
13199  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
13200  */
13201 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
13202
13203 /**
13204  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
13205  * but with all dynamically-allocated buffers duplicated in new buffers.
13206  */
13207 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
13208
13209 /**
13210  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13211  */
13212 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
13213
13214 /**
13215  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
13216  */
13217 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
13218
13219 /**
13220  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
13221  */
13222 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13223
13224 /**
13225  * Checks if the given object is currently in the success state
13226  */
13227 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13228
13229 /**
13230  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
13231  */
13232 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
13233
13234 /**
13235  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
13236  * but with all dynamically-allocated buffers duplicated in new buffers.
13237  */
13238 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13239
13240 /**
13241  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
13242  */
13243 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
13244
13245 /**
13246  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
13247  */
13248 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13249
13250 /**
13251  * Checks if the given object is currently in the success state
13252  */
13253 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13254
13255 /**
13256  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
13257  */
13258 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
13259
13260 /**
13261  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
13262  * but with all dynamically-allocated buffers duplicated in new buffers.
13263  */
13264 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13265
13266 /**
13267  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
13268  */
13269 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
13270
13271 /**
13272  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
13273  */
13274 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
13275
13276 /**
13277  * Checks if the given object is currently in the success state
13278  */
13279 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
13280
13281 /**
13282  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
13283  */
13284 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
13285
13286 /**
13287  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
13288  */
13289 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
13290
13291 /**
13292  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
13293  */
13294 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13295
13296 /**
13297  * Checks if the given object is currently in the success state
13298  */
13299 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13300
13301 /**
13302  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
13303  */
13304 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
13305
13306 /**
13307  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
13308  * but with all dynamically-allocated buffers duplicated in new buffers.
13309  */
13310 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13311
13312 /**
13313  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
13314  */
13315 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
13316
13317 /**
13318  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
13319  */
13320 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
13321
13322 /**
13323  * Checks if the given object is currently in the success state
13324  */
13325 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
13326
13327 /**
13328  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
13329  */
13330 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
13331
13332 /**
13333  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
13334  */
13335 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
13336
13337 /**
13338  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
13339  */
13340 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
13341
13342 /**
13343  * Checks if the given object is currently in the success state
13344  */
13345 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
13346
13347 /**
13348  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
13349  */
13350 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
13351
13352 /**
13353  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
13354  * but with all dynamically-allocated buffers duplicated in new buffers.
13355  */
13356 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
13357
13358 /**
13359  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
13360  */
13361 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
13362
13363 /**
13364  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
13365  */
13366 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
13367
13368 /**
13369  * Checks if the given object is currently in the success state
13370  */
13371 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
13372
13373 /**
13374  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
13375  */
13376 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
13377
13378 /**
13379  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
13380  * but with all dynamically-allocated buffers duplicated in new buffers.
13381  */
13382 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
13383
13384 /**
13385  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
13386  */
13387 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
13388
13389 /**
13390  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
13391  */
13392 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
13393
13394 /**
13395  * Checks if the given object is currently in the success state
13396  */
13397 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
13398
13399 /**
13400  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
13401  */
13402 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
13403
13404 /**
13405  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
13406  * but with all dynamically-allocated buffers duplicated in new buffers.
13407  */
13408 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
13409
13410 /**
13411  * Creates a new CResult_NoneErrorZ in the success state.
13412  */
13413 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
13414
13415 /**
13416  * Creates a new CResult_NoneErrorZ in the error state.
13417  */
13418 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
13419
13420 /**
13421  * Checks if the given object is currently in the success state
13422  */
13423 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
13424
13425 /**
13426  * Frees any resources used by the CResult_NoneErrorZ.
13427  */
13428 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
13429
13430 /**
13431  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
13432  * but with all dynamically-allocated buffers duplicated in new buffers.
13433  */
13434 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
13435
13436 /**
13437  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
13438  */
13439 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
13440
13441 /**
13442  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
13443  */
13444 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
13445
13446 /**
13447  * Checks if the given object is currently in the success state
13448  */
13449 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
13450
13451 /**
13452  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
13453  */
13454 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
13455
13456 /**
13457  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
13458  * but with all dynamically-allocated buffers duplicated in new buffers.
13459  */
13460 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
13461
13462 /**
13463  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13464  */
13465 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
13466
13467 /**
13468  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13469  */
13470 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
13471
13472 /**
13473  * Creates a new CResult_RouteDecodeErrorZ in the success state.
13474  */
13475 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
13476
13477 /**
13478  * Creates a new CResult_RouteDecodeErrorZ in the error state.
13479  */
13480 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
13481
13482 /**
13483  * Checks if the given object is currently in the success state
13484  */
13485 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
13486
13487 /**
13488  * Frees any resources used by the CResult_RouteDecodeErrorZ.
13489  */
13490 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
13491
13492 /**
13493  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
13494  * but with all dynamically-allocated buffers duplicated in new buffers.
13495  */
13496 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
13497
13498 /**
13499  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
13500  */
13501 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
13502
13503 /**
13504  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
13505  */
13506 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
13507
13508 /**
13509  * Checks if the given object is currently in the success state
13510  */
13511 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
13512
13513 /**
13514  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
13515  */
13516 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
13517
13518 /**
13519  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
13520  * but with all dynamically-allocated buffers duplicated in new buffers.
13521  */
13522 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
13523
13524 /**
13525  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13526  */
13527 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
13528
13529 /**
13530  * Constructs a new COption_u64Z containing a u64
13531  */
13532 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
13533
13534 /**
13535  * Constructs a new COption_u64Z containing nothing
13536  */
13537 struct LDKCOption_u64Z COption_u64Z_none(void);
13538
13539 /**
13540  * Frees any resources associated with the u64, if we are in the Some state
13541  */
13542 void COption_u64Z_free(struct LDKCOption_u64Z _res);
13543
13544 /**
13545  * Creates a new COption_u64Z which has the same data as `orig`
13546  * but with all dynamically-allocated buffers duplicated in new buffers.
13547  */
13548 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
13549
13550 /**
13551  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
13552  */
13553 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
13554
13555 /**
13556  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
13557  */
13558 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
13559
13560 /**
13561  * Checks if the given object is currently in the success state
13562  */
13563 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
13564
13565 /**
13566  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
13567  */
13568 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
13569
13570 /**
13571  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
13572  * but with all dynamically-allocated buffers duplicated in new buffers.
13573  */
13574 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
13575
13576 /**
13577  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13578  */
13579 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
13580
13581 /**
13582  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
13583  */
13584 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
13585
13586 /**
13587  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
13588  */
13589 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
13590
13591 /**
13592  * Checks if the given object is currently in the success state
13593  */
13594 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
13595
13596 /**
13597  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
13598  */
13599 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
13600
13601 /**
13602  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
13603  * but with all dynamically-allocated buffers duplicated in new buffers.
13604  */
13605 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
13606
13607 /**
13608  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
13609  */
13610 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
13611
13612 /**
13613  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
13614  */
13615 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
13616
13617 /**
13618  * Checks if the given object is currently in the success state
13619  */
13620 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
13621
13622 /**
13623  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
13624  */
13625 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
13626
13627 /**
13628  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
13629  * but with all dynamically-allocated buffers duplicated in new buffers.
13630  */
13631 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
13632
13633 /**
13634  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13635  */
13636 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
13637
13638 /**
13639  * Creates a new CResult_RouteLightningErrorZ in the success state.
13640  */
13641 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
13642
13643 /**
13644  * Creates a new CResult_RouteLightningErrorZ in the error state.
13645  */
13646 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
13647
13648 /**
13649  * Checks if the given object is currently in the success state
13650  */
13651 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
13652
13653 /**
13654  * Frees any resources used by the CResult_RouteLightningErrorZ.
13655  */
13656 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
13657
13658 /**
13659  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
13660  * but with all dynamically-allocated buffers duplicated in new buffers.
13661  */
13662 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
13663
13664 /**
13665  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13666  */
13667 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
13668
13669 /**
13670  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
13671  */
13672 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
13673
13674 /**
13675  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
13676  */
13677 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
13678
13679 /**
13680  * Checks if the given object is currently in the success state
13681  */
13682 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
13683
13684 /**
13685  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
13686  */
13687 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
13688
13689 /**
13690  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
13691  * but with all dynamically-allocated buffers duplicated in new buffers.
13692  */
13693 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
13694
13695 /**
13696  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
13697  */
13698 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
13699
13700 /**
13701  * Constructs a new COption_ClosureReasonZ containing nothing
13702  */
13703 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
13704
13705 /**
13706  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
13707  */
13708 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
13709
13710 /**
13711  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
13712  * but with all dynamically-allocated buffers duplicated in new buffers.
13713  */
13714 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
13715
13716 /**
13717  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
13718  */
13719 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
13720
13721 /**
13722  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
13723  */
13724 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
13725
13726 /**
13727  * Checks if the given object is currently in the success state
13728  */
13729 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
13730
13731 /**
13732  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
13733  */
13734 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
13735
13736 /**
13737  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
13738  * but with all dynamically-allocated buffers duplicated in new buffers.
13739  */
13740 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
13741
13742 /**
13743  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
13744  */
13745 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
13746
13747 /**
13748  * Constructs a new COption_NetworkUpdateZ containing nothing
13749  */
13750 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
13751
13752 /**
13753  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
13754  */
13755 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
13756
13757 /**
13758  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
13759  * but with all dynamically-allocated buffers duplicated in new buffers.
13760  */
13761 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
13762
13763 /**
13764  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13765  */
13766 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
13767
13768 /**
13769  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
13770  */
13771 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
13772
13773 /**
13774  * Constructs a new COption_EventZ containing nothing
13775  */
13776 struct LDKCOption_EventZ COption_EventZ_none(void);
13777
13778 /**
13779  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
13780  */
13781 void COption_EventZ_free(struct LDKCOption_EventZ _res);
13782
13783 /**
13784  * Creates a new COption_EventZ which has the same data as `orig`
13785  * but with all dynamically-allocated buffers duplicated in new buffers.
13786  */
13787 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
13788
13789 /**
13790  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
13791  */
13792 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
13793
13794 /**
13795  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
13796  */
13797 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
13798
13799 /**
13800  * Checks if the given object is currently in the success state
13801  */
13802 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
13803
13804 /**
13805  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
13806  */
13807 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
13808
13809 /**
13810  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
13811  * but with all dynamically-allocated buffers duplicated in new buffers.
13812  */
13813 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
13814
13815 /**
13816  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13817  */
13818 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
13819
13820 /**
13821  * Creates a new CResult_TxOutAccessErrorZ in the success state.
13822  */
13823 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
13824
13825 /**
13826  * Creates a new CResult_TxOutAccessErrorZ in the error state.
13827  */
13828 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
13829
13830 /**
13831  * Checks if the given object is currently in the success state
13832  */
13833 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
13834
13835 /**
13836  * Frees any resources used by the CResult_TxOutAccessErrorZ.
13837  */
13838 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
13839
13840 /**
13841  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
13842  * but with all dynamically-allocated buffers duplicated in new buffers.
13843  */
13844 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
13845
13846 /**
13847  * Creates a new tuple which has the same data as `orig`
13848  * but with all dynamically-allocated buffers duplicated in new buffers.
13849  */
13850 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
13851
13852 /**
13853  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
13854  */
13855 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
13856
13857 /**
13858  * Frees any resources used by the C2Tuple_usizeTransactionZ.
13859  */
13860 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
13861
13862 /**
13863  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13864  */
13865 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
13866
13867 /**
13868  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13869  */
13870 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
13871
13872 /**
13873  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
13874  */
13875 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
13876
13877 /**
13878  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
13879  */
13880 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
13881
13882 /**
13883  * Checks if the given object is currently in the success state
13884  */
13885 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
13886
13887 /**
13888  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
13889  */
13890 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
13891
13892 /**
13893  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
13894  * but with all dynamically-allocated buffers duplicated in new buffers.
13895  */
13896 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
13897
13898 /**
13899  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13900  */
13901 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
13902
13903 /**
13904  * Creates a new tuple which has the same data as `orig`
13905  * but with all dynamically-allocated buffers duplicated in new buffers.
13906  */
13907 struct LDKC2Tuple_OutPointCVec_MonitorEventZZ C2Tuple_OutPointCVec_MonitorEventZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR orig);
13908
13909 /**
13910  * Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
13911  */
13912 struct LDKC2Tuple_OutPointCVec_MonitorEventZZ C2Tuple_OutPointCVec_MonitorEventZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b);
13913
13914 /**
13915  * Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
13916  */
13917 void C2Tuple_OutPointCVec_MonitorEventZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorEventZZ _res);
13918
13919 /**
13920  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13921  */
13922 void CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res);
13923
13924 /**
13925  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
13926  */
13927 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
13928
13929 /**
13930  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
13931  */
13932 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
13933
13934 /**
13935  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
13936  */
13937 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
13938
13939 /**
13940  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
13941  * but with all dynamically-allocated buffers duplicated in new buffers.
13942  */
13943 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
13944
13945 /**
13946  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
13947  */
13948 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
13949
13950 /**
13951  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
13952  */
13953 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
13954
13955 /**
13956  * Checks if the given object is currently in the success state
13957  */
13958 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
13959
13960 /**
13961  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
13962  */
13963 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
13964
13965 /**
13966  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
13967  * but with all dynamically-allocated buffers duplicated in new buffers.
13968  */
13969 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
13970
13971 /**
13972  * Creates a new tuple which has the same data as `orig`
13973  * but with all dynamically-allocated buffers duplicated in new buffers.
13974  */
13975 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
13976
13977 /**
13978  * Creates a new C2Tuple_u64u64Z from the contained elements.
13979  */
13980 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
13981
13982 /**
13983  * Frees any resources used by the C2Tuple_u64u64Z.
13984  */
13985 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
13986
13987 /**
13988  * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
13989  */
13990 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o);
13991
13992 /**
13993  * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
13994  */
13995 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void);
13996
13997 /**
13998  * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
13999  */
14000 void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res);
14001
14002 /**
14003  * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
14004  * but with all dynamically-allocated buffers duplicated in new buffers.
14005  */
14006 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig);
14007
14008 /**
14009  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14010  */
14011 void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res);
14012
14013 /**
14014  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
14015  */
14016 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
14017
14018 /**
14019  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
14020  */
14021 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
14022
14023 /**
14024  * Checks if the given object is currently in the success state
14025  */
14026 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
14027
14028 /**
14029  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
14030  */
14031 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
14032
14033 /**
14034  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
14035  */
14036 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
14037
14038 /**
14039  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
14040  */
14041 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14042
14043 /**
14044  * Checks if the given object is currently in the success state
14045  */
14046 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
14047
14048 /**
14049  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
14050  */
14051 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
14052
14053 /**
14054  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
14055  * but with all dynamically-allocated buffers duplicated in new buffers.
14056  */
14057 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
14058
14059 /**
14060  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
14061  */
14062 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
14063
14064 /**
14065  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
14066  */
14067 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14068
14069 /**
14070  * Checks if the given object is currently in the success state
14071  */
14072 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
14073
14074 /**
14075  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
14076  */
14077 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
14078
14079 /**
14080  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
14081  * but with all dynamically-allocated buffers duplicated in new buffers.
14082  */
14083 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
14084
14085 /**
14086  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
14087  */
14088 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
14089
14090 /**
14091  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
14092  */
14093 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14094
14095 /**
14096  * Checks if the given object is currently in the success state
14097  */
14098 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
14099
14100 /**
14101  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
14102  */
14103 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
14104
14105 /**
14106  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
14107  * but with all dynamically-allocated buffers duplicated in new buffers.
14108  */
14109 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
14110
14111 /**
14112  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
14113  */
14114 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
14115
14116 /**
14117  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
14118  */
14119 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14120
14121 /**
14122  * Checks if the given object is currently in the success state
14123  */
14124 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
14125
14126 /**
14127  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
14128  */
14129 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
14130
14131 /**
14132  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
14133  * but with all dynamically-allocated buffers duplicated in new buffers.
14134  */
14135 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
14136
14137 /**
14138  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
14139  */
14140 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
14141
14142 /**
14143  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
14144  */
14145 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14146
14147 /**
14148  * Checks if the given object is currently in the success state
14149  */
14150 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
14151
14152 /**
14153  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
14154  */
14155 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
14156
14157 /**
14158  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
14159  * but with all dynamically-allocated buffers duplicated in new buffers.
14160  */
14161 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
14162
14163 /**
14164  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
14165  */
14166 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
14167
14168 /**
14169  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
14170  */
14171 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
14172
14173 /**
14174  * Checks if the given object is currently in the success state
14175  */
14176 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
14177
14178 /**
14179  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
14180  */
14181 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
14182
14183 /**
14184  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
14185  * but with all dynamically-allocated buffers duplicated in new buffers.
14186  */
14187 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
14188
14189 /**
14190  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
14191  */
14192 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
14193
14194 /**
14195  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
14196  */
14197 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
14198
14199 /**
14200  * Checks if the given object is currently in the success state
14201  */
14202 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
14203
14204 /**
14205  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
14206  */
14207 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
14208
14209 /**
14210  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
14211  * but with all dynamically-allocated buffers duplicated in new buffers.
14212  */
14213 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
14214
14215 /**
14216  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
14217  */
14218 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
14219
14220 /**
14221  * Constructs a new COption_AccessZ containing nothing
14222  */
14223 struct LDKCOption_AccessZ COption_AccessZ_none(void);
14224
14225 /**
14226  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
14227  */
14228 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
14229
14230 /**
14231  * Creates a new CResult_boolLightningErrorZ in the success state.
14232  */
14233 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
14234
14235 /**
14236  * Creates a new CResult_boolLightningErrorZ in the error state.
14237  */
14238 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
14239
14240 /**
14241  * Checks if the given object is currently in the success state
14242  */
14243 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
14244
14245 /**
14246  * Frees any resources used by the CResult_boolLightningErrorZ.
14247  */
14248 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
14249
14250 /**
14251  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
14252  * but with all dynamically-allocated buffers duplicated in new buffers.
14253  */
14254 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
14255
14256 /**
14257  * Creates a new tuple which has the same data as `orig`
14258  * but with all dynamically-allocated buffers duplicated in new buffers.
14259  */
14260 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
14261
14262 /**
14263  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
14264  */
14265 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
14266
14267 /**
14268  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
14269  */
14270 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
14271
14272 /**
14273  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14274  */
14275 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
14276
14277 /**
14278  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14279  */
14280 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
14281
14282 /**
14283  * Creates a new CResult_NoneLightningErrorZ in the success state.
14284  */
14285 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
14286
14287 /**
14288  * Creates a new CResult_NoneLightningErrorZ in the error state.
14289  */
14290 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
14291
14292 /**
14293  * Checks if the given object is currently in the success state
14294  */
14295 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
14296
14297 /**
14298  * Frees any resources used by the CResult_NoneLightningErrorZ.
14299  */
14300 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
14301
14302 /**
14303  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
14304  * but with all dynamically-allocated buffers duplicated in new buffers.
14305  */
14306 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
14307
14308 /**
14309  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
14310  */
14311 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
14312
14313 /**
14314  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
14315  */
14316 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
14317
14318 /**
14319  * Checks if the given object is currently in the success state
14320  */
14321 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
14322
14323 /**
14324  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
14325  */
14326 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
14327
14328 /**
14329  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
14330  * but with all dynamically-allocated buffers duplicated in new buffers.
14331  */
14332 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
14333
14334 /**
14335  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
14336  */
14337 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
14338
14339 /**
14340  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
14341  */
14342 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
14343
14344 /**
14345  * Checks if the given object is currently in the success state
14346  */
14347 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
14348
14349 /**
14350  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
14351  */
14352 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
14353
14354 /**
14355  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
14356  * but with all dynamically-allocated buffers duplicated in new buffers.
14357  */
14358 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
14359
14360 /**
14361  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
14362  */
14363 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
14364
14365 /**
14366  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
14367  */
14368 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
14369
14370 /**
14371  * Checks if the given object is currently in the success state
14372  */
14373 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
14374
14375 /**
14376  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
14377  */
14378 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
14379
14380 /**
14381  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
14382  * but with all dynamically-allocated buffers duplicated in new buffers.
14383  */
14384 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
14385
14386 /**
14387  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14388  */
14389 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
14390
14391 /**
14392  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
14393  */
14394 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
14395
14396 /**
14397  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
14398  */
14399 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
14400
14401 /**
14402  * Checks if the given object is currently in the success state
14403  */
14404 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
14405
14406 /**
14407  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
14408  */
14409 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
14410
14411 /**
14412  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
14413  * but with all dynamically-allocated buffers duplicated in new buffers.
14414  */
14415 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
14416
14417 /**
14418  * Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
14419  */
14420 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o);
14421
14422 /**
14423  * Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
14424  */
14425 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e);
14426
14427 /**
14428  * Checks if the given object is currently in the success state
14429  */
14430 bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o);
14431
14432 /**
14433  * Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
14434  */
14435 void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res);
14436
14437 /**
14438  * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
14439  * but with all dynamically-allocated buffers duplicated in new buffers.
14440  */
14441 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig);
14442
14443 /**
14444  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14445  */
14446 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
14447
14448 /**
14449  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
14450  */
14451 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
14452
14453 /**
14454  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
14455  */
14456 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
14457
14458 /**
14459  * Checks if the given object is currently in the success state
14460  */
14461 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
14462
14463 /**
14464  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
14465  */
14466 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
14467
14468 /**
14469  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
14470  * but with all dynamically-allocated buffers duplicated in new buffers.
14471  */
14472 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
14473
14474 /**
14475  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
14476  */
14477 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
14478
14479 /**
14480  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
14481  */
14482 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
14483
14484 /**
14485  * Checks if the given object is currently in the success state
14486  */
14487 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
14488
14489 /**
14490  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
14491  */
14492 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
14493
14494 /**
14495  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
14496  */
14497 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
14498
14499 /**
14500  * Constructs a new COption_CVec_NetAddressZZ containing nothing
14501  */
14502 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
14503
14504 /**
14505  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
14506  */
14507 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
14508
14509 /**
14510  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
14511  * but with all dynamically-allocated buffers duplicated in new buffers.
14512  */
14513 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
14514
14515 /**
14516  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
14517  */
14518 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
14519
14520 /**
14521  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
14522  */
14523 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14524
14525 /**
14526  * Checks if the given object is currently in the success state
14527  */
14528 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14529
14530 /**
14531  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
14532  */
14533 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
14534
14535 /**
14536  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
14537  * but with all dynamically-allocated buffers duplicated in new buffers.
14538  */
14539 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14540
14541 /**
14542  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
14543  */
14544 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
14545
14546 /**
14547  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
14548  */
14549 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14550
14551 /**
14552  * Checks if the given object is currently in the success state
14553  */
14554 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14555
14556 /**
14557  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
14558  */
14559 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
14560
14561 /**
14562  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
14563  * but with all dynamically-allocated buffers duplicated in new buffers.
14564  */
14565 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14566
14567 /**
14568  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
14569  */
14570 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
14571
14572 /**
14573  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
14574  */
14575 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14576
14577 /**
14578  * Checks if the given object is currently in the success state
14579  */
14580 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14581
14582 /**
14583  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
14584  */
14585 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
14586
14587 /**
14588  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
14589  * but with all dynamically-allocated buffers duplicated in new buffers.
14590  */
14591 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14592
14593 /**
14594  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14595  */
14596 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
14597
14598 /**
14599  * Creates a new tuple which has the same data as `orig`
14600  * but with all dynamically-allocated buffers duplicated in new buffers.
14601  */
14602 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
14603
14604 /**
14605  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
14606  */
14607 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
14608
14609 /**
14610  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
14611  */
14612 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
14613
14614 /**
14615  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
14616  */
14617 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
14618
14619 /**
14620  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
14621  */
14622 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
14623
14624 /**
14625  * Checks if the given object is currently in the success state
14626  */
14627 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
14628
14629 /**
14630  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
14631  */
14632 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
14633
14634 /**
14635  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
14636  * but with all dynamically-allocated buffers duplicated in new buffers.
14637  */
14638 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
14639
14640 /**
14641  * Creates a new CResult_SignatureNoneZ in the success state.
14642  */
14643 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
14644
14645 /**
14646  * Creates a new CResult_SignatureNoneZ in the error state.
14647  */
14648 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
14649
14650 /**
14651  * Checks if the given object is currently in the success state
14652  */
14653 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
14654
14655 /**
14656  * Frees any resources used by the CResult_SignatureNoneZ.
14657  */
14658 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
14659
14660 /**
14661  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
14662  * but with all dynamically-allocated buffers duplicated in new buffers.
14663  */
14664 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
14665
14666 /**
14667  * Creates a new tuple which has the same data as `orig`
14668  * but with all dynamically-allocated buffers duplicated in new buffers.
14669  */
14670 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
14671
14672 /**
14673  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
14674  */
14675 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
14676
14677 /**
14678  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
14679  */
14680 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
14681
14682 /**
14683  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
14684  */
14685 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
14686
14687 /**
14688  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
14689  */
14690 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
14691
14692 /**
14693  * Checks if the given object is currently in the success state
14694  */
14695 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
14696
14697 /**
14698  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
14699  */
14700 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
14701
14702 /**
14703  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
14704  * but with all dynamically-allocated buffers duplicated in new buffers.
14705  */
14706 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
14707
14708 /**
14709  * Creates a new CResult_SecretKeyNoneZ in the success state.
14710  */
14711 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
14712
14713 /**
14714  * Creates a new CResult_SecretKeyNoneZ in the error state.
14715  */
14716 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
14717
14718 /**
14719  * Checks if the given object is currently in the success state
14720  */
14721 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
14722
14723 /**
14724  * Frees any resources used by the CResult_SecretKeyNoneZ.
14725  */
14726 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
14727
14728 /**
14729  * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
14730  * but with all dynamically-allocated buffers duplicated in new buffers.
14731  */
14732 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
14733
14734 /**
14735  * Creates a new CResult_SignDecodeErrorZ in the success state.
14736  */
14737 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
14738
14739 /**
14740  * Creates a new CResult_SignDecodeErrorZ in the error state.
14741  */
14742 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
14743
14744 /**
14745  * Checks if the given object is currently in the success state
14746  */
14747 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
14748
14749 /**
14750  * Frees any resources used by the CResult_SignDecodeErrorZ.
14751  */
14752 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
14753
14754 /**
14755  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
14756  * but with all dynamically-allocated buffers duplicated in new buffers.
14757  */
14758 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
14759
14760 /**
14761  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14762  */
14763 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
14764
14765 /**
14766  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
14767  */
14768 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
14769
14770 /**
14771  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
14772  */
14773 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
14774
14775 /**
14776  * Checks if the given object is currently in the success state
14777  */
14778 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
14779
14780 /**
14781  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
14782  */
14783 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
14784
14785 /**
14786  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
14787  * but with all dynamically-allocated buffers duplicated in new buffers.
14788  */
14789 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
14790
14791 /**
14792  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14793  */
14794 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
14795
14796 /**
14797  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14798  */
14799 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
14800
14801 /**
14802  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
14803  */
14804 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
14805
14806 /**
14807  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
14808  */
14809 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
14810
14811 /**
14812  * Checks if the given object is currently in the success state
14813  */
14814 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
14815
14816 /**
14817  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
14818  */
14819 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
14820
14821 /**
14822  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
14823  * but with all dynamically-allocated buffers duplicated in new buffers.
14824  */
14825 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
14826
14827 /**
14828  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
14829  */
14830 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
14831
14832 /**
14833  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
14834  */
14835 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
14836
14837 /**
14838  * Checks if the given object is currently in the success state
14839  */
14840 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
14841
14842 /**
14843  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
14844  */
14845 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
14846
14847 /**
14848  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
14849  * but with all dynamically-allocated buffers duplicated in new buffers.
14850  */
14851 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
14852
14853 /**
14854  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14855  */
14856 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
14857
14858 /**
14859  * Creates a new CResult_TransactionNoneZ in the success state.
14860  */
14861 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
14862
14863 /**
14864  * Creates a new CResult_TransactionNoneZ in the error state.
14865  */
14866 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
14867
14868 /**
14869  * Checks if the given object is currently in the success state
14870  */
14871 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
14872
14873 /**
14874  * Frees any resources used by the CResult_TransactionNoneZ.
14875  */
14876 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
14877
14878 /**
14879  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
14880  * but with all dynamically-allocated buffers duplicated in new buffers.
14881  */
14882 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
14883
14884 /**
14885  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
14886  */
14887 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
14888
14889 /**
14890  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
14891  */
14892 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
14893
14894 /**
14895  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14896  */
14897 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
14898
14899 /**
14900  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
14901  */
14902 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
14903
14904 /**
14905  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
14906  */
14907 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
14908
14909 /**
14910  * Checks if the given object is currently in the success state
14911  */
14912 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
14913
14914 /**
14915  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
14916  */
14917 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
14918
14919 /**
14920  * Constructs a new COption_u16Z containing a u16
14921  */
14922 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
14923
14924 /**
14925  * Constructs a new COption_u16Z containing nothing
14926  */
14927 struct LDKCOption_u16Z COption_u16Z_none(void);
14928
14929 /**
14930  * Frees any resources associated with the u16, if we are in the Some state
14931  */
14932 void COption_u16Z_free(struct LDKCOption_u16Z _res);
14933
14934 /**
14935  * Creates a new COption_u16Z which has the same data as `orig`
14936  * but with all dynamically-allocated buffers duplicated in new buffers.
14937  */
14938 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
14939
14940 /**
14941  * Creates a new CResult_NoneAPIErrorZ in the success state.
14942  */
14943 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
14944
14945 /**
14946  * Creates a new CResult_NoneAPIErrorZ in the error state.
14947  */
14948 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
14949
14950 /**
14951  * Checks if the given object is currently in the success state
14952  */
14953 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
14954
14955 /**
14956  * Frees any resources used by the CResult_NoneAPIErrorZ.
14957  */
14958 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
14959
14960 /**
14961  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
14962  * but with all dynamically-allocated buffers duplicated in new buffers.
14963  */
14964 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
14965
14966 /**
14967  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14968  */
14969 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
14970
14971 /**
14972  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14973  */
14974 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
14975
14976 /**
14977  * Creates a new CResult__u832APIErrorZ in the success state.
14978  */
14979 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
14980
14981 /**
14982  * Creates a new CResult__u832APIErrorZ in the error state.
14983  */
14984 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
14985
14986 /**
14987  * Checks if the given object is currently in the success state
14988  */
14989 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
14990
14991 /**
14992  * Frees any resources used by the CResult__u832APIErrorZ.
14993  */
14994 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
14995
14996 /**
14997  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
14998  * but with all dynamically-allocated buffers duplicated in new buffers.
14999  */
15000 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
15001
15002 /**
15003  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
15004  */
15005 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
15006
15007 /**
15008  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
15009  */
15010 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
15011
15012 /**
15013  * Checks if the given object is currently in the success state
15014  */
15015 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
15016
15017 /**
15018  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
15019  */
15020 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
15021
15022 /**
15023  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
15024  * but with all dynamically-allocated buffers duplicated in new buffers.
15025  */
15026 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
15027
15028 /**
15029  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
15030  */
15031 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
15032
15033 /**
15034  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
15035  */
15036 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
15037
15038 /**
15039  * Checks if the given object is currently in the success state
15040  */
15041 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
15042
15043 /**
15044  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
15045  */
15046 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
15047
15048 /**
15049  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
15050  * but with all dynamically-allocated buffers duplicated in new buffers.
15051  */
15052 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
15053
15054 /**
15055  * Creates a new tuple which has the same data as `orig`
15056  * but with all dynamically-allocated buffers duplicated in new buffers.
15057  */
15058 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
15059
15060 /**
15061  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
15062  */
15063 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
15064
15065 /**
15066  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
15067  */
15068 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
15069
15070 /**
15071  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
15072  */
15073 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
15074
15075 /**
15076  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
15077  */
15078 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
15079
15080 /**
15081  * Checks if the given object is currently in the success state
15082  */
15083 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
15084
15085 /**
15086  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
15087  */
15088 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
15089
15090 /**
15091  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
15092  * but with all dynamically-allocated buffers duplicated in new buffers.
15093  */
15094 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
15095
15096 /**
15097  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15098  */
15099 void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res);
15100
15101 /**
15102  * Creates a new tuple which has the same data as `orig`
15103  * but with all dynamically-allocated buffers duplicated in new buffers.
15104  */
15105 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
15106
15107 /**
15108  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
15109  */
15110 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
15111
15112 /**
15113  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
15114  */
15115 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
15116
15117 /**
15118  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
15119  */
15120 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
15121
15122 /**
15123  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
15124  */
15125 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
15126
15127 /**
15128  * Checks if the given object is currently in the success state
15129  */
15130 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
15131
15132 /**
15133  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
15134  */
15135 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
15136
15137 /**
15138  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
15139  * but with all dynamically-allocated buffers duplicated in new buffers.
15140  */
15141 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
15142
15143 /**
15144  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
15145  */
15146 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
15147
15148 /**
15149  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
15150  */
15151 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
15152
15153 /**
15154  * Checks if the given object is currently in the success state
15155  */
15156 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
15157
15158 /**
15159  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
15160  */
15161 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
15162
15163 /**
15164  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
15165  * but with all dynamically-allocated buffers duplicated in new buffers.
15166  */
15167 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
15168
15169 /**
15170  * Creates a new CResult_PaymentSecretNoneZ in the success state.
15171  */
15172 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
15173
15174 /**
15175  * Creates a new CResult_PaymentSecretNoneZ in the error state.
15176  */
15177 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
15178
15179 /**
15180  * Checks if the given object is currently in the success state
15181  */
15182 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
15183
15184 /**
15185  * Frees any resources used by the CResult_PaymentSecretNoneZ.
15186  */
15187 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
15188
15189 /**
15190  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
15191  * but with all dynamically-allocated buffers duplicated in new buffers.
15192  */
15193 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
15194
15195 /**
15196  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
15197  */
15198 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
15199
15200 /**
15201  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
15202  */
15203 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
15204
15205 /**
15206  * Checks if the given object is currently in the success state
15207  */
15208 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
15209
15210 /**
15211  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
15212  */
15213 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
15214
15215 /**
15216  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
15217  * but with all dynamically-allocated buffers duplicated in new buffers.
15218  */
15219 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
15220
15221 /**
15222  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
15223  */
15224 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
15225
15226 /**
15227  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
15228  */
15229 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
15230
15231 /**
15232  * Checks if the given object is currently in the success state
15233  */
15234 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
15235
15236 /**
15237  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
15238  */
15239 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
15240
15241 /**
15242  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
15243  * but with all dynamically-allocated buffers duplicated in new buffers.
15244  */
15245 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
15246
15247 /**
15248  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
15249  */
15250 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
15251
15252 /**
15253  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
15254  */
15255 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
15256
15257 /**
15258  * Checks if the given object is currently in the success state
15259  */
15260 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
15261
15262 /**
15263  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
15264  */
15265 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
15266
15267 /**
15268  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
15269  * but with all dynamically-allocated buffers duplicated in new buffers.
15270  */
15271 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
15272
15273 /**
15274  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
15275  */
15276 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
15277
15278 /**
15279  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
15280  */
15281 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
15282
15283 /**
15284  * Checks if the given object is currently in the success state
15285  */
15286 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
15287
15288 /**
15289  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
15290  */
15291 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
15292
15293 /**
15294  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
15295  * but with all dynamically-allocated buffers duplicated in new buffers.
15296  */
15297 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
15298
15299 /**
15300  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
15301  */
15302 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
15303
15304 /**
15305  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
15306  */
15307 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
15308
15309 /**
15310  * Checks if the given object is currently in the success state
15311  */
15312 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
15313
15314 /**
15315  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
15316  */
15317 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
15318
15319 /**
15320  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
15321  * but with all dynamically-allocated buffers duplicated in new buffers.
15322  */
15323 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
15324
15325 /**
15326  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
15327  */
15328 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
15329
15330 /**
15331  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
15332  */
15333 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
15334
15335 /**
15336  * Checks if the given object is currently in the success state
15337  */
15338 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
15339
15340 /**
15341  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
15342  */
15343 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
15344
15345 /**
15346  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
15347  * but with all dynamically-allocated buffers duplicated in new buffers.
15348  */
15349 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
15350
15351 /**
15352  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15353  */
15354 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
15355
15356 /**
15357  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
15358  */
15359 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
15360
15361 /**
15362  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
15363  */
15364 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
15365
15366 /**
15367  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
15368  */
15369 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
15370
15371 /**
15372  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
15373  */
15374 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
15375
15376 /**
15377  * Checks if the given object is currently in the success state
15378  */
15379 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
15380
15381 /**
15382  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
15383  */
15384 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
15385
15386 /**
15387  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
15388  */
15389 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
15390
15391 /**
15392  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
15393  */
15394 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
15395
15396 /**
15397  * Checks if the given object is currently in the success state
15398  */
15399 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
15400
15401 /**
15402  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
15403  */
15404 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
15405
15406 /**
15407  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
15408  * but with all dynamically-allocated buffers duplicated in new buffers.
15409  */
15410 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
15411
15412 /**
15413  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
15414  */
15415 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
15416
15417 /**
15418  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
15419  */
15420 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
15421
15422 /**
15423  * Checks if the given object is currently in the success state
15424  */
15425 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
15426
15427 /**
15428  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
15429  */
15430 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
15431
15432 /**
15433  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
15434  * but with all dynamically-allocated buffers duplicated in new buffers.
15435  */
15436 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
15437
15438 /**
15439  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
15440  */
15441 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
15442
15443 /**
15444  * Constructs a new COption_TypeZ containing nothing
15445  */
15446 struct LDKCOption_TypeZ COption_TypeZ_none(void);
15447
15448 /**
15449  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
15450  */
15451 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
15452
15453 /**
15454  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
15455  */
15456 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
15457
15458 /**
15459  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
15460  */
15461 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
15462
15463 /**
15464  * Checks if the given object is currently in the success state
15465  */
15466 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
15467
15468 /**
15469  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
15470  */
15471 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
15472
15473 /**
15474  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
15475  */
15476 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
15477
15478 /**
15479  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
15480  */
15481 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
15482
15483 /**
15484  * Checks if the given object is currently in the success state
15485  */
15486 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
15487
15488 /**
15489  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
15490  */
15491 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
15492
15493 /**
15494  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
15495  * but with all dynamically-allocated buffers duplicated in new buffers.
15496  */
15497 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
15498
15499 /**
15500  * Creates a new CResult_SiPrefixParseErrorZ in the success state.
15501  */
15502 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
15503
15504 /**
15505  * Creates a new CResult_SiPrefixParseErrorZ in the error state.
15506  */
15507 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
15508
15509 /**
15510  * Checks if the given object is currently in the success state
15511  */
15512 bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
15513
15514 /**
15515  * Frees any resources used by the CResult_SiPrefixParseErrorZ.
15516  */
15517 void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
15518
15519 /**
15520  * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
15521  * but with all dynamically-allocated buffers duplicated in new buffers.
15522  */
15523 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
15524
15525 /**
15526  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
15527  */
15528 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
15529
15530 /**
15531  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
15532  */
15533 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
15534
15535 /**
15536  * Checks if the given object is currently in the success state
15537  */
15538 bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
15539
15540 /**
15541  * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
15542  */
15543 void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
15544
15545 /**
15546  * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
15547  * but with all dynamically-allocated buffers duplicated in new buffers.
15548  */
15549 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
15550
15551 /**
15552  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
15553  */
15554 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
15555
15556 /**
15557  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
15558  */
15559 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
15560
15561 /**
15562  * Checks if the given object is currently in the success state
15563  */
15564 bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
15565
15566 /**
15567  * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
15568  */
15569 void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
15570
15571 /**
15572  * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
15573  * but with all dynamically-allocated buffers duplicated in new buffers.
15574  */
15575 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
15576
15577 /**
15578  * Creates a new tuple which has the same data as `orig`
15579  * but with all dynamically-allocated buffers duplicated in new buffers.
15580  */
15581 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
15582
15583 /**
15584  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
15585  */
15586 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
15587
15588 /**
15589  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
15590  */
15591 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
15592
15593 /**
15594  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
15595  */
15596 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
15597
15598 /**
15599  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
15600  */
15601 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
15602
15603 /**
15604  * Checks if the given object is currently in the success state
15605  */
15606 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
15607
15608 /**
15609  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
15610  */
15611 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
15612
15613 /**
15614  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
15615  * but with all dynamically-allocated buffers duplicated in new buffers.
15616  */
15617 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
15618
15619 /**
15620  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15621  */
15622 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
15623
15624 /**
15625  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
15626  */
15627 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
15628
15629 /**
15630  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
15631  */
15632 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
15633
15634 /**
15635  * Checks if the given object is currently in the success state
15636  */
15637 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
15638
15639 /**
15640  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
15641  */
15642 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
15643
15644 /**
15645  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
15646  * but with all dynamically-allocated buffers duplicated in new buffers.
15647  */
15648 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
15649
15650 /**
15651  * Creates a new CResult_NoneSemanticErrorZ in the success state.
15652  */
15653 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
15654
15655 /**
15656  * Creates a new CResult_NoneSemanticErrorZ in the error state.
15657  */
15658 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
15659
15660 /**
15661  * Checks if the given object is currently in the success state
15662  */
15663 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
15664
15665 /**
15666  * Frees any resources used by the CResult_NoneSemanticErrorZ.
15667  */
15668 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
15669
15670 /**
15671  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
15672  * but with all dynamically-allocated buffers duplicated in new buffers.
15673  */
15674 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
15675
15676 /**
15677  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
15678  */
15679 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
15680
15681 /**
15682  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
15683  */
15684 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
15685
15686 /**
15687  * Checks if the given object is currently in the success state
15688  */
15689 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
15690
15691 /**
15692  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
15693  */
15694 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
15695
15696 /**
15697  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
15698  * but with all dynamically-allocated buffers duplicated in new buffers.
15699  */
15700 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
15701
15702 /**
15703  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
15704  */
15705 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
15706
15707 /**
15708  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
15709  */
15710 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
15711
15712 /**
15713  * Checks if the given object is currently in the success state
15714  */
15715 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
15716
15717 /**
15718  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
15719  */
15720 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
15721
15722 /**
15723  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
15724  * but with all dynamically-allocated buffers duplicated in new buffers.
15725  */
15726 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
15727
15728 /**
15729  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
15730  */
15731 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
15732
15733 /**
15734  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
15735  */
15736 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
15737
15738 /**
15739  * Checks if the given object is currently in the success state
15740  */
15741 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
15742
15743 /**
15744  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
15745  */
15746 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
15747
15748 /**
15749  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
15750  * but with all dynamically-allocated buffers duplicated in new buffers.
15751  */
15752 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
15753
15754 /**
15755  * Creates a new CResult_StringErrorZ in the success state.
15756  */
15757 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
15758
15759 /**
15760  * Creates a new CResult_StringErrorZ in the error state.
15761  */
15762 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
15763
15764 /**
15765  * Checks if the given object is currently in the success state
15766  */
15767 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
15768
15769 /**
15770  * Frees any resources used by the CResult_StringErrorZ.
15771  */
15772 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
15773
15774 /**
15775  * Creates a new CResult_StringErrorZ which has the same data as `orig`
15776  * but with all dynamically-allocated buffers duplicated in new buffers.
15777  */
15778 struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
15779
15780 /**
15781  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
15782  */
15783 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
15784
15785 /**
15786  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
15787  */
15788 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15789
15790 /**
15791  * Checks if the given object is currently in the success state
15792  */
15793 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
15794
15795 /**
15796  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
15797  */
15798 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
15799
15800 /**
15801  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
15802  * but with all dynamically-allocated buffers duplicated in new buffers.
15803  */
15804 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
15805
15806 /**
15807  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
15808  */
15809 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
15810
15811 /**
15812  * Constructs a new COption_MonitorEventZ containing nothing
15813  */
15814 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
15815
15816 /**
15817  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
15818  */
15819 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
15820
15821 /**
15822  * Creates a new COption_MonitorEventZ which has the same data as `orig`
15823  * but with all dynamically-allocated buffers duplicated in new buffers.
15824  */
15825 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
15826
15827 /**
15828  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
15829  */
15830 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
15831
15832 /**
15833  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
15834  */
15835 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
15836
15837 /**
15838  * Checks if the given object is currently in the success state
15839  */
15840 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
15841
15842 /**
15843  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
15844  */
15845 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
15846
15847 /**
15848  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
15849  * but with all dynamically-allocated buffers duplicated in new buffers.
15850  */
15851 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
15852
15853 /**
15854  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
15855  */
15856 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
15857
15858 /**
15859  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
15860  */
15861 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15862
15863 /**
15864  * Checks if the given object is currently in the success state
15865  */
15866 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
15867
15868 /**
15869  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
15870  */
15871 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
15872
15873 /**
15874  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
15875  * but with all dynamically-allocated buffers duplicated in new buffers.
15876  */
15877 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
15878
15879 /**
15880  * Creates a new tuple which has the same data as `orig`
15881  * but with all dynamically-allocated buffers duplicated in new buffers.
15882  */
15883 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
15884
15885 /**
15886  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
15887  */
15888 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
15889
15890 /**
15891  * Frees any resources used by the C2Tuple_OutPointScriptZ.
15892  */
15893 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
15894
15895 /**
15896  * Creates a new tuple which has the same data as `orig`
15897  * but with all dynamically-allocated buffers duplicated in new buffers.
15898  */
15899 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
15900
15901 /**
15902  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
15903  */
15904 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
15905
15906 /**
15907  * Frees any resources used by the C2Tuple_u32ScriptZ.
15908  */
15909 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
15910
15911 /**
15912  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15913  */
15914 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
15915
15916 /**
15917  * Creates a new tuple which has the same data as `orig`
15918  * but with all dynamically-allocated buffers duplicated in new buffers.
15919  */
15920 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
15921
15922 /**
15923  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
15924  */
15925 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
15926
15927 /**
15928  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
15929  */
15930 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
15931
15932 /**
15933  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15934  */
15935 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
15936
15937 /**
15938  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15939  */
15940 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
15941
15942 /**
15943  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15944  */
15945 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
15946
15947 /**
15948  * Creates a new tuple which has the same data as `orig`
15949  * but with all dynamically-allocated buffers duplicated in new buffers.
15950  */
15951 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
15952
15953 /**
15954  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
15955  */
15956 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
15957
15958 /**
15959  * Frees any resources used by the C2Tuple_u32TxOutZ.
15960  */
15961 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
15962
15963 /**
15964  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15965  */
15966 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
15967
15968 /**
15969  * Creates a new tuple which has the same data as `orig`
15970  * but with all dynamically-allocated buffers duplicated in new buffers.
15971  */
15972 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
15973
15974 /**
15975  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
15976  */
15977 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
15978
15979 /**
15980  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
15981  */
15982 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
15983
15984 /**
15985  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15986  */
15987 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
15988
15989 /**
15990  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15991  */
15992 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
15993
15994 /**
15995  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
15996  */
15997 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
15998
15999 /**
16000  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
16001  */
16002 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
16003
16004 /**
16005  * Checks if the given object is currently in the success state
16006  */
16007 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
16008
16009 /**
16010  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
16011  */
16012 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
16013
16014 /**
16015  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
16016  */
16017 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
16018
16019 /**
16020  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
16021  */
16022 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
16023
16024 /**
16025  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16026  */
16027 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
16028
16029 /**
16030  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
16031  */
16032 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
16033
16034 /**
16035  * Constructs a new COption_NetAddressZ containing nothing
16036  */
16037 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
16038
16039 /**
16040  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
16041  */
16042 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
16043
16044 /**
16045  * Creates a new COption_NetAddressZ which has the same data as `orig`
16046  * but with all dynamically-allocated buffers duplicated in new buffers.
16047  */
16048 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
16049
16050 /**
16051  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
16052  */
16053 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
16054
16055 /**
16056  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
16057  */
16058 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
16059
16060 /**
16061  * Checks if the given object is currently in the success state
16062  */
16063 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
16064
16065 /**
16066  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
16067  */
16068 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
16069
16070 /**
16071  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
16072  * but with all dynamically-allocated buffers duplicated in new buffers.
16073  */
16074 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
16075
16076 /**
16077  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
16078  */
16079 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
16080
16081 /**
16082  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
16083  */
16084 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
16085
16086 /**
16087  * Checks if the given object is currently in the success state
16088  */
16089 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
16090
16091 /**
16092  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
16093  */
16094 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
16095
16096 /**
16097  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
16098  * but with all dynamically-allocated buffers duplicated in new buffers.
16099  */
16100 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
16101
16102 /**
16103  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
16104  */
16105 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
16106
16107 /**
16108  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
16109  */
16110 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
16111
16112 /**
16113  * Checks if the given object is currently in the success state
16114  */
16115 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
16116
16117 /**
16118  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
16119  */
16120 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
16121
16122 /**
16123  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
16124  * but with all dynamically-allocated buffers duplicated in new buffers.
16125  */
16126 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
16127
16128 /**
16129  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
16130  */
16131 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
16132
16133 /**
16134  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
16135  */
16136 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
16137
16138 /**
16139  * Checks if the given object is currently in the success state
16140  */
16141 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
16142
16143 /**
16144  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
16145  */
16146 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
16147
16148 /**
16149  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
16150  */
16151 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
16152
16153 /**
16154  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
16155  */
16156 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
16157
16158 /**
16159  * Checks if the given object is currently in the success state
16160  */
16161 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
16162
16163 /**
16164  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
16165  */
16166 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
16167
16168 /**
16169  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
16170  * but with all dynamically-allocated buffers duplicated in new buffers.
16171  */
16172 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
16173
16174 /**
16175  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16176  */
16177 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
16178
16179 /**
16180  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16181  */
16182 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
16183
16184 /**
16185  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16186  */
16187 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
16188
16189 /**
16190  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16191  */
16192 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
16193
16194 /**
16195  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
16196  */
16197 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
16198
16199 /**
16200  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
16201  */
16202 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
16203
16204 /**
16205  * Checks if the given object is currently in the success state
16206  */
16207 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
16208
16209 /**
16210  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
16211  */
16212 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
16213
16214 /**
16215  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
16216  * but with all dynamically-allocated buffers duplicated in new buffers.
16217  */
16218 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
16219
16220 /**
16221  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
16222  */
16223 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
16224
16225 /**
16226  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
16227  */
16228 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
16229
16230 /**
16231  * Checks if the given object is currently in the success state
16232  */
16233 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
16234
16235 /**
16236  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
16237  */
16238 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
16239
16240 /**
16241  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
16242  * but with all dynamically-allocated buffers duplicated in new buffers.
16243  */
16244 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
16245
16246 /**
16247  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
16248  */
16249 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
16250
16251 /**
16252  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
16253  */
16254 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
16255
16256 /**
16257  * Checks if the given object is currently in the success state
16258  */
16259 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
16260
16261 /**
16262  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
16263  */
16264 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
16265
16266 /**
16267  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
16268  * but with all dynamically-allocated buffers duplicated in new buffers.
16269  */
16270 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
16271
16272 /**
16273  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
16274  */
16275 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
16276
16277 /**
16278  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
16279  */
16280 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
16281
16282 /**
16283  * Checks if the given object is currently in the success state
16284  */
16285 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
16286
16287 /**
16288  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
16289  */
16290 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
16291
16292 /**
16293  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
16294  * but with all dynamically-allocated buffers duplicated in new buffers.
16295  */
16296 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
16297
16298 /**
16299  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
16300  */
16301 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
16302
16303 /**
16304  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
16305  */
16306 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
16307
16308 /**
16309  * Checks if the given object is currently in the success state
16310  */
16311 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
16312
16313 /**
16314  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
16315  */
16316 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
16317
16318 /**
16319  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
16320  * but with all dynamically-allocated buffers duplicated in new buffers.
16321  */
16322 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
16323
16324 /**
16325  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
16326  */
16327 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
16328
16329 /**
16330  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
16331  */
16332 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
16333
16334 /**
16335  * Checks if the given object is currently in the success state
16336  */
16337 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
16338
16339 /**
16340  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
16341  */
16342 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
16343
16344 /**
16345  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
16346  * but with all dynamically-allocated buffers duplicated in new buffers.
16347  */
16348 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
16349
16350 /**
16351  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
16352  */
16353 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
16354
16355 /**
16356  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
16357  */
16358 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
16359
16360 /**
16361  * Checks if the given object is currently in the success state
16362  */
16363 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
16364
16365 /**
16366  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
16367  */
16368 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
16369
16370 /**
16371  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
16372  * but with all dynamically-allocated buffers duplicated in new buffers.
16373  */
16374 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
16375
16376 /**
16377  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
16378  */
16379 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
16380
16381 /**
16382  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
16383  */
16384 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
16385
16386 /**
16387  * Checks if the given object is currently in the success state
16388  */
16389 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
16390
16391 /**
16392  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
16393  */
16394 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
16395
16396 /**
16397  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
16398  * but with all dynamically-allocated buffers duplicated in new buffers.
16399  */
16400 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
16401
16402 /**
16403  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
16404  */
16405 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
16406
16407 /**
16408  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
16409  */
16410 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
16411
16412 /**
16413  * Checks if the given object is currently in the success state
16414  */
16415 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
16416
16417 /**
16418  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
16419  */
16420 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
16421
16422 /**
16423  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
16424  * but with all dynamically-allocated buffers duplicated in new buffers.
16425  */
16426 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
16427
16428 /**
16429  * Creates a new CResult_InitDecodeErrorZ in the success state.
16430  */
16431 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
16432
16433 /**
16434  * Creates a new CResult_InitDecodeErrorZ in the error state.
16435  */
16436 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
16437
16438 /**
16439  * Checks if the given object is currently in the success state
16440  */
16441 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
16442
16443 /**
16444  * Frees any resources used by the CResult_InitDecodeErrorZ.
16445  */
16446 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
16447
16448 /**
16449  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
16450  * but with all dynamically-allocated buffers duplicated in new buffers.
16451  */
16452 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
16453
16454 /**
16455  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
16456  */
16457 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
16458
16459 /**
16460  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
16461  */
16462 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
16463
16464 /**
16465  * Checks if the given object is currently in the success state
16466  */
16467 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
16468
16469 /**
16470  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
16471  */
16472 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
16473
16474 /**
16475  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
16476  * but with all dynamically-allocated buffers duplicated in new buffers.
16477  */
16478 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
16479
16480 /**
16481  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
16482  */
16483 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
16484
16485 /**
16486  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
16487  */
16488 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
16489
16490 /**
16491  * Checks if the given object is currently in the success state
16492  */
16493 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
16494
16495 /**
16496  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
16497  */
16498 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
16499
16500 /**
16501  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
16502  * but with all dynamically-allocated buffers duplicated in new buffers.
16503  */
16504 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
16505
16506 /**
16507  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
16508  */
16509 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
16510
16511 /**
16512  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
16513  */
16514 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
16515
16516 /**
16517  * Checks if the given object is currently in the success state
16518  */
16519 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
16520
16521 /**
16522  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
16523  */
16524 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
16525
16526 /**
16527  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
16528  * but with all dynamically-allocated buffers duplicated in new buffers.
16529  */
16530 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
16531
16532 /**
16533  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
16534  */
16535 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
16536
16537 /**
16538  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
16539  */
16540 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16541
16542 /**
16543  * Checks if the given object is currently in the success state
16544  */
16545 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
16546
16547 /**
16548  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
16549  */
16550 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
16551
16552 /**
16553  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
16554  * but with all dynamically-allocated buffers duplicated in new buffers.
16555  */
16556 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
16557
16558 /**
16559  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
16560  */
16561 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
16562
16563 /**
16564  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
16565  */
16566 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16567
16568 /**
16569  * Checks if the given object is currently in the success state
16570  */
16571 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
16572
16573 /**
16574  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
16575  */
16576 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
16577
16578 /**
16579  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
16580  * but with all dynamically-allocated buffers duplicated in new buffers.
16581  */
16582 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
16583
16584 /**
16585  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16586  */
16587 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
16588
16589 /**
16590  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16591  */
16592 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
16593
16594 /**
16595  * Checks if the given object is currently in the success state
16596  */
16597 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
16598
16599 /**
16600  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16601  */
16602 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
16603
16604 /**
16605  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16606  * but with all dynamically-allocated buffers duplicated in new buffers.
16607  */
16608 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
16609
16610 /**
16611  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16612  */
16613 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
16614
16615 /**
16616  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16617  */
16618 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16619
16620 /**
16621  * Checks if the given object is currently in the success state
16622  */
16623 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
16624
16625 /**
16626  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16627  */
16628 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
16629
16630 /**
16631  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16632  * but with all dynamically-allocated buffers duplicated in new buffers.
16633  */
16634 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
16635
16636 /**
16637  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16638  */
16639 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
16640
16641 /**
16642  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16643  */
16644 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16645
16646 /**
16647  * Checks if the given object is currently in the success state
16648  */
16649 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
16650
16651 /**
16652  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16653  */
16654 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
16655
16656 /**
16657  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16658  * but with all dynamically-allocated buffers duplicated in new buffers.
16659  */
16660 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
16661
16662 /**
16663  * Creates a new CResult_PingDecodeErrorZ in the success state.
16664  */
16665 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
16666
16667 /**
16668  * Creates a new CResult_PingDecodeErrorZ in the error state.
16669  */
16670 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
16671
16672 /**
16673  * Checks if the given object is currently in the success state
16674  */
16675 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
16676
16677 /**
16678  * Frees any resources used by the CResult_PingDecodeErrorZ.
16679  */
16680 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
16681
16682 /**
16683  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16684  * but with all dynamically-allocated buffers duplicated in new buffers.
16685  */
16686 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
16687
16688 /**
16689  * Creates a new CResult_PongDecodeErrorZ in the success state.
16690  */
16691 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
16692
16693 /**
16694  * Creates a new CResult_PongDecodeErrorZ in the error state.
16695  */
16696 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
16697
16698 /**
16699  * Checks if the given object is currently in the success state
16700  */
16701 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
16702
16703 /**
16704  * Frees any resources used by the CResult_PongDecodeErrorZ.
16705  */
16706 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
16707
16708 /**
16709  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16710  * but with all dynamically-allocated buffers duplicated in new buffers.
16711  */
16712 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
16713
16714 /**
16715  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16716  */
16717 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
16718
16719 /**
16720  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16721  */
16722 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16723
16724 /**
16725  * Checks if the given object is currently in the success state
16726  */
16727 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16728
16729 /**
16730  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16731  */
16732 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
16733
16734 /**
16735  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16736  * but with all dynamically-allocated buffers duplicated in new buffers.
16737  */
16738 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16739
16740 /**
16741  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16742  */
16743 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
16744
16745 /**
16746  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16747  */
16748 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16749
16750 /**
16751  * Checks if the given object is currently in the success state
16752  */
16753 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16754
16755 /**
16756  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16757  */
16758 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
16759
16760 /**
16761  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16762  * but with all dynamically-allocated buffers duplicated in new buffers.
16763  */
16764 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16765
16766 /**
16767  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16768  */
16769 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
16770
16771 /**
16772  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16773  */
16774 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16775
16776 /**
16777  * Checks if the given object is currently in the success state
16778  */
16779 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16780
16781 /**
16782  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16783  */
16784 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
16785
16786 /**
16787  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16788  * but with all dynamically-allocated buffers duplicated in new buffers.
16789  */
16790 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16791
16792 /**
16793  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16794  */
16795 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
16796
16797 /**
16798  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16799  */
16800 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16801
16802 /**
16803  * Checks if the given object is currently in the success state
16804  */
16805 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16806
16807 /**
16808  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16809  */
16810 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
16811
16812 /**
16813  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16814  * but with all dynamically-allocated buffers duplicated in new buffers.
16815  */
16816 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16817
16818 /**
16819  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16820  */
16821 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
16822
16823 /**
16824  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16825  */
16826 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
16827
16828 /**
16829  * Checks if the given object is currently in the success state
16830  */
16831 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
16832
16833 /**
16834  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16835  */
16836 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
16837
16838 /**
16839  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16840  * but with all dynamically-allocated buffers duplicated in new buffers.
16841  */
16842 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
16843
16844 /**
16845  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16846  */
16847 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
16848
16849 /**
16850  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16851  */
16852 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
16853
16854 /**
16855  * Checks if the given object is currently in the success state
16856  */
16857 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
16858
16859 /**
16860  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16861  */
16862 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
16863
16864 /**
16865  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16866  * but with all dynamically-allocated buffers duplicated in new buffers.
16867  */
16868 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
16869
16870 /**
16871  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16872  */
16873 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
16874
16875 /**
16876  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16877  */
16878 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16879
16880 /**
16881  * Checks if the given object is currently in the success state
16882  */
16883 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16884
16885 /**
16886  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16887  */
16888 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
16889
16890 /**
16891  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16892  * but with all dynamically-allocated buffers duplicated in new buffers.
16893  */
16894 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16895
16896 /**
16897  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16898  */
16899 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
16900
16901 /**
16902  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16903  */
16904 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16905
16906 /**
16907  * Checks if the given object is currently in the success state
16908  */
16909 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16910
16911 /**
16912  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16913  */
16914 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
16915
16916 /**
16917  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16918  * but with all dynamically-allocated buffers duplicated in new buffers.
16919  */
16920 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16921
16922 /**
16923  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16924  */
16925 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
16926
16927 /**
16928  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16929  */
16930 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
16931
16932 /**
16933  * Checks if the given object is currently in the success state
16934  */
16935 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
16936
16937 /**
16938  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16939  */
16940 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
16941
16942 /**
16943  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16944  * but with all dynamically-allocated buffers duplicated in new buffers.
16945  */
16946 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
16947
16948 /**
16949  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16950  */
16951 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
16952
16953 /**
16954  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16955  */
16956 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
16957
16958 /**
16959  * Checks if the given object is currently in the success state
16960  */
16961 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
16962
16963 /**
16964  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16965  */
16966 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
16967
16968 /**
16969  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16970  * but with all dynamically-allocated buffers duplicated in new buffers.
16971  */
16972 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
16973
16974 /**
16975  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16976  */
16977 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
16978
16979 /**
16980  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16981  */
16982 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16983
16984 /**
16985  * Checks if the given object is currently in the success state
16986  */
16987 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
16988
16989 /**
16990  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16991  */
16992 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
16993
16994 /**
16995  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16996  * but with all dynamically-allocated buffers duplicated in new buffers.
16997  */
16998 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16999
17000 /**
17001  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
17002  */
17003 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
17004
17005 /**
17006  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
17007  */
17008 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
17009
17010 /**
17011  * Checks if the given object is currently in the success state
17012  */
17013 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
17014
17015 /**
17016  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
17017  */
17018 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
17019
17020 /**
17021  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
17022  * but with all dynamically-allocated buffers duplicated in new buffers.
17023  */
17024 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
17025
17026 /**
17027  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
17028  */
17029 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
17030
17031 /**
17032  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
17033  */
17034 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
17035
17036 /**
17037  * Checks if the given object is currently in the success state
17038  */
17039 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
17040
17041 /**
17042  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
17043  */
17044 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
17045
17046 /**
17047  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17048  * but with all dynamically-allocated buffers duplicated in new buffers.
17049  */
17050 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
17051
17052 /**
17053  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17054  */
17055 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
17056
17057 /**
17058  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
17059  */
17060 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
17061
17062 /**
17063  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
17064  */
17065 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
17066
17067 /**
17068  * Checks if the given object is currently in the success state
17069  */
17070 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
17071
17072 /**
17073  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
17074  */
17075 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
17076
17077 /**
17078  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
17079  * but with all dynamically-allocated buffers duplicated in new buffers.
17080  */
17081 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
17082
17083 /**
17084  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
17085  */
17086 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
17087
17088 /**
17089  * Constructs a new COption_FilterZ containing nothing
17090  */
17091 struct LDKCOption_FilterZ COption_FilterZ_none(void);
17092
17093 /**
17094  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
17095  */
17096 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
17097
17098 /**
17099  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
17100  */
17101 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
17102
17103 /**
17104  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
17105  */
17106 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
17107
17108 /**
17109  * Checks if the given object is currently in the success state
17110  */
17111 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
17112
17113 /**
17114  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
17115  */
17116 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
17117
17118 /**
17119  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17120  */
17121 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
17122
17123 /**
17124  * Frees any resources used by the PaymentPurpose
17125  */
17126 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
17127
17128 /**
17129  * Creates a copy of the PaymentPurpose
17130  */
17131 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
17132
17133 /**
17134  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
17135  */
17136 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
17137
17138 /**
17139  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
17140  */
17141 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
17142
17143 /**
17144  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
17145  */
17146 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
17147
17148 /**
17149  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
17150  */
17151 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
17152
17153 /**
17154  * Frees any resources used by the ClosureReason
17155  */
17156 void ClosureReason_free(struct LDKClosureReason this_ptr);
17157
17158 /**
17159  * Creates a copy of the ClosureReason
17160  */
17161 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
17162
17163 /**
17164  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
17165  */
17166 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
17167
17168 /**
17169  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
17170  */
17171 struct LDKClosureReason ClosureReason_holder_force_closed(void);
17172
17173 /**
17174  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
17175  */
17176 struct LDKClosureReason ClosureReason_cooperative_closure(void);
17177
17178 /**
17179  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
17180  */
17181 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
17182
17183 /**
17184  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
17185  */
17186 struct LDKClosureReason ClosureReason_funding_timed_out(void);
17187
17188 /**
17189  * Utility method to constructs a new ProcessingError-variant ClosureReason
17190  */
17191 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
17192
17193 /**
17194  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
17195  */
17196 struct LDKClosureReason ClosureReason_disconnected_peer(void);
17197
17198 /**
17199  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
17200  */
17201 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
17202
17203 /**
17204  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
17205  */
17206 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
17207
17208 /**
17209  * Read a ClosureReason from a byte array, created by ClosureReason_write
17210  */
17211 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
17212
17213 /**
17214  * Frees any resources used by the Event
17215  */
17216 void Event_free(struct LDKEvent this_ptr);
17217
17218 /**
17219  * Creates a copy of the Event
17220  */
17221 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
17222
17223 /**
17224  * Utility method to constructs a new FundingGenerationReady-variant Event
17225  */
17226 struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id);
17227
17228 /**
17229  * Utility method to constructs a new PaymentReceived-variant Event
17230  */
17231 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
17232
17233 /**
17234  * Utility method to constructs a new PaymentClaimed-variant Event
17235  */
17236 struct LDKEvent Event_payment_claimed(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
17237
17238 /**
17239  * Utility method to constructs a new PaymentSent-variant Event
17240  */
17241 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
17242
17243 /**
17244  * Utility method to constructs a new PaymentFailed-variant Event
17245  */
17246 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
17247
17248 /**
17249  * Utility method to constructs a new PaymentPathSuccessful-variant Event
17250  */
17251 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
17252
17253 /**
17254  * Utility method to constructs a new PaymentPathFailed-variant Event
17255  */
17256 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);
17257
17258 /**
17259  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
17260  */
17261 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
17262
17263 /**
17264  * Utility method to constructs a new SpendableOutputs-variant Event
17265  */
17266 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
17267
17268 /**
17269  * Utility method to constructs a new PaymentForwarded-variant Event
17270  */
17271 struct LDKEvent Event_payment_forwarded(struct LDKThirtyTwoBytes prev_channel_id, struct LDKThirtyTwoBytes next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
17272
17273 /**
17274  * Utility method to constructs a new ChannelClosed-variant Event
17275  */
17276 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
17277
17278 /**
17279  * Utility method to constructs a new DiscardFunding-variant Event
17280  */
17281 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
17282
17283 /**
17284  * Utility method to constructs a new OpenChannelRequest-variant Event
17285  */
17286 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);
17287
17288 /**
17289  * Serialize the Event object into a byte array which can be read by Event_read
17290  */
17291 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
17292
17293 /**
17294  * Read a Event from a byte array, created by Event_write
17295  */
17296 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
17297
17298 /**
17299  * Frees any resources used by the MessageSendEvent
17300  */
17301 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
17302
17303 /**
17304  * Creates a copy of the MessageSendEvent
17305  */
17306 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
17307
17308 /**
17309  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
17310  */
17311 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
17312
17313 /**
17314  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
17315  */
17316 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
17317
17318 /**
17319  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
17320  */
17321 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
17322
17323 /**
17324  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
17325  */
17326 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
17327
17328 /**
17329  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
17330  */
17331 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
17332
17333 /**
17334  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
17335  */
17336 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
17337
17338 /**
17339  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
17340  */
17341 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
17342
17343 /**
17344  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
17345  */
17346 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
17347
17348 /**
17349  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
17350  */
17351 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
17352
17353 /**
17354  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
17355  */
17356 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
17357
17358 /**
17359  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
17360  */
17361 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
17362
17363 /**
17364  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
17365  */
17366 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
17367
17368 /**
17369  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
17370  */
17371 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
17372
17373 /**
17374  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
17375  */
17376 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
17377
17378 /**
17379  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
17380  */
17381 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
17382
17383 /**
17384  * Utility method to constructs a new HandleError-variant MessageSendEvent
17385  */
17386 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
17387
17388 /**
17389  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
17390  */
17391 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
17392
17393 /**
17394  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
17395  */
17396 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
17397
17398 /**
17399  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
17400  */
17401 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
17402
17403 /**
17404  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
17405  */
17406 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
17407
17408 /**
17409  * Calls the free function if one is set
17410  */
17411 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
17412
17413 /**
17414  * Calls the free function if one is set
17415  */
17416 void EventsProvider_free(struct LDKEventsProvider this_ptr);
17417
17418 /**
17419  * Calls the free function if one is set
17420  */
17421 void EventHandler_free(struct LDKEventHandler this_ptr);
17422
17423 /**
17424  * Frees any resources used by the APIError
17425  */
17426 void APIError_free(struct LDKAPIError this_ptr);
17427
17428 /**
17429  * Creates a copy of the APIError
17430  */
17431 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
17432
17433 /**
17434  * Utility method to constructs a new APIMisuseError-variant APIError
17435  */
17436 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
17437
17438 /**
17439  * Utility method to constructs a new FeeRateTooHigh-variant APIError
17440  */
17441 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
17442
17443 /**
17444  * Utility method to constructs a new RouteError-variant APIError
17445  */
17446 struct LDKAPIError APIError_route_error(struct LDKStr err);
17447
17448 /**
17449  * Utility method to constructs a new ChannelUnavailable-variant APIError
17450  */
17451 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
17452
17453 /**
17454  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
17455  */
17456 struct LDKAPIError APIError_monitor_update_failed(void);
17457
17458 /**
17459  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
17460  */
17461 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
17462
17463 /**
17464  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
17465  */
17466 void BigSize_free(struct LDKBigSize this_obj);
17467
17468 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
17469
17470 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
17471
17472 /**
17473  * Constructs a new BigSize given each field
17474  */
17475 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
17476
17477 /**
17478  * Creates a digital signature of a message given a SecretKey, like the node's secret.
17479  * 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.
17480  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
17481  */
17482 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
17483
17484 /**
17485  * Recovers the PublicKey of the signer of the message given the message and the signature.
17486  */
17487 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
17488
17489 /**
17490  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
17491  * and the PublicKey.
17492  */
17493 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
17494
17495 /**
17496  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
17497  */
17498 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
17499
17500 /**
17501  * Calls the free function if one is set
17502  */
17503 void Persister_free(struct LDKPersister this_ptr);
17504
17505 /**
17506  * Creates a copy of the Level
17507  */
17508 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
17509
17510 /**
17511  * Utility method to constructs a new Gossip-variant Level
17512  */
17513 enum LDKLevel Level_gossip(void);
17514
17515 /**
17516  * Utility method to constructs a new Trace-variant Level
17517  */
17518 enum LDKLevel Level_trace(void);
17519
17520 /**
17521  * Utility method to constructs a new Debug-variant Level
17522  */
17523 enum LDKLevel Level_debug(void);
17524
17525 /**
17526  * Utility method to constructs a new Info-variant Level
17527  */
17528 enum LDKLevel Level_info(void);
17529
17530 /**
17531  * Utility method to constructs a new Warn-variant Level
17532  */
17533 enum LDKLevel Level_warn(void);
17534
17535 /**
17536  * Utility method to constructs a new Error-variant Level
17537  */
17538 enum LDKLevel Level_error(void);
17539
17540 /**
17541  * Checks if two Levels contain equal inner contents.
17542  * This ignores pointers and is_owned flags and looks at the values in fields.
17543  */
17544 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
17545
17546 /**
17547  * Checks if two Levels contain equal inner contents.
17548  */
17549 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
17550
17551 /**
17552  * Returns the most verbose logging level.
17553  */
17554 MUST_USE_RES enum LDKLevel Level_max(void);
17555
17556 /**
17557  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
17558  */
17559 void Record_free(struct LDKRecord this_obj);
17560
17561 /**
17562  * The verbosity level of the message.
17563  */
17564 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
17565
17566 /**
17567  * The verbosity level of the message.
17568  */
17569 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
17570
17571 /**
17572  * The message body.
17573  */
17574 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
17575
17576 /**
17577  * The message body.
17578  */
17579 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17580
17581 /**
17582  * The module path of the message.
17583  */
17584 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
17585
17586 /**
17587  * The module path of the message.
17588  */
17589 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17590
17591 /**
17592  * The source file containing the message.
17593  */
17594 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
17595
17596 /**
17597  * The source file containing the message.
17598  */
17599 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17600
17601 /**
17602  * The line containing the message.
17603  */
17604 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
17605
17606 /**
17607  * The line containing the message.
17608  */
17609 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
17610
17611 /**
17612  * Creates a copy of the Record
17613  */
17614 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
17615
17616 /**
17617  * Calls the free function if one is set
17618  */
17619 void Logger_free(struct LDKLogger this_ptr);
17620
17621 /**
17622  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
17623  */
17624 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
17625
17626 /**
17627  * Confirmations we will wait for before considering the channel locked in.
17628  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
17629  * equivalent limit applied to outbound channels).
17630  *
17631  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
17632  * transaction before operation. If you wish to accept channels with zero confirmations, see
17633  * [`UserConfig::manually_accept_inbound_channels`] and
17634  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
17635  *
17636  * Default value: 6.
17637  *
17638  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
17639  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
17640  */
17641 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17642
17643 /**
17644  * Confirmations we will wait for before considering the channel locked in.
17645  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
17646  * equivalent limit applied to outbound channels).
17647  *
17648  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
17649  * transaction before operation. If you wish to accept channels with zero confirmations, see
17650  * [`UserConfig::manually_accept_inbound_channels`] and
17651  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
17652  *
17653  * Default value: 6.
17654  *
17655  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
17656  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
17657  */
17658 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
17659
17660 /**
17661  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
17662  * the number of blocks we have to punish our counterparty if they broadcast a revoked
17663  * transaction).
17664  *
17665  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
17666  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
17667  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
17668  * possibly with time in between to RBF the spending transaction).
17669  *
17670  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
17671  * case of an honest unilateral channel close, which implicitly decrease the economic value of
17672  * our channel.
17673  *
17674  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
17675  * can tweak config to ask for more security, not less.
17676  */
17677 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17678
17679 /**
17680  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
17681  * the number of blocks we have to punish our counterparty if they broadcast a revoked
17682  * transaction).
17683  *
17684  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
17685  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
17686  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
17687  * possibly with time in between to RBF the spending transaction).
17688  *
17689  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
17690  * case of an honest unilateral channel close, which implicitly decrease the economic value of
17691  * our channel.
17692  *
17693  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
17694  * can tweak config to ask for more security, not less.
17695  */
17696 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
17697
17698 /**
17699  * Set to the smallest value HTLC we will accept to process.
17700  *
17701  * This value is sent to our counterparty on channel-open and we close the channel any time
17702  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
17703  *
17704  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
17705  * by the protocol.
17706  */
17707 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17708
17709 /**
17710  * Set to the smallest value HTLC we will accept to process.
17711  *
17712  * This value is sent to our counterparty on channel-open and we close the channel any time
17713  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
17714  *
17715  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
17716  * by the protocol.
17717  */
17718 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
17719
17720 /**
17721  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
17722  * HTLCs to.
17723  *
17724  * This can be set to a value between 1-100, where the value corresponds to the percent of the
17725  * channel value in whole percentages.
17726  *
17727  * Note that:
17728  * * If configured to another value than the default value 10, any new channels created with
17729  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
17730  * `ChannelManager`.
17731  *
17732  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
17733  * no way to configure the cap for the total value of outbound HTLCs in-flight.
17734  *
17735  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
17736  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
17737  * restrict exposure to loss due to being offline for too long.
17738  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
17739  * for more information.
17740  *
17741  * Default value: 10.
17742  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
17743  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
17744  */
17745 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17746
17747 /**
17748  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
17749  * HTLCs to.
17750  *
17751  * This can be set to a value between 1-100, where the value corresponds to the percent of the
17752  * channel value in whole percentages.
17753  *
17754  * Note that:
17755  * * If configured to another value than the default value 10, any new channels created with
17756  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
17757  * `ChannelManager`.
17758  *
17759  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
17760  * no way to configure the cap for the total value of outbound HTLCs in-flight.
17761  *
17762  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
17763  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
17764  * restrict exposure to loss due to being offline for too long.
17765  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
17766  * for more information.
17767  *
17768  * Default value: 10.
17769  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
17770  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
17771  */
17772 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
17773
17774 /**
17775  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
17776  * BOLTs) option for outbound private channels. This provides better privacy by not including
17777  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
17778  * relay HTLCs to us using the channel's SCID alias.
17779  *
17780  * If this option is set, channels may be created that will not be readable by LDK versions
17781  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
17782  * [`DecodeError::InvalidValue`].
17783  *
17784  * Note that setting this to true does *not* prevent us from opening channels with
17785  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
17786  * private channel without that option.
17787  *
17788  * Ignored if the channel is negotiated to be announced, see
17789  * [`ChannelHandshakeConfig::announced_channel`] and
17790  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
17791  *
17792  * Default value: false. This value is likely to change to true in the future.
17793  *
17794  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17795  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
17796  */
17797 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17798
17799 /**
17800  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
17801  * BOLTs) option for outbound private channels. This provides better privacy by not including
17802  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
17803  * relay HTLCs to us using the channel's SCID alias.
17804  *
17805  * If this option is set, channels may be created that will not be readable by LDK versions
17806  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
17807  * [`DecodeError::InvalidValue`].
17808  *
17809  * Note that setting this to true does *not* prevent us from opening channels with
17810  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
17811  * private channel without that option.
17812  *
17813  * Ignored if the channel is negotiated to be announced, see
17814  * [`ChannelHandshakeConfig::announced_channel`] and
17815  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
17816  *
17817  * Default value: false. This value is likely to change to true in the future.
17818  *
17819  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17820  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
17821  */
17822 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
17823
17824 /**
17825  * Set to announce the channel publicly and notify all nodes that they can route via this
17826  * channel.
17827  *
17828  * This should only be set to true for nodes which expect to be online reliably.
17829  *
17830  * As the node which funds a channel picks this value this will only apply for new outbound
17831  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17832  *
17833  * Default value: false.
17834  */
17835 bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17836
17837 /**
17838  * Set to announce the channel publicly and notify all nodes that they can route via this
17839  * channel.
17840  *
17841  * This should only be set to true for nodes which expect to be online reliably.
17842  *
17843  * As the node which funds a channel picks this value this will only apply for new outbound
17844  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17845  *
17846  * Default value: false.
17847  */
17848 void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
17849
17850 /**
17851  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17852  * supports it, they will then enforce the mutual-close output to us matches what we provided
17853  * at intialization, preventing us from closing to an alternate pubkey.
17854  *
17855  * This is set to true by default to provide a slight increase in security, though ultimately
17856  * any attacker who is able to take control of a channel can just as easily send the funds via
17857  * lightning payments, so we never require that our counterparties support this option.
17858  *
17859  * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
17860  *
17861  * Default value: true.
17862  *
17863  * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
17864  */
17865 bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17866
17867 /**
17868  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17869  * supports it, they will then enforce the mutual-close output to us matches what we provided
17870  * at intialization, preventing us from closing to an alternate pubkey.
17871  *
17872  * This is set to true by default to provide a slight increase in security, though ultimately
17873  * any attacker who is able to take control of a channel can just as easily send the funds via
17874  * lightning payments, so we never require that our counterparties support this option.
17875  *
17876  * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
17877  *
17878  * Default value: true.
17879  *
17880  * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
17881  */
17882 void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
17883
17884 /**
17885  * Constructs a new ChannelHandshakeConfig given each field
17886  */
17887 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
17888
17889 /**
17890  * Creates a copy of the ChannelHandshakeConfig
17891  */
17892 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
17893
17894 /**
17895  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
17896  */
17897 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
17898
17899 /**
17900  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
17901  */
17902 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
17903
17904 /**
17905  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
17906  * only applies to inbound channels.
17907  *
17908  * Default value: 0.
17909  */
17910 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17911
17912 /**
17913  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
17914  * only applies to inbound channels.
17915  *
17916  * Default value: 0.
17917  */
17918 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17919
17920 /**
17921  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
17922  * only applies to inbound channels.
17923  *
17924  * Default value: 2^24 - 1.
17925  */
17926 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17927
17928 /**
17929  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
17930  * only applies to inbound channels.
17931  *
17932  * Default value: 2^24 - 1.
17933  */
17934 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17935
17936 /**
17937  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
17938  * you to limit the maximum minimum-size they can require.
17939  *
17940  * Default value: u64::max_value.
17941  */
17942 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17943
17944 /**
17945  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
17946  * you to limit the maximum minimum-size they can require.
17947  *
17948  * Default value: u64::max_value.
17949  */
17950 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17951
17952 /**
17953  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17954  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17955  *
17956  * Default value: 0.
17957  */
17958 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17959
17960 /**
17961  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17962  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17963  *
17964  * Default value: 0.
17965  */
17966 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17967
17968 /**
17969  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17970  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17971  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17972  *
17973  * Default value: u64::max_value.
17974  */
17975 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17976
17977 /**
17978  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17979  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17980  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17981  *
17982  * Default value: u64::max_value.
17983  */
17984 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17985
17986 /**
17987  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17988  * time. This allows you to set a minimum such value.
17989  *
17990  * Default value: 0.
17991  */
17992 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17993
17994 /**
17995  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17996  * time. This allows you to set a minimum such value.
17997  *
17998  * Default value: 0.
17999  */
18000 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
18001
18002 /**
18003  * Before a channel is usable the funding transaction will need to be confirmed by at least a
18004  * certain number of blocks, specified by the node which is not the funder (as the funder can
18005  * assume they aren't going to double-spend themselves).
18006  * This config allows you to set a limit on the maximum amount of time to wait.
18007  *
18008  * Default value: 144, or roughly one day and only applies to outbound channels.
18009  */
18010 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18011
18012 /**
18013  * Before a channel is usable the funding transaction will need to be confirmed by at least a
18014  * certain number of blocks, specified by the node which is not the funder (as the funder can
18015  * assume they aren't going to double-spend themselves).
18016  * This config allows you to set a limit on the maximum amount of time to wait.
18017  *
18018  * Default value: 144, or roughly one day and only applies to outbound channels.
18019  */
18020 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
18021
18022 /**
18023  * Whether we implicitly trust funding transactions generated by us for our own outbound
18024  * channels to not be double-spent.
18025  *
18026  * If this is set, we assume that our own funding transactions are *never* double-spent, and
18027  * thus we can trust them without any confirmations. This is generally a reasonable
18028  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
18029  * control of the signing keys).
18030  *
18031  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
18032  * double-spend the funding transaction to RBF with an alternative channel open.
18033  *
18034  * This only applies if our counterparty set their confirmations-required value to 0, and we
18035  * always trust our own funding transaction at 1 confirmation irrespective of this value.
18036  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
18037  * `true` (0) and `false` (1).
18038  *
18039  * Default value: true
18040  */
18041 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18042
18043 /**
18044  * Whether we implicitly trust funding transactions generated by us for our own outbound
18045  * channels to not be double-spent.
18046  *
18047  * If this is set, we assume that our own funding transactions are *never* double-spent, and
18048  * thus we can trust them without any confirmations. This is generally a reasonable
18049  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
18050  * control of the signing keys).
18051  *
18052  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
18053  * double-spend the funding transaction to RBF with an alternative channel open.
18054  *
18055  * This only applies if our counterparty set their confirmations-required value to 0, and we
18056  * always trust our own funding transaction at 1 confirmation irrespective of this value.
18057  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
18058  * `true` (0) and `false` (1).
18059  *
18060  * Default value: true
18061  */
18062 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
18063
18064 /**
18065  * Set to force an incoming channel to match our announced channel preference in
18066  * [`ChannelHandshakeConfig::announced_channel`].
18067  *
18068  * For a node which is not online reliably, this should be set to true and
18069  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
18070  * channels will ever be opened.
18071  *
18072  * Default value: true.
18073  */
18074 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18075
18076 /**
18077  * Set to force an incoming channel to match our announced channel preference in
18078  * [`ChannelHandshakeConfig::announced_channel`].
18079  *
18080  * For a node which is not online reliably, this should be set to true and
18081  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
18082  * channels will ever be opened.
18083  *
18084  * Default value: true.
18085  */
18086 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
18087
18088 /**
18089  * Set to the amount of time we're willing to wait to claim money back to us.
18090  *
18091  * Not checking this value would be a security issue, as our peer would be able to set it to
18092  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
18093  *
18094  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
18095  * reduce the loss of having useless locked funds (if your peer accepts)
18096  */
18097 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18098
18099 /**
18100  * Set to the amount of time we're willing to wait to claim money back to us.
18101  *
18102  * Not checking this value would be a security issue, as our peer would be able to set it to
18103  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
18104  *
18105  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
18106  * reduce the loss of having useless locked funds (if your peer accepts)
18107  */
18108 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
18109
18110 /**
18111  * Constructs a new ChannelHandshakeLimits given each field
18112  */
18113 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool trust_own_funding_0conf_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
18114
18115 /**
18116  * Creates a copy of the ChannelHandshakeLimits
18117  */
18118 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
18119
18120 /**
18121  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
18122  */
18123 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
18124
18125 /**
18126  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
18127  */
18128 void ChannelConfig_free(struct LDKChannelConfig this_obj);
18129
18130 /**
18131  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
18132  * over the channel.
18133  * This may be allowed to change at runtime in a later update, however doing so must result in
18134  * update messages sent to notify all nodes of our updated relay fee.
18135  *
18136  * Default value: 0.
18137  */
18138 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18139
18140 /**
18141  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
18142  * over the channel.
18143  * This may be allowed to change at runtime in a later update, however doing so must result in
18144  * update messages sent to notify all nodes of our updated relay fee.
18145  *
18146  * Default value: 0.
18147  */
18148 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
18149
18150 /**
18151  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
18152  * excess of [`forwarding_fee_proportional_millionths`].
18153  * This may be allowed to change at runtime in a later update, however doing so must result in
18154  * update messages sent to notify all nodes of our updated relay fee.
18155  *
18156  * The default value of a single satoshi roughly matches the market rate on many routing nodes
18157  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
18158  * this node.
18159  *
18160  * Default value: 1000.
18161  *
18162  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
18163  */
18164 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18165
18166 /**
18167  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
18168  * excess of [`forwarding_fee_proportional_millionths`].
18169  * This may be allowed to change at runtime in a later update, however doing so must result in
18170  * update messages sent to notify all nodes of our updated relay fee.
18171  *
18172  * The default value of a single satoshi roughly matches the market rate on many routing nodes
18173  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
18174  * this node.
18175  *
18176  * Default value: 1000.
18177  *
18178  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
18179  */
18180 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
18181
18182 /**
18183  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
18184  * the channel this config applies to.
18185  *
18186  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
18187  * HTLC balance when a channel appears on-chain whereas
18188  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
18189  * (non-HTLC-encumbered) balance.
18190  *
18191  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
18192  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
18193  * commitment transaction at least once per this many blocks (minus some margin to allow us
18194  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
18195  * the spending transaction).
18196  *
18197  * Default value: 72 (12 hours at an average of 6 blocks/hour).
18198  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
18199  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
18200  *
18201  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
18202  */
18203 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18204
18205 /**
18206  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
18207  * the channel this config applies to.
18208  *
18209  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
18210  * HTLC balance when a channel appears on-chain whereas
18211  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
18212  * (non-HTLC-encumbered) balance.
18213  *
18214  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
18215  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
18216  * commitment transaction at least once per this many blocks (minus some margin to allow us
18217  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
18218  * the spending transaction).
18219  *
18220  * Default value: 72 (12 hours at an average of 6 blocks/hour).
18221  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
18222  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
18223  *
18224  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
18225  */
18226 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
18227
18228 /**
18229  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
18230  * small to claim on-chain.
18231  *
18232  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
18233  * not be claimable on-chain, instead being turned into additional miner fees if either
18234  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
18235  * to such payments may be sustantial if there are many dust HTLCs present when the
18236  * channel is force-closed.
18237  *
18238  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
18239  * exposure across all three types per-channel. Setting this too low may prevent the
18240  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
18241  * important to prevent stealing of dust HTLCs by miners.
18242  *
18243  * Default value: 5_000_000 msat.
18244  */
18245 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18246
18247 /**
18248  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
18249  * small to claim on-chain.
18250  *
18251  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
18252  * not be claimable on-chain, instead being turned into additional miner fees if either
18253  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
18254  * to such payments may be sustantial if there are many dust HTLCs present when the
18255  * channel is force-closed.
18256  *
18257  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
18258  * exposure across all three types per-channel. Setting this too low may prevent the
18259  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
18260  * important to prevent stealing of dust HTLCs by miners.
18261  *
18262  * Default value: 5_000_000 msat.
18263  */
18264 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
18265
18266 /**
18267  * The additional fee we're willing to pay to avoid waiting for the counterparty's
18268  * `to_self_delay` to reclaim funds.
18269  *
18270  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
18271  * closing transaction which both sides find acceptable, ultimately paid by the channel
18272  * funder/initiator.
18273  *
18274  * When we are the funder, because we have to pay the channel closing fee, we bound the
18275  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
18276  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
18277  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
18278  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
18279  * funds.
18280  *
18281  * When we are not the funder, we require the closing transaction fee pay at least our
18282  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
18283  * Thus, this value is ignored when we are not the funder.
18284  *
18285  * Default value: 1000 satoshis.
18286  *
18287  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
18288  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
18289  */
18290 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18291
18292 /**
18293  * The additional fee we're willing to pay to avoid waiting for the counterparty's
18294  * `to_self_delay` to reclaim funds.
18295  *
18296  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
18297  * closing transaction which both sides find acceptable, ultimately paid by the channel
18298  * funder/initiator.
18299  *
18300  * When we are the funder, because we have to pay the channel closing fee, we bound the
18301  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
18302  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
18303  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
18304  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
18305  * funds.
18306  *
18307  * When we are not the funder, we require the closing transaction fee pay at least our
18308  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
18309  * Thus, this value is ignored when we are not the funder.
18310  *
18311  * Default value: 1000 satoshis.
18312  *
18313  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
18314  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
18315  */
18316 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
18317
18318 /**
18319  * Constructs a new ChannelConfig given each field
18320  */
18321 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
18322
18323 /**
18324  * Creates a copy of the ChannelConfig
18325  */
18326 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
18327
18328 /**
18329  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
18330  */
18331 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
18332
18333 /**
18334  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
18335  */
18336 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
18337
18338 /**
18339  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
18340  */
18341 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
18342
18343 /**
18344  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
18345  */
18346 void UserConfig_free(struct LDKUserConfig this_obj);
18347
18348 /**
18349  * Channel handshake config that we propose to our counterparty.
18350  */
18351 struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18352
18353 /**
18354  * Channel handshake config that we propose to our counterparty.
18355  */
18356 void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
18357
18358 /**
18359  * Limits applied to our counterparty's proposed channel handshake config settings.
18360  */
18361 struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18362
18363 /**
18364  * Limits applied to our counterparty's proposed channel handshake config settings.
18365  */
18366 void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
18367
18368 /**
18369  * Channel config which affects behavior during channel lifetime.
18370  */
18371 struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18372
18373 /**
18374  * Channel config which affects behavior during channel lifetime.
18375  */
18376 void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
18377
18378 /**
18379  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
18380  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
18381  * node which is not online reliably.
18382  *
18383  * For nodes which are not online reliably, you should set all channels to *not* be announced
18384  * (using [`ChannelHandshakeConfig::announced_channel`] and
18385  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
18386  * ensure you are not exposed to any forwarding risk.
18387  *
18388  * Note that because you cannot change a channel's announced state after creation, there is no
18389  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
18390  * from a publicly-announced forwarding node to a private non-forwarding node you must close
18391  * all your channels and open new ones. For privacy, you should also change your node_id
18392  * (swapping all private and public key material for new ones) at that time.
18393  *
18394  * Default value: false.
18395  */
18396 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18397
18398 /**
18399  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
18400  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
18401  * node which is not online reliably.
18402  *
18403  * For nodes which are not online reliably, you should set all channels to *not* be announced
18404  * (using [`ChannelHandshakeConfig::announced_channel`] and
18405  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
18406  * ensure you are not exposed to any forwarding risk.
18407  *
18408  * Note that because you cannot change a channel's announced state after creation, there is no
18409  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
18410  * from a publicly-announced forwarding node to a private non-forwarding node you must close
18411  * all your channels and open new ones. For privacy, you should also change your node_id
18412  * (swapping all private and public key material for new ones) at that time.
18413  *
18414  * Default value: false.
18415  */
18416 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18417
18418 /**
18419  * If this is set to false, we do not accept inbound requests to open a new channel.
18420  * Default value: true.
18421  */
18422 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18423
18424 /**
18425  * If this is set to false, we do not accept inbound requests to open a new channel.
18426  * Default value: true.
18427  */
18428 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18429
18430 /**
18431  * If this is set to true, the user needs to manually accept inbound requests to open a new
18432  * channel.
18433  *
18434  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
18435  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
18436  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
18437  * user explicitly chooses to accept the request.
18438  *
18439  * Default value: false.
18440  *
18441  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
18442  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
18443  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
18444  */
18445 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18446
18447 /**
18448  * If this is set to true, the user needs to manually accept inbound requests to open a new
18449  * channel.
18450  *
18451  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
18452  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
18453  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
18454  * user explicitly chooses to accept the request.
18455  *
18456  * Default value: false.
18457  *
18458  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
18459  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
18460  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
18461  */
18462 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18463
18464 /**
18465  * Constructs a new UserConfig given each field
18466  */
18467 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig channel_handshake_config_arg, struct LDKChannelHandshakeLimits channel_handshake_limits_arg, struct LDKChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg);
18468
18469 /**
18470  * Creates a copy of the UserConfig
18471  */
18472 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
18473
18474 /**
18475  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
18476  */
18477 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
18478
18479 /**
18480  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
18481  */
18482 void BestBlock_free(struct LDKBestBlock this_obj);
18483
18484 /**
18485  * Creates a copy of the BestBlock
18486  */
18487 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
18488
18489 /**
18490  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
18491  * network.
18492  */
18493 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
18494
18495 /**
18496  * Returns a `BestBlock` as identified by the given block hash and height.
18497  */
18498 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
18499
18500 /**
18501  * Returns the best block hash.
18502  */
18503 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
18504
18505 /**
18506  * Returns the best block height.
18507  */
18508 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
18509
18510 /**
18511  * Creates a copy of the AccessError
18512  */
18513 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
18514
18515 /**
18516  * Utility method to constructs a new UnknownChain-variant AccessError
18517  */
18518 enum LDKAccessError AccessError_unknown_chain(void);
18519
18520 /**
18521  * Utility method to constructs a new UnknownTx-variant AccessError
18522  */
18523 enum LDKAccessError AccessError_unknown_tx(void);
18524
18525 /**
18526  * Calls the free function if one is set
18527  */
18528 void Access_free(struct LDKAccess this_ptr);
18529
18530 /**
18531  * Calls the free function if one is set
18532  */
18533 void Listen_free(struct LDKListen this_ptr);
18534
18535 /**
18536  * Calls the free function if one is set
18537  */
18538 void Confirm_free(struct LDKConfirm this_ptr);
18539
18540 /**
18541  * Creates a copy of the ChannelMonitorUpdateErr
18542  */
18543 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
18544
18545 /**
18546  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
18547  */
18548 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
18549
18550 /**
18551  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
18552  */
18553 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
18554
18555 /**
18556  * Calls the free function if one is set
18557  */
18558 void Watch_free(struct LDKWatch this_ptr);
18559
18560 /**
18561  * Calls the free function if one is set
18562  */
18563 void Filter_free(struct LDKFilter this_ptr);
18564
18565 /**
18566  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
18567  */
18568 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
18569
18570 /**
18571  * First block where the transaction output may have been spent.
18572  *
18573  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18574  */
18575 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18576
18577 /**
18578  * First block where the transaction output may have been spent.
18579  *
18580  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18581  */
18582 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18583
18584 /**
18585  * Outpoint identifying the transaction output.
18586  */
18587 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18588
18589 /**
18590  * Outpoint identifying the transaction output.
18591  */
18592 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18593
18594 /**
18595  * Spending condition of the transaction output.
18596  */
18597 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18598
18599 /**
18600  * Spending condition of the transaction output.
18601  */
18602 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
18603
18604 /**
18605  * Constructs a new WatchedOutput given each field
18606  */
18607 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
18608
18609 /**
18610  * Creates a copy of the WatchedOutput
18611  */
18612 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
18613
18614 /**
18615  * Checks if two WatchedOutputs contain equal inner contents.
18616  */
18617 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
18618
18619 /**
18620  * Calls the free function if one is set
18621  */
18622 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
18623
18624 /**
18625  * Creates a copy of the ConfirmationTarget
18626  */
18627 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
18628
18629 /**
18630  * Utility method to constructs a new Background-variant ConfirmationTarget
18631  */
18632 enum LDKConfirmationTarget ConfirmationTarget_background(void);
18633
18634 /**
18635  * Utility method to constructs a new Normal-variant ConfirmationTarget
18636  */
18637 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
18638
18639 /**
18640  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
18641  */
18642 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
18643
18644 /**
18645  * Checks if two ConfirmationTargets contain equal inner contents.
18646  * This ignores pointers and is_owned flags and looks at the values in fields.
18647  */
18648 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
18649
18650 /**
18651  * Calls the free function if one is set
18652  */
18653 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
18654
18655 /**
18656  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
18657  */
18658 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
18659
18660 /**
18661  * Creates a copy of the MonitorUpdateId
18662  */
18663 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
18664
18665 /**
18666  * Checks if two MonitorUpdateIds contain equal inner contents.
18667  */
18668 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
18669
18670 /**
18671  * Checks if two MonitorUpdateIds contain equal inner contents.
18672  * This ignores pointers and is_owned flags and looks at the values in fields.
18673  * Two objects with NULL inner values will be considered "equal" here.
18674  */
18675 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
18676
18677 /**
18678  * Calls the free function if one is set
18679  */
18680 void Persist_free(struct LDKPersist this_ptr);
18681
18682 /**
18683  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
18684  */
18685 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
18686
18687 /**
18688  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
18689  */
18690 void ChainMonitor_free(struct LDKChainMonitor this_obj);
18691
18692 /**
18693  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
18694  *
18695  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
18696  * will call back to it indicating transactions and outputs of interest. This allows clients to
18697  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
18698  * always need to fetch full blocks absent another means for determining which blocks contain
18699  * transactions relevant to the watched channels.
18700  */
18701 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
18702
18703 /**
18704  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
18705  * claims which are awaiting confirmation.
18706  *
18707  * Includes the balances from each [`ChannelMonitor`] *except* those included in
18708  * `ignored_channels`, allowing you to filter out balances from channels which are still open
18709  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
18710  *
18711  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
18712  * inclusion in the return value.
18713  */
18714 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
18715
18716 /**
18717  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
18718  * such [`ChannelMonitor`] is currently being monitored for.
18719  *
18720  * Note that the result holds a mutex over our monitor set, and should not be held
18721  * indefinitely.
18722  */
18723 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
18724
18725 /**
18726  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
18727  *
18728  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
18729  * monitoring for on-chain state resolutions.
18730  */
18731 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18732
18733 /**
18734  * Indicates the persistence of a [`ChannelMonitor`] has completed after
18735  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
18736  *
18737  * Thus, the anticipated use is, at a high level:
18738  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
18739  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
18740  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
18741  *  2) once all remote copies are updated, you call this function with the
18742  *     `completed_update_id` that completed, and once all pending updates have completed the
18743  *     channel will be re-enabled.
18744  *
18745  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
18746  * registered [`ChannelMonitor`]s.
18747  */
18748 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);
18749
18750 /**
18751  * Constructs a new Listen which calls the relevant methods on this_arg.
18752  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
18753  */
18754 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18755
18756 /**
18757  * Constructs a new Confirm which calls the relevant methods on this_arg.
18758  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
18759  */
18760 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18761
18762 /**
18763  * Constructs a new Watch which calls the relevant methods on this_arg.
18764  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
18765  */
18766 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18767
18768 /**
18769  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
18770  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
18771  */
18772 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18773
18774 /**
18775  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
18776  */
18777 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
18778
18779 /**
18780  * The sequence number of this update. Updates *must* be replayed in-order according to this
18781  * sequence number (and updates may panic if they are not). The update_id values are strictly
18782  * increasing and increase by one for each new update, with one exception specified below.
18783  *
18784  * This sequence number is also used to track up to which points updates which returned
18785  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
18786  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
18787  *
18788  * The only instance where update_id values are not strictly increasing is the case where we
18789  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
18790  * its docs for more details.
18791  */
18792 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
18793
18794 /**
18795  * The sequence number of this update. Updates *must* be replayed in-order according to this
18796  * sequence number (and updates may panic if they are not). The update_id values are strictly
18797  * increasing and increase by one for each new update, with one exception specified below.
18798  *
18799  * This sequence number is also used to track up to which points updates which returned
18800  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
18801  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
18802  *
18803  * The only instance where update_id values are not strictly increasing is the case where we
18804  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
18805  * its docs for more details.
18806  */
18807 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
18808
18809 /**
18810  * Creates a copy of the ChannelMonitorUpdate
18811  */
18812 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
18813
18814 /**
18815  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
18816  */
18817 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
18818
18819 /**
18820  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
18821  */
18822 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
18823
18824 /**
18825  * Frees any resources used by the MonitorEvent
18826  */
18827 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
18828
18829 /**
18830  * Creates a copy of the MonitorEvent
18831  */
18832 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
18833
18834 /**
18835  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
18836  */
18837 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
18838
18839 /**
18840  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
18841  */
18842 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
18843
18844 /**
18845  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
18846  */
18847 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
18848
18849 /**
18850  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
18851  */
18852 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
18853
18854 /**
18855  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
18856  */
18857 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
18858
18859 /**
18860  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
18861  */
18862 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
18863
18864 /**
18865  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
18866  */
18867 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
18868
18869 /**
18870  * Creates a copy of the HTLCUpdate
18871  */
18872 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
18873
18874 /**
18875  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
18876  */
18877 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
18878
18879 /**
18880  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
18881  */
18882 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
18883
18884 /**
18885  * Frees any resources used by the Balance
18886  */
18887 void Balance_free(struct LDKBalance this_ptr);
18888
18889 /**
18890  * Creates a copy of the Balance
18891  */
18892 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
18893
18894 /**
18895  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
18896  */
18897 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
18898
18899 /**
18900  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
18901  */
18902 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
18903
18904 /**
18905  * Utility method to constructs a new ContentiousClaimable-variant Balance
18906  */
18907 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
18908
18909 /**
18910  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
18911  */
18912 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
18913
18914 /**
18915  * Checks if two Balances contain equal inner contents.
18916  * This ignores pointers and is_owned flags and looks at the values in fields.
18917  */
18918 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
18919
18920 /**
18921  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
18922  */
18923 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
18924
18925 /**
18926  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
18927  */
18928 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
18929
18930 /**
18931  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
18932  * itself.
18933  *
18934  * panics if the given update is not the next update by update_id.
18935  */
18936 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);
18937
18938 /**
18939  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
18940  * ChannelMonitor.
18941  */
18942 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18943
18944 /**
18945  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
18946  */
18947 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18948
18949 /**
18950  * Gets a list of txids, with their output scripts (in the order they appear in the
18951  * transaction), which we must learn about spends of via block_connected().
18952  */
18953 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18954
18955 /**
18956  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
18957  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
18958  * have been registered.
18959  */
18960 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
18961
18962 /**
18963  * Get the list of HTLCs who's status has been updated on chain. This should be called by
18964  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
18965  */
18966 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18967
18968 /**
18969  * Gets the list of pending events which were generated by previous actions, clearing the list
18970  * in the process.
18971  *
18972  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
18973  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
18974  * no internal locking in ChannelMonitors.
18975  */
18976 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18977
18978 /**
18979  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
18980  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
18981  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
18982  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
18983  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
18984  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
18985  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
18986  * out-of-band the other node operator to coordinate with him if option is available to you.
18987  * In any-case, choice is up to the user.
18988  */
18989 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);
18990
18991 /**
18992  * Processes transactions in a newly connected block, which may result in any of the following:
18993  * - update the monitor's state against resolved HTLCs
18994  * - punish the counterparty in the case of seeing a revoked commitment transaction
18995  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
18996  * - detect settled outputs for later spending
18997  * - schedule and bump any in-flight claims
18998  *
18999  * Returns any new outputs to watch from `txdata`; after called, these are also included in
19000  * [`get_outputs_to_watch`].
19001  *
19002  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
19003  */
19004 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);
19005
19006 /**
19007  * Determines if the disconnected block contained any transactions of interest and updates
19008  * appropriately.
19009  */
19010 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);
19011
19012 /**
19013  * Processes transactions confirmed in a block with the given header and height, returning new
19014  * outputs to watch. See [`block_connected`] for details.
19015  *
19016  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
19017  * blocks. See [`chain::Confirm`] for calling expectations.
19018  *
19019  * [`block_connected`]: Self::block_connected
19020  */
19021 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);
19022
19023 /**
19024  * Processes a transaction that was reorganized out of the chain.
19025  *
19026  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
19027  * than blocks. See [`chain::Confirm`] for calling expectations.
19028  *
19029  * [`block_disconnected`]: Self::block_disconnected
19030  */
19031 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);
19032
19033 /**
19034  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
19035  * [`block_connected`] for details.
19036  *
19037  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
19038  * blocks. See [`chain::Confirm`] for calling expectations.
19039  *
19040  * [`block_connected`]: Self::block_connected
19041  */
19042 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);
19043
19044 /**
19045  * Returns the set of txids that should be monitored for re-organization out of the chain.
19046  */
19047 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19048
19049 /**
19050  * Gets the latest best block which was connected either via the [`chain::Listen`] or
19051  * [`chain::Confirm`] interfaces.
19052  */
19053 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19054
19055 /**
19056  * Gets the balances in this channel which are either claimable by us if we were to
19057  * force-close the channel now or which are claimable on-chain (possibly awaiting
19058  * confirmation).
19059  *
19060  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
19061  * included here until an [`Event::SpendableOutputs`] event has been generated for the
19062  * balance, or until our counterparty has claimed the balance and accrued several
19063  * confirmations on the claim transaction.
19064  *
19065  * Note that the balances available when you or your counterparty have broadcasted revoked
19066  * state(s) may not be fully captured here.
19067  *
19068  * See [`Balance`] for additional details on the types of claimable balances which
19069  * may be returned here and their meanings.
19070  */
19071 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19072
19073 /**
19074  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
19075  */
19076 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
19077
19078 /**
19079  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
19080  */
19081 void OutPoint_free(struct LDKOutPoint this_obj);
19082
19083 /**
19084  * The referenced transaction's txid.
19085  */
19086 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
19087
19088 /**
19089  * The referenced transaction's txid.
19090  */
19091 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19092
19093 /**
19094  * The index of the referenced output in its transaction's vout.
19095  */
19096 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
19097
19098 /**
19099  * The index of the referenced output in its transaction's vout.
19100  */
19101 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
19102
19103 /**
19104  * Constructs a new OutPoint given each field
19105  */
19106 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
19107
19108 /**
19109  * Creates a copy of the OutPoint
19110  */
19111 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
19112
19113 /**
19114  * Checks if two OutPoints contain equal inner contents.
19115  * This ignores pointers and is_owned flags and looks at the values in fields.
19116  * Two objects with NULL inner values will be considered "equal" here.
19117  */
19118 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
19119
19120 /**
19121  * Checks if two OutPoints contain equal inner contents.
19122  */
19123 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
19124
19125 /**
19126  * Convert an `OutPoint` to a lightning channel id.
19127  */
19128 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
19129
19130 /**
19131  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
19132  */
19133 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
19134
19135 /**
19136  * Read a OutPoint from a byte array, created by OutPoint_write
19137  */
19138 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
19139
19140 /**
19141  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
19142  */
19143 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
19144
19145 /**
19146  * The outpoint which is spendable
19147  */
19148 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19149
19150 /**
19151  * The outpoint which is spendable
19152  */
19153 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19154
19155 /**
19156  * Per commitment point to derive delayed_payment_key by key holder
19157  */
19158 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19159
19160 /**
19161  * Per commitment point to derive delayed_payment_key by key holder
19162  */
19163 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19164
19165 /**
19166  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
19167  * the witness_script.
19168  */
19169 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19170
19171 /**
19172  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
19173  * the witness_script.
19174  */
19175 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
19176
19177 /**
19178  * The output which is referenced by the given outpoint
19179  */
19180 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
19181
19182 /**
19183  * The revocation point specific to the commitment transaction which was broadcast. Used to
19184  * derive the witnessScript for this output.
19185  */
19186 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19187
19188 /**
19189  * The revocation point specific to the commitment transaction which was broadcast. Used to
19190  * derive the witnessScript for this output.
19191  */
19192 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19193
19194 /**
19195  * Arbitrary identification information returned by a call to
19196  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19197  * the channel to spend the output.
19198  */
19199 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
19200
19201 /**
19202  * Arbitrary identification information returned by a call to
19203  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19204  * the channel to spend the output.
19205  */
19206 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19207
19208 /**
19209  * The value of the channel which this output originated from, possibly indirectly.
19210  */
19211 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19212
19213 /**
19214  * The value of the channel which this output originated from, possibly indirectly.
19215  */
19216 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
19217
19218 /**
19219  * Constructs a new DelayedPaymentOutputDescriptor given each field
19220  */
19221 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);
19222
19223 /**
19224  * Creates a copy of the DelayedPaymentOutputDescriptor
19225  */
19226 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
19227
19228 /**
19229  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
19230  */
19231 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
19232
19233 /**
19234  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
19235  */
19236 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
19237
19238 /**
19239  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
19240  */
19241 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
19242
19243 /**
19244  * The outpoint which is spendable
19245  */
19246 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19247
19248 /**
19249  * The outpoint which is spendable
19250  */
19251 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19252
19253 /**
19254  * The output which is referenced by the given outpoint
19255  */
19256 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
19257
19258 /**
19259  * Arbitrary identification information returned by a call to
19260  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19261  * the channel to spend the output.
19262  */
19263 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
19264
19265 /**
19266  * Arbitrary identification information returned by a call to
19267  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19268  * the channel to spend the output.
19269  */
19270 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19271
19272 /**
19273  * The value of the channel which this transactions spends.
19274  */
19275 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19276
19277 /**
19278  * The value of the channel which this transactions spends.
19279  */
19280 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
19281
19282 /**
19283  * Constructs a new StaticPaymentOutputDescriptor given each field
19284  */
19285 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);
19286
19287 /**
19288  * Creates a copy of the StaticPaymentOutputDescriptor
19289  */
19290 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
19291
19292 /**
19293  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
19294  */
19295 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
19296
19297 /**
19298  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
19299  */
19300 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
19301
19302 /**
19303  * Frees any resources used by the SpendableOutputDescriptor
19304  */
19305 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
19306
19307 /**
19308  * Creates a copy of the SpendableOutputDescriptor
19309  */
19310 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
19311
19312 /**
19313  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
19314  */
19315 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
19316
19317 /**
19318  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
19319  */
19320 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
19321
19322 /**
19323  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
19324  */
19325 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
19326
19327 /**
19328  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
19329  */
19330 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
19331
19332 /**
19333  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
19334  */
19335 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
19336
19337 /**
19338  * Calls the free function if one is set
19339  */
19340 void BaseSign_free(struct LDKBaseSign this_ptr);
19341
19342 /**
19343  * Creates a copy of a Sign
19344  */
19345 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
19346
19347 /**
19348  * Calls the free function if one is set
19349  */
19350 void Sign_free(struct LDKSign this_ptr);
19351
19352 /**
19353  * Creates a copy of the Recipient
19354  */
19355 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
19356
19357 /**
19358  * Utility method to constructs a new Node-variant Recipient
19359  */
19360 enum LDKRecipient Recipient_node(void);
19361
19362 /**
19363  * Utility method to constructs a new PhantomNode-variant Recipient
19364  */
19365 enum LDKRecipient Recipient_phantom_node(void);
19366
19367 /**
19368  * Calls the free function if one is set
19369  */
19370 void KeysInterface_free(struct LDKKeysInterface this_ptr);
19371
19372 /**
19373  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
19374  */
19375 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
19376
19377 /**
19378  * Private key of anchor tx
19379  */
19380 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19381
19382 /**
19383  * Private key of anchor tx
19384  */
19385 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19386
19387 /**
19388  * Holder secret key for blinded revocation pubkey
19389  */
19390 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19391
19392 /**
19393  * Holder secret key for blinded revocation pubkey
19394  */
19395 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19396
19397 /**
19398  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
19399  */
19400 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19401
19402 /**
19403  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
19404  */
19405 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19406
19407 /**
19408  * Holder secret key used in HTLC tx
19409  */
19410 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19411
19412 /**
19413  * Holder secret key used in HTLC tx
19414  */
19415 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19416
19417 /**
19418  * Holder htlc secret key used in commitment tx htlc outputs
19419  */
19420 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19421
19422 /**
19423  * Holder htlc secret key used in commitment tx htlc outputs
19424  */
19425 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19426
19427 /**
19428  * Commitment seed
19429  */
19430 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19431
19432 /**
19433  * Commitment seed
19434  */
19435 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19436
19437 /**
19438  * Creates a copy of the InMemorySigner
19439  */
19440 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
19441
19442 /**
19443  * Create a new InMemorySigner
19444  */
19445 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);
19446
19447 /**
19448  * Counterparty pubkeys.
19449  * Will panic if ready_channel wasn't called.
19450  */
19451 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19452
19453 /**
19454  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
19455  * transactions, ie the amount of time that we have to wait to recover our funds if we
19456  * broadcast a transaction.
19457  * Will panic if ready_channel wasn't called.
19458  */
19459 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19460
19461 /**
19462  * The contest_delay value specified by us and applied on transactions broadcastable
19463  * by our counterparty, ie the amount of time that they have to wait to recover their funds
19464  * if they broadcast a transaction.
19465  * Will panic if ready_channel wasn't called.
19466  */
19467 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19468
19469 /**
19470  * Whether the holder is the initiator
19471  * Will panic if ready_channel wasn't called.
19472  */
19473 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19474
19475 /**
19476  * Funding outpoint
19477  * Will panic if ready_channel wasn't called.
19478  */
19479 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19480
19481 /**
19482  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
19483  * building transactions.
19484  *
19485  * Will panic if ready_channel wasn't called.
19486  */
19487 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19488
19489 /**
19490  * Whether anchors should be used.
19491  * Will panic if ready_channel wasn't called.
19492  */
19493 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19494
19495 /**
19496  * Sign the single input of spend_tx at index `input_idx` which spends the output
19497  * described by descriptor, returning the witness stack for the input.
19498  *
19499  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
19500  * is not spending the outpoint described by `descriptor.outpoint`,
19501  * or if an output descriptor script_pubkey does not match the one we can spend.
19502  */
19503 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);
19504
19505 /**
19506  * Sign the single input of spend_tx at index `input_idx` which spends the output
19507  * described by descriptor, returning the witness stack for the input.
19508  *
19509  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
19510  * is not spending the outpoint described by `descriptor.outpoint`, does not have a
19511  * sequence set to `descriptor.to_self_delay`, or if an output descriptor
19512  * script_pubkey does not match the one we can spend.
19513  */
19514 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);
19515
19516 /**
19517  * Constructs a new BaseSign which calls the relevant methods on this_arg.
19518  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
19519  */
19520 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19521
19522 /**
19523  * Constructs a new Sign which calls the relevant methods on this_arg.
19524  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
19525  */
19526 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19527
19528 /**
19529  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
19530  */
19531 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
19532
19533 /**
19534  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
19535  */
19536 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
19537
19538 /**
19539  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
19540  */
19541 void KeysManager_free(struct LDKKeysManager this_obj);
19542
19543 /**
19544  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
19545  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
19546  * starting_time isn't strictly required to actually be a time, but it must absolutely,
19547  * without a doubt, be unique to this instance. ie if you start multiple times with the same
19548  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
19549  * simply use the current time (with very high precision).
19550  *
19551  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
19552  * obviously, starting_time should be unique every time you reload the library - it is only
19553  * used to generate new ephemeral key data (which will be stored by the individual channel if
19554  * necessary).
19555  *
19556  * Note that the seed is required to recover certain on-chain funds independent of
19557  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
19558  * channel, and some on-chain during-closing funds.
19559  *
19560  * Note that until the 0.1 release there is no guarantee of backward compatibility between
19561  * versions. Once the library is more fully supported, the docs will be updated to include a
19562  * detailed description of the guarantee.
19563  */
19564 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
19565
19566 /**
19567  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
19568  *
19569  * Key derivation parameters are accessible through a per-channel secrets
19570  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
19571  * onchain output detection for which a corresponding delayed_payment_key must be derived.
19572  */
19573 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]);
19574
19575 /**
19576  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
19577  * output to the given change destination (if sufficient change value remains). The
19578  * transaction will have a feerate, at least, of the given value.
19579  *
19580  * Returns `Err(())` if the output value is greater than the input value minus required fee,
19581  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
19582  * does not match the one we can spend.
19583  *
19584  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
19585  *
19586  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
19587  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
19588  */
19589 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);
19590
19591 /**
19592  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
19593  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
19594  */
19595 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
19596
19597 /**
19598  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
19599  */
19600 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
19601
19602 /**
19603  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
19604  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
19605  */
19606 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
19607
19608 /**
19609  * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
19610  * that is shared across all nodes that intend to participate in [phantom node payments] together.
19611  *
19612  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
19613  * `starting_time_nanos`.
19614  *
19615  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
19616  * same across restarts, or else inbound payments may fail.
19617  *
19618  * [phantom node payments]: PhantomKeysManager
19619  */
19620 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]);
19621
19622 /**
19623  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
19624  */
19625 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);
19626
19627 /**
19628  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
19629  */
19630 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]);
19631
19632 /**
19633  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
19634  */
19635 void ChannelManager_free(struct LDKChannelManager this_obj);
19636
19637 /**
19638  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
19639  */
19640 void ChainParameters_free(struct LDKChainParameters this_obj);
19641
19642 /**
19643  * The network for determining the `chain_hash` in Lightning messages.
19644  */
19645 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
19646
19647 /**
19648  * The network for determining the `chain_hash` in Lightning messages.
19649  */
19650 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
19651
19652 /**
19653  * The hash and height of the latest block successfully connected.
19654  *
19655  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
19656  */
19657 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
19658
19659 /**
19660  * The hash and height of the latest block successfully connected.
19661  *
19662  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
19663  */
19664 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
19665
19666 /**
19667  * Constructs a new ChainParameters given each field
19668  */
19669 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
19670
19671 /**
19672  * Creates a copy of the ChainParameters
19673  */
19674 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
19675
19676 /**
19677  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
19678  */
19679 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
19680
19681 /**
19682  * Base routing fee in millisatoshis.
19683  */
19684 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19685
19686 /**
19687  * Base routing fee in millisatoshis.
19688  */
19689 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
19690
19691 /**
19692  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
19693  */
19694 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19695
19696 /**
19697  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
19698  */
19699 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
19700
19701 /**
19702  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
19703  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
19704  * `cltv_expiry_delta` for more details.
19705  */
19706 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19707
19708 /**
19709  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
19710  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
19711  * `cltv_expiry_delta` for more details.
19712  */
19713 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
19714
19715 /**
19716  * Constructs a new CounterpartyForwardingInfo given each field
19717  */
19718 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);
19719
19720 /**
19721  * Creates a copy of the CounterpartyForwardingInfo
19722  */
19723 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
19724
19725 /**
19726  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
19727  */
19728 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
19729
19730 /**
19731  * The node_id of our counterparty
19732  */
19733 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19734
19735 /**
19736  * The node_id of our counterparty
19737  */
19738 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19739
19740 /**
19741  * The Features the channel counterparty provided upon last connection.
19742  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
19743  * many routing-relevant features are present in the init context.
19744  */
19745 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19746
19747 /**
19748  * The Features the channel counterparty provided upon last connection.
19749  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
19750  * many routing-relevant features are present in the init context.
19751  */
19752 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
19753
19754 /**
19755  * The value, in satoshis, that must always be held in the channel for our counterparty. This
19756  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
19757  * claiming at least this value on chain.
19758  *
19759  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
19760  *
19761  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
19762  */
19763 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19764
19765 /**
19766  * The value, in satoshis, that must always be held in the channel for our counterparty. This
19767  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
19768  * claiming at least this value on chain.
19769  *
19770  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
19771  *
19772  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
19773  */
19774 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
19775
19776 /**
19777  * Information on the fees and requirements that the counterparty requires when forwarding
19778  * payments to us through this channel.
19779  *
19780  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19781  */
19782 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19783
19784 /**
19785  * Information on the fees and requirements that the counterparty requires when forwarding
19786  * payments to us through this channel.
19787  *
19788  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19789  */
19790 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
19791
19792 /**
19793  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
19794  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
19795  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
19796  */
19797 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19798
19799 /**
19800  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
19801  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
19802  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
19803  */
19804 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19805
19806 /**
19807  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
19808  */
19809 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19810
19811 /**
19812  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
19813  */
19814 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19815
19816 /**
19817  * Constructs a new ChannelCounterparty given each field
19818  */
19819 MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg);
19820
19821 /**
19822  * Creates a copy of the ChannelCounterparty
19823  */
19824 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
19825
19826 /**
19827  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
19828  */
19829 void ChannelDetails_free(struct LDKChannelDetails this_obj);
19830
19831 /**
19832  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
19833  * thereafter this is the txid of the funding transaction xor the funding transaction output).
19834  * Note that this means this value is *not* persistent - it can change once during the
19835  * lifetime of the channel.
19836  */
19837 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
19838
19839 /**
19840  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
19841  * thereafter this is the txid of the funding transaction xor the funding transaction output).
19842  * Note that this means this value is *not* persistent - it can change once during the
19843  * lifetime of the channel.
19844  */
19845 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19846
19847 /**
19848  * Parameters which apply to our counterparty. See individual fields for more information.
19849  */
19850 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19851
19852 /**
19853  * Parameters which apply to our counterparty. See individual fields for more information.
19854  */
19855 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
19856
19857 /**
19858  * The Channel's funding transaction output, if we've negotiated the funding transaction with
19859  * our counterparty already.
19860  *
19861  * Note that, if this has been set, `channel_id` will be equivalent to
19862  * `funding_txo.unwrap().to_channel_id()`.
19863  *
19864  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19865  */
19866 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19867
19868 /**
19869  * The Channel's funding transaction output, if we've negotiated the funding transaction with
19870  * our counterparty already.
19871  *
19872  * Note that, if this has been set, `channel_id` will be equivalent to
19873  * `funding_txo.unwrap().to_channel_id()`.
19874  *
19875  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19876  */
19877 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19878
19879 /**
19880  * The features which this channel operates with. See individual features for more info.
19881  *
19882  * `None` until negotiation completes and the channel type is finalized.
19883  *
19884  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19885  */
19886 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19887
19888 /**
19889  * The features which this channel operates with. See individual features for more info.
19890  *
19891  * `None` until negotiation completes and the channel type is finalized.
19892  *
19893  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19894  */
19895 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
19896
19897 /**
19898  * The position of the funding transaction in the chain. None if the funding transaction has
19899  * not yet been confirmed and the channel fully opened.
19900  *
19901  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
19902  * payments instead of this. See [`get_inbound_payment_scid`].
19903  *
19904  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
19905  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
19906  *
19907  * [`inbound_scid_alias`]: Self::inbound_scid_alias
19908  * [`outbound_scid_alias`]: Self::outbound_scid_alias
19909  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
19910  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
19911  * [`confirmations_required`]: Self::confirmations_required
19912  */
19913 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19914
19915 /**
19916  * The position of the funding transaction in the chain. None if the funding transaction has
19917  * not yet been confirmed and the channel fully opened.
19918  *
19919  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
19920  * payments instead of this. See [`get_inbound_payment_scid`].
19921  *
19922  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
19923  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
19924  *
19925  * [`inbound_scid_alias`]: Self::inbound_scid_alias
19926  * [`outbound_scid_alias`]: Self::outbound_scid_alias
19927  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
19928  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
19929  * [`confirmations_required`]: Self::confirmations_required
19930  */
19931 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19932
19933 /**
19934  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
19935  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
19936  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
19937  * `Some(0)`).
19938  *
19939  * This will be `None` as long as the channel is not available for routing outbound payments.
19940  *
19941  * [`short_channel_id`]: Self::short_channel_id
19942  * [`confirmations_required`]: Self::confirmations_required
19943  */
19944 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19945
19946 /**
19947  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
19948  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
19949  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
19950  * `Some(0)`).
19951  *
19952  * This will be `None` as long as the channel is not available for routing outbound payments.
19953  *
19954  * [`short_channel_id`]: Self::short_channel_id
19955  * [`confirmations_required`]: Self::confirmations_required
19956  */
19957 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19958
19959 /**
19960  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
19961  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
19962  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
19963  * when they see a payment to be routed to us.
19964  *
19965  * Our counterparty may choose to rotate this value at any time, though will always recognize
19966  * previous values for inbound payment forwarding.
19967  *
19968  * [`short_channel_id`]: Self::short_channel_id
19969  */
19970 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19971
19972 /**
19973  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
19974  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
19975  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
19976  * when they see a payment to be routed to us.
19977  *
19978  * Our counterparty may choose to rotate this value at any time, though will always recognize
19979  * previous values for inbound payment forwarding.
19980  *
19981  * [`short_channel_id`]: Self::short_channel_id
19982  */
19983 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19984
19985 /**
19986  * The value, in satoshis, of this channel as appears in the funding output
19987  */
19988 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19989
19990 /**
19991  * The value, in satoshis, of this channel as appears in the funding output
19992  */
19993 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19994
19995 /**
19996  * The value, in satoshis, that must always be held in the channel for us. This value ensures
19997  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
19998  * this value on chain.
19999  *
20000  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
20001  *
20002  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20003  *
20004  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
20005  */
20006 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20007
20008 /**
20009  * The value, in satoshis, that must always be held in the channel for us. This value ensures
20010  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
20011  * this value on chain.
20012  *
20013  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
20014  *
20015  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20016  *
20017  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
20018  */
20019 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20020
20021 /**
20022  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
20023  */
20024 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20025
20026 /**
20027  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
20028  */
20029 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20030
20031 /**
20032  * Our total balance.  This is the amount we would get if we close the channel.
20033  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
20034  * amount is not likely to be recoverable on close.
20035  *
20036  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
20037  * balance is not available for inclusion in new outbound HTLCs). This further does not include
20038  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
20039  * This does not consider any on-chain fees.
20040  *
20041  * See also [`ChannelDetails::outbound_capacity_msat`]
20042  */
20043 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20044
20045 /**
20046  * Our total balance.  This is the amount we would get if we close the channel.
20047  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
20048  * amount is not likely to be recoverable on close.
20049  *
20050  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
20051  * balance is not available for inclusion in new outbound HTLCs). This further does not include
20052  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
20053  * This does not consider any on-chain fees.
20054  *
20055  * See also [`ChannelDetails::outbound_capacity_msat`]
20056  */
20057 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20058
20059 /**
20060  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
20061  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
20062  * available for inclusion in new outbound HTLCs). This further does not include any pending
20063  * outgoing HTLCs which are awaiting some other resolution to be sent.
20064  *
20065  * See also [`ChannelDetails::balance_msat`]
20066  *
20067  * This value is not exact. Due to various in-flight changes, feerate changes, and our
20068  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
20069  * should be able to spend nearly this amount.
20070  */
20071 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20072
20073 /**
20074  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
20075  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
20076  * available for inclusion in new outbound HTLCs). This further does not include any pending
20077  * outgoing HTLCs which are awaiting some other resolution to be sent.
20078  *
20079  * See also [`ChannelDetails::balance_msat`]
20080  *
20081  * This value is not exact. Due to various in-flight changes, feerate changes, and our
20082  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
20083  * should be able to spend nearly this amount.
20084  */
20085 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20086
20087 /**
20088  * The available outbound capacity for sending a single HTLC to the remote peer. This is
20089  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
20090  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
20091  * to use a limit as close as possible to the HTLC limit we can currently send.
20092  *
20093  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
20094  */
20095 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20096
20097 /**
20098  * The available outbound capacity for sending a single HTLC to the remote peer. This is
20099  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
20100  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
20101  * to use a limit as close as possible to the HTLC limit we can currently send.
20102  *
20103  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
20104  */
20105 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20106
20107 /**
20108  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
20109  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
20110  * available for inclusion in new inbound HTLCs).
20111  * Note that there are some corner cases not fully handled here, so the actual available
20112  * inbound capacity may be slightly higher than this.
20113  *
20114  * This value is not exact. Due to various in-flight changes, feerate changes, and our
20115  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
20116  * However, our counterparty should be able to spend nearly this amount.
20117  */
20118 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20119
20120 /**
20121  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
20122  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
20123  * available for inclusion in new inbound HTLCs).
20124  * Note that there are some corner cases not fully handled here, so the actual available
20125  * inbound capacity may be slightly higher than this.
20126  *
20127  * This value is not exact. Due to various in-flight changes, feerate changes, and our
20128  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
20129  * However, our counterparty should be able to spend nearly this amount.
20130  */
20131 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20132
20133 /**
20134  * The number of required confirmations on the funding transaction before the funding will be
20135  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
20136  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
20137  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
20138  * [`ChannelHandshakeLimits::max_minimum_depth`].
20139  *
20140  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20141  *
20142  * [`is_outbound`]: ChannelDetails::is_outbound
20143  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
20144  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
20145  */
20146 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20147
20148 /**
20149  * The number of required confirmations on the funding transaction before the funding will be
20150  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
20151  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
20152  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
20153  * [`ChannelHandshakeLimits::max_minimum_depth`].
20154  *
20155  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20156  *
20157  * [`is_outbound`]: ChannelDetails::is_outbound
20158  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
20159  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
20160  */
20161 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
20162
20163 /**
20164  * The number of blocks (after our commitment transaction confirms) that we will need to wait
20165  * until we can claim our funds after we force-close the channel. During this time our
20166  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
20167  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
20168  * time to claim our non-HTLC-encumbered funds.
20169  *
20170  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20171  */
20172 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20173
20174 /**
20175  * The number of blocks (after our commitment transaction confirms) that we will need to wait
20176  * until we can claim our funds after we force-close the channel. During this time our
20177  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
20178  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
20179  * time to claim our non-HTLC-encumbered funds.
20180  *
20181  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20182  */
20183 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
20184
20185 /**
20186  * True if the channel was initiated (and thus funded) by us.
20187  */
20188 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20189
20190 /**
20191  * True if the channel was initiated (and thus funded) by us.
20192  */
20193 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20194
20195 /**
20196  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
20197  * channel is not currently being shut down. `channel_ready` message exchange implies the
20198  * required confirmation count has been reached (and we were connected to the peer at some
20199  * point after the funding transaction received enough confirmations). The required
20200  * confirmation count is provided in [`confirmations_required`].
20201  *
20202  * [`confirmations_required`]: ChannelDetails::confirmations_required
20203  */
20204 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20205
20206 /**
20207  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
20208  * channel is not currently being shut down. `channel_ready` message exchange implies the
20209  * required confirmation count has been reached (and we were connected to the peer at some
20210  * point after the funding transaction received enough confirmations). The required
20211  * confirmation count is provided in [`confirmations_required`].
20212  *
20213  * [`confirmations_required`]: ChannelDetails::confirmations_required
20214  */
20215 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20216
20217 /**
20218  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
20219  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
20220  *
20221  * This is a strict superset of `is_channel_ready`.
20222  */
20223 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20224
20225 /**
20226  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
20227  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
20228  *
20229  * This is a strict superset of `is_channel_ready`.
20230  */
20231 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20232
20233 /**
20234  * True if this channel is (or will be) publicly-announced.
20235  */
20236 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20237
20238 /**
20239  * True if this channel is (or will be) publicly-announced.
20240  */
20241 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20242
20243 /**
20244  * The smallest value HTLC (in msat) we will accept, for this channel. This field
20245  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
20246  */
20247 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20248
20249 /**
20250  * The smallest value HTLC (in msat) we will accept, for this channel. This field
20251  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
20252  */
20253 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20254
20255 /**
20256  * The largest value HTLC (in msat) we currently will accept, for this channel.
20257  */
20258 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20259
20260 /**
20261  * The largest value HTLC (in msat) we currently will accept, for this channel.
20262  */
20263 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20264
20265 /**
20266  * Set of configurable parameters that affect channel operation.
20267  *
20268  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
20269  *
20270  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20271  */
20272 struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20273
20274 /**
20275  * Set of configurable parameters that affect channel operation.
20276  *
20277  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
20278  *
20279  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20280  */
20281 void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
20282
20283 /**
20284  * Constructs a new ChannelDetails given each field
20285  */
20286 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg);
20287
20288 /**
20289  * Creates a copy of the ChannelDetails
20290  */
20291 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
20292
20293 /**
20294  * Gets the current SCID which should be used to identify this channel for inbound payments.
20295  * This should be used for providing invoice hints or in any other context where our
20296  * counterparty will forward a payment to us.
20297  *
20298  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
20299  * [`ChannelDetails::short_channel_id`]. See those for more information.
20300  */
20301 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
20302
20303 /**
20304  * Gets the current SCID which should be used to identify this channel for outbound payments.
20305  * This should be used in [`Route`]s to describe the first hop or in other contexts where
20306  * we're sending or forwarding a payment outbound over this channel.
20307  *
20308  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
20309  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
20310  */
20311 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
20312
20313 /**
20314  * Frees any resources used by the PaymentSendFailure
20315  */
20316 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
20317
20318 /**
20319  * Creates a copy of the PaymentSendFailure
20320  */
20321 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
20322
20323 /**
20324  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
20325  */
20326 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
20327
20328 /**
20329  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
20330  */
20331 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
20332
20333 /**
20334  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
20335  */
20336 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
20337
20338 /**
20339  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
20340  */
20341 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
20342
20343 /**
20344  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
20345  */
20346 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
20347
20348 /**
20349  * The list of channels to be included in the invoice route hints.
20350  */
20351 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20352
20353 /**
20354  * The list of channels to be included in the invoice route hints.
20355  */
20356 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
20357
20358 /**
20359  * A fake scid used for representing the phantom node's fake channel in generating the invoice
20360  * route hints.
20361  */
20362 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20363
20364 /**
20365  * A fake scid used for representing the phantom node's fake channel in generating the invoice
20366  * route hints.
20367  */
20368 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
20369
20370 /**
20371  * The pubkey of the real backing node that would ultimately receive the payment.
20372  */
20373 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20374
20375 /**
20376  * The pubkey of the real backing node that would ultimately receive the payment.
20377  */
20378 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20379
20380 /**
20381  * Constructs a new PhantomRouteHints given each field
20382  */
20383 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
20384
20385 /**
20386  * Creates a copy of the PhantomRouteHints
20387  */
20388 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
20389
20390 /**
20391  * Constructs a new ChannelManager to hold several channels and route between them.
20392  *
20393  * This is the main \"logic hub\" for all channel-related actions, and implements
20394  * ChannelMessageHandler.
20395  *
20396  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
20397  *
20398  * Users need to notify the new ChannelManager when a new block is connected or
20399  * disconnected using its `block_connected` and `block_disconnected` methods, starting
20400  * from after `params.latest_hash`.
20401  */
20402 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);
20403
20404 /**
20405  * Gets the current configuration applied to all new channels,  as
20406  */
20407 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
20408
20409 /**
20410  * Creates a new outbound channel to the given remote node and with the given value.
20411  *
20412  * `user_channel_id` will be provided back as in
20413  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
20414  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
20415  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
20416  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
20417  * ignored.
20418  *
20419  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
20420  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
20421  *
20422  * Note that we do not check if you are currently connected to the given peer. If no
20423  * connection is available, the outbound `open_channel` message may fail to send, resulting in
20424  * the channel eventually being silently forgotten (dropped on reload).
20425  *
20426  * Returns the new Channel's temporary `channel_id`. This ID will appear as
20427  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
20428  * [`ChannelDetails::channel_id`] until after
20429  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
20430  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
20431  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
20432  *
20433  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
20434  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
20435  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
20436  *
20437  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
20438  */
20439 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);
20440
20441 /**
20442  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
20443  * more information.
20444  */
20445 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
20446
20447 /**
20448  * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`]
20449  * to ensure non-announced channels are used.
20450  *
20451  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
20452  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
20453  * are.
20454  *
20455  * [`find_route`]: crate::routing::router::find_route
20456  */
20457 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
20458
20459 /**
20460  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
20461  * will be accepted on the given channel, and after additional timeout/the closing of all
20462  * pending HTLCs, the channel will be closed on chain.
20463  *
20464  *  * If we are the channel initiator, we will pay between our [`Background`] and
20465  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
20466  *    estimate.
20467  *  * If our counterparty is the channel initiator, we will require a channel closing
20468  *    transaction feerate of at least our [`Background`] feerate or the feerate which
20469  *    would appear on a force-closure transaction, whichever is lower. We will allow our
20470  *    counterparty to pay as much fee as they'd like, however.
20471  *
20472  * May generate a SendShutdown message event on success, which should be relayed.
20473  *
20474  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
20475  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20476  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20477  */
20478 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
20479
20480 /**
20481  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
20482  * will be accepted on the given channel, and after additional timeout/the closing of all
20483  * pending HTLCs, the channel will be closed on chain.
20484  *
20485  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
20486  * the channel being closed or not:
20487  *  * If we are the channel initiator, we will pay at least this feerate on the closing
20488  *    transaction. The upper-bound is set by
20489  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
20490  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
20491  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
20492  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
20493  *    will appear on a force-closure transaction, whichever is lower).
20494  *
20495  * May generate a SendShutdown message event on success, which should be relayed.
20496  *
20497  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
20498  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20499  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20500  */
20501 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id, uint32_t target_feerate_sats_per_1000_weight);
20502
20503 /**
20504  * Force closes a channel, immediately broadcasting the latest local transaction(s) and
20505  * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
20506  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
20507  * channel.
20508  */
20509 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
20510
20511 /**
20512  * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
20513  * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
20514  * `counterparty_node_id` isn't the counterparty of the corresponding channel.
20515  *
20516  * You can always get the latest local transaction(s) to broadcast from
20517  * [`ChannelMonitor::get_latest_holder_commitment_txn`].
20518  */
20519 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
20520
20521 /**
20522  * Force close all channels, immediately broadcasting the latest local commitment transaction
20523  * for each to the chain and rejecting new HTLCs on each.
20524  */
20525 void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
20526
20527 /**
20528  * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
20529  * local transaction(s).
20530  */
20531 void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
20532
20533 /**
20534  * Sends a payment along a given route.
20535  *
20536  * Value parameters are provided via the last hop in route, see documentation for RouteHop
20537  * fields for more info.
20538  *
20539  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
20540  * payment), we don't do anything to stop you! We always try to ensure that if the provided
20541  * next hop knows the preimage to payment_hash they can claim an additional amount as
20542  * specified in the last hop in the route! Thus, you should probably do your own
20543  * payment_preimage tracking (which you should already be doing as they represent \"proof of
20544  * payment\") and prevent double-sends yourself.
20545  *
20546  * May generate SendHTLCs message(s) event on success, which should be relayed.
20547  *
20548  * Each path may have a different return value, and PaymentSendValue may return a Vec with
20549  * each entry matching the corresponding-index entry in the route paths, see
20550  * PaymentSendFailure for more info.
20551  *
20552  * In general, a path may raise:
20553  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
20554  *    node public key) is specified.
20555  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
20556  *    (including due to previous monitor update failure or new permanent monitor update
20557  *    failure).
20558  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
20559  *    relevant updates.
20560  *
20561  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
20562  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
20563  * different route unless you intend to pay twice!
20564  *
20565  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
20566  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
20567  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
20568  * must not contain multiple paths as multi-path payments require a recipient-provided
20569  * payment_secret.
20570  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
20571  * bit set (either as required or as available). If multiple paths are present in the Route,
20572  * we assume the invoice had the basic_mpp feature set.
20573  *
20574  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
20575  */
20576 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);
20577
20578 /**
20579  * Retries a payment along the given [`Route`].
20580  *
20581  * Errors returned are a superset of those returned from [`send_payment`], so see
20582  * [`send_payment`] documentation for more details on errors. This method will also error if the
20583  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
20584  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
20585  * further retries have been disabled with [`abandon_payment`].
20586  *
20587  * [`send_payment`]: [`ChannelManager::send_payment`]
20588  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
20589  */
20590 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);
20591
20592 /**
20593  * Signals that no further retries for the given payment will occur.
20594  *
20595  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
20596  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
20597  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
20598  * pending HTLCs for this payment.
20599  *
20600  * Note that calling this method does *not* prevent a payment from succeeding. You must still
20601  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
20602  * determine the ultimate status of a payment.
20603  *
20604  * [`retry_payment`]: Self::retry_payment
20605  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
20606  * [`Event::PaymentSent`]: events::Event::PaymentSent
20607  */
20608 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
20609
20610 /**
20611  * Send a spontaneous payment, which is a payment that does not require the recipient to have
20612  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
20613  * the preimage, it must be a cryptographically secure random value that no intermediate node
20614  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
20615  * never reach the recipient.
20616  *
20617  * See [`send_payment`] documentation for more details on the return value of this function.
20618  *
20619  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
20620  * [`send_payment`] for more information about the risks of duplicate preimage usage.
20621  *
20622  * Note that `route` must have exactly one path.
20623  *
20624  * [`send_payment`]: Self::send_payment
20625  *
20626  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
20627  */
20628 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);
20629
20630 /**
20631  * Call this upon creation of a funding transaction for the given channel.
20632  *
20633  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
20634  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
20635  *
20636  * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
20637  * across the p2p network.
20638  *
20639  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
20640  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
20641  *
20642  * May panic if the output found in the funding transaction is duplicative with some other
20643  * channel (note that this should be trivially prevented by using unique funding transaction
20644  * keys per-channel).
20645  *
20646  * Do NOT broadcast the funding transaction yourself. When we have safely received our
20647  * counterparty's signature the funding transaction will automatically be broadcast via the
20648  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
20649  *
20650  * Note that this includes RBF or similar transaction replacement strategies - lightning does
20651  * not currently support replacing a funding transaction on an existing channel. Instead,
20652  * create a new channel with a conflicting funding transaction.
20653  *
20654  * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
20655  * the wallet software generating the funding transaction to apply anti-fee sniping as
20656  * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
20657  * for more details.
20658  *
20659  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
20660  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
20661  */
20662 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction);
20663
20664 /**
20665  * Regenerates channel_announcements and generates a signed node_announcement from the given
20666  * arguments, providing them in corresponding events via
20667  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
20668  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
20669  * announcement to ensure that the lightning P2P network is aware of the channels we have and
20670  * our network addresses.
20671  *
20672  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
20673  * node to humans. They carry no in-protocol meaning.
20674  *
20675  * `addresses` represent the set (possibly empty) of socket addresses on which this node
20676  * accepts incoming connections. These will be included in the node_announcement, publicly
20677  * tying these addresses together and to this node. If you wish to preserve user privacy,
20678  * addresses should likely contain only Tor Onion addresses.
20679  *
20680  * Panics if `addresses` is absurdly large (more than 500).
20681  *
20682  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
20683  */
20684 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
20685
20686 /**
20687  * Atomically updates the [`ChannelConfig`] for the given channels.
20688  *
20689  * Once the updates are applied, each eligible channel (advertised with a known short channel
20690  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
20691  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
20692  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
20693  *
20694  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
20695  * `counterparty_node_id` is provided.
20696  *
20697  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
20698  * below [`MIN_CLTV_EXPIRY_DELTA`].
20699  *
20700  * If an error is returned, none of the updates should be considered applied.
20701  *
20702  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
20703  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
20704  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
20705  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
20706  * [`ChannelUpdate`]: msgs::ChannelUpdate
20707  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
20708  * [`APIMisuseError`]: APIError::APIMisuseError
20709  */
20710 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ThirtyTwoBytesZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config);
20711
20712 /**
20713  * Processes HTLCs which are pending waiting on random forward delay.
20714  *
20715  * Should only really ever be called in response to a PendingHTLCsForwardable event.
20716  * Will likely generate further events.
20717  */
20718 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
20719
20720 /**
20721  * Performs actions which should happen on startup and roughly once per minute thereafter.
20722  *
20723  * This currently includes:
20724  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
20725  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
20726  *    than a minute, informing the network that they should no longer attempt to route over
20727  *    the channel.
20728  *  * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs
20729  *    with the current `ChannelConfig`.
20730  *
20731  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
20732  * estimate fetches.
20733  */
20734 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
20735
20736 /**
20737  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
20738  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
20739  * along the path (including in our own channel on which we received it).
20740  *
20741  * Note that in some cases around unclean shutdown, it is possible the payment may have
20742  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
20743  * second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment
20744  * may have already been failed automatically by LDK if it was nearing its expiration time.
20745  *
20746  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
20747  * [`ChannelManager::claim_funds`]), you should still monitor for
20748  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
20749  * startup during which time claims that were in-progress at shutdown may be replayed.
20750  */
20751 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
20752
20753 /**
20754  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
20755  * [`MessageSendEvent`]s needed to claim the payment.
20756  *
20757  * Note that calling this method does *not* guarantee that the payment has been claimed. You
20758  * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
20759  * provided to your [`EventHandler`] when [`process_pending_events`] is next called.
20760  *
20761  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
20762  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
20763  * event matches your expectation. If you fail to do so and call this method, you may provide
20764  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
20765  *
20766  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
20767  * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
20768  * [`process_pending_events`]: EventsProvider::process_pending_events
20769  * [`create_inbound_payment`]: Self::create_inbound_payment
20770  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
20771  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
20772  */
20773 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
20774
20775 /**
20776  * Gets the node_id held by this ChannelManager
20777  */
20778 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
20779
20780 /**
20781  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
20782  *
20783  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
20784  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
20785  * the channel.
20786  *
20787  * The `user_channel_id` parameter will be provided back in
20788  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
20789  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
20790  *
20791  * Note that this method will return an error and reject the channel, if it requires support
20792  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
20793  * used to accept such channels.
20794  *
20795  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
20796  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
20797  */
20798 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, uint64_t user_channel_id);
20799
20800 /**
20801  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
20802  * it as confirmed immediately.
20803  *
20804  * The `user_channel_id` parameter will be provided back in
20805  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
20806  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
20807  *
20808  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
20809  * and (if the counterparty agrees), enables forwarding of payments immediately.
20810  *
20811  * This fully trusts that the counterparty has honestly and correctly constructed the funding
20812  * transaction and blindly assumes that it will eventually confirm.
20813  *
20814  * If it does not confirm before we decide to close the channel, or if the funding transaction
20815  * does not pay to the correct script the correct amount, *you will lose funds*.
20816  *
20817  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
20818  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
20819  */
20820 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, uint64_t user_channel_id);
20821
20822 /**
20823  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
20824  * to pay us.
20825  *
20826  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
20827  * [`PaymentHash`] and [`PaymentPreimage`] for you.
20828  *
20829  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
20830  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
20831  * passed directly to [`claim_funds`].
20832  *
20833  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
20834  *
20835  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
20836  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
20837  *
20838  * # Note
20839  *
20840  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
20841  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
20842  *
20843  * Errors if `min_value_msat` is greater than total bitcoin supply.
20844  *
20845  * [`claim_funds`]: Self::claim_funds
20846  * [`PaymentReceived`]: events::Event::PaymentReceived
20847  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
20848  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
20849  */
20850 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);
20851
20852 /**
20853  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
20854  * serialized state with LDK node(s) running 0.0.103 and earlier.
20855  *
20856  * May panic if `invoice_expiry_delta_secs` is greater than one year.
20857  *
20858  * # Note
20859  * This method is deprecated and will be removed soon.
20860  *
20861  * [`create_inbound_payment`]: Self::create_inbound_payment
20862  */
20863 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);
20864
20865 /**
20866  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
20867  * stored external to LDK.
20868  *
20869  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
20870  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
20871  * the `min_value_msat` provided here, if one is provided.
20872  *
20873  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
20874  * note that LDK will not stop you from registering duplicate payment hashes for inbound
20875  * payments.
20876  *
20877  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
20878  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
20879  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
20880  * sender \"proof-of-payment\" unless they have paid the required amount.
20881  *
20882  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
20883  * in excess of the current time. This should roughly match the expiry time set in the invoice.
20884  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
20885  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
20886  * invoices when no timeout is set.
20887  *
20888  * Note that we use block header time to time-out pending inbound payments (with some margin
20889  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
20890  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
20891  * If you need exact expiry semantics, you should enforce them upon receipt of
20892  * [`PaymentReceived`].
20893  *
20894  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
20895  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
20896  *
20897  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
20898  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
20899  *
20900  * # Note
20901  *
20902  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
20903  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
20904  *
20905  * Errors if `min_value_msat` is greater than total bitcoin supply.
20906  *
20907  * [`create_inbound_payment`]: Self::create_inbound_payment
20908  * [`PaymentReceived`]: events::Event::PaymentReceived
20909  */
20910 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);
20911
20912 /**
20913  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
20914  * serialized state with LDK node(s) running 0.0.103 and earlier.
20915  *
20916  * May panic if `invoice_expiry_delta_secs` is greater than one year.
20917  *
20918  * # Note
20919  * This method is deprecated and will be removed soon.
20920  *
20921  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
20922  */
20923 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);
20924
20925 /**
20926  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
20927  * previously returned from [`create_inbound_payment`].
20928  *
20929  * [`create_inbound_payment`]: Self::create_inbound_payment
20930  */
20931 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);
20932
20933 /**
20934  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
20935  * are used when constructing the phantom invoice's route hints.
20936  *
20937  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20938  */
20939 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
20940
20941 /**
20942  * Gets route hints for use in receiving [phantom node payments].
20943  *
20944  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20945  */
20946 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
20947
20948 /**
20949  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
20950  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
20951  */
20952 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
20953
20954 /**
20955  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
20956  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
20957  */
20958 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
20959
20960 /**
20961  * Constructs a new Listen which calls the relevant methods on this_arg.
20962  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
20963  */
20964 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
20965
20966 /**
20967  * Constructs a new Confirm which calls the relevant methods on this_arg.
20968  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
20969  */
20970 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
20971
20972 /**
20973  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
20974  * indicating whether persistence is necessary. Only one listener on
20975  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
20976  * up.
20977  *
20978  * Note that this method is not available with the `no-std` feature.
20979  */
20980 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
20981
20982 /**
20983  * Blocks until ChannelManager needs to be persisted. Only one listener on
20984  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
20985  * up.
20986  */
20987 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
20988
20989 /**
20990  * Gets the latest best block which was connected either via the [`chain::Listen`] or
20991  * [`chain::Confirm`] interfaces.
20992  */
20993 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
20994
20995 /**
20996  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
20997  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
20998  */
20999 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
21000
21001 /**
21002  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
21003  */
21004 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
21005
21006 /**
21007  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
21008  */
21009 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
21010
21011 /**
21012  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
21013  */
21014 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
21015
21016 /**
21017  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
21018  */
21019 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
21020
21021 /**
21022  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
21023  */
21024 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
21025
21026 /**
21027  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
21028  */
21029 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
21030
21031 /**
21032  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
21033  */
21034 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
21035
21036 /**
21037  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
21038  */
21039 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
21040
21041 /**
21042  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
21043  */
21044 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
21045
21046 /**
21047  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
21048  */
21049 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
21050
21051 /**
21052  * The keys provider which will give us relevant keys. Some keys will be loaded during
21053  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
21054  * signing data.
21055  */
21056 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21057
21058 /**
21059  * The keys provider which will give us relevant keys. Some keys will be loaded during
21060  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
21061  * signing data.
21062  */
21063 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
21064
21065 /**
21066  * The fee_estimator for use in the ChannelManager in the future.
21067  *
21068  * No calls to the FeeEstimator will be made during deserialization.
21069  */
21070 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21071
21072 /**
21073  * The fee_estimator for use in the ChannelManager in the future.
21074  *
21075  * No calls to the FeeEstimator will be made during deserialization.
21076  */
21077 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
21078
21079 /**
21080  * The chain::Watch for use in the ChannelManager in the future.
21081  *
21082  * No calls to the chain::Watch will be made during deserialization. It is assumed that
21083  * you have deserialized ChannelMonitors separately and will add them to your
21084  * chain::Watch after deserializing this ChannelManager.
21085  */
21086 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21087
21088 /**
21089  * The chain::Watch for use in the ChannelManager in the future.
21090  *
21091  * No calls to the chain::Watch will be made during deserialization. It is assumed that
21092  * you have deserialized ChannelMonitors separately and will add them to your
21093  * chain::Watch after deserializing this ChannelManager.
21094  */
21095 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
21096
21097 /**
21098  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
21099  * used to broadcast the latest local commitment transactions of channels which must be
21100  * force-closed during deserialization.
21101  */
21102 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21103
21104 /**
21105  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
21106  * used to broadcast the latest local commitment transactions of channels which must be
21107  * force-closed during deserialization.
21108  */
21109 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
21110
21111 /**
21112  * The Logger for use in the ChannelManager and which may be used to log information during
21113  * deserialization.
21114  */
21115 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21116
21117 /**
21118  * The Logger for use in the ChannelManager and which may be used to log information during
21119  * deserialization.
21120  */
21121 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
21122
21123 /**
21124  * Default settings used for new channels. Any existing channels will continue to use the
21125  * runtime settings which were stored when the ChannelManager was serialized.
21126  */
21127 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21128
21129 /**
21130  * Default settings used for new channels. Any existing channels will continue to use the
21131  * runtime settings which were stored when the ChannelManager was serialized.
21132  */
21133 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
21134
21135 /**
21136  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
21137  * HashMap for you. This is primarily useful for C bindings where it is not practical to
21138  * populate a HashMap directly from C.
21139  */
21140 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);
21141
21142 /**
21143  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
21144  */
21145 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
21146
21147 /**
21148  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
21149  */
21150 void ExpandedKey_free(struct LDKExpandedKey this_obj);
21151
21152 /**
21153  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
21154  *
21155  * It is recommended to cache this value and not regenerate it for each new inbound payment.
21156  */
21157 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
21158
21159 /**
21160  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
21161  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
21162  * a `ChannelManager`.
21163  *
21164  * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
21165  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
21166  * regenerate it for each new inbound payment.
21167  *
21168  * `current_time` is a Unix timestamp representing the current time.
21169  *
21170  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
21171  */
21172 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKKeysInterface *NONNULL_PTR keys_manager, uint64_t current_time);
21173
21174 /**
21175  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
21176  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
21177  * without a `ChannelManager`.
21178  *
21179  * See [`create`] for information on the `keys` and `current_time` parameters.
21180  *
21181  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
21182  */
21183 struct LDKCResult_PaymentSecretNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time);
21184
21185 /**
21186  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
21187  */
21188 void DecodeError_free(struct LDKDecodeError this_obj);
21189
21190 /**
21191  * Creates a copy of the DecodeError
21192  */
21193 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
21194
21195 /**
21196  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
21197  */
21198 void Init_free(struct LDKInit this_obj);
21199
21200 /**
21201  * The relevant features which the sender supports
21202  */
21203 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
21204
21205 /**
21206  * The relevant features which the sender supports
21207  */
21208 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
21209
21210 /**
21211  * The receipient's network address. This adds the option to report a remote IP address
21212  * back to a connecting peer using the init message. A node can decide to use that information
21213  * to discover a potential update to its public IPv4 address (NAT) and use
21214  * that for a node_announcement update message containing the new address.
21215  */
21216 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
21217
21218 /**
21219  * The receipient's network address. This adds the option to report a remote IP address
21220  * back to a connecting peer using the init message. A node can decide to use that information
21221  * to discover a potential update to its public IPv4 address (NAT) and use
21222  * that for a node_announcement update message containing the new address.
21223  */
21224 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
21225
21226 /**
21227  * Constructs a new Init given each field
21228  */
21229 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
21230
21231 /**
21232  * Creates a copy of the Init
21233  */
21234 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
21235
21236 /**
21237  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
21238  */
21239 void ErrorMessage_free(struct LDKErrorMessage this_obj);
21240
21241 /**
21242  * The channel ID involved in the error.
21243  *
21244  * All-0s indicates a general error unrelated to a specific channel, after which all channels
21245  * with the sending peer should be closed.
21246  */
21247 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
21248
21249 /**
21250  * The channel ID involved in the error.
21251  *
21252  * All-0s indicates a general error unrelated to a specific channel, after which all channels
21253  * with the sending peer should be closed.
21254  */
21255 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21256
21257 /**
21258  * A possibly human-readable error description.
21259  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21260  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21261  * the terminal emulator or the logging subsystem.
21262  */
21263 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
21264
21265 /**
21266  * A possibly human-readable error description.
21267  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21268  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21269  * the terminal emulator or the logging subsystem.
21270  */
21271 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
21272
21273 /**
21274  * Constructs a new ErrorMessage given each field
21275  */
21276 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
21277
21278 /**
21279  * Creates a copy of the ErrorMessage
21280  */
21281 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
21282
21283 /**
21284  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
21285  */
21286 void WarningMessage_free(struct LDKWarningMessage this_obj);
21287
21288 /**
21289  * The channel ID involved in the warning.
21290  *
21291  * All-0s indicates a warning unrelated to a specific channel.
21292  */
21293 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
21294
21295 /**
21296  * The channel ID involved in the warning.
21297  *
21298  * All-0s indicates a warning unrelated to a specific channel.
21299  */
21300 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21301
21302 /**
21303  * A possibly human-readable warning description.
21304  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21305  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21306  * the terminal emulator or the logging subsystem.
21307  */
21308 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
21309
21310 /**
21311  * A possibly human-readable warning description.
21312  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21313  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21314  * the terminal emulator or the logging subsystem.
21315  */
21316 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
21317
21318 /**
21319  * Constructs a new WarningMessage given each field
21320  */
21321 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
21322
21323 /**
21324  * Creates a copy of the WarningMessage
21325  */
21326 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
21327
21328 /**
21329  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
21330  */
21331 void Ping_free(struct LDKPing this_obj);
21332
21333 /**
21334  * The desired response length
21335  */
21336 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
21337
21338 /**
21339  * The desired response length
21340  */
21341 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
21342
21343 /**
21344  * The ping packet size.
21345  * This field is not sent on the wire. byteslen zeros are sent.
21346  */
21347 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
21348
21349 /**
21350  * The ping packet size.
21351  * This field is not sent on the wire. byteslen zeros are sent.
21352  */
21353 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
21354
21355 /**
21356  * Constructs a new Ping given each field
21357  */
21358 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
21359
21360 /**
21361  * Creates a copy of the Ping
21362  */
21363 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
21364
21365 /**
21366  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
21367  */
21368 void Pong_free(struct LDKPong this_obj);
21369
21370 /**
21371  * The pong packet size.
21372  * This field is not sent on the wire. byteslen zeros are sent.
21373  */
21374 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
21375
21376 /**
21377  * The pong packet size.
21378  * This field is not sent on the wire. byteslen zeros are sent.
21379  */
21380 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
21381
21382 /**
21383  * Constructs a new Pong given each field
21384  */
21385 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
21386
21387 /**
21388  * Creates a copy of the Pong
21389  */
21390 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
21391
21392 /**
21393  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
21394  */
21395 void OpenChannel_free(struct LDKOpenChannel this_obj);
21396
21397 /**
21398  * The genesis hash of the blockchain where the channel is to be opened
21399  */
21400 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
21401
21402 /**
21403  * The genesis hash of the blockchain where the channel is to be opened
21404  */
21405 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21406
21407 /**
21408  * A temporary channel ID, until the funding outpoint is announced
21409  */
21410 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
21411
21412 /**
21413  * A temporary channel ID, until the funding outpoint is announced
21414  */
21415 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21416
21417 /**
21418  * The channel value
21419  */
21420 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21421
21422 /**
21423  * The channel value
21424  */
21425 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21426
21427 /**
21428  * The amount to push to the counterparty as part of the open, in milli-satoshi
21429  */
21430 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21431
21432 /**
21433  * The amount to push to the counterparty as part of the open, in milli-satoshi
21434  */
21435 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21436
21437 /**
21438  * The threshold below which outputs on transactions broadcast by sender will be omitted
21439  */
21440 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21441
21442 /**
21443  * The threshold below which outputs on transactions broadcast by sender will be omitted
21444  */
21445 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21446
21447 /**
21448  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21449  */
21450 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21451
21452 /**
21453  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21454  */
21455 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21456
21457 /**
21458  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21459  */
21460 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21461
21462 /**
21463  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21464  */
21465 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21466
21467 /**
21468  * The minimum HTLC size incoming to sender, in milli-satoshi
21469  */
21470 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21471
21472 /**
21473  * The minimum HTLC size incoming to sender, in milli-satoshi
21474  */
21475 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21476
21477 /**
21478  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
21479  */
21480 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21481
21482 /**
21483  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
21484  */
21485 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
21486
21487 /**
21488  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21489  */
21490 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21491
21492 /**
21493  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21494  */
21495 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
21496
21497 /**
21498  * The maximum number of inbound HTLCs towards sender
21499  */
21500 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21501
21502 /**
21503  * The maximum number of inbound HTLCs towards sender
21504  */
21505 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
21506
21507 /**
21508  * The sender's key controlling the funding transaction
21509  */
21510 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21511
21512 /**
21513  * The sender's key controlling the funding transaction
21514  */
21515 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21516
21517 /**
21518  * Used to derive a revocation key for transactions broadcast by counterparty
21519  */
21520 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21521
21522 /**
21523  * Used to derive a revocation key for transactions broadcast by counterparty
21524  */
21525 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21526
21527 /**
21528  * A payment key to sender for transactions broadcast by counterparty
21529  */
21530 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21531
21532 /**
21533  * A payment key to sender for transactions broadcast by counterparty
21534  */
21535 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21536
21537 /**
21538  * Used to derive a payment key to sender for transactions broadcast by sender
21539  */
21540 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21541
21542 /**
21543  * Used to derive a payment key to sender for transactions broadcast by sender
21544  */
21545 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21546
21547 /**
21548  * Used to derive an HTLC payment key to sender
21549  */
21550 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21551
21552 /**
21553  * Used to derive an HTLC payment key to sender
21554  */
21555 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21556
21557 /**
21558  * The first to-be-broadcast-by-sender transaction's per commitment point
21559  */
21560 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21561
21562 /**
21563  * The first to-be-broadcast-by-sender transaction's per commitment point
21564  */
21565 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21566
21567 /**
21568  * Channel flags
21569  */
21570 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21571
21572 /**
21573  * Channel flags
21574  */
21575 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
21576
21577 /**
21578  * The channel type that this channel will represent. If none is set, we derive the channel
21579  * type from the intersection of our feature bits with our counterparty's feature bits from
21580  * the Init message.
21581  *
21582  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21583  */
21584 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21585
21586 /**
21587  * The channel type that this channel will represent. If none is set, we derive the channel
21588  * type from the intersection of our feature bits with our counterparty's feature bits from
21589  * the Init message.
21590  *
21591  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21592  */
21593 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
21594
21595 /**
21596  * Creates a copy of the OpenChannel
21597  */
21598 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
21599
21600 /**
21601  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
21602  */
21603 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
21604
21605 /**
21606  * A temporary channel ID, until the funding outpoint is announced
21607  */
21608 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
21609
21610 /**
21611  * A temporary channel ID, until the funding outpoint is announced
21612  */
21613 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21614
21615 /**
21616  * The threshold below which outputs on transactions broadcast by sender will be omitted
21617  */
21618 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21619
21620 /**
21621  * The threshold below which outputs on transactions broadcast by sender will be omitted
21622  */
21623 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21624
21625 /**
21626  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21627  */
21628 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21629
21630 /**
21631  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21632  */
21633 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21634
21635 /**
21636  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21637  */
21638 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21639
21640 /**
21641  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21642  */
21643 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21644
21645 /**
21646  * The minimum HTLC size incoming to sender, in milli-satoshi
21647  */
21648 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21649
21650 /**
21651  * The minimum HTLC size incoming to sender, in milli-satoshi
21652  */
21653 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21654
21655 /**
21656  * Minimum depth of the funding transaction before the channel is considered open
21657  */
21658 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21659
21660 /**
21661  * Minimum depth of the funding transaction before the channel is considered open
21662  */
21663 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
21664
21665 /**
21666  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21667  */
21668 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21669
21670 /**
21671  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21672  */
21673 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
21674
21675 /**
21676  * The maximum number of inbound HTLCs towards sender
21677  */
21678 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21679
21680 /**
21681  * The maximum number of inbound HTLCs towards sender
21682  */
21683 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
21684
21685 /**
21686  * The sender's key controlling the funding transaction
21687  */
21688 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21689
21690 /**
21691  * The sender's key controlling the funding transaction
21692  */
21693 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21694
21695 /**
21696  * Used to derive a revocation key for transactions broadcast by counterparty
21697  */
21698 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21699
21700 /**
21701  * Used to derive a revocation key for transactions broadcast by counterparty
21702  */
21703 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21704
21705 /**
21706  * A payment key to sender for transactions broadcast by counterparty
21707  */
21708 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21709
21710 /**
21711  * A payment key to sender for transactions broadcast by counterparty
21712  */
21713 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21714
21715 /**
21716  * Used to derive a payment key to sender for transactions broadcast by sender
21717  */
21718 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21719
21720 /**
21721  * Used to derive a payment key to sender for transactions broadcast by sender
21722  */
21723 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21724
21725 /**
21726  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
21727  */
21728 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21729
21730 /**
21731  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
21732  */
21733 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21734
21735 /**
21736  * The first to-be-broadcast-by-sender transaction's per commitment point
21737  */
21738 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21739
21740 /**
21741  * The first to-be-broadcast-by-sender transaction's per commitment point
21742  */
21743 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21744
21745 /**
21746  * The channel type that this channel will represent. If none is set, we derive the channel
21747  * type from the intersection of our feature bits with our counterparty's feature bits from
21748  * the Init message.
21749  *
21750  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
21751  *
21752  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21753  */
21754 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21755
21756 /**
21757  * The channel type that this channel will represent. If none is set, we derive the channel
21758  * type from the intersection of our feature bits with our counterparty's feature bits from
21759  * the Init message.
21760  *
21761  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
21762  *
21763  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21764  */
21765 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
21766
21767 /**
21768  * Creates a copy of the AcceptChannel
21769  */
21770 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
21771
21772 /**
21773  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
21774  */
21775 void FundingCreated_free(struct LDKFundingCreated this_obj);
21776
21777 /**
21778  * A temporary channel ID, until the funding is established
21779  */
21780 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
21781
21782 /**
21783  * A temporary channel ID, until the funding is established
21784  */
21785 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21786
21787 /**
21788  * The funding transaction ID
21789  */
21790 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
21791
21792 /**
21793  * The funding transaction ID
21794  */
21795 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21796
21797 /**
21798  * The specific output index funding this channel
21799  */
21800 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
21801
21802 /**
21803  * The specific output index funding this channel
21804  */
21805 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
21806
21807 /**
21808  * The signature of the channel initiator (funder) on the initial commitment transaction
21809  */
21810 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
21811
21812 /**
21813  * The signature of the channel initiator (funder) on the initial commitment transaction
21814  */
21815 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
21816
21817 /**
21818  * Constructs a new FundingCreated given each field
21819  */
21820 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);
21821
21822 /**
21823  * Creates a copy of the FundingCreated
21824  */
21825 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
21826
21827 /**
21828  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
21829  */
21830 void FundingSigned_free(struct LDKFundingSigned this_obj);
21831
21832 /**
21833  * The channel ID
21834  */
21835 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
21836
21837 /**
21838  * The channel ID
21839  */
21840 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21841
21842 /**
21843  * The signature of the channel acceptor (fundee) on the initial commitment transaction
21844  */
21845 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
21846
21847 /**
21848  * The signature of the channel acceptor (fundee) on the initial commitment transaction
21849  */
21850 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
21851
21852 /**
21853  * Constructs a new FundingSigned given each field
21854  */
21855 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
21856
21857 /**
21858  * Creates a copy of the FundingSigned
21859  */
21860 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
21861
21862 /**
21863  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
21864  */
21865 void ChannelReady_free(struct LDKChannelReady this_obj);
21866
21867 /**
21868  * The channel ID
21869  */
21870 const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
21871
21872 /**
21873  * The channel ID
21874  */
21875 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21876
21877 /**
21878  * The per-commitment point of the second commitment transaction
21879  */
21880 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
21881
21882 /**
21883  * The per-commitment point of the second commitment transaction
21884  */
21885 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21886
21887 /**
21888  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
21889  * to be forwarded over this SCID and forward them to this messages' recipient.
21890  */
21891 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
21892
21893 /**
21894  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
21895  * to be forwarded over this SCID and forward them to this messages' recipient.
21896  */
21897 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21898
21899 /**
21900  * Constructs a new ChannelReady given each field
21901  */
21902 MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg);
21903
21904 /**
21905  * Creates a copy of the ChannelReady
21906  */
21907 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
21908
21909 /**
21910  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
21911  */
21912 void Shutdown_free(struct LDKShutdown this_obj);
21913
21914 /**
21915  * The channel ID
21916  */
21917 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
21918
21919 /**
21920  * The channel ID
21921  */
21922 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21923
21924 /**
21925  * The destination of this peer's funds on closing.
21926  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
21927  */
21928 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
21929
21930 /**
21931  * The destination of this peer's funds on closing.
21932  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
21933  */
21934 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
21935
21936 /**
21937  * Constructs a new Shutdown given each field
21938  */
21939 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
21940
21941 /**
21942  * Creates a copy of the Shutdown
21943  */
21944 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
21945
21946 /**
21947  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
21948  */
21949 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
21950
21951 /**
21952  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
21953  * transaction.
21954  */
21955 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
21956
21957 /**
21958  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
21959  * transaction.
21960  */
21961 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
21962
21963 /**
21964  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
21965  * transaction.
21966  */
21967 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
21968
21969 /**
21970  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
21971  * transaction.
21972  */
21973 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
21974
21975 /**
21976  * Constructs a new ClosingSignedFeeRange given each field
21977  */
21978 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
21979
21980 /**
21981  * Creates a copy of the ClosingSignedFeeRange
21982  */
21983 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
21984
21985 /**
21986  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
21987  */
21988 void ClosingSigned_free(struct LDKClosingSigned this_obj);
21989
21990 /**
21991  * The channel ID
21992  */
21993 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
21994
21995 /**
21996  * The channel ID
21997  */
21998 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21999
22000 /**
22001  * The proposed total fee for the closing transaction
22002  */
22003 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
22004
22005 /**
22006  * The proposed total fee for the closing transaction
22007  */
22008 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
22009
22010 /**
22011  * A signature on the closing transaction
22012  */
22013 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
22014
22015 /**
22016  * A signature on the closing transaction
22017  */
22018 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
22019
22020 /**
22021  * The minimum and maximum fees which the sender is willing to accept, provided only by new
22022  * nodes.
22023  *
22024  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22025  */
22026 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
22027
22028 /**
22029  * The minimum and maximum fees which the sender is willing to accept, provided only by new
22030  * nodes.
22031  *
22032  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22033  */
22034 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
22035
22036 /**
22037  * Constructs a new ClosingSigned given each field
22038  */
22039 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);
22040
22041 /**
22042  * Creates a copy of the ClosingSigned
22043  */
22044 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
22045
22046 /**
22047  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
22048  */
22049 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
22050
22051 /**
22052  * The channel ID
22053  */
22054 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
22055
22056 /**
22057  * The channel ID
22058  */
22059 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22060
22061 /**
22062  * The HTLC ID
22063  */
22064 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
22065
22066 /**
22067  * The HTLC ID
22068  */
22069 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
22070
22071 /**
22072  * The HTLC value in milli-satoshi
22073  */
22074 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
22075
22076 /**
22077  * The HTLC value in milli-satoshi
22078  */
22079 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
22080
22081 /**
22082  * The payment hash, the pre-image of which controls HTLC redemption
22083  */
22084 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
22085
22086 /**
22087  * The payment hash, the pre-image of which controls HTLC redemption
22088  */
22089 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22090
22091 /**
22092  * The expiry height of the HTLC
22093  */
22094 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
22095
22096 /**
22097  * The expiry height of the HTLC
22098  */
22099 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
22100
22101 /**
22102  * Creates a copy of the UpdateAddHTLC
22103  */
22104 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
22105
22106 /**
22107  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
22108  */
22109 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
22110
22111 /**
22112  * The channel ID
22113  */
22114 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
22115
22116 /**
22117  * The channel ID
22118  */
22119 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22120
22121 /**
22122  * The HTLC ID
22123  */
22124 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
22125
22126 /**
22127  * The HTLC ID
22128  */
22129 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
22130
22131 /**
22132  * The pre-image of the payment hash, allowing HTLC redemption
22133  */
22134 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
22135
22136 /**
22137  * The pre-image of the payment hash, allowing HTLC redemption
22138  */
22139 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22140
22141 /**
22142  * Constructs a new UpdateFulfillHTLC given each field
22143  */
22144 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
22145
22146 /**
22147  * Creates a copy of the UpdateFulfillHTLC
22148  */
22149 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
22150
22151 /**
22152  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
22153  */
22154 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
22155
22156 /**
22157  * The channel ID
22158  */
22159 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
22160
22161 /**
22162  * The channel ID
22163  */
22164 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22165
22166 /**
22167  * The HTLC ID
22168  */
22169 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
22170
22171 /**
22172  * The HTLC ID
22173  */
22174 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
22175
22176 /**
22177  * Creates a copy of the UpdateFailHTLC
22178  */
22179 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
22180
22181 /**
22182  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
22183  */
22184 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
22185
22186 /**
22187  * The channel ID
22188  */
22189 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
22190
22191 /**
22192  * The channel ID
22193  */
22194 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22195
22196 /**
22197  * The HTLC ID
22198  */
22199 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
22200
22201 /**
22202  * The HTLC ID
22203  */
22204 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
22205
22206 /**
22207  * The failure code
22208  */
22209 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
22210
22211 /**
22212  * The failure code
22213  */
22214 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
22215
22216 /**
22217  * Creates a copy of the UpdateFailMalformedHTLC
22218  */
22219 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
22220
22221 /**
22222  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
22223  */
22224 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
22225
22226 /**
22227  * The channel ID
22228  */
22229 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
22230
22231 /**
22232  * The channel ID
22233  */
22234 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22235
22236 /**
22237  * A signature on the commitment transaction
22238  */
22239 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
22240
22241 /**
22242  * A signature on the commitment transaction
22243  */
22244 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
22245
22246 /**
22247  * Signatures on the HTLC transactions
22248  */
22249 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
22250
22251 /**
22252  * Constructs a new CommitmentSigned given each field
22253  */
22254 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
22255
22256 /**
22257  * Creates a copy of the CommitmentSigned
22258  */
22259 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
22260
22261 /**
22262  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
22263  */
22264 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
22265
22266 /**
22267  * The channel ID
22268  */
22269 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
22270
22271 /**
22272  * The channel ID
22273  */
22274 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22275
22276 /**
22277  * The secret corresponding to the per-commitment point
22278  */
22279 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
22280
22281 /**
22282  * The secret corresponding to the per-commitment point
22283  */
22284 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22285
22286 /**
22287  * The next sender-broadcast commitment transaction's per-commitment point
22288  */
22289 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
22290
22291 /**
22292  * The next sender-broadcast commitment transaction's per-commitment point
22293  */
22294 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22295
22296 /**
22297  * Constructs a new RevokeAndACK given each field
22298  */
22299 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);
22300
22301 /**
22302  * Creates a copy of the RevokeAndACK
22303  */
22304 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
22305
22306 /**
22307  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
22308  */
22309 void UpdateFee_free(struct LDKUpdateFee this_obj);
22310
22311 /**
22312  * The channel ID
22313  */
22314 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
22315
22316 /**
22317  * The channel ID
22318  */
22319 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22320
22321 /**
22322  * Fee rate per 1000-weight of the transaction
22323  */
22324 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
22325
22326 /**
22327  * Fee rate per 1000-weight of the transaction
22328  */
22329 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
22330
22331 /**
22332  * Constructs a new UpdateFee given each field
22333  */
22334 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
22335
22336 /**
22337  * Creates a copy of the UpdateFee
22338  */
22339 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
22340
22341 /**
22342  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
22343  */
22344 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
22345
22346 /**
22347  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
22348  * belonging to the recipient
22349  */
22350 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
22351
22352 /**
22353  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
22354  * belonging to the recipient
22355  */
22356 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22357
22358 /**
22359  * The sender's per-commitment point for their current commitment transaction
22360  */
22361 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
22362
22363 /**
22364  * The sender's per-commitment point for their current commitment transaction
22365  */
22366 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22367
22368 /**
22369  * Constructs a new DataLossProtect given each field
22370  */
22371 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
22372
22373 /**
22374  * Creates a copy of the DataLossProtect
22375  */
22376 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
22377
22378 /**
22379  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
22380  */
22381 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
22382
22383 /**
22384  * The channel ID
22385  */
22386 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
22387
22388 /**
22389  * The channel ID
22390  */
22391 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22392
22393 /**
22394  * The next commitment number for the sender
22395  */
22396 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
22397
22398 /**
22399  * The next commitment number for the sender
22400  */
22401 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
22402
22403 /**
22404  * The next commitment number for the recipient
22405  */
22406 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
22407
22408 /**
22409  * The next commitment number for the recipient
22410  */
22411 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
22412
22413 /**
22414  * Creates a copy of the ChannelReestablish
22415  */
22416 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
22417
22418 /**
22419  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
22420  */
22421 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
22422
22423 /**
22424  * The channel ID
22425  */
22426 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
22427
22428 /**
22429  * The channel ID
22430  */
22431 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22432
22433 /**
22434  * The short channel ID
22435  */
22436 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22437
22438 /**
22439  * The short channel ID
22440  */
22441 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
22442
22443 /**
22444  * A signature by the node key
22445  */
22446 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22447
22448 /**
22449  * A signature by the node key
22450  */
22451 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
22452
22453 /**
22454  * A signature by the funding key
22455  */
22456 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22457
22458 /**
22459  * A signature by the funding key
22460  */
22461 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
22462
22463 /**
22464  * Constructs a new AnnouncementSignatures given each field
22465  */
22466 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);
22467
22468 /**
22469  * Creates a copy of the AnnouncementSignatures
22470  */
22471 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
22472
22473 /**
22474  * Frees any resources used by the NetAddress
22475  */
22476 void NetAddress_free(struct LDKNetAddress this_ptr);
22477
22478 /**
22479  * Creates a copy of the NetAddress
22480  */
22481 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
22482
22483 /**
22484  * Utility method to constructs a new IPv4-variant NetAddress
22485  */
22486 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
22487
22488 /**
22489  * Utility method to constructs a new IPv6-variant NetAddress
22490  */
22491 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
22492
22493 /**
22494  * Utility method to constructs a new OnionV2-variant NetAddress
22495  */
22496 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
22497
22498 /**
22499  * Utility method to constructs a new OnionV3-variant NetAddress
22500  */
22501 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
22502
22503 /**
22504  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
22505  */
22506 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
22507
22508 /**
22509  * Read a NetAddress from a byte array, created by NetAddress_write
22510  */
22511 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
22512
22513 /**
22514  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
22515  */
22516 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
22517
22518 /**
22519  * The advertised features
22520  */
22521 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22522
22523 /**
22524  * The advertised features
22525  */
22526 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
22527
22528 /**
22529  * A strictly monotonic announcement counter, with gaps allowed
22530  */
22531 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22532
22533 /**
22534  * A strictly monotonic announcement counter, with gaps allowed
22535  */
22536 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
22537
22538 /**
22539  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
22540  * to this node).
22541  */
22542 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22543
22544 /**
22545  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
22546  * to this node).
22547  */
22548 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22549
22550 /**
22551  * An RGB color for UI purposes
22552  */
22553 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
22554
22555 /**
22556  * An RGB color for UI purposes
22557  */
22558 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
22559
22560 /**
22561  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
22562  * of uniqueness.
22563  */
22564 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
22565
22566 /**
22567  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
22568  * of uniqueness.
22569  */
22570 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22571
22572 /**
22573  * List of addresses on which this node is reachable
22574  */
22575 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
22576
22577 /**
22578  * Creates a copy of the UnsignedNodeAnnouncement
22579  */
22580 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
22581
22582 /**
22583  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
22584  */
22585 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
22586
22587 /**
22588  * The signature by the node key
22589  */
22590 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
22591
22592 /**
22593  * The signature by the node key
22594  */
22595 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22596
22597 /**
22598  * The actual content of the announcement
22599  */
22600 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
22601
22602 /**
22603  * The actual content of the announcement
22604  */
22605 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
22606
22607 /**
22608  * Constructs a new NodeAnnouncement given each field
22609  */
22610 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
22611
22612 /**
22613  * Creates a copy of the NodeAnnouncement
22614  */
22615 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
22616
22617 /**
22618  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
22619  */
22620 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
22621
22622 /**
22623  * The advertised channel features
22624  */
22625 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22626
22627 /**
22628  * The advertised channel features
22629  */
22630 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
22631
22632 /**
22633  * The genesis hash of the blockchain where the channel is to be opened
22634  */
22635 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
22636
22637 /**
22638  * The genesis hash of the blockchain where the channel is to be opened
22639  */
22640 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22641
22642 /**
22643  * The short channel ID
22644  */
22645 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22646
22647 /**
22648  * The short channel ID
22649  */
22650 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
22651
22652 /**
22653  * One of the two node_ids which are endpoints of this channel
22654  */
22655 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22656
22657 /**
22658  * One of the two node_ids which are endpoints of this channel
22659  */
22660 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22661
22662 /**
22663  * The other of the two node_ids which are endpoints of this channel
22664  */
22665 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22666
22667 /**
22668  * The other of the two node_ids which are endpoints of this channel
22669  */
22670 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22671
22672 /**
22673  * The funding key for the first node
22674  */
22675 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22676
22677 /**
22678  * The funding key for the first node
22679  */
22680 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22681
22682 /**
22683  * The funding key for the second node
22684  */
22685 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22686
22687 /**
22688  * The funding key for the second node
22689  */
22690 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22691
22692 /**
22693  * Creates a copy of the UnsignedChannelAnnouncement
22694  */
22695 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
22696
22697 /**
22698  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
22699  */
22700 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
22701
22702 /**
22703  * Authentication of the announcement by the first public node
22704  */
22705 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22706
22707 /**
22708  * Authentication of the announcement by the first public node
22709  */
22710 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22711
22712 /**
22713  * Authentication of the announcement by the second public node
22714  */
22715 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22716
22717 /**
22718  * Authentication of the announcement by the second public node
22719  */
22720 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22721
22722 /**
22723  * Proof of funding UTXO ownership by the first public node
22724  */
22725 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22726
22727 /**
22728  * Proof of funding UTXO ownership by the first public node
22729  */
22730 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22731
22732 /**
22733  * Proof of funding UTXO ownership by the second public node
22734  */
22735 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22736
22737 /**
22738  * Proof of funding UTXO ownership by the second public node
22739  */
22740 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22741
22742 /**
22743  * The actual announcement
22744  */
22745 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22746
22747 /**
22748  * The actual announcement
22749  */
22750 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
22751
22752 /**
22753  * Constructs a new ChannelAnnouncement given each field
22754  */
22755 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);
22756
22757 /**
22758  * Creates a copy of the ChannelAnnouncement
22759  */
22760 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
22761
22762 /**
22763  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
22764  */
22765 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
22766
22767 /**
22768  * The genesis hash of the blockchain where the channel is to be opened
22769  */
22770 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
22771
22772 /**
22773  * The genesis hash of the blockchain where the channel is to be opened
22774  */
22775 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22776
22777 /**
22778  * The short channel ID
22779  */
22780 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22781
22782 /**
22783  * The short channel ID
22784  */
22785 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
22786
22787 /**
22788  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
22789  */
22790 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22791
22792 /**
22793  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
22794  */
22795 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
22796
22797 /**
22798  * Channel flags
22799  */
22800 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22801
22802 /**
22803  * Channel flags
22804  */
22805 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
22806
22807 /**
22808  * The number of blocks such that if:
22809  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
22810  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
22811  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
22812  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
22813  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
22814  * forwarding. Note that the HTLC sender is the one who originally sets this value when
22815  * constructing the route.
22816  */
22817 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22818
22819 /**
22820  * The number of blocks such that if:
22821  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
22822  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
22823  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
22824  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
22825  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
22826  * forwarding. Note that the HTLC sender is the one who originally sets this value when
22827  * constructing the route.
22828  */
22829 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
22830
22831 /**
22832  * The minimum HTLC size incoming to sender, in milli-satoshi
22833  */
22834 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22835
22836 /**
22837  * The minimum HTLC size incoming to sender, in milli-satoshi
22838  */
22839 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
22840
22841 /**
22842  * The base HTLC fee charged by sender, in milli-satoshi
22843  */
22844 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22845
22846 /**
22847  * The base HTLC fee charged by sender, in milli-satoshi
22848  */
22849 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
22850
22851 /**
22852  * The amount to fee multiplier, in micro-satoshi
22853  */
22854 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22855
22856 /**
22857  * The amount to fee multiplier, in micro-satoshi
22858  */
22859 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
22860
22861 /**
22862  * Excess data which was signed as a part of the message which we do not (yet) understand how
22863  * to decode. This is stored to ensure forward-compatibility as new fields are added to the
22864  * lightning gossip
22865  */
22866 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
22867
22868 /**
22869  * Creates a copy of the UnsignedChannelUpdate
22870  */
22871 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
22872
22873 /**
22874  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
22875  */
22876 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
22877
22878 /**
22879  * A signature of the channel update
22880  */
22881 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
22882
22883 /**
22884  * A signature of the channel update
22885  */
22886 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
22887
22888 /**
22889  * The actual channel update
22890  */
22891 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
22892
22893 /**
22894  * The actual channel update
22895  */
22896 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
22897
22898 /**
22899  * Constructs a new ChannelUpdate given each field
22900  */
22901 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
22902
22903 /**
22904  * Creates a copy of the ChannelUpdate
22905  */
22906 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
22907
22908 /**
22909  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
22910  */
22911 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
22912
22913 /**
22914  * The genesis hash of the blockchain being queried
22915  */
22916 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
22917
22918 /**
22919  * The genesis hash of the blockchain being queried
22920  */
22921 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22922
22923 /**
22924  * The height of the first block for the channel UTXOs being queried
22925  */
22926 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
22927
22928 /**
22929  * The height of the first block for the channel UTXOs being queried
22930  */
22931 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22932
22933 /**
22934  * The number of blocks to include in the query results
22935  */
22936 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
22937
22938 /**
22939  * The number of blocks to include in the query results
22940  */
22941 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22942
22943 /**
22944  * Constructs a new QueryChannelRange given each field
22945  */
22946 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
22947
22948 /**
22949  * Creates a copy of the QueryChannelRange
22950  */
22951 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
22952
22953 /**
22954  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
22955  */
22956 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
22957
22958 /**
22959  * The genesis hash of the blockchain being queried
22960  */
22961 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
22962
22963 /**
22964  * The genesis hash of the blockchain being queried
22965  */
22966 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22967
22968 /**
22969  * The height of the first block in the range of the reply
22970  */
22971 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22972
22973 /**
22974  * The height of the first block in the range of the reply
22975  */
22976 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22977
22978 /**
22979  * The number of blocks included in the range of the reply
22980  */
22981 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22982
22983 /**
22984  * The number of blocks included in the range of the reply
22985  */
22986 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22987
22988 /**
22989  * True when this is the final reply for a query
22990  */
22991 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22992
22993 /**
22994  * True when this is the final reply for a query
22995  */
22996 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
22997
22998 /**
22999  * The short_channel_ids in the channel range
23000  */
23001 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
23002
23003 /**
23004  * Constructs a new ReplyChannelRange given each field
23005  */
23006 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);
23007
23008 /**
23009  * Creates a copy of the ReplyChannelRange
23010  */
23011 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
23012
23013 /**
23014  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
23015  */
23016 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
23017
23018 /**
23019  * The genesis hash of the blockchain being queried
23020  */
23021 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
23022
23023 /**
23024  * The genesis hash of the blockchain being queried
23025  */
23026 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23027
23028 /**
23029  * The short_channel_ids that are being queried
23030  */
23031 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
23032
23033 /**
23034  * Constructs a new QueryShortChannelIds given each field
23035  */
23036 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
23037
23038 /**
23039  * Creates a copy of the QueryShortChannelIds
23040  */
23041 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
23042
23043 /**
23044  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
23045  */
23046 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
23047
23048 /**
23049  * The genesis hash of the blockchain that was queried
23050  */
23051 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
23052
23053 /**
23054  * The genesis hash of the blockchain that was queried
23055  */
23056 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23057
23058 /**
23059  * Indicates if the query recipient maintains up-to-date channel
23060  * information for the chain_hash
23061  */
23062 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
23063
23064 /**
23065  * Indicates if the query recipient maintains up-to-date channel
23066  * information for the chain_hash
23067  */
23068 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
23069
23070 /**
23071  * Constructs a new ReplyShortChannelIdsEnd given each field
23072  */
23073 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
23074
23075 /**
23076  * Creates a copy of the ReplyShortChannelIdsEnd
23077  */
23078 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
23079
23080 /**
23081  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
23082  */
23083 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
23084
23085 /**
23086  * The genesis hash of the blockchain for channel and node information
23087  */
23088 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
23089
23090 /**
23091  * The genesis hash of the blockchain for channel and node information
23092  */
23093 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23094
23095 /**
23096  * The starting unix timestamp
23097  */
23098 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
23099
23100 /**
23101  * The starting unix timestamp
23102  */
23103 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
23104
23105 /**
23106  * The range of information in seconds
23107  */
23108 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
23109
23110 /**
23111  * The range of information in seconds
23112  */
23113 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
23114
23115 /**
23116  * Constructs a new GossipTimestampFilter given each field
23117  */
23118 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
23119
23120 /**
23121  * Creates a copy of the GossipTimestampFilter
23122  */
23123 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
23124
23125 /**
23126  * Frees any resources used by the ErrorAction
23127  */
23128 void ErrorAction_free(struct LDKErrorAction this_ptr);
23129
23130 /**
23131  * Creates a copy of the ErrorAction
23132  */
23133 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
23134
23135 /**
23136  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
23137  */
23138 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
23139
23140 /**
23141  * Utility method to constructs a new IgnoreError-variant ErrorAction
23142  */
23143 struct LDKErrorAction ErrorAction_ignore_error(void);
23144
23145 /**
23146  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
23147  */
23148 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
23149
23150 /**
23151  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
23152  */
23153 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
23154
23155 /**
23156  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
23157  */
23158 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
23159
23160 /**
23161  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
23162  */
23163 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
23164
23165 /**
23166  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
23167  */
23168 void LightningError_free(struct LDKLightningError this_obj);
23169
23170 /**
23171  * A human-readable message describing the error
23172  */
23173 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
23174
23175 /**
23176  * A human-readable message describing the error
23177  */
23178 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
23179
23180 /**
23181  * The action which should be taken against the offending peer.
23182  */
23183 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
23184
23185 /**
23186  * The action which should be taken against the offending peer.
23187  */
23188 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
23189
23190 /**
23191  * Constructs a new LightningError given each field
23192  */
23193 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
23194
23195 /**
23196  * Creates a copy of the LightningError
23197  */
23198 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
23199
23200 /**
23201  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
23202  */
23203 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
23204
23205 /**
23206  * update_add_htlc messages which should be sent
23207  */
23208 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23209
23210 /**
23211  * update_add_htlc messages which should be sent
23212  */
23213 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
23214
23215 /**
23216  * update_fulfill_htlc messages which should be sent
23217  */
23218 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23219
23220 /**
23221  * update_fulfill_htlc messages which should be sent
23222  */
23223 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
23224
23225 /**
23226  * update_fail_htlc messages which should be sent
23227  */
23228 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23229
23230 /**
23231  * update_fail_htlc messages which should be sent
23232  */
23233 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
23234
23235 /**
23236  * update_fail_malformed_htlc messages which should be sent
23237  */
23238 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23239
23240 /**
23241  * update_fail_malformed_htlc messages which should be sent
23242  */
23243 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
23244
23245 /**
23246  * An update_fee message which should be sent
23247  *
23248  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23249  */
23250 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23251
23252 /**
23253  * An update_fee message which should be sent
23254  *
23255  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23256  */
23257 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
23258
23259 /**
23260  * Finally, the commitment_signed message which should be sent
23261  */
23262 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23263
23264 /**
23265  * Finally, the commitment_signed message which should be sent
23266  */
23267 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
23268
23269 /**
23270  * Constructs a new CommitmentUpdate given each field
23271  */
23272 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);
23273
23274 /**
23275  * Creates a copy of the CommitmentUpdate
23276  */
23277 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
23278
23279 /**
23280  * Calls the free function if one is set
23281  */
23282 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
23283
23284 /**
23285  * Calls the free function if one is set
23286  */
23287 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
23288
23289 /**
23290  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
23291  */
23292 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
23293
23294 /**
23295  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
23296  */
23297 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
23298
23299 /**
23300  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
23301  */
23302 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
23303
23304 /**
23305  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
23306  */
23307 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
23308
23309 /**
23310  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
23311  */
23312 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
23313
23314 /**
23315  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
23316  */
23317 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
23318
23319 /**
23320  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
23321  */
23322 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
23323
23324 /**
23325  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
23326  */
23327 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
23328
23329 /**
23330  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
23331  */
23332 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
23333
23334 /**
23335  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
23336  */
23337 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
23338
23339 /**
23340  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
23341  */
23342 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
23343
23344 /**
23345  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
23346  */
23347 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
23348
23349 /**
23350  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
23351  */
23352 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
23353
23354 /**
23355  * Read a FundingCreated from a byte array, created by FundingCreated_write
23356  */
23357 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
23358
23359 /**
23360  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
23361  */
23362 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
23363
23364 /**
23365  * Read a FundingSigned from a byte array, created by FundingSigned_write
23366  */
23367 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
23368
23369 /**
23370  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
23371  */
23372 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
23373
23374 /**
23375  * Read a ChannelReady from a byte array, created by ChannelReady_write
23376  */
23377 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
23378
23379 /**
23380  * Serialize the Init object into a byte array which can be read by Init_read
23381  */
23382 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
23383
23384 /**
23385  * Read a Init from a byte array, created by Init_write
23386  */
23387 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
23388
23389 /**
23390  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
23391  */
23392 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
23393
23394 /**
23395  * Read a OpenChannel from a byte array, created by OpenChannel_write
23396  */
23397 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
23398
23399 /**
23400  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
23401  */
23402 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
23403
23404 /**
23405  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
23406  */
23407 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
23408
23409 /**
23410  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
23411  */
23412 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
23413
23414 /**
23415  * Read a Shutdown from a byte array, created by Shutdown_write
23416  */
23417 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
23418
23419 /**
23420  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
23421  */
23422 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
23423
23424 /**
23425  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
23426  */
23427 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
23428
23429 /**
23430  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
23431  */
23432 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
23433
23434 /**
23435  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
23436  */
23437 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
23438
23439 /**
23440  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
23441  */
23442 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
23443
23444 /**
23445  * Read a UpdateFee from a byte array, created by UpdateFee_write
23446  */
23447 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
23448
23449 /**
23450  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
23451  */
23452 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
23453
23454 /**
23455  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
23456  */
23457 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
23458
23459 /**
23460  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
23461  */
23462 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
23463
23464 /**
23465  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
23466  */
23467 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
23468
23469 /**
23470  * Serialize the Ping object into a byte array which can be read by Ping_read
23471  */
23472 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
23473
23474 /**
23475  * Read a Ping from a byte array, created by Ping_write
23476  */
23477 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
23478
23479 /**
23480  * Serialize the Pong object into a byte array which can be read by Pong_read
23481  */
23482 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
23483
23484 /**
23485  * Read a Pong from a byte array, created by Pong_write
23486  */
23487 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
23488
23489 /**
23490  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
23491  */
23492 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
23493
23494 /**
23495  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
23496  */
23497 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
23498
23499 /**
23500  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
23501  */
23502 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
23503
23504 /**
23505  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
23506  */
23507 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
23508
23509 /**
23510  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
23511  */
23512 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
23513
23514 /**
23515  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
23516  */
23517 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
23518
23519 /**
23520  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
23521  */
23522 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
23523
23524 /**
23525  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
23526  */
23527 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
23528
23529 /**
23530  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
23531  */
23532 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
23533
23534 /**
23535  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
23536  */
23537 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
23538
23539 /**
23540  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
23541  */
23542 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
23543
23544 /**
23545  * Read a WarningMessage from a byte array, created by WarningMessage_write
23546  */
23547 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
23548
23549 /**
23550  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
23551  */
23552 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
23553
23554 /**
23555  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
23556  */
23557 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
23558
23559 /**
23560  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
23561  */
23562 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
23563
23564 /**
23565  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
23566  */
23567 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
23568
23569 /**
23570  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
23571  */
23572 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
23573
23574 /**
23575  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
23576  */
23577 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
23578
23579 /**
23580  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
23581  */
23582 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
23583
23584 /**
23585  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
23586  */
23587 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
23588
23589 /**
23590  *\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
23591  */
23592 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
23593
23594 /**
23595  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
23596  */
23597 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
23598
23599 /**
23600  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
23601  */
23602 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
23603
23604 /**
23605  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
23606  */
23607 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
23608
23609 /**
23610  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
23611  */
23612 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
23613
23614 /**
23615  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
23616  */
23617 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
23618
23619 /**
23620  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
23621  */
23622 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
23623
23624 /**
23625  * Calls the free function if one is set
23626  */
23627 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
23628
23629 /**
23630  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
23631  */
23632 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
23633
23634 /**
23635  * Constructs a new IgnoringMessageHandler given each field
23636  */
23637 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
23638
23639 /**
23640  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
23641  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
23642  */
23643 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23644
23645 /**
23646  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
23647  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
23648  */
23649 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23650
23651 /**
23652  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
23653  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
23654  */
23655 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23656
23657 /**
23658  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
23659  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
23660  */
23661 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23662
23663 /**
23664  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
23665  */
23666 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
23667
23668 /**
23669  * Constructs a new ErroringMessageHandler
23670  */
23671 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
23672
23673 /**
23674  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
23675  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
23676  */
23677 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
23678
23679 /**
23680  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
23681  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
23682  */
23683 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
23684
23685 /**
23686  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
23687  */
23688 void MessageHandler_free(struct LDKMessageHandler this_obj);
23689
23690 /**
23691  * A message handler which handles messages specific to channels. Usually this is just a
23692  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
23693  *
23694  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23695  */
23696 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
23697
23698 /**
23699  * A message handler which handles messages specific to channels. Usually this is just a
23700  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
23701  *
23702  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23703  */
23704 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
23705
23706 /**
23707  * A message handler which handles messages updating our knowledge of the network channel
23708  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
23709  *
23710  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
23711  */
23712 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
23713
23714 /**
23715  * A message handler which handles messages updating our knowledge of the network channel
23716  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
23717  *
23718  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
23719  */
23720 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
23721
23722 /**
23723  * Constructs a new MessageHandler given each field
23724  */
23725 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
23726
23727 /**
23728  * Creates a copy of a SocketDescriptor
23729  */
23730 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
23731
23732 /**
23733  * Calls the free function if one is set
23734  */
23735 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
23736
23737 /**
23738  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
23739  */
23740 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
23741
23742 /**
23743  * Used to indicate that we probably can't make any future connections to this peer (e.g.
23744  * because we required features that our peer was missing, or vice versa).
23745  *
23746  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
23747  * any channels with this peer or check for new versions of LDK.
23748  *
23749  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23750  */
23751 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
23752
23753 /**
23754  * Used to indicate that we probably can't make any future connections to this peer (e.g.
23755  * because we required features that our peer was missing, or vice versa).
23756  *
23757  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
23758  * any channels with this peer or check for new versions of LDK.
23759  *
23760  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23761  */
23762 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
23763
23764 /**
23765  * Constructs a new PeerHandleError given each field
23766  */
23767 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
23768
23769 /**
23770  * Creates a copy of the PeerHandleError
23771  */
23772 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
23773
23774 /**
23775  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
23776  */
23777 void PeerManager_free(struct LDKPeerManager this_obj);
23778
23779 /**
23780  * Constructs a new PeerManager with the given message handlers and node_id secret key
23781  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
23782  * cryptographically secure random bytes.
23783  */
23784 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);
23785
23786 /**
23787  * Get the list of node ids for peers which have completed the initial handshake.
23788  *
23789  * For outbound connections, this will be the same as the their_node_id parameter passed in to
23790  * new_outbound_connection, however entries will only appear once the initial handshake has
23791  * completed and we are sure the remote peer has the private key for the given node_id.
23792  */
23793 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
23794
23795 /**
23796  * Indicates a new outbound connection has been established to a node with the given node_id
23797  * and an optional remote network address.
23798  *
23799  * The remote network address adds the option to report a remote IP address back to a connecting
23800  * peer using the init message.
23801  * The user should pass the remote network address of the host they are connected to.
23802  *
23803  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
23804  * descriptor but must disconnect the connection immediately.
23805  *
23806  * Returns a small number of bytes to send to the remote node (currently always 50).
23807  *
23808  * Panics if descriptor is duplicative with some other descriptor which has not yet been
23809  * [`socket_disconnected()`].
23810  *
23811  * [`socket_disconnected()`]: PeerManager::socket_disconnected
23812  */
23813 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);
23814
23815 /**
23816  * Indicates a new inbound connection has been established to a node with an optional remote
23817  * network address.
23818  *
23819  * The remote network address adds the option to report a remote IP address back to a connecting
23820  * peer using the init message.
23821  * The user should pass the remote network address of the host they are connected to.
23822  *
23823  * May refuse the connection by returning an Err, but will never write bytes to the remote end
23824  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
23825  * call socket_disconnected for the new descriptor but must disconnect the connection
23826  * immediately.
23827  *
23828  * Panics if descriptor is duplicative with some other descriptor which has not yet been
23829  * [`socket_disconnected()`].
23830  *
23831  * [`socket_disconnected()`]: PeerManager::socket_disconnected
23832  */
23833 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);
23834
23835 /**
23836  * Indicates that there is room to write data to the given socket descriptor.
23837  *
23838  * May return an Err to indicate that the connection should be closed.
23839  *
23840  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
23841  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
23842  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
23843  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
23844  * sufficient!
23845  *
23846  * [`send_data`]: SocketDescriptor::send_data
23847  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
23848  */
23849 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
23850
23851 /**
23852  * Indicates that data was read from the given socket descriptor.
23853  *
23854  * May return an Err to indicate that the connection should be closed.
23855  *
23856  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
23857  * Thus, however, you should call [`process_events`] after any `read_event` to generate
23858  * [`send_data`] calls to handle responses.
23859  *
23860  * If `Ok(true)` is returned, further read_events should not be triggered until a
23861  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
23862  * send buffer).
23863  *
23864  * [`send_data`]: SocketDescriptor::send_data
23865  * [`process_events`]: PeerManager::process_events
23866  */
23867 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);
23868
23869 /**
23870  * Checks for any events generated by our handlers and processes them. Includes sending most
23871  * response messages as well as messages generated by calls to handler functions directly (eg
23872  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
23873  *
23874  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
23875  * issues!
23876  *
23877  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
23878  * or one of the other clients provided in our language bindings.
23879  *
23880  * Note that if there are any other calls to this function waiting on lock(s) this may return
23881  * without doing any work. All available events that need handling will be handled before the
23882  * other calls return.
23883  *
23884  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
23885  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
23886  * [`send_data`]: SocketDescriptor::send_data
23887  */
23888 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
23889
23890 /**
23891  * Indicates that the given socket descriptor's connection is now closed.
23892  */
23893 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
23894
23895 /**
23896  * Disconnect a peer given its node id.
23897  *
23898  * Set `no_connection_possible` to true to prevent any further connection with this peer,
23899  * force-closing any channels we have with it.
23900  *
23901  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
23902  * peer. Thus, be very careful about reentrancy issues.
23903  *
23904  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
23905  */
23906 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
23907
23908 /**
23909  * Disconnects all currently-connected peers. This is useful on platforms where there may be
23910  * an indication that TCP sockets have stalled even if we weren't around to time them out
23911  * using regular ping/pongs.
23912  */
23913 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
23914
23915 /**
23916  * Send pings to each peer and disconnect those which did not respond to the last round of
23917  * pings.
23918  *
23919  * This may be called on any timescale you want, however, roughly once every ten seconds is
23920  * preferred. The call rate determines both how often we send a ping to our peers and how much
23921  * time they have to respond before we disconnect them.
23922  *
23923  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
23924  * issues!
23925  *
23926  * [`send_data`]: SocketDescriptor::send_data
23927  */
23928 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
23929
23930 /**
23931  * Gets the weight for an HTLC-Success transaction.
23932  */
23933 uint64_t htlc_success_tx_weight(bool opt_anchors);
23934
23935 /**
23936  * Gets the weight for an HTLC-Timeout transaction.
23937  */
23938 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
23939
23940 /**
23941  * Build the commitment secret from the seed and the commitment number
23942  */
23943 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
23944
23945 /**
23946  * Build a closing transaction
23947  */
23948 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);
23949
23950 /**
23951  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
23952  */
23953 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
23954
23955 /**
23956  * Creates a copy of the CounterpartyCommitmentSecrets
23957  */
23958 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
23959
23960 /**
23961  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
23962  */
23963 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
23964
23965 /**
23966  * Returns the minimum index of all stored secrets. Note that indexes start
23967  * at 1 << 48 and get decremented by one for each new secret.
23968  */
23969 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
23970
23971 /**
23972  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
23973  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
23974  */
23975 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
23976
23977 /**
23978  * Returns the secret at `idx`.
23979  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
23980  *
23981  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23982  */
23983 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
23984
23985 /**
23986  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
23987  */
23988 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
23989
23990 /**
23991  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
23992  */
23993 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
23994
23995 /**
23996  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
23997  * from the base secret and the per_commitment_point.
23998  *
23999  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
24000  * generated (ie our own).
24001  */
24002 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
24003
24004 /**
24005  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
24006  * from the base point and the per_commitment_key. This is the public equivalent of
24007  * derive_private_key - using only public keys to derive a public key instead of private keys.
24008  *
24009  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
24010  * generated (ie our own).
24011  */
24012 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
24013
24014 /**
24015  * Derives a per-commitment-transaction revocation key from its constituent parts.
24016  *
24017  * Only the cheating participant owns a valid witness to propagate a revoked
24018  * commitment transaction, thus per_commitment_secret always come from cheater
24019  * and revocation_base_secret always come from punisher, which is the broadcaster
24020  * of the transaction spending with this key knowledge.
24021  *
24022  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
24023  * generated (ie our own).
24024  */
24025 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
24026
24027 /**
24028  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
24029  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
24030  * public key instead of private keys.
24031  *
24032  * Only the cheating participant owns a valid witness to propagate a revoked
24033  * commitment transaction, thus per_commitment_point always come from cheater
24034  * and revocation_base_point always come from punisher, which is the broadcaster
24035  * of the transaction spending with this key knowledge.
24036  *
24037  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
24038  * generated (ie our own).
24039  */
24040 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
24041
24042 /**
24043  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
24044  */
24045 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
24046
24047 /**
24048  * The broadcaster's per-commitment public key which was used to derive the other keys.
24049  */
24050 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
24051
24052 /**
24053  * The broadcaster's per-commitment public key which was used to derive the other keys.
24054  */
24055 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24056
24057 /**
24058  * The revocation key which is used to allow the broadcaster of the commitment
24059  * transaction to provide their counterparty the ability to punish them if they broadcast
24060  * an old state.
24061  */
24062 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
24063
24064 /**
24065  * The revocation key which is used to allow the broadcaster of the commitment
24066  * transaction to provide their counterparty the ability to punish them if they broadcast
24067  * an old state.
24068  */
24069 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24070
24071 /**
24072  * Broadcaster's HTLC Key
24073  */
24074 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
24075
24076 /**
24077  * Broadcaster's HTLC Key
24078  */
24079 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24080
24081 /**
24082  * Countersignatory's HTLC Key
24083  */
24084 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
24085
24086 /**
24087  * Countersignatory's HTLC Key
24088  */
24089 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24090
24091 /**
24092  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
24093  */
24094 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
24095
24096 /**
24097  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
24098  */
24099 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24100
24101 /**
24102  * Constructs a new TxCreationKeys given each field
24103  */
24104 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);
24105
24106 /**
24107  * Creates a copy of the TxCreationKeys
24108  */
24109 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
24110
24111 /**
24112  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
24113  */
24114 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
24115
24116 /**
24117  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
24118  */
24119 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
24120
24121 /**
24122  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
24123  */
24124 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
24125
24126 /**
24127  * The public key which is used to sign all commitment transactions, as it appears in the
24128  * on-chain channel lock-in 2-of-2 multisig output.
24129  */
24130 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
24131
24132 /**
24133  * The public key which is used to sign all commitment transactions, as it appears in the
24134  * on-chain channel lock-in 2-of-2 multisig output.
24135  */
24136 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24137
24138 /**
24139  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
24140  * revocation keys. This is combined with the per-commitment-secret generated by the
24141  * counterparty to create a secret which the counterparty can reveal to revoke previous
24142  * states.
24143  */
24144 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
24145
24146 /**
24147  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
24148  * revocation keys. This is combined with the per-commitment-secret generated by the
24149  * counterparty to create a secret which the counterparty can reveal to revoke previous
24150  * states.
24151  */
24152 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24153
24154 /**
24155  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
24156  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
24157  * static across every commitment transaction.
24158  */
24159 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
24160
24161 /**
24162  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
24163  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
24164  * static across every commitment transaction.
24165  */
24166 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24167
24168 /**
24169  * The base point which is used (with derive_public_key) to derive a per-commitment payment
24170  * public key which receives non-HTLC-encumbered funds which are only available for spending
24171  * after some delay (or can be claimed via the revocation path).
24172  */
24173 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
24174
24175 /**
24176  * The base point which is used (with derive_public_key) to derive a per-commitment payment
24177  * public key which receives non-HTLC-encumbered funds which are only available for spending
24178  * after some delay (or can be claimed via the revocation path).
24179  */
24180 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24181
24182 /**
24183  * The base point which is used (with derive_public_key) to derive a per-commitment public key
24184  * which is used to encumber HTLC-in-flight outputs.
24185  */
24186 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
24187
24188 /**
24189  * The base point which is used (with derive_public_key) to derive a per-commitment public key
24190  * which is used to encumber HTLC-in-flight outputs.
24191  */
24192 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24193
24194 /**
24195  * Constructs a new ChannelPublicKeys given each field
24196  */
24197 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);
24198
24199 /**
24200  * Creates a copy of the ChannelPublicKeys
24201  */
24202 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
24203
24204 /**
24205  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
24206  */
24207 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
24208
24209 /**
24210  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
24211  */
24212 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
24213
24214 /**
24215  * Create per-state keys from channel base points and the per-commitment point.
24216  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
24217  */
24218 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);
24219
24220 /**
24221  * Generate per-state keys from channel static keys.
24222  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
24223  */
24224 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);
24225
24226 /**
24227  * A script either spendable by the revocation
24228  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
24229  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
24230  */
24231 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
24232
24233 /**
24234  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
24235  */
24236 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
24237
24238 /**
24239  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
24240  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
24241  * need to compare this value to whether the commitment transaction in question is that of
24242  * the counterparty or our own.
24243  */
24244 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24245
24246 /**
24247  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
24248  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
24249  * need to compare this value to whether the commitment transaction in question is that of
24250  * the counterparty or our own.
24251  */
24252 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
24253
24254 /**
24255  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
24256  * this divided by 1000.
24257  */
24258 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24259
24260 /**
24261  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
24262  * this divided by 1000.
24263  */
24264 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
24265
24266 /**
24267  * The CLTV lock-time at which this HTLC expires.
24268  */
24269 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24270
24271 /**
24272  * The CLTV lock-time at which this HTLC expires.
24273  */
24274 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
24275
24276 /**
24277  * The hash of the preimage which unlocks this HTLC.
24278  */
24279 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
24280
24281 /**
24282  * The hash of the preimage which unlocks this HTLC.
24283  */
24284 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24285
24286 /**
24287  * The position within the commitment transactions' outputs. This may be None if the value is
24288  * below the dust limit (in which case no output appears in the commitment transaction and the
24289  * value is spent to additional transaction fees).
24290  */
24291 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24292
24293 /**
24294  * The position within the commitment transactions' outputs. This may be None if the value is
24295  * below the dust limit (in which case no output appears in the commitment transaction and the
24296  * value is spent to additional transaction fees).
24297  */
24298 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
24299
24300 /**
24301  * Constructs a new HTLCOutputInCommitment given each field
24302  */
24303 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);
24304
24305 /**
24306  * Creates a copy of the HTLCOutputInCommitment
24307  */
24308 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
24309
24310 /**
24311  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
24312  */
24313 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
24314
24315 /**
24316  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
24317  */
24318 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
24319
24320 /**
24321  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
24322  * does not need to have its previous_output_index filled.
24323  */
24324 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
24325
24326 /**
24327  * Gets the redeemscript for a funding output from the two funding public keys.
24328  * Note that the order of funding public keys does not matter.
24329  */
24330 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
24331
24332 /**
24333  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
24334  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
24335  * transaction which needs signing, and can be used to construct an HTLC transaction which is
24336  * broadcastable given a counterparty HTLC signature.
24337  *
24338  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
24339  * commitment transaction).
24340  */
24341 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);
24342
24343 /**
24344  * Gets the witnessScript for an anchor output from the funding public key.
24345  * The witness in the spending input must be:
24346  * <BIP 143 funding_signature>
24347  * After 16 blocks of confirmation, an alternative satisfying witness could be:
24348  * <>
24349  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
24350  */
24351 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
24352
24353 /**
24354  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24355  */
24356 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
24357
24358 /**
24359  * Holder public keys
24360  */
24361 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24362
24363 /**
24364  * Holder public keys
24365  */
24366 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
24367
24368 /**
24369  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
24370  */
24371 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24372
24373 /**
24374  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
24375  */
24376 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
24377
24378 /**
24379  * Whether the holder is the initiator of this channel.
24380  * This is an input to the commitment number obscure factor computation.
24381  */
24382 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24383
24384 /**
24385  * Whether the holder is the initiator of this channel.
24386  * This is an input to the commitment number obscure factor computation.
24387  */
24388 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
24389
24390 /**
24391  * The late-bound counterparty channel transaction parameters.
24392  * These parameters are populated at the point in the protocol where the counterparty provides them.
24393  *
24394  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24395  */
24396 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24397
24398 /**
24399  * The late-bound counterparty channel transaction parameters.
24400  * These parameters are populated at the point in the protocol where the counterparty provides them.
24401  *
24402  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24403  */
24404 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
24405
24406 /**
24407  * The late-bound funding outpoint
24408  *
24409  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24410  */
24411 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24412
24413 /**
24414  * The late-bound funding outpoint
24415  *
24416  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24417  */
24418 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
24419
24420 /**
24421  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
24422  */
24423 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24424
24425 /**
24426  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
24427  */
24428 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
24429
24430 /**
24431  * Constructs a new ChannelTransactionParameters given each field
24432  */
24433 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);
24434
24435 /**
24436  * Creates a copy of the ChannelTransactionParameters
24437  */
24438 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
24439
24440 /**
24441  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24442  */
24443 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
24444
24445 /**
24446  * Counter-party public keys
24447  */
24448 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
24449
24450 /**
24451  * Counter-party public keys
24452  */
24453 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
24454
24455 /**
24456  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
24457  */
24458 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
24459
24460 /**
24461  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
24462  */
24463 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
24464
24465 /**
24466  * Constructs a new CounterpartyChannelTransactionParameters given each field
24467  */
24468 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
24469
24470 /**
24471  * Creates a copy of the CounterpartyChannelTransactionParameters
24472  */
24473 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
24474
24475 /**
24476  * Whether the late bound parameters are populated.
24477  */
24478 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24479
24480 /**
24481  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
24482  * given that the holder is the broadcaster.
24483  *
24484  * self.is_populated() must be true before calling this function.
24485  */
24486 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24487
24488 /**
24489  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
24490  * given that the counterparty is the broadcaster.
24491  *
24492  * self.is_populated() must be true before calling this function.
24493  */
24494 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24495
24496 /**
24497  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
24498  */
24499 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
24500
24501 /**
24502  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
24503  */
24504 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
24505
24506 /**
24507  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
24508  */
24509 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
24510
24511 /**
24512  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
24513  */
24514 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
24515
24516 /**
24517  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24518  */
24519 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
24520
24521 /**
24522  * Get the channel pubkeys for the broadcaster
24523  */
24524 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24525
24526 /**
24527  * Get the channel pubkeys for the countersignatory
24528  */
24529 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24530
24531 /**
24532  * Get the contest delay applicable to the transactions.
24533  * Note that the contest delay was selected by the countersignatory.
24534  */
24535 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24536
24537 /**
24538  * Whether the channel is outbound from the broadcaster.
24539  *
24540  * The boolean representing the side that initiated the channel is
24541  * an input to the commitment number obscure factor computation.
24542  */
24543 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24544
24545 /**
24546  * The funding outpoint
24547  */
24548 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24549
24550 /**
24551  * Whether to use anchors for this channel
24552  */
24553 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24554
24555 /**
24556  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
24557  */
24558 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
24559
24560 /**
24561  * Our counterparty's signature for the transaction
24562  */
24563 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
24564
24565 /**
24566  * Our counterparty's signature for the transaction
24567  */
24568 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
24569
24570 /**
24571  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
24572  */
24573 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
24574
24575 /**
24576  * Creates a copy of the HolderCommitmentTransaction
24577  */
24578 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
24579
24580 /**
24581  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
24582  */
24583 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
24584
24585 /**
24586  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
24587  */
24588 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
24589
24590 /**
24591  * Create a new holder transaction with the given counterparty signatures.
24592  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
24593  */
24594 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);
24595
24596 /**
24597  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
24598  */
24599 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
24600
24601 /**
24602  * The commitment transaction
24603  */
24604 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
24605
24606 /**
24607  * The commitment transaction
24608  */
24609 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
24610
24611 /**
24612  * The txid for the commitment transaction.
24613  *
24614  * This is provided as a performance optimization, instead of calling transaction.txid()
24615  * multiple times.
24616  */
24617 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
24618
24619 /**
24620  * The txid for the commitment transaction.
24621  *
24622  * This is provided as a performance optimization, instead of calling transaction.txid()
24623  * multiple times.
24624  */
24625 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24626
24627 /**
24628  * Constructs a new BuiltCommitmentTransaction given each field
24629  */
24630 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
24631
24632 /**
24633  * Creates a copy of the BuiltCommitmentTransaction
24634  */
24635 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
24636
24637 /**
24638  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
24639  */
24640 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
24641
24642 /**
24643  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
24644  */
24645 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
24646
24647 /**
24648  * Get the SIGHASH_ALL sighash value of the transaction.
24649  *
24650  * This can be used to verify a signature.
24651  */
24652 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);
24653
24654 /**
24655  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
24656  * because we are about to broadcast a holder transaction.
24657  */
24658 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);
24659
24660 /**
24661  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
24662  */
24663 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
24664
24665 /**
24666  * Creates a copy of the ClosingTransaction
24667  */
24668 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
24669
24670 /**
24671  * Checks if two ClosingTransactions contain equal inner contents.
24672  */
24673 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
24674
24675 /**
24676  * Construct an object of the class
24677  */
24678 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);
24679
24680 /**
24681  * Trust our pre-built transaction.
24682  *
24683  * Applies a wrapper which allows access to the transaction.
24684  *
24685  * This should only be used if you fully trust the builder of this object. It should not
24686  * be used by an external signer - instead use the verify function.
24687  */
24688 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24689
24690 /**
24691  * Verify our pre-built transaction.
24692  *
24693  * Applies a wrapper which allows access to the transaction.
24694  *
24695  * An external validating signer must call this method before signing
24696  * or using the built transaction.
24697  */
24698 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
24699
24700 /**
24701  * The value to be sent to the holder, or zero if the output will be omitted
24702  */
24703 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24704
24705 /**
24706  * The value to be sent to the counterparty, or zero if the output will be omitted
24707  */
24708 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24709
24710 /**
24711  * The destination of the holder's output
24712  */
24713 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24714
24715 /**
24716  * The destination of the counterparty's output
24717  */
24718 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24719
24720 /**
24721  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
24722  */
24723 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
24724
24725 /**
24726  * The pre-built Bitcoin commitment transaction
24727  */
24728 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
24729
24730 /**
24731  * Get the SIGHASH_ALL sighash value of the transaction.
24732  *
24733  * This can be used to verify a signature.
24734  */
24735 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);
24736
24737 /**
24738  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
24739  * because we are about to broadcast a holder transaction.
24740  */
24741 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);
24742
24743 /**
24744  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
24745  */
24746 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
24747
24748 /**
24749  * Creates a copy of the CommitmentTransaction
24750  */
24751 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
24752
24753 /**
24754  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
24755  */
24756 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
24757
24758 /**
24759  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
24760  */
24761 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
24762
24763 /**
24764  * The backwards-counting commitment number
24765  */
24766 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24767
24768 /**
24769  * The value to be sent to the broadcaster
24770  */
24771 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24772
24773 /**
24774  * The value to be sent to the counterparty
24775  */
24776 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24777
24778 /**
24779  * The feerate paid per 1000-weight-unit in this commitment transaction.
24780  */
24781 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24782
24783 /**
24784  * Trust our pre-built transaction and derived transaction creation public keys.
24785  *
24786  * Applies a wrapper which allows access to these fields.
24787  *
24788  * This should only be used if you fully trust the builder of this object.  It should not
24789  * be used by an external signer - instead use the verify function.
24790  */
24791 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24792
24793 /**
24794  * Verify our pre-built transaction and derived transaction creation public keys.
24795  *
24796  * Applies a wrapper which allows access to these fields.
24797  *
24798  * An external validating signer must call this method before signing
24799  * or using the built transaction.
24800  */
24801 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);
24802
24803 /**
24804  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
24805  */
24806 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
24807
24808 /**
24809  * The transaction ID of the built Bitcoin transaction
24810  */
24811 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24812
24813 /**
24814  * The pre-built Bitcoin commitment transaction
24815  */
24816 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24817
24818 /**
24819  * The pre-calculated transaction creation public keys.
24820  */
24821 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24822
24823 /**
24824  * Should anchors be used.
24825  */
24826 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24827
24828 /**
24829  * Get a signature for each HTLC which was included in the commitment transaction (ie for
24830  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
24831  *
24832  * The returned Vec has one entry for each HTLC, and in the same order.
24833  *
24834  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
24835  */
24836 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);
24837
24838 /**
24839  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
24840  * shared secret first. This prevents on-chain observers from discovering how many commitment
24841  * transactions occurred in a channel before it was closed.
24842  *
24843  * This function gets the shared secret from relevant channel public keys and can be used to
24844  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
24845  */
24846 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
24847
24848 /**
24849  * Checks if two InitFeaturess contain equal inner contents.
24850  * This ignores pointers and is_owned flags and looks at the values in fields.
24851  * Two objects with NULL inner values will be considered "equal" here.
24852  */
24853 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
24854
24855 /**
24856  * Checks if two NodeFeaturess contain equal inner contents.
24857  * This ignores pointers and is_owned flags and looks at the values in fields.
24858  * Two objects with NULL inner values will be considered "equal" here.
24859  */
24860 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
24861
24862 /**
24863  * Checks if two ChannelFeaturess contain equal inner contents.
24864  * This ignores pointers and is_owned flags and looks at the values in fields.
24865  * Two objects with NULL inner values will be considered "equal" here.
24866  */
24867 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
24868
24869 /**
24870  * Checks if two InvoiceFeaturess contain equal inner contents.
24871  * This ignores pointers and is_owned flags and looks at the values in fields.
24872  * Two objects with NULL inner values will be considered "equal" here.
24873  */
24874 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
24875
24876 /**
24877  * Checks if two ChannelTypeFeaturess contain equal inner contents.
24878  * This ignores pointers and is_owned flags and looks at the values in fields.
24879  * Two objects with NULL inner values will be considered "equal" here.
24880  */
24881 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
24882
24883 /**
24884  * Creates a copy of the InitFeatures
24885  */
24886 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
24887
24888 /**
24889  * Creates a copy of the NodeFeatures
24890  */
24891 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
24892
24893 /**
24894  * Creates a copy of the ChannelFeatures
24895  */
24896 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
24897
24898 /**
24899  * Creates a copy of the InvoiceFeatures
24900  */
24901 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
24902
24903 /**
24904  * Creates a copy of the ChannelTypeFeatures
24905  */
24906 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
24907
24908 /**
24909  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
24910  */
24911 void InitFeatures_free(struct LDKInitFeatures this_obj);
24912
24913 /**
24914  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
24915  */
24916 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
24917
24918 /**
24919  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
24920  */
24921 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
24922
24923 /**
24924  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
24925  */
24926 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
24927
24928 /**
24929  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
24930  */
24931 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
24932
24933 /**
24934  * Create a blank Features with no features set
24935  */
24936 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
24937
24938 /**
24939  * Creates a Features with the bits set which are known by the implementation
24940  */
24941 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
24942
24943 /**
24944  * Returns true if this `Features` object contains unknown feature flags which are set as
24945  * \"required\".
24946  */
24947 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24948
24949 /**
24950  * Create a blank Features with no features set
24951  */
24952 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
24953
24954 /**
24955  * Creates a Features with the bits set which are known by the implementation
24956  */
24957 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
24958
24959 /**
24960  * Returns true if this `Features` object contains unknown feature flags which are set as
24961  * \"required\".
24962  */
24963 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24964
24965 /**
24966  * Create a blank Features with no features set
24967  */
24968 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
24969
24970 /**
24971  * Creates a Features with the bits set which are known by the implementation
24972  */
24973 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
24974
24975 /**
24976  * Returns true if this `Features` object contains unknown feature flags which are set as
24977  * \"required\".
24978  */
24979 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
24980
24981 /**
24982  * Create a blank Features with no features set
24983  */
24984 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
24985
24986 /**
24987  * Creates a Features with the bits set which are known by the implementation
24988  */
24989 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
24990
24991 /**
24992  * Returns true if this `Features` object contains unknown feature flags which are set as
24993  * \"required\".
24994  */
24995 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24996
24997 /**
24998  * Create a blank Features with no features set
24999  */
25000 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
25001
25002 /**
25003  * Creates a Features with the bits set which are known by the implementation
25004  */
25005 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
25006
25007 /**
25008  * Returns true if this `Features` object contains unknown feature flags which are set as
25009  * \"required\".
25010  */
25011 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25012
25013 /**
25014  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
25015  */
25016 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
25017
25018 /**
25019  * Read a InitFeatures from a byte array, created by InitFeatures_write
25020  */
25021 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
25022
25023 /**
25024  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
25025  */
25026 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
25027
25028 /**
25029  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
25030  */
25031 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
25032
25033 /**
25034  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
25035  */
25036 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
25037
25038 /**
25039  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
25040  */
25041 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
25042
25043 /**
25044  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
25045  */
25046 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
25047
25048 /**
25049  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
25050  */
25051 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
25052
25053 /**
25054  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
25055  */
25056 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
25057
25058 /**
25059  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
25060  */
25061 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
25062
25063 /**
25064  * Set this feature as optional.
25065  */
25066 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25067
25068 /**
25069  * Set this feature as required.
25070  */
25071 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25072
25073 /**
25074  * Checks if this feature is supported.
25075  */
25076 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25077
25078 /**
25079  * Set this feature as optional.
25080  */
25081 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25082
25083 /**
25084  * Set this feature as required.
25085  */
25086 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25087
25088 /**
25089  * Checks if this feature is supported.
25090  */
25091 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25092
25093 /**
25094  * Checks if this feature is required.
25095  */
25096 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25097
25098 /**
25099  * Checks if this feature is required.
25100  */
25101 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25102
25103 /**
25104  * Set this feature as optional.
25105  */
25106 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25107
25108 /**
25109  * Set this feature as required.
25110  */
25111 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25112
25113 /**
25114  * Checks if this feature is supported.
25115  */
25116 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25117
25118 /**
25119  * Set this feature as optional.
25120  */
25121 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25122
25123 /**
25124  * Set this feature as required.
25125  */
25126 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25127
25128 /**
25129  * Checks if this feature is supported.
25130  */
25131 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25132
25133 /**
25134  * Set this feature as optional.
25135  */
25136 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25137
25138 /**
25139  * Set this feature as required.
25140  */
25141 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25142
25143 /**
25144  * Checks if this feature is supported.
25145  */
25146 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25147
25148 /**
25149  * Checks if this feature is required.
25150  */
25151 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25152
25153 /**
25154  * Checks if this feature is required.
25155  */
25156 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25157
25158 /**
25159  * Set this feature as optional.
25160  */
25161 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25162
25163 /**
25164  * Set this feature as required.
25165  */
25166 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25167
25168 /**
25169  * Checks if this feature is supported.
25170  */
25171 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25172
25173 /**
25174  * Set this feature as optional.
25175  */
25176 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25177
25178 /**
25179  * Set this feature as required.
25180  */
25181 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25182
25183 /**
25184  * Checks if this feature is supported.
25185  */
25186 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25187
25188 /**
25189  * Checks if this feature is required.
25190  */
25191 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25192
25193 /**
25194  * Checks if this feature is required.
25195  */
25196 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25197
25198 /**
25199  * Set this feature as optional.
25200  */
25201 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25202
25203 /**
25204  * Set this feature as required.
25205  */
25206 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25207
25208 /**
25209  * Checks if this feature is supported.
25210  */
25211 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25212
25213 /**
25214  * Set this feature as optional.
25215  */
25216 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25217
25218 /**
25219  * Set this feature as required.
25220  */
25221 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25222
25223 /**
25224  * Checks if this feature is supported.
25225  */
25226 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25227
25228 /**
25229  * Set this feature as optional.
25230  */
25231 void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25232
25233 /**
25234  * Set this feature as required.
25235  */
25236 void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25237
25238 /**
25239  * Checks if this feature is supported.
25240  */
25241 MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25242
25243 /**
25244  * Checks if this feature is required.
25245  */
25246 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25247
25248 /**
25249  * Checks if this feature is required.
25250  */
25251 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25252
25253 /**
25254  * Checks if this feature is required.
25255  */
25256 MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25257
25258 /**
25259  * Set this feature as optional.
25260  */
25261 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25262
25263 /**
25264  * Set this feature as required.
25265  */
25266 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25267
25268 /**
25269  * Checks if this feature is supported.
25270  */
25271 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25272
25273 /**
25274  * Set this feature as optional.
25275  */
25276 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25277
25278 /**
25279  * Set this feature as required.
25280  */
25281 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25282
25283 /**
25284  * Checks if this feature is supported.
25285  */
25286 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25287
25288 /**
25289  * Set this feature as optional.
25290  */
25291 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25292
25293 /**
25294  * Set this feature as required.
25295  */
25296 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25297
25298 /**
25299  * Checks if this feature is supported.
25300  */
25301 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25302
25303 /**
25304  * Checks if this feature is required.
25305  */
25306 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25307
25308 /**
25309  * Checks if this feature is required.
25310  */
25311 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25312
25313 /**
25314  * Checks if this feature is required.
25315  */
25316 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25317
25318 /**
25319  * Set this feature as optional.
25320  */
25321 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25322
25323 /**
25324  * Set this feature as required.
25325  */
25326 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25327
25328 /**
25329  * Checks if this feature is supported.
25330  */
25331 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25332
25333 /**
25334  * Set this feature as optional.
25335  */
25336 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25337
25338 /**
25339  * Set this feature as required.
25340  */
25341 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25342
25343 /**
25344  * Checks if this feature is supported.
25345  */
25346 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25347
25348 /**
25349  * Set this feature as optional.
25350  */
25351 void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25352
25353 /**
25354  * Set this feature as required.
25355  */
25356 void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25357
25358 /**
25359  * Checks if this feature is supported.
25360  */
25361 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25362
25363 /**
25364  * Checks if this feature is required.
25365  */
25366 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25367
25368 /**
25369  * Checks if this feature is required.
25370  */
25371 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25372
25373 /**
25374  * Checks if this feature is required.
25375  */
25376 MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25377
25378 /**
25379  * Set this feature as optional.
25380  */
25381 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25382
25383 /**
25384  * Set this feature as required.
25385  */
25386 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25387
25388 /**
25389  * Checks if this feature is supported.
25390  */
25391 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25392
25393 /**
25394  * Set this feature as optional.
25395  */
25396 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25397
25398 /**
25399  * Set this feature as required.
25400  */
25401 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25402
25403 /**
25404  * Checks if this feature is supported.
25405  */
25406 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25407
25408 /**
25409  * Set this feature as optional.
25410  */
25411 void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25412
25413 /**
25414  * Set this feature as required.
25415  */
25416 void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25417
25418 /**
25419  * Checks if this feature is supported.
25420  */
25421 MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25422
25423 /**
25424  * Checks if this feature is required.
25425  */
25426 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25427
25428 /**
25429  * Checks if this feature is required.
25430  */
25431 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25432
25433 /**
25434  * Checks if this feature is required.
25435  */
25436 MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25437
25438 /**
25439  * Set this feature as optional.
25440  */
25441 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25442
25443 /**
25444  * Set this feature as required.
25445  */
25446 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25447
25448 /**
25449  * Checks if this feature is supported.
25450  */
25451 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25452
25453 /**
25454  * Set this feature as optional.
25455  */
25456 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25457
25458 /**
25459  * Set this feature as required.
25460  */
25461 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25462
25463 /**
25464  * Checks if this feature is supported.
25465  */
25466 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25467
25468 /**
25469  * Checks if this feature is required.
25470  */
25471 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25472
25473 /**
25474  * Checks if this feature is required.
25475  */
25476 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25477
25478 /**
25479  * Set this feature as optional.
25480  */
25481 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25482
25483 /**
25484  * Set this feature as required.
25485  */
25486 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25487
25488 /**
25489  * Checks if this feature is supported.
25490  */
25491 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25492
25493 /**
25494  * Set this feature as optional.
25495  */
25496 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25497
25498 /**
25499  * Set this feature as required.
25500  */
25501 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25502
25503 /**
25504  * Checks if this feature is supported.
25505  */
25506 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25507
25508 /**
25509  * Checks if this feature is required.
25510  */
25511 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25512
25513 /**
25514  * Checks if this feature is required.
25515  */
25516 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25517
25518 /**
25519  * Set this feature as optional.
25520  */
25521 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25522
25523 /**
25524  * Set this feature as required.
25525  */
25526 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25527
25528 /**
25529  * Checks if this feature is supported.
25530  */
25531 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25532
25533 /**
25534  * Set this feature as optional.
25535  */
25536 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25537
25538 /**
25539  * Set this feature as required.
25540  */
25541 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25542
25543 /**
25544  * Checks if this feature is supported.
25545  */
25546 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25547
25548 /**
25549  * Checks if this feature is required.
25550  */
25551 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25552
25553 /**
25554  * Checks if this feature is required.
25555  */
25556 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25557
25558 /**
25559  * Set this feature as optional.
25560  */
25561 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25562
25563 /**
25564  * Set this feature as required.
25565  */
25566 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25567
25568 /**
25569  * Checks if this feature is supported.
25570  */
25571 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25572
25573 /**
25574  * Set this feature as optional.
25575  */
25576 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25577
25578 /**
25579  * Set this feature as required.
25580  */
25581 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25582
25583 /**
25584  * Checks if this feature is supported.
25585  */
25586 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25587
25588 /**
25589  * Set this feature as optional.
25590  */
25591 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25592
25593 /**
25594  * Set this feature as required.
25595  */
25596 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25597
25598 /**
25599  * Checks if this feature is supported.
25600  */
25601 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25602
25603 /**
25604  * Checks if this feature is required.
25605  */
25606 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25607
25608 /**
25609  * Checks if this feature is required.
25610  */
25611 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25612
25613 /**
25614  * Checks if this feature is required.
25615  */
25616 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25617
25618 /**
25619  * Set this feature as optional.
25620  */
25621 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25622
25623 /**
25624  * Set this feature as required.
25625  */
25626 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25627
25628 /**
25629  * Checks if this feature is supported.
25630  */
25631 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25632
25633 /**
25634  * Set this feature as optional.
25635  */
25636 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25637
25638 /**
25639  * Set this feature as required.
25640  */
25641 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25642
25643 /**
25644  * Checks if this feature is supported.
25645  */
25646 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25647
25648 /**
25649  * Set this feature as optional.
25650  */
25651 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25652
25653 /**
25654  * Set this feature as required.
25655  */
25656 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25657
25658 /**
25659  * Checks if this feature is supported.
25660  */
25661 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25662
25663 /**
25664  * Checks if this feature is required.
25665  */
25666 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25667
25668 /**
25669  * Checks if this feature is required.
25670  */
25671 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25672
25673 /**
25674  * Checks if this feature is required.
25675  */
25676 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25677
25678 /**
25679  * Set this feature as optional.
25680  */
25681 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25682
25683 /**
25684  * Set this feature as required.
25685  */
25686 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25687
25688 /**
25689  * Checks if this feature is supported.
25690  */
25691 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25692
25693 /**
25694  * Checks if this feature is required.
25695  */
25696 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25697
25698 /**
25699  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
25700  */
25701 void ShutdownScript_free(struct LDKShutdownScript this_obj);
25702
25703 /**
25704  * Creates a copy of the ShutdownScript
25705  */
25706 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
25707
25708 /**
25709  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
25710  */
25711 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
25712
25713 /**
25714  * The script that did not meet the requirements from [BOLT #2].
25715  *
25716  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
25717  */
25718 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
25719
25720 /**
25721  * The script that did not meet the requirements from [BOLT #2].
25722  *
25723  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
25724  */
25725 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
25726
25727 /**
25728  * Constructs a new InvalidShutdownScript given each field
25729  */
25730 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
25731
25732 /**
25733  * Creates a copy of the InvalidShutdownScript
25734  */
25735 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
25736
25737 /**
25738  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
25739  */
25740 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
25741
25742 /**
25743  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
25744  */
25745 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
25746
25747 /**
25748  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
25749  */
25750 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
25751
25752 /**
25753  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
25754  */
25755 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
25756
25757 /**
25758  * Generates a witness script pubkey from the given segwit version and program.
25759  *
25760  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
25761  * [`ShutdownScript::new_p2wsh`] instead.
25762  *
25763  * # Errors
25764  *
25765  * This function may return an error if `program` is invalid for the segwit `version`.
25766  */
25767 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
25768
25769 /**
25770  * Converts the shutdown script into the underlying [`Script`].
25771  */
25772 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
25773
25774 /**
25775  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
25776  *
25777  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25778  */
25779 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
25780
25781 /**
25782  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
25783  *
25784  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
25785  */
25786 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
25787
25788 /**
25789  * Calls the free function if one is set
25790  */
25791 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
25792
25793 /**
25794  * Calls the free function if one is set
25795  */
25796 void Type_free(struct LDKType this_ptr);
25797
25798 /**
25799  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
25800  */
25801 void NodeId_free(struct LDKNodeId this_obj);
25802
25803 /**
25804  * Creates a copy of the NodeId
25805  */
25806 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
25807
25808 /**
25809  * Create a new NodeId from a public key
25810  */
25811 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
25812
25813 /**
25814  * Get the public key slice from this NodeId
25815  */
25816 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
25817
25818 /**
25819  * Checks if two NodeIds contain equal inner contents.
25820  */
25821 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
25822
25823 /**
25824  * Serialize the NodeId object into a byte array which can be read by NodeId_read
25825  */
25826 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
25827
25828 /**
25829  * Read a NodeId from a byte array, created by NodeId_write
25830  */
25831 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
25832
25833 /**
25834  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
25835  */
25836 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
25837
25838 /**
25839  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
25840  */
25841 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
25842
25843 /**
25844  * Frees any resources used by the NetworkUpdate
25845  */
25846 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
25847
25848 /**
25849  * Creates a copy of the NetworkUpdate
25850  */
25851 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
25852
25853 /**
25854  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
25855  */
25856 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
25857
25858 /**
25859  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
25860  */
25861 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
25862
25863 /**
25864  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
25865  */
25866 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
25867
25868 /**
25869  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
25870  */
25871 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
25872
25873 /**
25874  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
25875  */
25876 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
25877
25878 /**
25879  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
25880  */
25881 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
25882
25883 /**
25884  * Creates a new tracker of the actual state of the network of channels and nodes,
25885  * assuming an existing Network Graph.
25886  * Chain monitor is used to make sure announced channels exist on-chain,
25887  * channel data is correct, and that the announcement is signed with
25888  * channel owners' keys.
25889  */
25890 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
25891
25892 /**
25893  * Adds a provider used to check new announcements. Does not affect
25894  * existing announcements unless they are updated.
25895  * Add, update or remove the provider would replace the current one.
25896  */
25897 void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
25898
25899 /**
25900  * Constructs a new EventHandler which calls the relevant methods on this_arg.
25901  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
25902  */
25903 struct LDKEventHandler NetworkGraph_as_EventHandler(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
25904
25905 /**
25906  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
25907  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
25908  */
25909 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
25910
25911 /**
25912  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
25913  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
25914  */
25915 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
25916
25917 /**
25918  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
25919  */
25920 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
25921
25922 /**
25923  * When the last update to the channel direction was issued.
25924  * Value is opaque, as set in the announcement.
25925  */
25926 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25927
25928 /**
25929  * When the last update to the channel direction was issued.
25930  * Value is opaque, as set in the announcement.
25931  */
25932 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
25933
25934 /**
25935  * Whether the channel can be currently used for payments (in this one direction).
25936  */
25937 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25938
25939 /**
25940  * Whether the channel can be currently used for payments (in this one direction).
25941  */
25942 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
25943
25944 /**
25945  * The difference in CLTV values that you must have when routing through this channel.
25946  */
25947 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25948
25949 /**
25950  * The difference in CLTV values that you must have when routing through this channel.
25951  */
25952 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
25953
25954 /**
25955  * The minimum value, which must be relayed to the next hop via the channel
25956  */
25957 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25958
25959 /**
25960  * The minimum value, which must be relayed to the next hop via the channel
25961  */
25962 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
25963
25964 /**
25965  * The maximum value which may be relayed to the next hop via the channel.
25966  */
25967 struct LDKCOption_u64Z ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25968
25969 /**
25970  * The maximum value which may be relayed to the next hop via the channel.
25971  */
25972 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25973
25974 /**
25975  * Fees charged when the channel is used for routing
25976  */
25977 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25978
25979 /**
25980  * Fees charged when the channel is used for routing
25981  */
25982 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
25983
25984 /**
25985  * Most recent update for the channel received from the network
25986  * Mostly redundant with the data we store in fields explicitly.
25987  * Everything else is useful only for sending out for initial routing sync.
25988  * Not stored if contains excess data to prevent DoS.
25989  *
25990  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25991  */
25992 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25993
25994 /**
25995  * Most recent update for the channel received from the network
25996  * Mostly redundant with the data we store in fields explicitly.
25997  * Everything else is useful only for sending out for initial routing sync.
25998  * Not stored if contains excess data to prevent DoS.
25999  *
26000  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26001  */
26002 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
26003
26004 /**
26005  * Constructs a new ChannelUpdateInfo given each field
26006  */
26007 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);
26008
26009 /**
26010  * Creates a copy of the ChannelUpdateInfo
26011  */
26012 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
26013
26014 /**
26015  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
26016  */
26017 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
26018
26019 /**
26020  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
26021  */
26022 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
26023
26024 /**
26025  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
26026  */
26027 void ChannelInfo_free(struct LDKChannelInfo this_obj);
26028
26029 /**
26030  * Protocol features of a channel communicated during its announcement
26031  */
26032 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26033
26034 /**
26035  * Protocol features of a channel communicated during its announcement
26036  */
26037 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
26038
26039 /**
26040  * Source node of the first direction of a channel
26041  */
26042 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26043
26044 /**
26045  * Source node of the first direction of a channel
26046  */
26047 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
26048
26049 /**
26050  * Details about the first direction of a channel
26051  *
26052  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26053  */
26054 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26055
26056 /**
26057  * Details about the first direction of a channel
26058  *
26059  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26060  */
26061 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
26062
26063 /**
26064  * Source node of the second direction of a channel
26065  */
26066 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26067
26068 /**
26069  * Source node of the second direction of a channel
26070  */
26071 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
26072
26073 /**
26074  * Details about the second direction of a channel
26075  *
26076  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26077  */
26078 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26079
26080 /**
26081  * Details about the second direction of a channel
26082  *
26083  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26084  */
26085 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
26086
26087 /**
26088  * The channel capacity as seen on-chain, if chain lookup is available.
26089  */
26090 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26091
26092 /**
26093  * The channel capacity as seen on-chain, if chain lookup is available.
26094  */
26095 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26096
26097 /**
26098  * An initial announcement of the channel
26099  * Mostly redundant with the data we store in fields explicitly.
26100  * Everything else is useful only for sending out for initial routing sync.
26101  * Not stored if contains excess data to prevent DoS.
26102  *
26103  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26104  */
26105 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26106
26107 /**
26108  * An initial announcement of the channel
26109  * Mostly redundant with the data we store in fields explicitly.
26110  * Everything else is useful only for sending out for initial routing sync.
26111  * Not stored if contains excess data to prevent DoS.
26112  *
26113  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26114  */
26115 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
26116
26117 /**
26118  * Creates a copy of the ChannelInfo
26119  */
26120 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
26121
26122 /**
26123  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
26124  *
26125  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26126  */
26127 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
26128
26129 /**
26130  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
26131  */
26132 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
26133
26134 /**
26135  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
26136  */
26137 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
26138
26139 /**
26140  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
26141  */
26142 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
26143
26144 /**
26145  * Creates a copy of the DirectedChannelInfo
26146  */
26147 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
26148
26149 /**
26150  * Returns information for the channel.
26151  */
26152 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
26153
26154 /**
26155  * Returns information for the direction.
26156  *
26157  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26158  */
26159 MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
26160
26161 /**
26162  * Returns the maximum HTLC amount allowed over the channel in the direction.
26163  */
26164 MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
26165
26166 /**
26167  * Returns the [`EffectiveCapacity`] of the channel in the direction.
26168  *
26169  * This is either the total capacity from the funding transaction, if known, or the
26170  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
26171  * otherwise.
26172  */
26173 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
26174
26175 /**
26176  * Frees any resources used by the EffectiveCapacity
26177  */
26178 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
26179
26180 /**
26181  * Creates a copy of the EffectiveCapacity
26182  */
26183 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
26184
26185 /**
26186  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
26187  */
26188 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
26189
26190 /**
26191  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
26192  */
26193 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
26194
26195 /**
26196  * Utility method to constructs a new Total-variant EffectiveCapacity
26197  */
26198 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, struct LDKCOption_u64Z htlc_maximum_msat);
26199
26200 /**
26201  * Utility method to constructs a new Infinite-variant EffectiveCapacity
26202  */
26203 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
26204
26205 /**
26206  * Utility method to constructs a new Unknown-variant EffectiveCapacity
26207  */
26208 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
26209
26210 /**
26211  * Returns the effective capacity denominated in millisatoshi.
26212  */
26213 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
26214
26215 /**
26216  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
26217  */
26218 void RoutingFees_free(struct LDKRoutingFees this_obj);
26219
26220 /**
26221  * Flat routing fee in satoshis
26222  */
26223 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
26224
26225 /**
26226  * Flat routing fee in satoshis
26227  */
26228 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
26229
26230 /**
26231  * Liquidity-based routing fee in millionths of a routed amount.
26232  * In other words, 10000 is 1%.
26233  */
26234 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
26235
26236 /**
26237  * Liquidity-based routing fee in millionths of a routed amount.
26238  * In other words, 10000 is 1%.
26239  */
26240 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
26241
26242 /**
26243  * Constructs a new RoutingFees given each field
26244  */
26245 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
26246
26247 /**
26248  * Checks if two RoutingFeess contain equal inner contents.
26249  * This ignores pointers and is_owned flags and looks at the values in fields.
26250  * Two objects with NULL inner values will be considered "equal" here.
26251  */
26252 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
26253
26254 /**
26255  * Creates a copy of the RoutingFees
26256  */
26257 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
26258
26259 /**
26260  * Checks if two RoutingFeess contain equal inner contents.
26261  */
26262 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
26263
26264 /**
26265  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
26266  */
26267 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
26268
26269 /**
26270  * Read a RoutingFees from a byte array, created by RoutingFees_write
26271  */
26272 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
26273
26274 /**
26275  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
26276  */
26277 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
26278
26279 /**
26280  * Protocol features the node announced support for
26281  */
26282 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26283
26284 /**
26285  * Protocol features the node announced support for
26286  */
26287 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
26288
26289 /**
26290  * When the last known update to the node state was issued.
26291  * Value is opaque, as set in the announcement.
26292  */
26293 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26294
26295 /**
26296  * When the last known update to the node state was issued.
26297  * Value is opaque, as set in the announcement.
26298  */
26299 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
26300
26301 /**
26302  * Color assigned to the node
26303  */
26304 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
26305
26306 /**
26307  * Color assigned to the node
26308  */
26309 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
26310
26311 /**
26312  * Moniker assigned to the node.
26313  * May be invalid or malicious (eg control chars),
26314  * should not be exposed to the user.
26315  */
26316 struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26317
26318 /**
26319  * Moniker assigned to the node.
26320  * May be invalid or malicious (eg control chars),
26321  * should not be exposed to the user.
26322  */
26323 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
26324
26325 /**
26326  * Internet-level addresses via which one can connect to the node
26327  */
26328 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
26329
26330 /**
26331  * An initial announcement of the node
26332  * Mostly redundant with the data we store in fields explicitly.
26333  * Everything else is useful only for sending out for initial routing sync.
26334  * Not stored if contains excess data to prevent DoS.
26335  *
26336  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26337  */
26338 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26339
26340 /**
26341  * An initial announcement of the node
26342  * Mostly redundant with the data we store in fields explicitly.
26343  * Everything else is useful only for sending out for initial routing sync.
26344  * Not stored if contains excess data to prevent DoS.
26345  *
26346  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26347  */
26348 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
26349
26350 /**
26351  * Constructs a new NodeAnnouncementInfo given each field
26352  */
26353 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
26354
26355 /**
26356  * Creates a copy of the NodeAnnouncementInfo
26357  */
26358 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
26359
26360 /**
26361  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
26362  */
26363 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
26364
26365 /**
26366  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
26367  */
26368 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
26369
26370 /**
26371  * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL.
26372  */
26373 void NodeAlias_free(struct LDKNodeAlias this_obj);
26374
26375 const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32];
26376
26377 void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26378
26379 /**
26380  * Constructs a new NodeAlias given each field
26381  */
26382 MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg);
26383
26384 /**
26385  * Creates a copy of the NodeAlias
26386  */
26387 struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig);
26388
26389 /**
26390  * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
26391  */
26392 struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj);
26393
26394 /**
26395  * Read a NodeAlias from a byte array, created by NodeAlias_write
26396  */
26397 struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser);
26398
26399 /**
26400  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
26401  */
26402 void NodeInfo_free(struct LDKNodeInfo this_obj);
26403
26404 /**
26405  * All valid channels a node has announced
26406  */
26407 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
26408
26409 /**
26410  * Lowest fees enabling routing via any of the enabled, known channels to a node.
26411  * The two fields (flat and proportional fee) are independent,
26412  * meaning they don't have to refer to the same channel.
26413  *
26414  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26415  */
26416 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
26417
26418 /**
26419  * Lowest fees enabling routing via any of the enabled, known channels to a node.
26420  * The two fields (flat and proportional fee) are independent,
26421  * meaning they don't have to refer to the same channel.
26422  *
26423  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26424  */
26425 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
26426
26427 /**
26428  * More information about a node from node_announcement.
26429  * Optional because we store a Node entry after learning about it from
26430  * a channel announcement, but before receiving a node announcement.
26431  *
26432  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26433  */
26434 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
26435
26436 /**
26437  * More information about a node from node_announcement.
26438  * Optional because we store a Node entry after learning about it from
26439  * a channel announcement, but before receiving a node announcement.
26440  *
26441  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26442  */
26443 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
26444
26445 /**
26446  * Constructs a new NodeInfo given each field
26447  */
26448 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
26449
26450 /**
26451  * Creates a copy of the NodeInfo
26452  */
26453 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
26454
26455 /**
26456  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
26457  */
26458 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
26459
26460 /**
26461  * Read a NodeInfo from a byte array, created by NodeInfo_write
26462  */
26463 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
26464
26465 /**
26466  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
26467  */
26468 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
26469
26470 /**
26471  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
26472  */
26473 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
26474
26475 /**
26476  * Creates a new, empty, network graph.
26477  */
26478 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger);
26479
26480 /**
26481  * Returns a read-only view of the network graph.
26482  */
26483 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26484
26485 /**
26486  * The unix timestamp provided by the most recent rapid gossip sync.
26487  * It will be set by the rapid sync process after every sync completion.
26488  */
26489 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26490
26491 /**
26492  * Update the unix timestamp provided by the most recent rapid gossip sync.
26493  * This should be done automatically by the rapid sync process after every sync completion.
26494  */
26495 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
26496
26497 /**
26498  * For an already known node (from channel announcements), update its stored properties from a
26499  * given node announcement.
26500  *
26501  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26502  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26503  * routing messages from a source using a protocol other than the lightning P2P protocol.
26504  */
26505 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
26506
26507 /**
26508  * For an already known node (from channel announcements), update its stored properties from a
26509  * given node announcement without verifying the associated signatures. Because we aren't
26510  * given the associated signatures here we cannot relay the node announcement to any of our
26511  * peers.
26512  */
26513 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);
26514
26515 /**
26516  * Store or update channel info from a channel announcement.
26517  *
26518  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26519  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26520  * routing messages from a source using a protocol other than the lightning P2P protocol.
26521  *
26522  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
26523  * the corresponding UTXO exists on chain and is correctly-formatted.
26524  */
26525 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);
26526
26527 /**
26528  * Store or update channel info from a channel announcement without verifying the associated
26529  * signatures. Because we aren't given the associated signatures here we cannot relay the
26530  * channel announcement to any of our peers.
26531  *
26532  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
26533  * the corresponding UTXO exists on chain and is correctly-formatted.
26534  */
26535 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);
26536
26537 /**
26538  * Update channel from partial announcement data received via rapid gossip sync
26539  *
26540  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
26541  * rapid gossip sync server)
26542  *
26543  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
26544  */
26545 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from_partial_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t timestamp, struct LDKChannelFeatures features, struct LDKPublicKey node_id_1, struct LDKPublicKey node_id_2);
26546
26547 /**
26548  * Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
26549  * If permanent, removes a channel from the local storage.
26550  * May cause the removal of nodes too, if this was their last channel.
26551  * If not permanent, makes channels unavailable for routing.
26552  */
26553 void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
26554
26555 /**
26556  * Marks a node in the graph as failed.
26557  */
26558 void NetworkGraph_node_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
26559
26560 /**
26561  * Removes information about channels that we haven't heard any updates about in some time.
26562  * This can be used regularly to prune the network graph of channels that likely no longer
26563  * exist.
26564  *
26565  * While there is no formal requirement that nodes regularly re-broadcast their channel
26566  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
26567  * pruning occur for updates which are at least two weeks old, which we implement here.
26568  *
26569  * Note that for users of the `lightning-background-processor` crate this method may be
26570  * automatically called regularly for you.
26571  *
26572  * This method is only available with the `std` feature. See
26573  * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
26574  */
26575 void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26576
26577 /**
26578  * Removes information about channels that we haven't heard any updates about in some time.
26579  * This can be used regularly to prune the network graph of channels that likely no longer
26580  * exist.
26581  *
26582  * While there is no formal requirement that nodes regularly re-broadcast their channel
26583  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
26584  * pruning occur for updates which are at least two weeks old, which we implement here.
26585  *
26586  * This function takes the current unix time as an argument. For users with the `std` feature
26587  * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
26588  */
26589 void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
26590
26591 /**
26592  * For an already known (from announcement) channel, update info about one of the directions
26593  * of the channel.
26594  *
26595  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26596  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26597  * routing messages from a source using a protocol other than the lightning P2P protocol.
26598  *
26599  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
26600  * materially in the future will be rejected.
26601  */
26602 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
26603
26604 /**
26605  * For an already known (from announcement) channel, update info about one of the directions
26606  * of the channel without verifying the associated signatures. Because we aren't given the
26607  * associated signatures here we cannot relay the channel update to any of our peers.
26608  *
26609  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
26610  * materially in the future will be rejected.
26611  */
26612 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
26613
26614 /**
26615  * Get network addresses by node id.
26616  * Returns None if the requested node is completely unknown,
26617  * or if node announcement for the node was never received.
26618  */
26619 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
26620
26621 /**
26622  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
26623  */
26624 void RouteHop_free(struct LDKRouteHop this_obj);
26625
26626 /**
26627  * The node_id of the node at this hop.
26628  */
26629 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26630
26631 /**
26632  * The node_id of the node at this hop.
26633  */
26634 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26635
26636 /**
26637  * The node_announcement features of the node at this hop. For the last hop, these may be
26638  * amended to match the features present in the invoice this node generated.
26639  */
26640 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26641
26642 /**
26643  * The node_announcement features of the node at this hop. For the last hop, these may be
26644  * amended to match the features present in the invoice this node generated.
26645  */
26646 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
26647
26648 /**
26649  * The channel that should be used from the previous hop to reach this node.
26650  */
26651 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26652
26653 /**
26654  * The channel that should be used from the previous hop to reach this node.
26655  */
26656 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
26657
26658 /**
26659  * The channel_announcement features of the channel that should be used from the previous hop
26660  * to reach this node.
26661  */
26662 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26663
26664 /**
26665  * The channel_announcement features of the channel that should be used from the previous hop
26666  * to reach this node.
26667  */
26668 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
26669
26670 /**
26671  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
26672  * For the last hop, this should be the full value of the payment (might be more than
26673  * requested if we had to match htlc_minimum_msat).
26674  */
26675 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26676
26677 /**
26678  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
26679  * For the last hop, this should be the full value of the payment (might be more than
26680  * requested if we had to match htlc_minimum_msat).
26681  */
26682 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
26683
26684 /**
26685  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
26686  * expected at the destination, in excess of the current block height.
26687  */
26688 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26689
26690 /**
26691  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
26692  * expected at the destination, in excess of the current block height.
26693  */
26694 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
26695
26696 /**
26697  * Constructs a new RouteHop given each field
26698  */
26699 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);
26700
26701 /**
26702  * Creates a copy of the RouteHop
26703  */
26704 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
26705
26706 /**
26707  * Checks if two RouteHops contain equal inner contents.
26708  */
26709 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
26710
26711 /**
26712  * Checks if two RouteHops contain equal inner contents.
26713  * This ignores pointers and is_owned flags and looks at the values in fields.
26714  * Two objects with NULL inner values will be considered "equal" here.
26715  */
26716 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
26717
26718 /**
26719  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
26720  */
26721 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
26722
26723 /**
26724  * Read a RouteHop from a byte array, created by RouteHop_write
26725  */
26726 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
26727
26728 /**
26729  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
26730  */
26731 void Route_free(struct LDKRoute this_obj);
26732
26733 /**
26734  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
26735  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
26736  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
26737  * least length one. While the maximum length of any given path is variable, keeping the length
26738  * of any path less or equal to 19 should currently ensure it is viable.
26739  */
26740 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
26741
26742 /**
26743  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
26744  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
26745  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
26746  * least length one. While the maximum length of any given path is variable, keeping the length
26747  * of any path less or equal to 19 should currently ensure it is viable.
26748  */
26749 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
26750
26751 /**
26752  * The `payment_params` parameter passed to [`find_route`].
26753  * This is used by `ChannelManager` to track information which may be required for retries,
26754  * provided back to you via [`Event::PaymentPathFailed`].
26755  *
26756  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
26757  *
26758  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26759  */
26760 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
26761
26762 /**
26763  * The `payment_params` parameter passed to [`find_route`].
26764  * This is used by `ChannelManager` to track information which may be required for retries,
26765  * provided back to you via [`Event::PaymentPathFailed`].
26766  *
26767  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
26768  *
26769  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26770  */
26771 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
26772
26773 /**
26774  * Constructs a new Route given each field
26775  */
26776 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
26777
26778 /**
26779  * Creates a copy of the Route
26780  */
26781 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
26782
26783 /**
26784  * Checks if two Routes contain equal inner contents.
26785  */
26786 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
26787
26788 /**
26789  * Checks if two Routes contain equal inner contents.
26790  * This ignores pointers and is_owned flags and looks at the values in fields.
26791  * Two objects with NULL inner values will be considered "equal" here.
26792  */
26793 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
26794
26795 /**
26796  * Returns the total amount of fees paid on this [`Route`].
26797  *
26798  * This doesn't include any extra payment made to the recipient, which can happen in excess of
26799  * the amount passed to [`find_route`]'s `params.final_value_msat`.
26800  */
26801 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
26802
26803 /**
26804  * Returns the total amount paid on this [`Route`], excluding the fees.
26805  */
26806 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
26807
26808 /**
26809  * Serialize the Route object into a byte array which can be read by Route_read
26810  */
26811 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
26812
26813 /**
26814  * Read a Route from a byte array, created by Route_write
26815  */
26816 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
26817
26818 /**
26819  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
26820  */
26821 void RouteParameters_free(struct LDKRouteParameters this_obj);
26822
26823 /**
26824  * The parameters of the failed payment path.
26825  */
26826 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
26827
26828 /**
26829  * The parameters of the failed payment path.
26830  */
26831 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
26832
26833 /**
26834  * The amount in msats sent on the failed payment path.
26835  */
26836 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
26837
26838 /**
26839  * The amount in msats sent on the failed payment path.
26840  */
26841 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
26842
26843 /**
26844  * The CLTV on the final hop of the failed payment path.
26845  */
26846 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
26847
26848 /**
26849  * The CLTV on the final hop of the failed payment path.
26850  */
26851 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
26852
26853 /**
26854  * Constructs a new RouteParameters given each field
26855  */
26856 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);
26857
26858 /**
26859  * Creates a copy of the RouteParameters
26860  */
26861 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
26862
26863 /**
26864  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
26865  */
26866 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
26867
26868 /**
26869  * Read a RouteParameters from a byte array, created by RouteParameters_write
26870  */
26871 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
26872
26873 /**
26874  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
26875  */
26876 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
26877
26878 /**
26879  * The node id of the payee.
26880  */
26881 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26882
26883 /**
26884  * The node id of the payee.
26885  */
26886 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26887
26888 /**
26889  * Features supported by the payee.
26890  *
26891  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
26892  * does not contain any features.
26893  *
26894  * [`for_keysend`]: Self::for_keysend
26895  *
26896  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26897  */
26898 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26899
26900 /**
26901  * Features supported by the payee.
26902  *
26903  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
26904  * does not contain any features.
26905  *
26906  * [`for_keysend`]: Self::for_keysend
26907  *
26908  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26909  */
26910 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
26911
26912 /**
26913  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
26914  */
26915 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26916
26917 /**
26918  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
26919  */
26920 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
26921
26922 /**
26923  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
26924  */
26925 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26926
26927 /**
26928  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
26929  */
26930 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26931
26932 /**
26933  * The maximum total CLTV delta we accept for the route.
26934  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
26935  */
26936 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26937
26938 /**
26939  * The maximum total CLTV delta we accept for the route.
26940  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
26941  */
26942 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
26943
26944 /**
26945  * The maximum number of paths that may be used by MPP payments.
26946  * Defaults to [`DEFAULT_MAX_MPP_PATH_COUNT`].
26947  */
26948 uint8_t PaymentParameters_get_max_mpp_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26949
26950 /**
26951  * The maximum number of paths that may be used by MPP payments.
26952  * Defaults to [`DEFAULT_MAX_MPP_PATH_COUNT`].
26953  */
26954 void PaymentParameters_set_max_mpp_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
26955
26956 /**
26957  * Constructs a new PaymentParameters given each field
26958  */
26959 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_mpp_path_count_arg);
26960
26961 /**
26962  * Creates a copy of the PaymentParameters
26963  */
26964 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
26965
26966 /**
26967  * Checks if two PaymentParameterss contain equal inner contents.
26968  */
26969 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
26970
26971 /**
26972  * Checks if two PaymentParameterss contain equal inner contents.
26973  * This ignores pointers and is_owned flags and looks at the values in fields.
26974  * Two objects with NULL inner values will be considered "equal" here.
26975  */
26976 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
26977
26978 /**
26979  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
26980  */
26981 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
26982
26983 /**
26984  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
26985  */
26986 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
26987
26988 /**
26989  * Creates a payee with the node id of the given `pubkey`.
26990  */
26991 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
26992
26993 /**
26994  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
26995  */
26996 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
26997
26998 /**
26999  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
27000  */
27001 void RouteHint_free(struct LDKRouteHint this_obj);
27002
27003 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
27004
27005 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
27006
27007 /**
27008  * Constructs a new RouteHint given each field
27009  */
27010 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
27011
27012 /**
27013  * Creates a copy of the RouteHint
27014  */
27015 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
27016
27017 /**
27018  * Checks if two RouteHints contain equal inner contents.
27019  */
27020 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
27021
27022 /**
27023  * Checks if two RouteHints contain equal inner contents.
27024  * This ignores pointers and is_owned flags and looks at the values in fields.
27025  * Two objects with NULL inner values will be considered "equal" here.
27026  */
27027 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
27028
27029 /**
27030  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
27031  */
27032 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
27033
27034 /**
27035  * Read a RouteHint from a byte array, created by RouteHint_write
27036  */
27037 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
27038
27039 /**
27040  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
27041  */
27042 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
27043
27044 /**
27045  * The node_id of the non-target end of the route
27046  */
27047 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27048
27049 /**
27050  * The node_id of the non-target end of the route
27051  */
27052 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27053
27054 /**
27055  * The short_channel_id of this channel
27056  */
27057 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27058
27059 /**
27060  * The short_channel_id of this channel
27061  */
27062 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
27063
27064 /**
27065  * The fees which must be paid to use this channel
27066  */
27067 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27068
27069 /**
27070  * The fees which must be paid to use this channel
27071  */
27072 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
27073
27074 /**
27075  * The difference in CLTV values between this node and the next node.
27076  */
27077 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27078
27079 /**
27080  * The difference in CLTV values between this node and the next node.
27081  */
27082 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
27083
27084 /**
27085  * The minimum value, in msat, which must be relayed to the next hop.
27086  */
27087 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27088
27089 /**
27090  * The minimum value, in msat, which must be relayed to the next hop.
27091  */
27092 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27093
27094 /**
27095  * The maximum value in msat available for routing with a single HTLC.
27096  */
27097 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27098
27099 /**
27100  * The maximum value in msat available for routing with a single HTLC.
27101  */
27102 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27103
27104 /**
27105  * Constructs a new RouteHintHop given each field
27106  */
27107 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);
27108
27109 /**
27110  * Creates a copy of the RouteHintHop
27111  */
27112 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
27113
27114 /**
27115  * Checks if two RouteHintHops contain equal inner contents.
27116  */
27117 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
27118
27119 /**
27120  * Checks if two RouteHintHops contain equal inner contents.
27121  * This ignores pointers and is_owned flags and looks at the values in fields.
27122  * Two objects with NULL inner values will be considered "equal" here.
27123  */
27124 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
27125
27126 /**
27127  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
27128  */
27129 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
27130
27131 /**
27132  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
27133  */
27134 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
27135
27136 /**
27137  * Finds a route from us (payer) to the given target node (payee).
27138  *
27139  * If the payee provided features in their invoice, they should be provided via `params.payee`.
27140  * Without this, MPP will only be used if the payee's features are available in the network graph.
27141  *
27142  * Private routing paths between a public node and the target may be included in `params.payee`.
27143  *
27144  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
27145  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
27146  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
27147  *
27148  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
27149  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
27150  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
27151  *
27152  * # Note
27153  *
27154  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
27155  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
27156  * function.
27157  *
27158  * # Panics
27159  *
27160  * Panics if first_hops contains channels without short_channel_ids;
27161  * [`ChannelManager::list_usable_channels`] will never include such channels.
27162  *
27163  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
27164  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
27165  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
27166  *
27167  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
27168  */
27169 struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]);
27170
27171 /**
27172  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
27173  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
27174  *
27175  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
27176  */
27177 struct LDKCResult_RouteLightningErrorZ build_route_from_hops(struct LDKPublicKey our_node_pubkey, struct LDKCVec_PublicKeyZ hops, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]);
27178
27179 /**
27180  * Calls the free function if one is set
27181  */
27182 void Score_free(struct LDKScore this_ptr);
27183
27184 /**
27185  * Calls the free function if one is set
27186  */
27187 void LockableScore_free(struct LDKLockableScore this_ptr);
27188
27189 /**
27190  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
27191  */
27192 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
27193
27194 /**
27195  * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
27196  */
27197 struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
27198
27199 /**
27200  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
27201  */
27202 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
27203
27204 /**
27205  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
27206  */
27207 void ChannelUsage_free(struct LDKChannelUsage this_obj);
27208
27209 /**
27210  * The amount to send through the channel, denominated in millisatoshis.
27211  */
27212 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
27213
27214 /**
27215  * The amount to send through the channel, denominated in millisatoshis.
27216  */
27217 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
27218
27219 /**
27220  * Total amount, denominated in millisatoshis, already allocated to send through the channel
27221  * as part of a multi-path payment.
27222  */
27223 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
27224
27225 /**
27226  * Total amount, denominated in millisatoshis, already allocated to send through the channel
27227  * as part of a multi-path payment.
27228  */
27229 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
27230
27231 /**
27232  * The effective capacity of the channel.
27233  */
27234 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
27235
27236 /**
27237  * The effective capacity of the channel.
27238  */
27239 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
27240
27241 /**
27242  * Constructs a new ChannelUsage given each field
27243  */
27244 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
27245
27246 /**
27247  * Creates a copy of the ChannelUsage
27248  */
27249 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
27250
27251 /**
27252  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
27253  */
27254 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
27255
27256 /**
27257  * Creates a copy of the FixedPenaltyScorer
27258  */
27259 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
27260
27261 /**
27262  * Creates a new scorer using `penalty_msat`.
27263  */
27264 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
27265
27266 /**
27267  * Constructs a new Score which calls the relevant methods on this_arg.
27268  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
27269  */
27270 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
27271
27272 /**
27273  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
27274  */
27275 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
27276
27277 /**
27278  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
27279  */
27280 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
27281
27282 /**
27283  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
27284  */
27285 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
27286
27287 /**
27288  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
27289  */
27290 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
27291
27292 /**
27293  * A fixed penalty in msats to apply to each channel.
27294  *
27295  * Default value: 500 msat
27296  */
27297 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27298
27299 /**
27300  * A fixed penalty in msats to apply to each channel.
27301  *
27302  * Default value: 500 msat
27303  */
27304 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27305
27306 /**
27307  * A multiplier used in conjunction with the negative `log10` of the channel's success
27308  * probability for a payment to determine the liquidity penalty.
27309  *
27310  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
27311  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
27312  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
27313  * lower bounding the success probability to `0.01`) when the amount falls within the
27314  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
27315  * result in a `u64::max_value` penalty, however.
27316  *
27317  * Default value: 40,000 msat
27318  *
27319  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
27320  */
27321 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27322
27323 /**
27324  * A multiplier used in conjunction with the negative `log10` of the channel's success
27325  * probability for a payment to determine the liquidity penalty.
27326  *
27327  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
27328  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
27329  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
27330  * lower bounding the success probability to `0.01`) when the amount falls within the
27331  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
27332  * result in a `u64::max_value` penalty, however.
27333  *
27334  * Default value: 40,000 msat
27335  *
27336  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
27337  */
27338 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27339
27340 /**
27341  * The time required to elapse before any knowledge learned about channel liquidity balances is
27342  * cut in half.
27343  *
27344  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
27345  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
27346  * the certainty of the channel liquidity balance.
27347  *
27348  * Default value: 1 hour
27349  *
27350  * # Note
27351  *
27352  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
27353  * liquidity knowledge will never decay except when the bounds cross.
27354  */
27355 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27356
27357 /**
27358  * The time required to elapse before any knowledge learned about channel liquidity balances is
27359  * cut in half.
27360  *
27361  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
27362  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
27363  * the certainty of the channel liquidity balance.
27364  *
27365  * Default value: 1 hour
27366  *
27367  * # Note
27368  *
27369  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
27370  * liquidity knowledge will never decay except when the bounds cross.
27371  */
27372 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27373
27374 /**
27375  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
27376  * channel's success probability for the payment to determine the amount penalty.
27377  *
27378  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
27379  * fees plus penalty) for large payments. The penalty is computed as the product of this
27380  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
27381  * success probability.
27382  *
27383  * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
27384  *
27385  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
27386  * the amount will result in a penalty of the multiplier. And, as the success probability
27387  * decreases, the negative `log10` weighting will increase dramatically. For higher success
27388  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
27389  * fall below `1`.
27390  *
27391  * Default value: 256 msat
27392  */
27393 uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27394
27395 /**
27396  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
27397  * channel's success probability for the payment to determine the amount penalty.
27398  *
27399  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
27400  * fees plus penalty) for large payments. The penalty is computed as the product of this
27401  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
27402  * success probability.
27403  *
27404  * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
27405  *
27406  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
27407  * the amount will result in a penalty of the multiplier. And, as the success probability
27408  * decreases, the negative `log10` weighting will increase dramatically. For higher success
27409  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
27410  * fall below `1`.
27411  *
27412  * Default value: 256 msat
27413  */
27414 void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27415
27416 /**
27417  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
27418  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
27419  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
27420  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
27421  *
27422  * Default value: 250 msat
27423  */
27424 uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27425
27426 /**
27427  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
27428  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
27429  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
27430  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
27431  *
27432  * Default value: 250 msat
27433  */
27434 void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27435
27436 /**
27437  * Creates a copy of the ProbabilisticScoringParameters
27438  */
27439 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
27440
27441 /**
27442  * Creates a new scorer using the given scoring parameters for sending payments from a node
27443  * through a network graph.
27444  */
27445 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
27446
27447 /**
27448  * Dump the contents of this scorer into the configured logger.
27449  *
27450  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
27451  * which may be a substantial amount of log output.
27452  */
27453 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
27454
27455 /**
27456  * Query the estimated minimum and maximum liquidity available for sending a payment over the
27457  * channel with `scid` towards the given `target` node.
27458  */
27459 MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_channel_liquidity_range(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target);
27460
27461 /**
27462  * Marks the node with the given `node_id` as banned, i.e.,
27463  * it will be avoided during path finding.
27464  */
27465 void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
27466
27467 /**
27468  * Removes the node with the given `node_id` from the list of nodes to avoid.
27469  */
27470 void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
27471
27472 /**
27473  * Clears the list of nodes that are avoided during path finding.
27474  */
27475 void ProbabilisticScorer_clear_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
27476
27477 /**
27478  * Marks all nodes in the given list as banned, i.e.,
27479  * they will be avoided during path finding.
27480  */
27481 void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids);
27482
27483 /**
27484  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
27485  */
27486 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
27487
27488 /**
27489  * Constructs a new Score which calls the relevant methods on this_arg.
27490  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
27491  */
27492 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
27493
27494 /**
27495  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
27496  */
27497 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
27498
27499 /**
27500  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
27501  */
27502 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
27503
27504 /**
27505  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
27506  */
27507 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
27508
27509 /**
27510  * Initialize a new FilesystemPersister and set the path to the individual channels'
27511  * files.
27512  */
27513 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
27514
27515 /**
27516  * Get the directory which was provided when this persister was initialized.
27517  */
27518 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
27519
27520 /**
27521  * Read `ChannelMonitor`s from disk.
27522  */
27523 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
27524
27525 /**
27526  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
27527  */
27528 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
27529
27530 /**
27531  * Frees any resources used by the GossipSync
27532  */
27533 void GossipSync_free(struct LDKGossipSync this_ptr);
27534
27535 /**
27536  * Utility method to constructs a new P2P-variant GossipSync
27537  */
27538 struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
27539
27540 /**
27541  * Utility method to constructs a new Rapid-variant GossipSync
27542  */
27543 struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
27544
27545 /**
27546  * Utility method to constructs a new None-variant GossipSync
27547  */
27548 struct LDKGossipSync GossipSync_none(void);
27549
27550 /**
27551  * Start a background thread that takes care of responsibilities enumerated in the [top-level
27552  * documentation].
27553  *
27554  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
27555  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
27556  * either [`join`] or [`stop`].
27557  *
27558  * # Data Persistence
27559  *
27560  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
27561  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
27562  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
27563  * provided implementation.
27564  *
27565  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
27566  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
27567  * See the `lightning-persister` crate for LDK's provided implementation.
27568  *
27569  * Typically, users should either implement [`Persister::persist_manager`] to never return an
27570  * error or call [`join`] and handle any error that may arise. For the latter case,
27571  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
27572  *
27573  * # Event Handling
27574  *
27575  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
27576  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
27577  * functionality implemented by other handlers.
27578  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
27579  *
27580  * # Rapid Gossip Sync
27581  *
27582  * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
27583  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
27584  * until the [`RapidGossipSync`] instance completes its first sync.
27585  *
27586  * [top-level documentation]: BackgroundProcessor
27587  * [`join`]: Self::join
27588  * [`stop`]: Self::stop
27589  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
27590  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
27591  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
27592  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
27593  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
27594  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
27595  *
27596  * Note that scorer (or a relevant inner pointer) may be NULL or all-0s to represent None
27597  */
27598 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger, struct LDKMultiThreadedLockableScore scorer);
27599
27600 /**
27601  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
27602  * [`ChannelManager`].
27603  *
27604  * # Panics
27605  *
27606  * This function panics if the background thread has panicked such as while persisting or
27607  * handling events.
27608  *
27609  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
27610  */
27611 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
27612
27613 /**
27614  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
27615  * [`ChannelManager`].
27616  *
27617  * # Panics
27618  *
27619  * This function panics if the background thread has panicked such as while persisting or
27620  * handling events.
27621  *
27622  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
27623  */
27624 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
27625
27626 /**
27627  * Frees any resources used by the ParseError
27628  */
27629 void ParseError_free(struct LDKParseError this_ptr);
27630
27631 /**
27632  * Creates a copy of the ParseError
27633  */
27634 struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
27635
27636 /**
27637  * Utility method to constructs a new Bech32Error-variant ParseError
27638  */
27639 struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
27640
27641 /**
27642  * Utility method to constructs a new ParseAmountError-variant ParseError
27643  */
27644 struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
27645
27646 /**
27647  * Utility method to constructs a new MalformedSignature-variant ParseError
27648  */
27649 struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
27650
27651 /**
27652  * Utility method to constructs a new BadPrefix-variant ParseError
27653  */
27654 struct LDKParseError ParseError_bad_prefix(void);
27655
27656 /**
27657  * Utility method to constructs a new UnknownCurrency-variant ParseError
27658  */
27659 struct LDKParseError ParseError_unknown_currency(void);
27660
27661 /**
27662  * Utility method to constructs a new UnknownSiPrefix-variant ParseError
27663  */
27664 struct LDKParseError ParseError_unknown_si_prefix(void);
27665
27666 /**
27667  * Utility method to constructs a new MalformedHRP-variant ParseError
27668  */
27669 struct LDKParseError ParseError_malformed_hrp(void);
27670
27671 /**
27672  * Utility method to constructs a new TooShortDataPart-variant ParseError
27673  */
27674 struct LDKParseError ParseError_too_short_data_part(void);
27675
27676 /**
27677  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
27678  */
27679 struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
27680
27681 /**
27682  * Utility method to constructs a new DescriptionDecodeError-variant ParseError
27683  */
27684 struct LDKParseError ParseError_description_decode_error(struct LDKError a);
27685
27686 /**
27687  * Utility method to constructs a new PaddingError-variant ParseError
27688  */
27689 struct LDKParseError ParseError_padding_error(void);
27690
27691 /**
27692  * Utility method to constructs a new IntegerOverflowError-variant ParseError
27693  */
27694 struct LDKParseError ParseError_integer_overflow_error(void);
27695
27696 /**
27697  * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
27698  */
27699 struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
27700
27701 /**
27702  * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
27703  */
27704 struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
27705
27706 /**
27707  * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
27708  */
27709 struct LDKParseError ParseError_invalid_script_hash_length(void);
27710
27711 /**
27712  * Utility method to constructs a new InvalidRecoveryId-variant ParseError
27713  */
27714 struct LDKParseError ParseError_invalid_recovery_id(void);
27715
27716 /**
27717  * Utility method to constructs a new InvalidSliceLength-variant ParseError
27718  */
27719 struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
27720
27721 /**
27722  * Utility method to constructs a new Skip-variant ParseError
27723  */
27724 struct LDKParseError ParseError_skip(void);
27725
27726 /**
27727  * Frees any resources used by the ParseOrSemanticError
27728  */
27729 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
27730
27731 /**
27732  * Creates a copy of the ParseOrSemanticError
27733  */
27734 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
27735
27736 /**
27737  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
27738  */
27739 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
27740
27741 /**
27742  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
27743  */
27744 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
27745
27746 /**
27747  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
27748  */
27749 void Invoice_free(struct LDKInvoice this_obj);
27750
27751 /**
27752  * Checks if two Invoices contain equal inner contents.
27753  * This ignores pointers and is_owned flags and looks at the values in fields.
27754  * Two objects with NULL inner values will be considered "equal" here.
27755  */
27756 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
27757
27758 /**
27759  * Creates a copy of the Invoice
27760  */
27761 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
27762
27763 /**
27764  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
27765  */
27766 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
27767
27768 /**
27769  * Checks if two SignedRawInvoices contain equal inner contents.
27770  * This ignores pointers and is_owned flags and looks at the values in fields.
27771  * Two objects with NULL inner values will be considered "equal" here.
27772  */
27773 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
27774
27775 /**
27776  * Creates a copy of the SignedRawInvoice
27777  */
27778 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
27779
27780 /**
27781  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
27782  */
27783 void RawInvoice_free(struct LDKRawInvoice this_obj);
27784
27785 /**
27786  * data part
27787  */
27788 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
27789
27790 /**
27791  * data part
27792  */
27793 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
27794
27795 /**
27796  * Checks if two RawInvoices contain equal inner contents.
27797  * This ignores pointers and is_owned flags and looks at the values in fields.
27798  * Two objects with NULL inner values will be considered "equal" here.
27799  */
27800 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
27801
27802 /**
27803  * Creates a copy of the RawInvoice
27804  */
27805 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
27806
27807 /**
27808  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
27809  */
27810 void RawDataPart_free(struct LDKRawDataPart this_obj);
27811
27812 /**
27813  * generation time of the invoice
27814  */
27815 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
27816
27817 /**
27818  * generation time of the invoice
27819  */
27820 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
27821
27822 /**
27823  * Checks if two RawDataParts contain equal inner contents.
27824  * This ignores pointers and is_owned flags and looks at the values in fields.
27825  * Two objects with NULL inner values will be considered "equal" here.
27826  */
27827 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
27828
27829 /**
27830  * Creates a copy of the RawDataPart
27831  */
27832 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
27833
27834 /**
27835  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
27836  */
27837 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
27838
27839 /**
27840  * Checks if two PositiveTimestamps contain equal inner contents.
27841  * This ignores pointers and is_owned flags and looks at the values in fields.
27842  * Two objects with NULL inner values will be considered "equal" here.
27843  */
27844 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
27845
27846 /**
27847  * Creates a copy of the PositiveTimestamp
27848  */
27849 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
27850
27851 /**
27852  * Creates a copy of the SiPrefix
27853  */
27854 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
27855
27856 /**
27857  * Utility method to constructs a new Milli-variant SiPrefix
27858  */
27859 enum LDKSiPrefix SiPrefix_milli(void);
27860
27861 /**
27862  * Utility method to constructs a new Micro-variant SiPrefix
27863  */
27864 enum LDKSiPrefix SiPrefix_micro(void);
27865
27866 /**
27867  * Utility method to constructs a new Nano-variant SiPrefix
27868  */
27869 enum LDKSiPrefix SiPrefix_nano(void);
27870
27871 /**
27872  * Utility method to constructs a new Pico-variant SiPrefix
27873  */
27874 enum LDKSiPrefix SiPrefix_pico(void);
27875
27876 /**
27877  * Checks if two SiPrefixs contain equal inner contents.
27878  * This ignores pointers and is_owned flags and looks at the values in fields.
27879  */
27880 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
27881
27882 /**
27883  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
27884  * This is effectively 10^12 * the prefix multiplier
27885  */
27886 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
27887
27888 /**
27889  * Creates a copy of the Currency
27890  */
27891 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
27892
27893 /**
27894  * Utility method to constructs a new Bitcoin-variant Currency
27895  */
27896 enum LDKCurrency Currency_bitcoin(void);
27897
27898 /**
27899  * Utility method to constructs a new BitcoinTestnet-variant Currency
27900  */
27901 enum LDKCurrency Currency_bitcoin_testnet(void);
27902
27903 /**
27904  * Utility method to constructs a new Regtest-variant Currency
27905  */
27906 enum LDKCurrency Currency_regtest(void);
27907
27908 /**
27909  * Utility method to constructs a new Simnet-variant Currency
27910  */
27911 enum LDKCurrency Currency_simnet(void);
27912
27913 /**
27914  * Utility method to constructs a new Signet-variant Currency
27915  */
27916 enum LDKCurrency Currency_signet(void);
27917
27918 /**
27919  * Checks if two Currencys contain equal inner contents.
27920  */
27921 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
27922
27923 /**
27924  * Checks if two Currencys contain equal inner contents.
27925  * This ignores pointers and is_owned flags and looks at the values in fields.
27926  */
27927 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
27928
27929 /**
27930  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
27931  */
27932 void Sha256_free(struct LDKSha256 this_obj);
27933
27934 /**
27935  * Creates a copy of the Sha256
27936  */
27937 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
27938
27939 /**
27940  * Checks if two Sha256s contain equal inner contents.
27941  */
27942 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
27943
27944 /**
27945  * Checks if two Sha256s contain equal inner contents.
27946  * This ignores pointers and is_owned flags and looks at the values in fields.
27947  * Two objects with NULL inner values will be considered "equal" here.
27948  */
27949 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
27950
27951 /**
27952  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
27953  */
27954 void Description_free(struct LDKDescription this_obj);
27955
27956 /**
27957  * Creates a copy of the Description
27958  */
27959 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
27960
27961 /**
27962  * Checks if two Descriptions contain equal inner contents.
27963  */
27964 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
27965
27966 /**
27967  * Checks if two Descriptions contain equal inner contents.
27968  * This ignores pointers and is_owned flags and looks at the values in fields.
27969  * Two objects with NULL inner values will be considered "equal" here.
27970  */
27971 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
27972
27973 /**
27974  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
27975  */
27976 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
27977
27978 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
27979
27980 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27981
27982 /**
27983  * Constructs a new PayeePubKey given each field
27984  */
27985 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
27986
27987 /**
27988  * Creates a copy of the PayeePubKey
27989  */
27990 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
27991
27992 /**
27993  * Checks if two PayeePubKeys contain equal inner contents.
27994  */
27995 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
27996
27997 /**
27998  * Checks if two PayeePubKeys contain equal inner contents.
27999  * This ignores pointers and is_owned flags and looks at the values in fields.
28000  * Two objects with NULL inner values will be considered "equal" here.
28001  */
28002 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
28003
28004 /**
28005  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
28006  */
28007 void ExpiryTime_free(struct LDKExpiryTime this_obj);
28008
28009 /**
28010  * Creates a copy of the ExpiryTime
28011  */
28012 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
28013
28014 /**
28015  * Checks if two ExpiryTimes contain equal inner contents.
28016  */
28017 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
28018
28019 /**
28020  * Checks if two ExpiryTimes contain equal inner contents.
28021  * This ignores pointers and is_owned flags and looks at the values in fields.
28022  * Two objects with NULL inner values will be considered "equal" here.
28023  */
28024 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
28025
28026 /**
28027  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
28028  */
28029 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
28030
28031 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
28032
28033 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
28034
28035 /**
28036  * Constructs a new MinFinalCltvExpiry given each field
28037  */
28038 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
28039
28040 /**
28041  * Creates a copy of the MinFinalCltvExpiry
28042  */
28043 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
28044
28045 /**
28046  * Checks if two MinFinalCltvExpirys contain equal inner contents.
28047  */
28048 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
28049
28050 /**
28051  * Checks if two MinFinalCltvExpirys contain equal inner contents.
28052  * This ignores pointers and is_owned flags and looks at the values in fields.
28053  * Two objects with NULL inner values will be considered "equal" here.
28054  */
28055 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
28056
28057 /**
28058  * Frees any resources used by the Fallback
28059  */
28060 void Fallback_free(struct LDKFallback this_ptr);
28061
28062 /**
28063  * Creates a copy of the Fallback
28064  */
28065 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
28066
28067 /**
28068  * Utility method to constructs a new SegWitProgram-variant Fallback
28069  */
28070 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
28071
28072 /**
28073  * Utility method to constructs a new PubKeyHash-variant Fallback
28074  */
28075 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
28076
28077 /**
28078  * Utility method to constructs a new ScriptHash-variant Fallback
28079  */
28080 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
28081
28082 /**
28083  * Checks if two Fallbacks contain equal inner contents.
28084  */
28085 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
28086
28087 /**
28088  * Checks if two Fallbacks contain equal inner contents.
28089  * This ignores pointers and is_owned flags and looks at the values in fields.
28090  */
28091 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
28092
28093 /**
28094  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
28095  */
28096 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
28097
28098 /**
28099  * Creates a copy of the InvoiceSignature
28100  */
28101 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
28102
28103 /**
28104  * Checks if two InvoiceSignatures contain equal inner contents.
28105  * This ignores pointers and is_owned flags and looks at the values in fields.
28106  * Two objects with NULL inner values will be considered "equal" here.
28107  */
28108 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
28109
28110 /**
28111  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
28112  */
28113 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
28114
28115 /**
28116  * Creates a copy of the PrivateRoute
28117  */
28118 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
28119
28120 /**
28121  * Checks if two PrivateRoutes contain equal inner contents.
28122  */
28123 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
28124
28125 /**
28126  * Checks if two PrivateRoutes contain equal inner contents.
28127  * This ignores pointers and is_owned flags and looks at the values in fields.
28128  * Two objects with NULL inner values will be considered "equal" here.
28129  */
28130 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
28131
28132 /**
28133  * Disassembles the `SignedRawInvoice` into its three parts:
28134  *  1. raw invoice
28135  *  2. hash of the raw invoice
28136  *  3. signature
28137  */
28138 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
28139
28140 /**
28141  * The `RawInvoice` which was signed.
28142  */
28143 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
28144
28145 /**
28146  * The hash of the `RawInvoice` that was signed.
28147  */
28148 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
28149
28150 /**
28151  * InvoiceSignature for the invoice.
28152  */
28153 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
28154
28155 /**
28156  * Recovers the public key used for signing the invoice from the recoverable signature.
28157  */
28158 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
28159
28160 /**
28161  * Checks if the signature is valid for the included payee public key or if none exists if it's
28162  * valid for the recovered signature (which should always be true?).
28163  */
28164 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
28165
28166 /**
28167  * Calculate the hash of the encoded `RawInvoice`
28168  */
28169 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28170
28171 /**
28172  *
28173  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28174  */
28175 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28176
28177 /**
28178  *
28179  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28180  */
28181 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28182
28183 /**
28184  *
28185  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28186  */
28187 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28188
28189 /**
28190  *
28191  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28192  */
28193 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28194
28195 /**
28196  *
28197  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28198  */
28199 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28200
28201 /**
28202  *
28203  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28204  */
28205 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28206
28207 /**
28208  *
28209  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28210  */
28211 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28212
28213 /**
28214  *
28215  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28216  */
28217 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28218
28219 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28220
28221 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28222
28223 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28224
28225 /**
28226  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
28227  *
28228  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
28229  */
28230 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
28231
28232 /**
28233  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
28234  * the range `0..=MAX_TIMESTAMP`.
28235  *
28236  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
28237  */
28238 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
28239
28240 /**
28241  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
28242  * `0..=MAX_TIMESTAMP`.
28243  *
28244  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
28245  */
28246 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
28247
28248 /**
28249  * Returns the Unix timestamp representing the stored time
28250  */
28251 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
28252
28253 /**
28254  * Returns the duration of the stored time since the Unix epoch
28255  */
28256 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
28257
28258 /**
28259  * Returns the [`SystemTime`] representing the stored time
28260  */
28261 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
28262
28263 /**
28264  * Transform the `Invoice` into it's unchecked version
28265  */
28266 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
28267
28268 /**
28269  * Check that the invoice is signed correctly and that key recovery works
28270  */
28271 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
28272
28273 /**
28274  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
28275  * ```
28276  * use lightning_invoice::*;
28277  *
28278  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
28279  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
28280  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
28281  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
28282  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
28283  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
28284  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
28285  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
28286  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
28287  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
28288  * j5r6drg6k6zcqj0fcwg\";
28289  *
28290  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
28291  *
28292  * assert!(Invoice::from_signed(signed).is_ok());
28293  * ```
28294  */
28295 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
28296
28297 /**
28298  * Returns the `Invoice`'s timestamp (should equal its creation time)
28299  */
28300 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
28301
28302 /**
28303  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
28304  */
28305 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
28306
28307 /**
28308  * Returns the hash to which we will receive the preimage on completion of the payment
28309  */
28310 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
28311
28312 /**
28313  * Get the payee's public key if one was included in the invoice
28314  *
28315  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28316  */
28317 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
28318
28319 /**
28320  * Get the payment secret if one was included in the invoice
28321  */
28322 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
28323
28324 /**
28325  * Get the invoice features if they were included in the invoice
28326  *
28327  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28328  */
28329 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
28330
28331 /**
28332  * Recover the payee's public key (only to be used if none was included in the invoice)
28333  */
28334 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
28335
28336 /**
28337  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
28338  */
28339 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
28340
28341 /**
28342  * Returns whether the invoice has expired.
28343  */
28344 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
28345
28346 /**
28347  * Returns whether the expiry time would pass at the given point in time.
28348  * `at_time` is the timestamp as a duration since the Unix epoch.
28349  */
28350 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
28351
28352 /**
28353  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
28354  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
28355  */
28356 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
28357
28358 /**
28359  * Returns a list of all routes included in the invoice
28360  */
28361 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
28362
28363 /**
28364  * Returns a list of all routes included in the invoice as the underlying hints
28365  */
28366 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
28367
28368 /**
28369  * Returns the currency for which the invoice was issued
28370  */
28371 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
28372
28373 /**
28374  * Returns the amount if specified in the invoice as millisatoshis.
28375  */
28376 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
28377
28378 /**
28379  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
28380  * returns `CreationError::DescriptionTooLong` otherwise
28381  *
28382  * Please note that single characters may use more than one byte due to UTF8 encoding.
28383  */
28384 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
28385
28386 /**
28387  * Returns the underlying description `String`
28388  */
28389 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
28390
28391 /**
28392  * Construct an `ExpiryTime` from seconds.
28393  */
28394 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
28395
28396 /**
28397  * Construct an `ExpiryTime` from a `Duration`.
28398  */
28399 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
28400
28401 /**
28402  * Returns the expiry time in seconds
28403  */
28404 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
28405
28406 /**
28407  * Returns a reference to the underlying `Duration` (=expiry time)
28408  */
28409 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
28410
28411 /**
28412  * Creates a new (partial) route from a list of hops
28413  */
28414 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
28415
28416 /**
28417  * Returns the underlying list of hops
28418  */
28419 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
28420
28421 /**
28422  * Creates a copy of the CreationError
28423  */
28424 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
28425
28426 /**
28427  * Utility method to constructs a new DescriptionTooLong-variant CreationError
28428  */
28429 enum LDKCreationError CreationError_description_too_long(void);
28430
28431 /**
28432  * Utility method to constructs a new RouteTooLong-variant CreationError
28433  */
28434 enum LDKCreationError CreationError_route_too_long(void);
28435
28436 /**
28437  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
28438  */
28439 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
28440
28441 /**
28442  * Utility method to constructs a new InvalidAmount-variant CreationError
28443  */
28444 enum LDKCreationError CreationError_invalid_amount(void);
28445
28446 /**
28447  * Utility method to constructs a new MissingRouteHints-variant CreationError
28448  */
28449 enum LDKCreationError CreationError_missing_route_hints(void);
28450
28451 /**
28452  * Checks if two CreationErrors contain equal inner contents.
28453  * This ignores pointers and is_owned flags and looks at the values in fields.
28454  */
28455 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
28456
28457 /**
28458  * Get the string representation of a CreationError object
28459  */
28460 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
28461
28462 /**
28463  * Creates a copy of the SemanticError
28464  */
28465 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
28466
28467 /**
28468  * Utility method to constructs a new NoPaymentHash-variant SemanticError
28469  */
28470 enum LDKSemanticError SemanticError_no_payment_hash(void);
28471
28472 /**
28473  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
28474  */
28475 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
28476
28477 /**
28478  * Utility method to constructs a new NoDescription-variant SemanticError
28479  */
28480 enum LDKSemanticError SemanticError_no_description(void);
28481
28482 /**
28483  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
28484  */
28485 enum LDKSemanticError SemanticError_multiple_descriptions(void);
28486
28487 /**
28488  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
28489  */
28490 enum LDKSemanticError SemanticError_no_payment_secret(void);
28491
28492 /**
28493  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
28494  */
28495 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
28496
28497 /**
28498  * Utility method to constructs a new InvalidFeatures-variant SemanticError
28499  */
28500 enum LDKSemanticError SemanticError_invalid_features(void);
28501
28502 /**
28503  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
28504  */
28505 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
28506
28507 /**
28508  * Utility method to constructs a new InvalidSignature-variant SemanticError
28509  */
28510 enum LDKSemanticError SemanticError_invalid_signature(void);
28511
28512 /**
28513  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
28514  */
28515 enum LDKSemanticError SemanticError_imprecise_amount(void);
28516
28517 /**
28518  * Checks if two SemanticErrors contain equal inner contents.
28519  * This ignores pointers and is_owned flags and looks at the values in fields.
28520  */
28521 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
28522
28523 /**
28524  * Get the string representation of a SemanticError object
28525  */
28526 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
28527
28528 /**
28529  * Frees any resources used by the SignOrCreationError
28530  */
28531 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
28532
28533 /**
28534  * Creates a copy of the SignOrCreationError
28535  */
28536 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
28537
28538 /**
28539  * Utility method to constructs a new SignError-variant SignOrCreationError
28540  */
28541 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
28542
28543 /**
28544  * Utility method to constructs a new CreationError-variant SignOrCreationError
28545  */
28546 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
28547
28548 /**
28549  * Checks if two SignOrCreationErrors contain equal inner contents.
28550  * This ignores pointers and is_owned flags and looks at the values in fields.
28551  */
28552 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
28553
28554 /**
28555  * Get the string representation of a SignOrCreationError object
28556  */
28557 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
28558
28559 /**
28560  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
28561  */
28562 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
28563
28564 /**
28565  * Calls the free function if one is set
28566  */
28567 void Payer_free(struct LDKPayer this_ptr);
28568
28569 /**
28570  * Calls the free function if one is set
28571  */
28572 void Router_free(struct LDKRouter this_ptr);
28573
28574 /**
28575  * Frees any resources used by the Retry
28576  */
28577 void Retry_free(struct LDKRetry this_ptr);
28578
28579 /**
28580  * Creates a copy of the Retry
28581  */
28582 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
28583
28584 /**
28585  * Utility method to constructs a new Attempts-variant Retry
28586  */
28587 struct LDKRetry Retry_attempts(uintptr_t a);
28588
28589 /**
28590  * Utility method to constructs a new Timeout-variant Retry
28591  */
28592 struct LDKRetry Retry_timeout(uint64_t a);
28593
28594 /**
28595  * Checks if two Retrys contain equal inner contents.
28596  * This ignores pointers and is_owned flags and looks at the values in fields.
28597  */
28598 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
28599
28600 /**
28601  * Checks if two Retrys contain equal inner contents.
28602  */
28603 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
28604
28605 /**
28606  * Frees any resources used by the PaymentError
28607  */
28608 void PaymentError_free(struct LDKPaymentError this_ptr);
28609
28610 /**
28611  * Creates a copy of the PaymentError
28612  */
28613 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
28614
28615 /**
28616  * Utility method to constructs a new Invoice-variant PaymentError
28617  */
28618 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
28619
28620 /**
28621  * Utility method to constructs a new Routing-variant PaymentError
28622  */
28623 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
28624
28625 /**
28626  * Utility method to constructs a new Sending-variant PaymentError
28627  */
28628 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
28629
28630 /**
28631  * Creates an invoice payer that retries failed payment paths.
28632  *
28633  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
28634  * `retry` has been exceeded for a given [`Invoice`].
28635  */
28636 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 LDKRetry retry);
28637
28638 /**
28639  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
28640  *
28641  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
28642  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
28643  * for you.
28644  */
28645 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
28646
28647 /**
28648  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
28649  * case a retry is needed.
28650  *
28651  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
28652  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
28653  * for you.
28654  */
28655 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);
28656
28657 /**
28658  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
28659  * case a retry is needed.
28660  *
28661  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
28662  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
28663  */
28664 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);
28665
28666 /**
28667  * Removes the payment cached by the given payment hash.
28668  *
28669  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
28670  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
28671  */
28672 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
28673
28674 /**
28675  * Constructs a new EventHandler which calls the relevant methods on this_arg.
28676  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
28677  */
28678 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
28679
28680 /**
28681  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
28682  * See [`PhantomKeysManager`] for more information on phantom node payments.
28683  *
28684  * `phantom_route_hints` parameter:
28685  * * Contains channel info for all nodes participating in the phantom invoice
28686  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
28687  *   participating node
28688  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
28689  *   updated when a channel becomes disabled or closes
28690  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
28691  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
28692  *   down
28693  *
28694  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
28695  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
28696  * If `None` is provided for `payment_hash`, then one will be created.
28697  *
28698  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28699  * in excess of the current time.
28700  *
28701  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
28702  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
28703  * requirement).
28704  *
28705  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
28706  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
28707  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
28708  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
28709  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
28710  *
28711  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
28712  */
28713 struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
28714
28715 /**
28716  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
28717  * See [`PhantomKeysManager`] for more information on phantom node payments.
28718  *
28719  * `phantom_route_hints` parameter:
28720  * * Contains channel info for all nodes participating in the phantom invoice
28721  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
28722  *   participating node
28723  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
28724  *   updated when a channel becomes disabled or closes
28725  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
28726  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
28727  *   down
28728  *
28729  * `description_hash` is a SHA-256 hash of the description text
28730  *
28731  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
28732  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
28733  * If `None` is provided for `payment_hash`, then one will be created.
28734  *
28735  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28736  * in excess of the current time.
28737  *
28738  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
28739  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
28740  * requirement).
28741  *
28742  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
28743  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
28744  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
28745  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
28746  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
28747  *
28748  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
28749  */
28750 struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network);
28751
28752 /**
28753  * Utility to construct an invoice. Generally, unless you want to do something like a custom
28754  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
28755  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
28756  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
28757  * that the payment secret is valid when the invoice is paid.
28758  *
28759  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28760  * in excess of the current time.
28761  */
28762 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, uint32_t invoice_expiry_delta_secs);
28763
28764 /**
28765  * Utility to construct an invoice. Generally, unless you want to do something like a custom
28766  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
28767  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
28768  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
28769  * that the payment secret is valid when the invoice is paid.
28770  * Use this variant if you want to pass the `description_hash` to the invoice.
28771  *
28772  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28773  * in excess of the current time.
28774  */
28775 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, uint32_t invoice_expiry_delta_secs);
28776
28777 /**
28778  * See [`create_invoice_from_channelmanager_with_description_hash`]
28779  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
28780  * available and the current time is supplied by the caller.
28781  */
28782 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, uint32_t invoice_expiry_delta_secs);
28783
28784 /**
28785  * See [`create_invoice_from_channelmanager`]
28786  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
28787  * available and the current time is supplied by the caller.
28788  */
28789 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, uint32_t invoice_expiry_delta_secs);
28790
28791 /**
28792  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
28793  */
28794 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
28795
28796 /**
28797  * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source
28798  * `random_seed_bytes`.
28799  */
28800 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes);
28801
28802 /**
28803  * Constructs a new Router which calls the relevant methods on this_arg.
28804  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
28805  */
28806 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
28807
28808 /**
28809  * Constructs a new Payer which calls the relevant methods on this_arg.
28810  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
28811  */
28812 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
28813
28814 /**
28815  * Read a SiPrefix object from a string
28816  */
28817 struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
28818
28819 /**
28820  * Read a Invoice object from a string
28821  */
28822 struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
28823
28824 /**
28825  * Read a SignedRawInvoice object from a string
28826  */
28827 struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
28828
28829 /**
28830  * Get the string representation of a ParseError object
28831  */
28832 struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
28833
28834 /**
28835  * Get the string representation of a ParseOrSemanticError object
28836  */
28837 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
28838
28839 /**
28840  * Get the string representation of a Invoice object
28841  */
28842 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
28843
28844 /**
28845  * Get the string representation of a SignedRawInvoice object
28846  */
28847 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
28848
28849 /**
28850  * Get the string representation of a Currency object
28851  */
28852 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
28853
28854 /**
28855  * Get the string representation of a SiPrefix object
28856  */
28857 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
28858
28859 /**
28860  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
28861  */
28862 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
28863
28864 /**
28865  * Instantiate a new [`RapidGossipSync`] instance
28866  */
28867 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph);
28868
28869 /**
28870  * Sync gossip data from a file
28871  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
28872  *
28873  * `network_graph`: The network graph to apply the updates to
28874  *
28875  * `sync_path`: Path to the file where the gossip update data is located
28876  *
28877  */
28878 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path);
28879
28880 /**
28881  * Returns whether a rapid gossip sync has completed at least once
28882  */
28883 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
28884
28885 /**
28886  * Frees any resources used by the GraphSyncError
28887  */
28888 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
28889
28890 /**
28891  * Creates a copy of the GraphSyncError
28892  */
28893 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
28894
28895 /**
28896  * Utility method to constructs a new DecodeError-variant GraphSyncError
28897  */
28898 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
28899
28900 /**
28901  * Utility method to constructs a new LightningError-variant GraphSyncError
28902  */
28903 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
28904
28905 /**
28906  * Update network graph from binary data.
28907  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
28908  *
28909  * `network_graph`: network graph to be updated
28910  *
28911  * `update_data`: `&[u8]` binary stream that comprises the update data
28912  */
28913 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
28914
28915 #endif /* LDK_C_BINDINGS_H */
28916
28917 #include "ldk_ver.h"