Update auto-generated bindings
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.20.0 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include "ldk_rust_types.h"
12
13 /**
14  * An error when accessing the chain via [`Access`].
15  */
16 typedef enum LDKAccessError {
17    /**
18     * The requested chain is unknown.
19     */
20    LDKAccessError_UnknownChain,
21    /**
22     * The requested transaction doesn't exist or hasn't confirmed.
23     */
24    LDKAccessError_UnknownTx,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKAccessError_Sentinel,
29 } LDKAccessError;
30
31 /**
32  * An enum which can either contain a  or not
33  */
34 typedef enum LDKCOption_NoneZ {
35    /**
36     * When we're in this state, this COption_NoneZ contains a
37     */
38    LDKCOption_NoneZ_Some,
39    /**
40     * When we're in this state, this COption_NoneZ contains nothing
41     */
42    LDKCOption_NoneZ_None,
43    /**
44     * Must be last for serialization purposes
45     */
46    LDKCOption_NoneZ_Sentinel,
47 } LDKCOption_NoneZ;
48
49 /**
50  * An error enum representing a failure to persist a channel monitor update.
51  */
52 typedef enum LDKChannelMonitorUpdateErr {
53    /**
54     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
55     * our state failed, but is expected to succeed at some point in the future).
56     *
57     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
58     * submitting new commitment transactions to the counterparty. Once the update(s) that failed
59     * have been successfully applied, a [`MonitorEvent::UpdateCompleted`] event should be returned
60     * via [`Watch::release_pending_monitor_events`] which will then restore the channel to an
61     * operational state.
62     *
63     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
64     * you return a TemporaryFailure you must ensure that it is written to disk safely before
65     * writing out the latest ChannelManager state.
66     *
67     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
68     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
69     * to claim it on this channel) and those updates must be applied wherever they can be. At
70     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
71     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
72     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
73     * been \"frozen\".
74     *
75     * Note that even if updates made after TemporaryFailure succeed you must still provide a
76     * [`MonitorEvent::UpdateCompleted`] to ensure you have the latest monitor and re-enable
77     * normal channel operation. Note that this is normally generated through a call to
78     * [`ChainMonitor::channel_monitor_updated`].
79     *
80     * Note that the update being processed here will not be replayed for you when you return a
81     * [`MonitorEvent::UpdateCompleted`] event via [`Watch::release_pending_monitor_events`], so
82     * you must store the update itself on your own local disk prior to returning a
83     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
84     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
85     * reload-time.
86     *
87     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
88     * remote location (with local copies persisted immediately), it is anticipated that all
89     * updates will return TemporaryFailure until the remote copies could be updated.
90     *
91     * [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated
92     */
93    LDKChannelMonitorUpdateErr_TemporaryFailure,
94    /**
95     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
96     * different watchtower and cannot update with all watchtowers that were previously informed
97     * of this channel).
98     *
99     * At reception of this error, ChannelManager will force-close the channel and return at
100     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
101     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
102     * update must be rejected.
103     *
104     * This failure may also signal a failure to update the local persisted copy of one of
105     * the channel monitor instance.
106     *
107     * Note that even when you fail a holder commitment transaction update, you must store the
108     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
109     * broadcasts it (e.g distributed channel-monitor deployment)
110     *
111     * In case of distributed watchtowers deployment, the new version must be written to disk, as
112     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
113     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
114     * lagging behind on block processing.
115     */
116    LDKChannelMonitorUpdateErr_PermanentFailure,
117    /**
118     * Must be last for serialization purposes
119     */
120    LDKChannelMonitorUpdateErr_Sentinel,
121 } LDKChannelMonitorUpdateErr;
122
123 /**
124  * An enum that represents the speed at which we want a transaction to confirm used for feerate
125  * estimation.
126  */
127 typedef enum LDKConfirmationTarget {
128    /**
129     * We are happy with this transaction confirming slowly when feerate drops some.
130     */
131    LDKConfirmationTarget_Background,
132    /**
133     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
134     */
135    LDKConfirmationTarget_Normal,
136    /**
137     * We'd like this transaction to confirm in the next few blocks.
138     */
139    LDKConfirmationTarget_HighPriority,
140    /**
141     * Must be last for serialization purposes
142     */
143    LDKConfirmationTarget_Sentinel,
144 } LDKConfirmationTarget;
145
146 /**
147  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
148  */
149 typedef enum LDKCreationError {
150    /**
151     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
152     */
153    LDKCreationError_DescriptionTooLong,
154    /**
155     * The specified route has too many hops and can't be encoded
156     */
157    LDKCreationError_RouteTooLong,
158    /**
159     * The Unix timestamp of the supplied date is less than zero or greater than 35-bits
160     */
161    LDKCreationError_TimestampOutOfBounds,
162    /**
163     * The supplied millisatoshi amount was greater than the total bitcoin supply.
164     */
165    LDKCreationError_InvalidAmount,
166    /**
167     * Route hints were required for this invoice and were missing. Applies to
168     * [phantom invoices].
169     *
170     * [phantom invoices]: crate::utils::create_phantom_invoice
171     */
172    LDKCreationError_MissingRouteHints,
173    /**
174     * Must be last for serialization purposes
175     */
176    LDKCreationError_Sentinel,
177 } LDKCreationError;
178
179 /**
180  * Enum representing the crypto currencies (or networks) supported by this library
181  */
182 typedef enum LDKCurrency {
183    /**
184     * Bitcoin mainnet
185     */
186    LDKCurrency_Bitcoin,
187    /**
188     * Bitcoin testnet
189     */
190    LDKCurrency_BitcoinTestnet,
191    /**
192     * Bitcoin regtest
193     */
194    LDKCurrency_Regtest,
195    /**
196     * Bitcoin simnet
197     */
198    LDKCurrency_Simnet,
199    /**
200     * Bitcoin signet
201     */
202    LDKCurrency_Signet,
203    /**
204     * Must be last for serialization purposes
205     */
206    LDKCurrency_Sentinel,
207 } LDKCurrency;
208
209 /**
210  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
211  */
212 typedef enum LDKIOError {
213    LDKIOError_NotFound,
214    LDKIOError_PermissionDenied,
215    LDKIOError_ConnectionRefused,
216    LDKIOError_ConnectionReset,
217    LDKIOError_ConnectionAborted,
218    LDKIOError_NotConnected,
219    LDKIOError_AddrInUse,
220    LDKIOError_AddrNotAvailable,
221    LDKIOError_BrokenPipe,
222    LDKIOError_AlreadyExists,
223    LDKIOError_WouldBlock,
224    LDKIOError_InvalidInput,
225    LDKIOError_InvalidData,
226    LDKIOError_TimedOut,
227    LDKIOError_WriteZero,
228    LDKIOError_Interrupted,
229    LDKIOError_Other,
230    LDKIOError_UnexpectedEof,
231    /**
232     * Must be last for serialization purposes
233     */
234    LDKIOError_Sentinel,
235 } LDKIOError;
236
237 /**
238  * An enum representing the available verbosity levels of the logger.
239  */
240 typedef enum LDKLevel {
241    /**
242     * Designates extremely verbose information, including gossip-induced messages
243     */
244    LDKLevel_Gossip,
245    /**
246     * Designates very low priority, often extremely verbose, information
247     */
248    LDKLevel_Trace,
249    /**
250     * Designates lower priority information
251     */
252    LDKLevel_Debug,
253    /**
254     * Designates useful information
255     */
256    LDKLevel_Info,
257    /**
258     * Designates hazardous situations
259     */
260    LDKLevel_Warn,
261    /**
262     * Designates very serious errors
263     */
264    LDKLevel_Error,
265    /**
266     * Must be last for serialization purposes
267     */
268    LDKLevel_Sentinel,
269 } LDKLevel;
270
271 /**
272  * An enum representing the possible Bitcoin or test networks which we can run on
273  */
274 typedef enum LDKNetwork {
275    /**
276     * The main Bitcoin blockchain.
277     */
278    LDKNetwork_Bitcoin,
279    /**
280     * The testnet3 blockchain.
281     */
282    LDKNetwork_Testnet,
283    /**
284     * A local test blockchain.
285     */
286    LDKNetwork_Regtest,
287    /**
288     * A blockchain on which blocks are signed instead of mined.
289     */
290    LDKNetwork_Signet,
291    /**
292     * Must be last for serialization purposes
293     */
294    LDKNetwork_Sentinel,
295 } LDKNetwork;
296
297 /**
298  * Specifies the recipient of an invoice, to indicate to [`KeysInterface::sign_invoice`] what node
299  * secret key should be used to sign the invoice.
300  */
301 typedef enum LDKRecipient {
302    /**
303     * The invoice should be signed with the local node secret key.
304     */
305    LDKRecipient_Node,
306    /**
307     * The invoice should be signed with the phantom node secret key. This secret key must be the
308     * same for all nodes participating in the [phantom node payment].
309     *
310     * [phantom node payment]: PhantomKeysManager
311     */
312    LDKRecipient_PhantomNode,
313    /**
314     * Must be last for serialization purposes
315     */
316    LDKRecipient_Sentinel,
317 } LDKRecipient;
318
319 /**
320  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
321  */
322 typedef enum LDKSecp256k1Error {
323    /**
324     * Signature failed verification
325     */
326    LDKSecp256k1Error_IncorrectSignature,
327    /**
328     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
329     */
330    LDKSecp256k1Error_InvalidMessage,
331    /**
332     * Bad public key
333     */
334    LDKSecp256k1Error_InvalidPublicKey,
335    /**
336     * Bad signature
337     */
338    LDKSecp256k1Error_InvalidSignature,
339    /**
340     * Bad secret key
341     */
342    LDKSecp256k1Error_InvalidSecretKey,
343    /**
344     * Bad 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
1564 /**
1565  * Represents the compressed public key of a node
1566  */
1567 typedef struct MUST_USE_STRUCT LDKNodeId {
1568    /**
1569     * A pointer to the opaque Rust object.
1570     * Nearly everywhere, inner must be non-null, however in places where
1571     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1572     */
1573    LDKnativeNodeId *inner;
1574    /**
1575     * Indicates that this is the only struct which contains the same pointer.
1576     * Rust functions which take ownership of an object provided via an argument require
1577     * this to be true and invalidate the object pointed to by inner.
1578     */
1579    bool is_owned;
1580 } LDKNodeId;
1581
1582
1583
1584 /**
1585  * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
1586  */
1587 typedef struct MUST_USE_STRUCT LDKChannelUsage {
1588    /**
1589     * A pointer to the opaque Rust object.
1590     * Nearly everywhere, inner must be non-null, however in places where
1591     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1592     */
1593    LDKnativeChannelUsage *inner;
1594    /**
1595     * Indicates that this is the only struct which contains the same pointer.
1596     * Rust functions which take ownership of an object provided via an argument require
1597     * this to be true and invalidate the object pointed to by inner.
1598     */
1599    bool is_owned;
1600 } LDKChannelUsage;
1601
1602
1603
1604 /**
1605  * A hop in a route
1606  */
1607 typedef struct MUST_USE_STRUCT LDKRouteHop {
1608    /**
1609     * A pointer to the opaque Rust object.
1610     * Nearly everywhere, inner must be non-null, however in places where
1611     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1612     */
1613    LDKnativeRouteHop *inner;
1614    /**
1615     * Indicates that this is the only struct which contains the same pointer.
1616     * Rust functions which take ownership of an object provided via an argument require
1617     * this to be true and invalidate the object pointed to by inner.
1618     */
1619    bool is_owned;
1620 } LDKRouteHop;
1621
1622 /**
1623  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1624  * This corresponds to std::vector in C++
1625  */
1626 typedef struct LDKCVec_RouteHopZ {
1627    /**
1628     * The elements in the array.
1629     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1630     */
1631    struct LDKRouteHop *data;
1632    /**
1633     * The number of elements pointed to by `data`.
1634     */
1635    uintptr_t datalen;
1636 } LDKCVec_RouteHopZ;
1637
1638 /**
1639  * An interface used to score payment channels for path finding.
1640  *
1641  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
1642  */
1643 typedef struct LDKScore {
1644    /**
1645     * An opaque pointer which is passed to your function implementations as an argument.
1646     * This has no meaning in the LDK, and can be NULL or any other value.
1647     */
1648    void *this_arg;
1649    /**
1650     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
1651     * given channel in the direction from `source` to `target`.
1652     *
1653     * The channel's capacity (less any other MPP parts that are also being considered for use in
1654     * the same payment) is given by `capacity_msat`. It may be determined from various sources
1655     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
1656     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
1657     * Thus, implementations should be overflow-safe.
1658     */
1659    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);
1660    /**
1661     * Handles updating channel penalties after failing to route through a channel.
1662     */
1663    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
1664    /**
1665     * Handles updating channel penalties after successfully routing along a path.
1666     */
1667    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
1668    /**
1669     * Serialize the object into a byte array
1670     */
1671    struct LDKCVec_u8Z (*write)(const void *this_arg);
1672    /**
1673     * Frees any resources associated with this object given its this_arg pointer.
1674     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1675     */
1676    void (*free)(void *this_arg);
1677 } LDKScore;
1678
1679 /**
1680  * A scorer that is accessed under a lock.
1681  *
1682  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
1683  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
1684  * implementations. Internal locking would be detrimental to route finding performance and could
1685  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
1686  *
1687  * [`find_route`]: crate::routing::router::find_route
1688  */
1689 typedef struct LDKLockableScore {
1690    /**
1691     * An opaque pointer which is passed to your function implementations as an argument.
1692     * This has no meaning in the LDK, and can be NULL or any other value.
1693     */
1694    void *this_arg;
1695    /**
1696     * Returns the locked scorer.
1697     */
1698    struct LDKScore (*lock)(const void *this_arg);
1699    /**
1700     * Frees any resources associated with this object given its this_arg pointer.
1701     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1702     */
1703    void (*free)(void *this_arg);
1704 } LDKLockableScore;
1705
1706 /**
1707  * Refers to a scorer that is accessible under lock and also writeable to disk
1708  *
1709  * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to
1710  * use the Persister to persist it.
1711  */
1712 typedef struct LDKWriteableScore {
1713    /**
1714     * An opaque pointer which is passed to your function implementations as an argument.
1715     * This has no meaning in the LDK, and can be NULL or any other value.
1716     */
1717    void *this_arg;
1718    /**
1719     * Implementation of LockableScore for this object.
1720     */
1721    struct LDKLockableScore LockableScore;
1722    /**
1723     * Serialize the object into a byte array
1724     */
1725    struct LDKCVec_u8Z (*write)(const void *this_arg);
1726    /**
1727     * Frees any resources associated with this object given its this_arg pointer.
1728     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
1729     */
1730    void (*free)(void *this_arg);
1731 } LDKWriteableScore;
1732
1733 /**
1734  * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not
1735  */
1736 typedef enum LDKCOption_WriteableScoreZ_Tag {
1737    /**
1738     * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore
1739     */
1740    LDKCOption_WriteableScoreZ_Some,
1741    /**
1742     * When we're in this state, this COption_WriteableScoreZ contains nothing
1743     */
1744    LDKCOption_WriteableScoreZ_None,
1745    /**
1746     * Must be last for serialization purposes
1747     */
1748    LDKCOption_WriteableScoreZ_Sentinel,
1749 } LDKCOption_WriteableScoreZ_Tag;
1750
1751 typedef struct LDKCOption_WriteableScoreZ {
1752    LDKCOption_WriteableScoreZ_Tag tag;
1753    union {
1754       struct {
1755          struct LDKWriteableScore some;
1756       };
1757    };
1758 } LDKCOption_WriteableScoreZ;
1759
1760 /**
1761  * The contents of CResult_NoneErrorZ
1762  */
1763 typedef union LDKCResult_NoneErrorZPtr {
1764    /**
1765     * Note that this value is always NULL, as there are no contents in the OK variant
1766     */
1767    void *result;
1768    /**
1769     * A pointer to the contents in the error state.
1770     * Reading from this pointer when `result_ok` is set is undefined.
1771     */
1772    enum LDKIOError *err;
1773 } LDKCResult_NoneErrorZPtr;
1774
1775 /**
1776  * A CResult_NoneErrorZ represents the result of a fallible operation,
1777  * containing a () on success and a crate::c_types::IOError on failure.
1778  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1779  */
1780 typedef struct LDKCResult_NoneErrorZ {
1781    /**
1782     * The contents of this CResult_NoneErrorZ, accessible via either
1783     * `err` or `result` depending on the state of `result_ok`.
1784     */
1785    union LDKCResult_NoneErrorZPtr contents;
1786    /**
1787     * Whether this CResult_NoneErrorZ represents a success state.
1788     */
1789    bool result_ok;
1790 } LDKCResult_NoneErrorZ;
1791
1792 /**
1793  * The contents of CResult_RouteHopDecodeErrorZ
1794  */
1795 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1796    /**
1797     * A pointer to the contents in the success state.
1798     * Reading from this pointer when `result_ok` is not set is undefined.
1799     */
1800    struct LDKRouteHop *result;
1801    /**
1802     * A pointer to the contents in the error state.
1803     * Reading from this pointer when `result_ok` is set is undefined.
1804     */
1805    struct LDKDecodeError *err;
1806 } LDKCResult_RouteHopDecodeErrorZPtr;
1807
1808 /**
1809  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1810  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1811  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1812  */
1813 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1814    /**
1815     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1816     * `err` or `result` depending on the state of `result_ok`.
1817     */
1818    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1819    /**
1820     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1821     */
1822    bool result_ok;
1823 } LDKCResult_RouteHopDecodeErrorZ;
1824
1825 /**
1826  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1827  * This corresponds to std::vector in C++
1828  */
1829 typedef struct LDKCVec_CVec_RouteHopZZ {
1830    /**
1831     * The elements in the array.
1832     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1833     */
1834    struct LDKCVec_RouteHopZ *data;
1835    /**
1836     * The number of elements pointed to by `data`.
1837     */
1838    uintptr_t datalen;
1839 } LDKCVec_CVec_RouteHopZZ;
1840
1841
1842
1843 /**
1844  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1845  * it can take multiple paths. Each path is composed of one or more hops through the network.
1846  */
1847 typedef struct MUST_USE_STRUCT LDKRoute {
1848    /**
1849     * A pointer to the opaque Rust object.
1850     * Nearly everywhere, inner must be non-null, however in places where
1851     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1852     */
1853    LDKnativeRoute *inner;
1854    /**
1855     * Indicates that this is the only struct which contains the same pointer.
1856     * Rust functions which take ownership of an object provided via an argument require
1857     * this to be true and invalidate the object pointed to by inner.
1858     */
1859    bool is_owned;
1860 } LDKRoute;
1861
1862 /**
1863  * The contents of CResult_RouteDecodeErrorZ
1864  */
1865 typedef union LDKCResult_RouteDecodeErrorZPtr {
1866    /**
1867     * A pointer to the contents in the success state.
1868     * Reading from this pointer when `result_ok` is not set is undefined.
1869     */
1870    struct LDKRoute *result;
1871    /**
1872     * A pointer to the contents in the error state.
1873     * Reading from this pointer when `result_ok` is set is undefined.
1874     */
1875    struct LDKDecodeError *err;
1876 } LDKCResult_RouteDecodeErrorZPtr;
1877
1878 /**
1879  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1880  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1881  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1882  */
1883 typedef struct LDKCResult_RouteDecodeErrorZ {
1884    /**
1885     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1886     * `err` or `result` depending on the state of `result_ok`.
1887     */
1888    union LDKCResult_RouteDecodeErrorZPtr contents;
1889    /**
1890     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1891     */
1892    bool result_ok;
1893 } LDKCResult_RouteDecodeErrorZ;
1894
1895
1896
1897 /**
1898  * Parameters needed to find a [`Route`].
1899  *
1900  * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
1901  * [`Event::PaymentPathFailed`] for retrying a failed payment path.
1902  *
1903  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
1904  */
1905 typedef struct MUST_USE_STRUCT LDKRouteParameters {
1906    /**
1907     * A pointer to the opaque Rust object.
1908     * Nearly everywhere, inner must be non-null, however in places where
1909     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1910     */
1911    LDKnativeRouteParameters *inner;
1912    /**
1913     * Indicates that this is the only struct which contains the same pointer.
1914     * Rust functions which take ownership of an object provided via an argument require
1915     * this to be true and invalidate the object pointed to by inner.
1916     */
1917    bool is_owned;
1918 } LDKRouteParameters;
1919
1920 /**
1921  * The contents of CResult_RouteParametersDecodeErrorZ
1922  */
1923 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
1924    /**
1925     * A pointer to the contents in the success state.
1926     * Reading from this pointer when `result_ok` is not set is undefined.
1927     */
1928    struct LDKRouteParameters *result;
1929    /**
1930     * A pointer to the contents in the error state.
1931     * Reading from this pointer when `result_ok` is set is undefined.
1932     */
1933    struct LDKDecodeError *err;
1934 } LDKCResult_RouteParametersDecodeErrorZPtr;
1935
1936 /**
1937  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1938  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1939  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1940  */
1941 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
1942    /**
1943     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1944     * `err` or `result` depending on the state of `result_ok`.
1945     */
1946    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
1947    /**
1948     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1949     */
1950    bool result_ok;
1951 } LDKCResult_RouteParametersDecodeErrorZ;
1952
1953
1954
1955 /**
1956  * A list of hops along a payment path terminating with a channel to the recipient.
1957  */
1958 typedef struct MUST_USE_STRUCT LDKRouteHint {
1959    /**
1960     * A pointer to the opaque Rust object.
1961     * Nearly everywhere, inner must be non-null, however in places where
1962     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1963     */
1964    LDKnativeRouteHint *inner;
1965    /**
1966     * Indicates that this is the only struct which contains the same pointer.
1967     * Rust functions which take ownership of an object provided via an argument require
1968     * this to be true and invalidate the object pointed to by inner.
1969     */
1970    bool is_owned;
1971 } LDKRouteHint;
1972
1973 /**
1974  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1975  * This corresponds to std::vector in C++
1976  */
1977 typedef struct LDKCVec_RouteHintZ {
1978    /**
1979     * The elements in the array.
1980     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1981     */
1982    struct LDKRouteHint *data;
1983    /**
1984     * The number of elements pointed to by `data`.
1985     */
1986    uintptr_t datalen;
1987 } LDKCVec_RouteHintZ;
1988
1989 /**
1990  * An enum which can either contain a u64 or not
1991  */
1992 typedef enum LDKCOption_u64Z_Tag {
1993    /**
1994     * When we're in this state, this COption_u64Z contains a u64
1995     */
1996    LDKCOption_u64Z_Some,
1997    /**
1998     * When we're in this state, this COption_u64Z contains nothing
1999     */
2000    LDKCOption_u64Z_None,
2001    /**
2002     * Must be last for serialization purposes
2003     */
2004    LDKCOption_u64Z_Sentinel,
2005 } LDKCOption_u64Z_Tag;
2006
2007 typedef struct LDKCOption_u64Z {
2008    LDKCOption_u64Z_Tag tag;
2009    union {
2010       struct {
2011          uint64_t some;
2012       };
2013    };
2014 } LDKCOption_u64Z;
2015
2016
2017
2018 /**
2019  * The recipient of a payment.
2020  */
2021 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
2022    /**
2023     * A pointer to the opaque Rust object.
2024     * Nearly everywhere, inner must be non-null, however in places where
2025     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2026     */
2027    LDKnativePaymentParameters *inner;
2028    /**
2029     * Indicates that this is the only struct which contains the same pointer.
2030     * Rust functions which take ownership of an object provided via an argument require
2031     * this to be true and invalidate the object pointed to by inner.
2032     */
2033    bool is_owned;
2034 } LDKPaymentParameters;
2035
2036 /**
2037  * The contents of CResult_PaymentParametersDecodeErrorZ
2038  */
2039 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
2040    /**
2041     * A pointer to the contents in the success state.
2042     * Reading from this pointer when `result_ok` is not set is undefined.
2043     */
2044    struct LDKPaymentParameters *result;
2045    /**
2046     * A pointer to the contents in the error state.
2047     * Reading from this pointer when `result_ok` is set is undefined.
2048     */
2049    struct LDKDecodeError *err;
2050 } LDKCResult_PaymentParametersDecodeErrorZPtr;
2051
2052 /**
2053  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
2054  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
2055  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2056  */
2057 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
2058    /**
2059     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
2060     * `err` or `result` depending on the state of `result_ok`.
2061     */
2062    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
2063    /**
2064     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
2065     */
2066    bool result_ok;
2067 } LDKCResult_PaymentParametersDecodeErrorZ;
2068
2069
2070
2071 /**
2072  * A channel descriptor for a hop along a payment path.
2073  */
2074 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
2075    /**
2076     * A pointer to the opaque Rust object.
2077     * Nearly everywhere, inner must be non-null, however in places where
2078     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2079     */
2080    LDKnativeRouteHintHop *inner;
2081    /**
2082     * Indicates that this is the only struct which contains the same pointer.
2083     * Rust functions which take ownership of an object provided via an argument require
2084     * this to be true and invalidate the object pointed to by inner.
2085     */
2086    bool is_owned;
2087 } LDKRouteHintHop;
2088
2089 /**
2090  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
2091  * This corresponds to std::vector in C++
2092  */
2093 typedef struct LDKCVec_RouteHintHopZ {
2094    /**
2095     * The elements in the array.
2096     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2097     */
2098    struct LDKRouteHintHop *data;
2099    /**
2100     * The number of elements pointed to by `data`.
2101     */
2102    uintptr_t datalen;
2103 } LDKCVec_RouteHintHopZ;
2104
2105 /**
2106  * The contents of CResult_RouteHintDecodeErrorZ
2107  */
2108 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
2109    /**
2110     * A pointer to the contents in the success state.
2111     * Reading from this pointer when `result_ok` is not set is undefined.
2112     */
2113    struct LDKRouteHint *result;
2114    /**
2115     * A pointer to the contents in the error state.
2116     * Reading from this pointer when `result_ok` is set is undefined.
2117     */
2118    struct LDKDecodeError *err;
2119 } LDKCResult_RouteHintDecodeErrorZPtr;
2120
2121 /**
2122  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
2123  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
2124  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2125  */
2126 typedef struct LDKCResult_RouteHintDecodeErrorZ {
2127    /**
2128     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
2129     * `err` or `result` depending on the state of `result_ok`.
2130     */
2131    union LDKCResult_RouteHintDecodeErrorZPtr contents;
2132    /**
2133     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
2134     */
2135    bool result_ok;
2136 } LDKCResult_RouteHintDecodeErrorZ;
2137
2138 /**
2139  * The contents of CResult_RouteHintHopDecodeErrorZ
2140  */
2141 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
2142    /**
2143     * A pointer to the contents in the success state.
2144     * Reading from this pointer when `result_ok` is not set is undefined.
2145     */
2146    struct LDKRouteHintHop *result;
2147    /**
2148     * A pointer to the contents in the error state.
2149     * Reading from this pointer when `result_ok` is set is undefined.
2150     */
2151    struct LDKDecodeError *err;
2152 } LDKCResult_RouteHintHopDecodeErrorZPtr;
2153
2154 /**
2155  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2156  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2157  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2158  */
2159 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
2160    /**
2161     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2162     * `err` or `result` depending on the state of `result_ok`.
2163     */
2164    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
2165    /**
2166     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2167     */
2168    bool result_ok;
2169 } LDKCResult_RouteHintHopDecodeErrorZ;
2170
2171
2172
2173 /**
2174  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2175  */
2176 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2177    /**
2178     * A pointer to the opaque Rust object.
2179     * Nearly everywhere, inner must be non-null, however in places where
2180     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2181     */
2182    LDKnativeChannelDetails *inner;
2183    /**
2184     * Indicates that this is the only struct which contains the same pointer.
2185     * Rust functions which take ownership of an object provided via an argument require
2186     * this to be true and invalidate the object pointed to by inner.
2187     */
2188    bool is_owned;
2189 } LDKChannelDetails;
2190
2191 /**
2192  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2193  * This corresponds to std::vector in C++
2194  */
2195 typedef struct LDKCVec_ChannelDetailsZ {
2196    /**
2197     * The elements in the array.
2198     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2199     */
2200    struct LDKChannelDetails *data;
2201    /**
2202     * The number of elements pointed to by `data`.
2203     */
2204    uintptr_t datalen;
2205 } LDKCVec_ChannelDetailsZ;
2206
2207
2208
2209 /**
2210  * An Err type for failure to process messages.
2211  */
2212 typedef struct MUST_USE_STRUCT LDKLightningError {
2213    /**
2214     * A pointer to the opaque Rust object.
2215     * Nearly everywhere, inner must be non-null, however in places where
2216     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2217     */
2218    LDKnativeLightningError *inner;
2219    /**
2220     * Indicates that this is the only struct which contains the same pointer.
2221     * Rust functions which take ownership of an object provided via an argument require
2222     * this to be true and invalidate the object pointed to by inner.
2223     */
2224    bool is_owned;
2225 } LDKLightningError;
2226
2227 /**
2228  * The contents of CResult_RouteLightningErrorZ
2229  */
2230 typedef union LDKCResult_RouteLightningErrorZPtr {
2231    /**
2232     * A pointer to the contents in the success state.
2233     * Reading from this pointer when `result_ok` is not set is undefined.
2234     */
2235    struct LDKRoute *result;
2236    /**
2237     * A pointer to the contents in the error state.
2238     * Reading from this pointer when `result_ok` is set is undefined.
2239     */
2240    struct LDKLightningError *err;
2241 } LDKCResult_RouteLightningErrorZPtr;
2242
2243 /**
2244  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2245  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2246  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2247  */
2248 typedef struct LDKCResult_RouteLightningErrorZ {
2249    /**
2250     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2251     * `err` or `result` depending on the state of `result_ok`.
2252     */
2253    union LDKCResult_RouteLightningErrorZPtr contents;
2254    /**
2255     * Whether this CResult_RouteLightningErrorZ represents a success state.
2256     */
2257    bool result_ok;
2258 } LDKCResult_RouteLightningErrorZ;
2259
2260 /**
2261  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2262  * This corresponds to std::vector in C++
2263  */
2264 typedef struct LDKCVec_PublicKeyZ {
2265    /**
2266     * The elements in the array.
2267     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2268     */
2269    struct LDKPublicKey *data;
2270    /**
2271     * The number of elements pointed to by `data`.
2272     */
2273    uintptr_t datalen;
2274 } LDKCVec_PublicKeyZ;
2275
2276 /**
2277  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
2278  * look up the corresponding function in rust-lightning's docs.
2279  */
2280 typedef struct LDKThirtyTwoBytes {
2281    /**
2282     * The thirty-two bytes
2283     */
2284    uint8_t data[32];
2285 } LDKThirtyTwoBytes;
2286
2287 /**
2288  * Some information provided on receipt of payment depends on whether the payment received is a
2289  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2290  */
2291 typedef enum LDKPaymentPurpose_Tag {
2292    /**
2293     * Information for receiving a payment that we generated an invoice for.
2294     */
2295    LDKPaymentPurpose_InvoicePayment,
2296    /**
2297     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2298     * (the payee) providing a preimage.
2299     */
2300    LDKPaymentPurpose_SpontaneousPayment,
2301    /**
2302     * Must be last for serialization purposes
2303     */
2304    LDKPaymentPurpose_Sentinel,
2305 } LDKPaymentPurpose_Tag;
2306
2307 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2308    /**
2309     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2310     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2311     * [`ChannelManager::claim_funds`].
2312     *
2313     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2314     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2315     *
2316     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2317     */
2318    struct LDKThirtyTwoBytes payment_preimage;
2319    /**
2320     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2321     * number of deanonymization attacks during the routing process.
2322     * It is provided here for your reference, however its accuracy is enforced directly by
2323     * [`ChannelManager`] using the values you previously provided to
2324     * [`ChannelManager::create_inbound_payment`] or
2325     * [`ChannelManager::create_inbound_payment_for_hash`].
2326     *
2327     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2328     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2329     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2330     */
2331    struct LDKThirtyTwoBytes payment_secret;
2332 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2333
2334 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2335    LDKPaymentPurpose_Tag tag;
2336    union {
2337       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2338       struct {
2339          struct LDKThirtyTwoBytes spontaneous_payment;
2340       };
2341    };
2342 } LDKPaymentPurpose;
2343
2344 /**
2345  * The contents of CResult_PaymentPurposeDecodeErrorZ
2346  */
2347 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
2348    /**
2349     * A pointer to the contents in the success state.
2350     * Reading from this pointer when `result_ok` is not set is undefined.
2351     */
2352    struct LDKPaymentPurpose *result;
2353    /**
2354     * A pointer to the contents in the error state.
2355     * Reading from this pointer when `result_ok` is set is undefined.
2356     */
2357    struct LDKDecodeError *err;
2358 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
2359
2360 /**
2361  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2362  * containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2363  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2364  */
2365 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
2366    /**
2367     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2368     * `err` or `result` depending on the state of `result_ok`.
2369     */
2370    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
2371    /**
2372     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2373     */
2374    bool result_ok;
2375 } LDKCResult_PaymentPurposeDecodeErrorZ;
2376
2377 /**
2378  * The reason the channel was closed. See individual variants more details.
2379  */
2380 typedef enum LDKClosureReason_Tag {
2381    /**
2382     * Closure generated from receiving a peer error message.
2383     *
2384     * Our counterparty may have broadcasted their latest commitment state, and we have
2385     * as well.
2386     */
2387    LDKClosureReason_CounterpartyForceClosed,
2388    /**
2389     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2390     *
2391     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2392     */
2393    LDKClosureReason_HolderForceClosed,
2394    /**
2395     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2396     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2397     */
2398    LDKClosureReason_CooperativeClosure,
2399    /**
2400     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2401     * commitment transaction came from our counterparty, but it may also have come from
2402     * a copy of our own `ChannelMonitor`.
2403     */
2404    LDKClosureReason_CommitmentTxConfirmed,
2405    /**
2406     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2407     */
2408    LDKClosureReason_FundingTimedOut,
2409    /**
2410     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2411     */
2412    LDKClosureReason_ProcessingError,
2413    /**
2414     * The peer disconnected prior to funding completing. In this case the spec mandates that we
2415     * forget the channel entirely - we can attempt again if the peer reconnects.
2416     *
2417     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
2418     * peer because of mutual incompatibility between us and our channel counterparty.
2419     */
2420    LDKClosureReason_DisconnectedPeer,
2421    /**
2422     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
2423     * the ChannelManager deserialized.
2424     */
2425    LDKClosureReason_OutdatedChannelManager,
2426    /**
2427     * Must be last for serialization purposes
2428     */
2429    LDKClosureReason_Sentinel,
2430 } LDKClosureReason_Tag;
2431
2432 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2433    /**
2434     * The error which the peer sent us.
2435     *
2436     * The string should be sanitized before it is used (e.g emitted to logs
2437     * or printed to stdout). Otherwise, a well crafted error message may exploit
2438     * a security vulnerability in the terminal emulator or the logging subsystem.
2439     */
2440    struct LDKStr peer_msg;
2441 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2442
2443 typedef struct LDKClosureReason_LDKProcessingError_Body {
2444    /**
2445     * A developer-readable error message which we generated.
2446     */
2447    struct LDKStr err;
2448 } LDKClosureReason_LDKProcessingError_Body;
2449
2450 typedef struct MUST_USE_STRUCT LDKClosureReason {
2451    LDKClosureReason_Tag tag;
2452    union {
2453       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2454       LDKClosureReason_LDKProcessingError_Body processing_error;
2455    };
2456 } LDKClosureReason;
2457
2458 /**
2459  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2460  */
2461 typedef enum LDKCOption_ClosureReasonZ_Tag {
2462    /**
2463     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2464     */
2465    LDKCOption_ClosureReasonZ_Some,
2466    /**
2467     * When we're in this state, this COption_ClosureReasonZ contains nothing
2468     */
2469    LDKCOption_ClosureReasonZ_None,
2470    /**
2471     * Must be last for serialization purposes
2472     */
2473    LDKCOption_ClosureReasonZ_Sentinel,
2474 } LDKCOption_ClosureReasonZ_Tag;
2475
2476 typedef struct LDKCOption_ClosureReasonZ {
2477    LDKCOption_ClosureReasonZ_Tag tag;
2478    union {
2479       struct {
2480          struct LDKClosureReason some;
2481       };
2482    };
2483 } LDKCOption_ClosureReasonZ;
2484
2485 /**
2486  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2487  */
2488 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2489    /**
2490     * A pointer to the contents in the success state.
2491     * Reading from this pointer when `result_ok` is not set is undefined.
2492     */
2493    struct LDKCOption_ClosureReasonZ *result;
2494    /**
2495     * A pointer to the contents in the error state.
2496     * Reading from this pointer when `result_ok` is set is undefined.
2497     */
2498    struct LDKDecodeError *err;
2499 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2500
2501 /**
2502  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2503  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2504  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2505  */
2506 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2507    /**
2508     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2509     * `err` or `result` depending on the state of `result_ok`.
2510     */
2511    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2512    /**
2513     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2514     */
2515    bool result_ok;
2516 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2517
2518
2519
2520 /**
2521  * A channel_update message to be sent or received from a peer
2522  */
2523 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2524    /**
2525     * A pointer to the opaque Rust object.
2526     * Nearly everywhere, inner must be non-null, however in places where
2527     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2528     */
2529    LDKnativeChannelUpdate *inner;
2530    /**
2531     * Indicates that this is the only struct which contains the same pointer.
2532     * Rust functions which take ownership of an object provided via an argument require
2533     * this to be true and invalidate the object pointed to by inner.
2534     */
2535    bool is_owned;
2536 } LDKChannelUpdate;
2537
2538 /**
2539  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2540  * return packet by a node along the route. See [BOLT #4] for details.
2541  *
2542  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
2543  */
2544 typedef enum LDKNetworkUpdate_Tag {
2545    /**
2546     * An error indicating a `channel_update` messages should be applied via
2547     * [`NetworkGraph::update_channel`].
2548     */
2549    LDKNetworkUpdate_ChannelUpdateMessage,
2550    /**
2551     * An error indicating that a channel failed to route a payment, which should be applied via
2552     * [`NetworkGraph::channel_failed`].
2553     */
2554    LDKNetworkUpdate_ChannelFailure,
2555    /**
2556     * An error indicating that a node failed to route a payment, which should be applied via
2557     * [`NetworkGraph::node_failed`].
2558     */
2559    LDKNetworkUpdate_NodeFailure,
2560    /**
2561     * Must be last for serialization purposes
2562     */
2563    LDKNetworkUpdate_Sentinel,
2564 } LDKNetworkUpdate_Tag;
2565
2566 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2567    /**
2568     * The update to apply via [`NetworkGraph::update_channel`].
2569     */
2570    struct LDKChannelUpdate msg;
2571 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2572
2573 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
2574    /**
2575     * The short channel id of the closed channel.
2576     */
2577    uint64_t short_channel_id;
2578    /**
2579     * Whether the channel should be permanently removed or temporarily disabled until a new
2580     * `channel_update` message is received.
2581     */
2582    bool is_permanent;
2583 } LDKNetworkUpdate_LDKChannelFailure_Body;
2584
2585 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2586    /**
2587     * The node id of the failed node.
2588     */
2589    struct LDKPublicKey node_id;
2590    /**
2591     * Whether the node should be permanently removed from consideration or can be restored
2592     * when a new `channel_update` message is received.
2593     */
2594    bool is_permanent;
2595 } LDKNetworkUpdate_LDKNodeFailure_Body;
2596
2597 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2598    LDKNetworkUpdate_Tag tag;
2599    union {
2600       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2601       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
2602       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2603    };
2604 } LDKNetworkUpdate;
2605
2606 /**
2607  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
2608  */
2609 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2610    /**
2611     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
2612     */
2613    LDKCOption_NetworkUpdateZ_Some,
2614    /**
2615     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2616     */
2617    LDKCOption_NetworkUpdateZ_None,
2618    /**
2619     * Must be last for serialization purposes
2620     */
2621    LDKCOption_NetworkUpdateZ_Sentinel,
2622 } LDKCOption_NetworkUpdateZ_Tag;
2623
2624 typedef struct LDKCOption_NetworkUpdateZ {
2625    LDKCOption_NetworkUpdateZ_Tag tag;
2626    union {
2627       struct {
2628          struct LDKNetworkUpdate some;
2629       };
2630    };
2631 } LDKCOption_NetworkUpdateZ;
2632
2633
2634
2635 /**
2636  * A reference to a transaction output.
2637  *
2638  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2639  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2640  */
2641 typedef struct MUST_USE_STRUCT LDKOutPoint {
2642    /**
2643     * A pointer to the opaque Rust object.
2644     * Nearly everywhere, inner must be non-null, however in places where
2645     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2646     */
2647    LDKnativeOutPoint *inner;
2648    /**
2649     * Indicates that this is the only struct which contains the same pointer.
2650     * Rust functions which take ownership of an object provided via an argument require
2651     * this to be true and invalidate the object pointed to by inner.
2652     */
2653    bool is_owned;
2654 } LDKOutPoint;
2655
2656
2657
2658 /**
2659  * Information about a spendable output to a P2WSH script. See
2660  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2661  */
2662 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2663    /**
2664     * A pointer to the opaque Rust object.
2665     * Nearly everywhere, inner must be non-null, however in places where
2666     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2667     */
2668    LDKnativeDelayedPaymentOutputDescriptor *inner;
2669    /**
2670     * Indicates that this is the only struct which contains the same pointer.
2671     * Rust functions which take ownership of an object provided via an argument require
2672     * this to be true and invalidate the object pointed to by inner.
2673     */
2674    bool is_owned;
2675 } LDKDelayedPaymentOutputDescriptor;
2676
2677
2678
2679 /**
2680  * Information about a spendable output to our \"payment key\". See
2681  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2682  */
2683 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2684    /**
2685     * A pointer to the opaque Rust object.
2686     * Nearly everywhere, inner must be non-null, however in places where
2687     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2688     */
2689    LDKnativeStaticPaymentOutputDescriptor *inner;
2690    /**
2691     * Indicates that this is the only struct which contains the same pointer.
2692     * Rust functions which take ownership of an object provided via an argument require
2693     * this to be true and invalidate the object pointed to by inner.
2694     */
2695    bool is_owned;
2696 } LDKStaticPaymentOutputDescriptor;
2697
2698 /**
2699  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2700  * claim at any point in the future) an event is generated which you must track and be able to
2701  * spend on-chain. The information needed to do this is provided in this enum, including the
2702  * outpoint describing which txid and output index is available, the full output which exists at
2703  * that txid/index, and any keys or other information required to sign.
2704  */
2705 typedef enum LDKSpendableOutputDescriptor_Tag {
2706    /**
2707     * An output to a script which was provided via KeysInterface directly, either from
2708     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2709     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2710     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2711     * on-chain using the payment preimage or after it has timed out.
2712     */
2713    LDKSpendableOutputDescriptor_StaticOutput,
2714    /**
2715     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2716     *
2717     * The witness in the spending input should be:
2718     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2719     *
2720     * Note that the nSequence field in the spending input must be set to to_self_delay
2721     * (which means the transaction is not broadcastable until at least to_self_delay
2722     * blocks after the outpoint confirms).
2723     *
2724     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2725     * it is an output from an old state which we broadcast (which should never happen).
2726     *
2727     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2728     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2729     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2730     * chan_utils::derive_private_key. The public key can be generated without the secret key
2731     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2732     * Sign::pubkeys().
2733     *
2734     * To derive the revocation_pubkey provided here (which is used in the witness
2735     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2736     * call to Sign::ready_channel) and the provided per_commitment point
2737     * to chan_utils::derive_public_revocation_key.
2738     *
2739     * The witness script which is hashed and included in the output script_pubkey may be
2740     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2741     * (derived as above), and the to_self_delay contained here to
2742     * chan_utils::get_revokeable_redeemscript.
2743     */
2744    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2745    /**
2746     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2747     * corresponds to the public key in Sign::pubkeys().payment_point).
2748     * The witness in the spending input, is, thus, simply:
2749     * <BIP 143 signature> <payment key>
2750     *
2751     * These are generally the result of our counterparty having broadcast the current state,
2752     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2753     */
2754    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2755    /**
2756     * Must be last for serialization purposes
2757     */
2758    LDKSpendableOutputDescriptor_Sentinel,
2759 } LDKSpendableOutputDescriptor_Tag;
2760
2761 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2762    /**
2763     * The outpoint which is spendable
2764     */
2765    struct LDKOutPoint outpoint;
2766    /**
2767     * The output which is referenced by the given outpoint.
2768     */
2769    struct LDKTxOut output;
2770 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2771
2772 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2773    LDKSpendableOutputDescriptor_Tag tag;
2774    union {
2775       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2776       struct {
2777          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2778       };
2779       struct {
2780          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2781       };
2782    };
2783 } LDKSpendableOutputDescriptor;
2784
2785 /**
2786  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2787  * This corresponds to std::vector in C++
2788  */
2789 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2790    /**
2791     * The elements in the array.
2792     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2793     */
2794    struct LDKSpendableOutputDescriptor *data;
2795    /**
2796     * The number of elements pointed to by `data`.
2797     */
2798    uintptr_t datalen;
2799 } LDKCVec_SpendableOutputDescriptorZ;
2800
2801
2802
2803 /**
2804  * Features used within the channel_type field in an OpenChannel message.
2805  *
2806  * A channel is always of some known \"type\", describing the transaction formats used and the exact
2807  * semantics of our interaction with our peer.
2808  *
2809  * Note that because a channel is a specific type which is proposed by the opener and accepted by
2810  * the counterparty, only required features are allowed here.
2811  *
2812  * This is serialized differently from other feature types - it is not prefixed by a length, and
2813  * thus must only appear inside a TLV where its length is known in advance.
2814  */
2815 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
2816    /**
2817     * A pointer to the opaque Rust object.
2818     * Nearly everywhere, inner must be non-null, however in places where
2819     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2820     */
2821    LDKnativeChannelTypeFeatures *inner;
2822    /**
2823     * Indicates that this is the only struct which contains the same pointer.
2824     * Rust functions which take ownership of an object provided via an argument require
2825     * this to be true and invalidate the object pointed to by inner.
2826     */
2827    bool is_owned;
2828 } LDKChannelTypeFeatures;
2829
2830 /**
2831  * An Event which you should probably take some action in response to.
2832  *
2833  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2834  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2835  * written as it makes no sense to respond to it after reconnecting to peers).
2836  */
2837 typedef enum LDKEvent_Tag {
2838    /**
2839     * Used to indicate that the client should generate a funding transaction with the given
2840     * parameters and then call [`ChannelManager::funding_transaction_generated`].
2841     * Generated in [`ChannelManager`] message handling.
2842     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2843     * counterparty can steal your funds!
2844     *
2845     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2846     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2847     */
2848    LDKEvent_FundingGenerationReady,
2849    /**
2850     * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
2851     * feed it to [`ChannelManager::claim_funds`] to get it....
2852     *
2853     * Note that if the preimage is not known, you should call
2854     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
2855     * network congestion.
2856     * If you fail to call either [`ChannelManager::claim_funds`] or
2857     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
2858     * automatically failed.
2859     *
2860     * # Note
2861     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2862     * `PaymentReceived` events may be generated for the same payment.
2863     *
2864     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2865     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
2866     */
2867    LDKEvent_PaymentReceived,
2868    /**
2869     * Indicates a payment has been claimed and we've received money!
2870     *
2871     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
2872     * to an [`Event::PaymentReceived`]. However, if we previously crashed during a
2873     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
2874     * [`Event::PaymentReceived`] event.
2875     *
2876     * # Note
2877     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2878     * `PaymentReceived` events may be generated for the same payment. If you then call
2879     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
2880     * multiple `PaymentClaimed` events.
2881     *
2882     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2883     */
2884    LDKEvent_PaymentClaimed,
2885    /**
2886     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
2887     * and we got back the payment preimage for it).
2888     *
2889     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
2890     * event. In this situation, you SHOULD treat this payment as having succeeded.
2891     */
2892    LDKEvent_PaymentSent,
2893    /**
2894     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
2895     * provide failure information for each MPP part in the payment.
2896     *
2897     * This event is provided once there are no further pending HTLCs for the payment and the
2898     * payment is no longer retryable, either due to a several-block timeout or because
2899     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
2900     *
2901     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2902     */
2903    LDKEvent_PaymentFailed,
2904    /**
2905     * Indicates that a path for an outbound payment was successful.
2906     *
2907     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
2908     * [`Event::PaymentSent`] for obtaining the payment preimage.
2909     */
2910    LDKEvent_PaymentPathSuccessful,
2911    /**
2912     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
2913     * something. You may wish to retry with a different route.
2914     *
2915     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
2916     * [`Event::PaymentFailed`] and [`all_paths_failed`].
2917     *
2918     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
2919     */
2920    LDKEvent_PaymentPathFailed,
2921    /**
2922     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
2923     * a time in the future.
2924     *
2925     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
2926     */
2927    LDKEvent_PendingHTLCsForwardable,
2928    /**
2929     * Used to indicate that an output which you should know how to spend was confirmed on chain
2930     * and is now spendable.
2931     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2932     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2933     * somewhere and spend them when you create on-chain transactions.
2934     */
2935    LDKEvent_SpendableOutputs,
2936    /**
2937     * This event is generated when a payment has been successfully forwarded through us and a
2938     * forwarding fee earned.
2939     */
2940    LDKEvent_PaymentForwarded,
2941    /**
2942     * Used to indicate that a previously opened channel with the given `channel_id` is in the
2943     * process of closure.
2944     */
2945    LDKEvent_ChannelClosed,
2946    /**
2947     * Used to indicate to the user that they can abandon the funding transaction and recycle the
2948     * inputs for another purpose.
2949     */
2950    LDKEvent_DiscardFunding,
2951    /**
2952     * Indicates a request to open a new channel by a peer.
2953     *
2954     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
2955     * request, call [`ChannelManager::force_close_channel`].
2956     *
2957     * The event is only triggered when a new open channel request is received and the
2958     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
2959     *
2960     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
2961     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
2962     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
2963     */
2964    LDKEvent_OpenChannelRequest,
2965    /**
2966     * Must be last for serialization purposes
2967     */
2968    LDKEvent_Sentinel,
2969 } LDKEvent_Tag;
2970
2971 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2972    /**
2973     * The random channel_id we picked which you'll need to pass into
2974     * [`ChannelManager::funding_transaction_generated`].
2975     *
2976     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2977     */
2978    struct LDKThirtyTwoBytes temporary_channel_id;
2979    /**
2980     * The counterparty's node_id, which you'll need to pass back into
2981     * [`ChannelManager::funding_transaction_generated`].
2982     *
2983     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2984     */
2985    struct LDKPublicKey counterparty_node_id;
2986    /**
2987     * The value, in satoshis, that the output should have.
2988     */
2989    uint64_t channel_value_satoshis;
2990    /**
2991     * The script which should be used in the transaction output.
2992     */
2993    struct LDKCVec_u8Z output_script;
2994    /**
2995     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2996     * an inbound channel.
2997     *
2998     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2999     */
3000    uint64_t user_channel_id;
3001 } LDKEvent_LDKFundingGenerationReady_Body;
3002
3003 typedef struct LDKEvent_LDKPaymentReceived_Body {
3004    /**
3005     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
3006     * not stop you from registering duplicate payment hashes for inbound payments.
3007     */
3008    struct LDKThirtyTwoBytes payment_hash;
3009    /**
3010     * The value, in thousandths of a satoshi, that this payment is for.
3011     */
3012    uint64_t amount_msat;
3013    /**
3014     * Information for claiming this received payment, based on whether the purpose of the
3015     * payment is to pay an invoice or to send a spontaneous payment.
3016     */
3017    struct LDKPaymentPurpose purpose;
3018 } LDKEvent_LDKPaymentReceived_Body;
3019
3020 typedef struct LDKEvent_LDKPaymentClaimed_Body {
3021    /**
3022     * The payment hash of the claimed payment. Note that LDK will not stop you from
3023     * registering duplicate payment hashes for inbound payments.
3024     */
3025    struct LDKThirtyTwoBytes payment_hash;
3026    /**
3027     * The value, in thousandths of a satoshi, that this payment is for.
3028     */
3029    uint64_t amount_msat;
3030    /**
3031     * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
3032     * spontaneous payment.
3033     */
3034    struct LDKPaymentPurpose purpose;
3035 } LDKEvent_LDKPaymentClaimed_Body;
3036
3037 typedef struct LDKEvent_LDKPaymentSent_Body {
3038    /**
3039     * The id returned by [`ChannelManager::send_payment`] and used with
3040     * [`ChannelManager::retry_payment`].
3041     *
3042     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3043     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3044     *
3045     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3046     */
3047    struct LDKThirtyTwoBytes payment_id;
3048    /**
3049     * The preimage to the hash given to ChannelManager::send_payment.
3050     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
3051     * store it somehow!
3052     */
3053    struct LDKThirtyTwoBytes payment_preimage;
3054    /**
3055     * The hash that was given to [`ChannelManager::send_payment`].
3056     *
3057     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3058     */
3059    struct LDKThirtyTwoBytes payment_hash;
3060    /**
3061     * The total fee which was spent at intermediate hops in this payment, across all paths.
3062     *
3063     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
3064     * overpayment to the recipient node.
3065     *
3066     * If the recipient or an intermediate node misbehaves and gives us free money, this may
3067     * overstate the amount paid, though this is unlikely.
3068     *
3069     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
3070     */
3071    struct LDKCOption_u64Z fee_paid_msat;
3072 } LDKEvent_LDKPaymentSent_Body;
3073
3074 typedef struct LDKEvent_LDKPaymentFailed_Body {
3075    /**
3076     * The id returned by [`ChannelManager::send_payment`] and used with
3077     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3078     *
3079     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3080     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3081     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3082     */
3083    struct LDKThirtyTwoBytes payment_id;
3084    /**
3085     * The hash that was given to [`ChannelManager::send_payment`].
3086     *
3087     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3088     */
3089    struct LDKThirtyTwoBytes payment_hash;
3090 } LDKEvent_LDKPaymentFailed_Body;
3091
3092 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3093    /**
3094     * The id returned by [`ChannelManager::send_payment`] and used with
3095     * [`ChannelManager::retry_payment`].
3096     *
3097     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3098     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3099     */
3100    struct LDKThirtyTwoBytes payment_id;
3101    /**
3102     * The hash that was given to [`ChannelManager::send_payment`].
3103     *
3104     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3105     *
3106     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3107     */
3108    struct LDKThirtyTwoBytes payment_hash;
3109    /**
3110     * The payment path that was successful.
3111     *
3112     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
3113     */
3114    struct LDKCVec_RouteHopZ path;
3115 } LDKEvent_LDKPaymentPathSuccessful_Body;
3116
3117 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
3118    /**
3119     * The id returned by [`ChannelManager::send_payment`] and used with
3120     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3121     *
3122     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3123     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3124     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3125     *
3126     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3127     */
3128    struct LDKThirtyTwoBytes payment_id;
3129    /**
3130     * The hash that was given to [`ChannelManager::send_payment`].
3131     *
3132     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3133     */
3134    struct LDKThirtyTwoBytes payment_hash;
3135    /**
3136     * Indicates the payment was rejected for some reason by the recipient. This implies that
3137     * the payment has failed, not just the route in question. If this is not set, you may
3138     * retry the payment via a different route.
3139     */
3140    bool rejected_by_dest;
3141    /**
3142     * Any failure information conveyed via the Onion return packet by a node along the failed
3143     * payment route.
3144     *
3145     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
3146     * account the update.
3147     *
3148     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
3149     */
3150    struct LDKCOption_NetworkUpdateZ network_update;
3151    /**
3152     * For both single-path and multi-path payments, this is set if all paths of the payment have
3153     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
3154     * larger MPP payment were still in flight when this event was generated.
3155     *
3156     * Note that if you are retrying individual MPP parts, using this value to determine if a
3157     * payment has fully failed is race-y. Because multiple failures can happen prior to events
3158     * being processed, you may retry in response to a first failure, with a second failure
3159     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
3160     * you will see `all_paths_failed` set even though the retry of the first failure still
3161     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3162     *
3163     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3164     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3165     *
3166     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3167     *
3168     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3169     */
3170    bool all_paths_failed;
3171    /**
3172     * The payment path that failed.
3173     */
3174    struct LDKCVec_RouteHopZ path;
3175    /**
3176     * The channel responsible for the failed payment path.
3177     *
3178     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3179     * may not refer to a channel in the public network graph. These aliases may also collide
3180     * with channels in the public network graph.
3181     *
3182     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3183     * retried. May be `None` for older [`Event`] serializations.
3184     */
3185    struct LDKCOption_u64Z short_channel_id;
3186    /**
3187     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3188     *
3189     * See [`find_route`] for details.
3190     *
3191     * [`Route`]: crate::routing::router::Route
3192     * [`find_route`]: crate::routing::router::find_route
3193     *
3194     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3195     */
3196    struct LDKRouteParameters retry;
3197 } LDKEvent_LDKPaymentPathFailed_Body;
3198
3199 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3200    /**
3201     * The minimum amount of time that should be waited prior to calling
3202     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3203     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3204     * now + 5*time_forwardable).
3205     */
3206    uint64_t time_forwardable;
3207 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3208
3209 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3210    /**
3211     * The outputs which you should store as spendable by you.
3212     */
3213    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3214 } LDKEvent_LDKSpendableOutputs_Body;
3215
3216 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3217    /**
3218     * The incoming channel between the previous node and us. This is only `None` for events
3219     * generated or serialized by versions prior to 0.0.107.
3220     *
3221     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3222     */
3223    struct LDKThirtyTwoBytes prev_channel_id;
3224    /**
3225     * The outgoing channel between the next node and us. This is only `None` for events
3226     * generated or serialized by versions prior to 0.0.107.
3227     *
3228     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3229     */
3230    struct LDKThirtyTwoBytes next_channel_id;
3231    /**
3232     * The fee, in milli-satoshis, which was earned as a result of the payment.
3233     *
3234     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3235     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3236     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3237     * claimed the full value in millisatoshis from the source. In this case,
3238     * `claim_from_onchain_tx` will be set.
3239     *
3240     * If the channel which sent us the payment has been force-closed, we will claim the funds
3241     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3242     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3243     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3244     * `None`.
3245     */
3246    struct LDKCOption_u64Z fee_earned_msat;
3247    /**
3248     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3249     * transaction.
3250     */
3251    bool claim_from_onchain_tx;
3252 } LDKEvent_LDKPaymentForwarded_Body;
3253
3254 typedef struct LDKEvent_LDKChannelClosed_Body {
3255    /**
3256     * The channel_id of the channel which has been closed. Note that on-chain transactions
3257     * resolving the channel are likely still awaiting confirmation.
3258     */
3259    struct LDKThirtyTwoBytes channel_id;
3260    /**
3261     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
3262     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
3263     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
3264     * `user_channel_id` will be 0 for an inbound channel.
3265     * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
3266     *
3267     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3268     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3269     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3270     */
3271    uint64_t user_channel_id;
3272    /**
3273     * The reason the channel was closed.
3274     */
3275    struct LDKClosureReason reason;
3276 } LDKEvent_LDKChannelClosed_Body;
3277
3278 typedef struct LDKEvent_LDKDiscardFunding_Body {
3279    /**
3280     * The channel_id of the channel which has been closed.
3281     */
3282    struct LDKThirtyTwoBytes channel_id;
3283    /**
3284     * The full transaction received from the user
3285     */
3286    struct LDKTransaction transaction;
3287 } LDKEvent_LDKDiscardFunding_Body;
3288
3289 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3290    /**
3291     * The temporary channel ID of the channel requested to be opened.
3292     *
3293     * When responding to the request, the `temporary_channel_id` should be passed
3294     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
3295     * or through [`ChannelManager::force_close_channel`] to reject.
3296     *
3297     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3298     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
3299     */
3300    struct LDKThirtyTwoBytes temporary_channel_id;
3301    /**
3302     * The node_id of the counterparty requesting to open the channel.
3303     *
3304     * When responding to the request, the `counterparty_node_id` should be passed
3305     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
3306     * accept the request, or through [`ChannelManager::force_close_channel`] to reject the
3307     * request.
3308     *
3309     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3310     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
3311     */
3312    struct LDKPublicKey counterparty_node_id;
3313    /**
3314     * The channel value of the requested channel.
3315     */
3316    uint64_t funding_satoshis;
3317    /**
3318     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3319     */
3320    uint64_t push_msat;
3321    /**
3322     * The features that this channel will operate with. If you reject the channel, a
3323     * well-behaved counterparty may automatically re-attempt the channel with a new set of
3324     * feature flags.
3325     *
3326     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
3327     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3328     * 0.0.106.
3329     *
3330     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
3331     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3332     * 0.0.107. Channels setting this type also need to get manually accepted via
3333     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
3334     * or will be rejected otherwise.
3335     *
3336     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3337     */
3338    struct LDKChannelTypeFeatures channel_type;
3339 } LDKEvent_LDKOpenChannelRequest_Body;
3340
3341 typedef struct MUST_USE_STRUCT LDKEvent {
3342    LDKEvent_Tag tag;
3343    union {
3344       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3345       LDKEvent_LDKPaymentReceived_Body payment_received;
3346       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
3347       LDKEvent_LDKPaymentSent_Body payment_sent;
3348       LDKEvent_LDKPaymentFailed_Body payment_failed;
3349       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3350       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3351       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3352       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3353       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3354       LDKEvent_LDKChannelClosed_Body channel_closed;
3355       LDKEvent_LDKDiscardFunding_Body discard_funding;
3356       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
3357    };
3358 } LDKEvent;
3359
3360 /**
3361  * An enum which can either contain a crate::lightning::util::events::Event or not
3362  */
3363 typedef enum LDKCOption_EventZ_Tag {
3364    /**
3365     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3366     */
3367    LDKCOption_EventZ_Some,
3368    /**
3369     * When we're in this state, this COption_EventZ contains nothing
3370     */
3371    LDKCOption_EventZ_None,
3372    /**
3373     * Must be last for serialization purposes
3374     */
3375    LDKCOption_EventZ_Sentinel,
3376 } LDKCOption_EventZ_Tag;
3377
3378 typedef struct LDKCOption_EventZ {
3379    LDKCOption_EventZ_Tag tag;
3380    union {
3381       struct {
3382          struct LDKEvent some;
3383       };
3384    };
3385 } LDKCOption_EventZ;
3386
3387 /**
3388  * The contents of CResult_COption_EventZDecodeErrorZ
3389  */
3390 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
3391    /**
3392     * A pointer to the contents in the success state.
3393     * Reading from this pointer when `result_ok` is not set is undefined.
3394     */
3395    struct LDKCOption_EventZ *result;
3396    /**
3397     * A pointer to the contents in the error state.
3398     * Reading from this pointer when `result_ok` is set is undefined.
3399     */
3400    struct LDKDecodeError *err;
3401 } LDKCResult_COption_EventZDecodeErrorZPtr;
3402
3403 /**
3404  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3405  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3406  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3407  */
3408 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3409    /**
3410     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3411     * `err` or `result` depending on the state of `result_ok`.
3412     */
3413    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3414    /**
3415     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3416     */
3417    bool result_ok;
3418 } LDKCResult_COption_EventZDecodeErrorZ;
3419
3420
3421
3422 /**
3423  * An accept_channel message to be sent or received from a peer
3424  */
3425 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3426    /**
3427     * A pointer to the opaque Rust object.
3428     * Nearly everywhere, inner must be non-null, however in places where
3429     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3430     */
3431    LDKnativeAcceptChannel *inner;
3432    /**
3433     * Indicates that this is the only struct which contains the same pointer.
3434     * Rust functions which take ownership of an object provided via an argument require
3435     * this to be true and invalidate the object pointed to by inner.
3436     */
3437    bool is_owned;
3438 } LDKAcceptChannel;
3439
3440
3441
3442 /**
3443  * An open_channel message to be sent or received from a peer
3444  */
3445 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3446    /**
3447     * A pointer to the opaque Rust object.
3448     * Nearly everywhere, inner must be non-null, however in places where
3449     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3450     */
3451    LDKnativeOpenChannel *inner;
3452    /**
3453     * Indicates that this is the only struct which contains the same pointer.
3454     * Rust functions which take ownership of an object provided via an argument require
3455     * this to be true and invalidate the object pointed to by inner.
3456     */
3457    bool is_owned;
3458 } LDKOpenChannel;
3459
3460
3461
3462 /**
3463  * A funding_created message to be sent or received from a peer
3464  */
3465 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3466    /**
3467     * A pointer to the opaque Rust object.
3468     * Nearly everywhere, inner must be non-null, however in places where
3469     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3470     */
3471    LDKnativeFundingCreated *inner;
3472    /**
3473     * Indicates that this is the only struct which contains the same pointer.
3474     * Rust functions which take ownership of an object provided via an argument require
3475     * this to be true and invalidate the object pointed to by inner.
3476     */
3477    bool is_owned;
3478 } LDKFundingCreated;
3479
3480
3481
3482 /**
3483  * A funding_signed message to be sent or received from a peer
3484  */
3485 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3486    /**
3487     * A pointer to the opaque Rust object.
3488     * Nearly everywhere, inner must be non-null, however in places where
3489     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3490     */
3491    LDKnativeFundingSigned *inner;
3492    /**
3493     * Indicates that this is the only struct which contains the same pointer.
3494     * Rust functions which take ownership of an object provided via an argument require
3495     * this to be true and invalidate the object pointed to by inner.
3496     */
3497    bool is_owned;
3498 } LDKFundingSigned;
3499
3500
3501
3502 /**
3503  * A channel_ready message to be sent or received from a peer
3504  */
3505 typedef struct MUST_USE_STRUCT LDKChannelReady {
3506    /**
3507     * A pointer to the opaque Rust object.
3508     * Nearly everywhere, inner must be non-null, however in places where
3509     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3510     */
3511    LDKnativeChannelReady *inner;
3512    /**
3513     * Indicates that this is the only struct which contains the same pointer.
3514     * Rust functions which take ownership of an object provided via an argument require
3515     * this to be true and invalidate the object pointed to by inner.
3516     */
3517    bool is_owned;
3518 } LDKChannelReady;
3519
3520
3521
3522 /**
3523  * An announcement_signatures message to be sent or received from a peer
3524  */
3525 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3526    /**
3527     * A pointer to the opaque Rust object.
3528     * Nearly everywhere, inner must be non-null, however in places where
3529     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3530     */
3531    LDKnativeAnnouncementSignatures *inner;
3532    /**
3533     * Indicates that this is the only struct which contains the same pointer.
3534     * Rust functions which take ownership of an object provided via an argument require
3535     * this to be true and invalidate the object pointed to by inner.
3536     */
3537    bool is_owned;
3538 } LDKAnnouncementSignatures;
3539
3540
3541
3542 /**
3543  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3544  * transaction updates if they were pending.
3545  */
3546 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3547    /**
3548     * A pointer to the opaque Rust object.
3549     * Nearly everywhere, inner must be non-null, however in places where
3550     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3551     */
3552    LDKnativeCommitmentUpdate *inner;
3553    /**
3554     * Indicates that this is the only struct which contains the same pointer.
3555     * Rust functions which take ownership of an object provided via an argument require
3556     * this to be true and invalidate the object pointed to by inner.
3557     */
3558    bool is_owned;
3559 } LDKCommitmentUpdate;
3560
3561
3562
3563 /**
3564  * A revoke_and_ack message to be sent or received from a peer
3565  */
3566 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3567    /**
3568     * A pointer to the opaque Rust object.
3569     * Nearly everywhere, inner must be non-null, however in places where
3570     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3571     */
3572    LDKnativeRevokeAndACK *inner;
3573    /**
3574     * Indicates that this is the only struct which contains the same pointer.
3575     * Rust functions which take ownership of an object provided via an argument require
3576     * this to be true and invalidate the object pointed to by inner.
3577     */
3578    bool is_owned;
3579 } LDKRevokeAndACK;
3580
3581
3582
3583 /**
3584  * A closing_signed message to be sent or received from a peer
3585  */
3586 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3587    /**
3588     * A pointer to the opaque Rust object.
3589     * Nearly everywhere, inner must be non-null, however in places where
3590     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3591     */
3592    LDKnativeClosingSigned *inner;
3593    /**
3594     * Indicates that this is the only struct which contains the same pointer.
3595     * Rust functions which take ownership of an object provided via an argument require
3596     * this to be true and invalidate the object pointed to by inner.
3597     */
3598    bool is_owned;
3599 } LDKClosingSigned;
3600
3601
3602
3603 /**
3604  * A shutdown message to be sent or received from a peer
3605  */
3606 typedef struct MUST_USE_STRUCT LDKShutdown {
3607    /**
3608     * A pointer to the opaque Rust object.
3609     * Nearly everywhere, inner must be non-null, however in places where
3610     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3611     */
3612    LDKnativeShutdown *inner;
3613    /**
3614     * Indicates that this is the only struct which contains the same pointer.
3615     * Rust functions which take ownership of an object provided via an argument require
3616     * this to be true and invalidate the object pointed to by inner.
3617     */
3618    bool is_owned;
3619 } LDKShutdown;
3620
3621
3622
3623 /**
3624  * A channel_reestablish message to be sent or received from a peer
3625  */
3626 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3627    /**
3628     * A pointer to the opaque Rust object.
3629     * Nearly everywhere, inner must be non-null, however in places where
3630     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3631     */
3632    LDKnativeChannelReestablish *inner;
3633    /**
3634     * Indicates that this is the only struct which contains the same pointer.
3635     * Rust functions which take ownership of an object provided via an argument require
3636     * this to be true and invalidate the object pointed to by inner.
3637     */
3638    bool is_owned;
3639 } LDKChannelReestablish;
3640
3641
3642
3643 /**
3644  * A channel_announcement message to be sent or received from a peer
3645  */
3646 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3647    /**
3648     * A pointer to the opaque Rust object.
3649     * Nearly everywhere, inner must be non-null, however in places where
3650     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3651     */
3652    LDKnativeChannelAnnouncement *inner;
3653    /**
3654     * Indicates that this is the only struct which contains the same pointer.
3655     * Rust functions which take ownership of an object provided via an argument require
3656     * this to be true and invalidate the object pointed to by inner.
3657     */
3658    bool is_owned;
3659 } LDKChannelAnnouncement;
3660
3661
3662
3663 /**
3664  * A node_announcement message to be sent or received from a peer
3665  */
3666 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3667    /**
3668     * A pointer to the opaque Rust object.
3669     * Nearly everywhere, inner must be non-null, however in places where
3670     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3671     */
3672    LDKnativeNodeAnnouncement *inner;
3673    /**
3674     * Indicates that this is the only struct which contains the same pointer.
3675     * Rust functions which take ownership of an object provided via an argument require
3676     * this to be true and invalidate the object pointed to by inner.
3677     */
3678    bool is_owned;
3679 } LDKNodeAnnouncement;
3680
3681
3682
3683 /**
3684  * An error message to be sent or received from a peer
3685  */
3686 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3687    /**
3688     * A pointer to the opaque Rust object.
3689     * Nearly everywhere, inner must be non-null, however in places where
3690     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3691     */
3692    LDKnativeErrorMessage *inner;
3693    /**
3694     * Indicates that this is the only struct which contains the same pointer.
3695     * Rust functions which take ownership of an object provided via an argument require
3696     * this to be true and invalidate the object pointed to by inner.
3697     */
3698    bool is_owned;
3699 } LDKErrorMessage;
3700
3701
3702
3703 /**
3704  * A warning message to be sent or received from a peer
3705  */
3706 typedef struct MUST_USE_STRUCT LDKWarningMessage {
3707    /**
3708     * A pointer to the opaque Rust object.
3709     * Nearly everywhere, inner must be non-null, however in places where
3710     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3711     */
3712    LDKnativeWarningMessage *inner;
3713    /**
3714     * Indicates that this is the only struct which contains the same pointer.
3715     * Rust functions which take ownership of an object provided via an argument require
3716     * this to be true and invalidate the object pointed to by inner.
3717     */
3718    bool is_owned;
3719 } LDKWarningMessage;
3720
3721 /**
3722  * Used to put an error message in a LightningError
3723  */
3724 typedef enum LDKErrorAction_Tag {
3725    /**
3726     * The peer took some action which made us think they were useless. Disconnect them.
3727     */
3728    LDKErrorAction_DisconnectPeer,
3729    /**
3730     * The peer did something harmless that we weren't able to process, just log and ignore
3731     */
3732    LDKErrorAction_IgnoreError,
3733    /**
3734     * The peer did something harmless that we weren't able to meaningfully process.
3735     * If the error is logged, log it at the given level.
3736     */
3737    LDKErrorAction_IgnoreAndLog,
3738    /**
3739     * The peer provided us with a gossip message which we'd already seen. In most cases this
3740     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
3741     * our own channel announcements.
3742     */
3743    LDKErrorAction_IgnoreDuplicateGossip,
3744    /**
3745     * The peer did something incorrect. Tell them.
3746     */
3747    LDKErrorAction_SendErrorMessage,
3748    /**
3749     * The peer did something incorrect. Tell them without closing any channels.
3750     */
3751    LDKErrorAction_SendWarningMessage,
3752    /**
3753     * Must be last for serialization purposes
3754     */
3755    LDKErrorAction_Sentinel,
3756 } LDKErrorAction_Tag;
3757
3758 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3759    /**
3760     * An error message which we should make an effort to send before we disconnect.
3761     *
3762     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3763     */
3764    struct LDKErrorMessage msg;
3765 } LDKErrorAction_LDKDisconnectPeer_Body;
3766
3767 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3768    /**
3769     * The message to send.
3770     */
3771    struct LDKErrorMessage msg;
3772 } LDKErrorAction_LDKSendErrorMessage_Body;
3773
3774 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
3775    /**
3776     * The message to send.
3777     */
3778    struct LDKWarningMessage msg;
3779    /**
3780     * The peer may have done something harmless that we weren't able to meaningfully process,
3781     * though we should still tell them about it.
3782     * If this event is logged, log it at the given level.
3783     */
3784    enum LDKLevel log_level;
3785 } LDKErrorAction_LDKSendWarningMessage_Body;
3786
3787 typedef struct MUST_USE_STRUCT LDKErrorAction {
3788    LDKErrorAction_Tag tag;
3789    union {
3790       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3791       struct {
3792          enum LDKLevel ignore_and_log;
3793       };
3794       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3795       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
3796    };
3797 } LDKErrorAction;
3798
3799
3800
3801 /**
3802  * A query_channel_range message is used to query a peer for channel
3803  * UTXOs in a range of blocks. The recipient of a query makes a best
3804  * effort to reply to the query using one or more reply_channel_range
3805  * messages.
3806  */
3807 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3808    /**
3809     * A pointer to the opaque Rust object.
3810     * Nearly everywhere, inner must be non-null, however in places where
3811     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3812     */
3813    LDKnativeQueryChannelRange *inner;
3814    /**
3815     * Indicates that this is the only struct which contains the same pointer.
3816     * Rust functions which take ownership of an object provided via an argument require
3817     * this to be true and invalidate the object pointed to by inner.
3818     */
3819    bool is_owned;
3820 } LDKQueryChannelRange;
3821
3822
3823
3824 /**
3825  * A query_short_channel_ids message is used to query a peer for
3826  * routing gossip messages related to one or more short_channel_ids.
3827  * The query recipient will reply with the latest, if available,
3828  * channel_announcement, channel_update and node_announcement messages
3829  * it maintains for the requested short_channel_ids followed by a
3830  * reply_short_channel_ids_end message. The short_channel_ids sent in
3831  * this query are encoded. We only support encoding_type=0 uncompressed
3832  * serialization and do not support encoding_type=1 zlib serialization.
3833  */
3834 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3835    /**
3836     * A pointer to the opaque Rust object.
3837     * Nearly everywhere, inner must be non-null, however in places where
3838     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3839     */
3840    LDKnativeQueryShortChannelIds *inner;
3841    /**
3842     * Indicates that this is the only struct which contains the same pointer.
3843     * Rust functions which take ownership of an object provided via an argument require
3844     * this to be true and invalidate the object pointed to by inner.
3845     */
3846    bool is_owned;
3847 } LDKQueryShortChannelIds;
3848
3849
3850
3851 /**
3852  * A reply_channel_range message is a reply to a query_channel_range
3853  * message. Multiple reply_channel_range messages can be sent in reply
3854  * to a single query_channel_range message. The query recipient makes a
3855  * best effort to respond based on their local network view which may
3856  * not be a perfect view of the network. The short_channel_ids in the
3857  * reply are encoded. We only support encoding_type=0 uncompressed
3858  * serialization and do not support encoding_type=1 zlib serialization.
3859  */
3860 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3861    /**
3862     * A pointer to the opaque Rust object.
3863     * Nearly everywhere, inner must be non-null, however in places where
3864     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3865     */
3866    LDKnativeReplyChannelRange *inner;
3867    /**
3868     * Indicates that this is the only struct which contains the same pointer.
3869     * Rust functions which take ownership of an object provided via an argument require
3870     * this to be true and invalidate the object pointed to by inner.
3871     */
3872    bool is_owned;
3873 } LDKReplyChannelRange;
3874
3875
3876
3877 /**
3878  * A gossip_timestamp_filter message is used by a node to request
3879  * gossip relay for messages in the requested time range when the
3880  * gossip_queries feature has been negotiated.
3881  */
3882 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
3883    /**
3884     * A pointer to the opaque Rust object.
3885     * Nearly everywhere, inner must be non-null, however in places where
3886     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3887     */
3888    LDKnativeGossipTimestampFilter *inner;
3889    /**
3890     * Indicates that this is the only struct which contains the same pointer.
3891     * Rust functions which take ownership of an object provided via an argument require
3892     * this to be true and invalidate the object pointed to by inner.
3893     */
3894    bool is_owned;
3895 } LDKGossipTimestampFilter;
3896
3897 /**
3898  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3899  * broadcast to most peers).
3900  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3901  */
3902 typedef enum LDKMessageSendEvent_Tag {
3903    /**
3904     * Used to indicate that we've accepted a channel open and should send the accept_channel
3905     * message provided to the given peer.
3906     */
3907    LDKMessageSendEvent_SendAcceptChannel,
3908    /**
3909     * Used to indicate that we've initiated a channel open and should send the open_channel
3910     * message provided to the given peer.
3911     */
3912    LDKMessageSendEvent_SendOpenChannel,
3913    /**
3914     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3915     */
3916    LDKMessageSendEvent_SendFundingCreated,
3917    /**
3918     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3919     */
3920    LDKMessageSendEvent_SendFundingSigned,
3921    /**
3922     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
3923     */
3924    LDKMessageSendEvent_SendChannelReady,
3925    /**
3926     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3927     */
3928    LDKMessageSendEvent_SendAnnouncementSignatures,
3929    /**
3930     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3931     * message should be sent to the peer with the given node_id.
3932     */
3933    LDKMessageSendEvent_UpdateHTLCs,
3934    /**
3935     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3936     */
3937    LDKMessageSendEvent_SendRevokeAndACK,
3938    /**
3939     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3940     */
3941    LDKMessageSendEvent_SendClosingSigned,
3942    /**
3943     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3944     */
3945    LDKMessageSendEvent_SendShutdown,
3946    /**
3947     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3948     */
3949    LDKMessageSendEvent_SendChannelReestablish,
3950    /**
3951     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3952     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3953     *
3954     * Note that after doing so, you very likely (unless you did so very recently) want to call
3955     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3956     * This ensures that any nodes which see our channel_announcement also have a relevant
3957     * node_announcement, including relevant feature flags which may be important for routing
3958     * through or to us.
3959     */
3960    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3961    /**
3962     * Used to indicate that a node_announcement should be broadcast to all peers.
3963     */
3964    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3965    /**
3966     * Used to indicate that a channel_update should be broadcast to all peers.
3967     */
3968    LDKMessageSendEvent_BroadcastChannelUpdate,
3969    /**
3970     * Used to indicate that a channel_update should be sent to a single peer.
3971     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
3972     * private channel and we shouldn't be informing all of our peers of channel parameters.
3973     */
3974    LDKMessageSendEvent_SendChannelUpdate,
3975    /**
3976     * Broadcast an error downstream to be handled
3977     */
3978    LDKMessageSendEvent_HandleError,
3979    /**
3980     * Query a peer for channels with funding transaction UTXOs in a block range.
3981     */
3982    LDKMessageSendEvent_SendChannelRangeQuery,
3983    /**
3984     * Request routing gossip messages from a peer for a list of channels identified by
3985     * their short_channel_ids.
3986     */
3987    LDKMessageSendEvent_SendShortIdsQuery,
3988    /**
3989     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3990     * emitted during processing of the query.
3991     */
3992    LDKMessageSendEvent_SendReplyChannelRange,
3993    /**
3994     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
3995     * enable receiving gossip messages from the peer.
3996     */
3997    LDKMessageSendEvent_SendGossipTimestampFilter,
3998    /**
3999     * Must be last for serialization purposes
4000     */
4001    LDKMessageSendEvent_Sentinel,
4002 } LDKMessageSendEvent_Tag;
4003
4004 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
4005    /**
4006     * The node_id of the node which should receive this message
4007     */
4008    struct LDKPublicKey node_id;
4009    /**
4010     * The message which should be sent.
4011     */
4012    struct LDKAcceptChannel msg;
4013 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
4014
4015 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
4016    /**
4017     * The node_id of the node which should receive this message
4018     */
4019    struct LDKPublicKey node_id;
4020    /**
4021     * The message which should be sent.
4022     */
4023    struct LDKOpenChannel msg;
4024 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
4025
4026 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
4027    /**
4028     * The node_id of the node which should receive this message
4029     */
4030    struct LDKPublicKey node_id;
4031    /**
4032     * The message which should be sent.
4033     */
4034    struct LDKFundingCreated msg;
4035 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
4036
4037 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
4038    /**
4039     * The node_id of the node which should receive this message
4040     */
4041    struct LDKPublicKey node_id;
4042    /**
4043     * The message which should be sent.
4044     */
4045    struct LDKFundingSigned msg;
4046 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
4047
4048 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
4049    /**
4050     * The node_id of the node which should receive these message(s)
4051     */
4052    struct LDKPublicKey node_id;
4053    /**
4054     * The channel_ready message which should be sent.
4055     */
4056    struct LDKChannelReady msg;
4057 } LDKMessageSendEvent_LDKSendChannelReady_Body;
4058
4059 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
4060    /**
4061     * The node_id of the node which should receive these message(s)
4062     */
4063    struct LDKPublicKey node_id;
4064    /**
4065     * The announcement_signatures message which should be sent.
4066     */
4067    struct LDKAnnouncementSignatures msg;
4068 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
4069
4070 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
4071    /**
4072     * The node_id of the node which should receive these message(s)
4073     */
4074    struct LDKPublicKey node_id;
4075    /**
4076     * The update messages which should be sent. ALL messages in the struct should be sent!
4077     */
4078    struct LDKCommitmentUpdate updates;
4079 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
4080
4081 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
4082    /**
4083     * The node_id of the node which should receive this message
4084     */
4085    struct LDKPublicKey node_id;
4086    /**
4087     * The message which should be sent.
4088     */
4089    struct LDKRevokeAndACK msg;
4090 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
4091
4092 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
4093    /**
4094     * The node_id of the node which should receive this message
4095     */
4096    struct LDKPublicKey node_id;
4097    /**
4098     * The message which should be sent.
4099     */
4100    struct LDKClosingSigned msg;
4101 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
4102
4103 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4104    /**
4105     * The node_id of the node which should receive this message
4106     */
4107    struct LDKPublicKey node_id;
4108    /**
4109     * The message which should be sent.
4110     */
4111    struct LDKShutdown msg;
4112 } LDKMessageSendEvent_LDKSendShutdown_Body;
4113
4114 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4115    /**
4116     * The node_id of the node which should receive this message
4117     */
4118    struct LDKPublicKey node_id;
4119    /**
4120     * The message which should be sent.
4121     */
4122    struct LDKChannelReestablish msg;
4123 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4124
4125 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4126    /**
4127     * The channel_announcement which should be sent.
4128     */
4129    struct LDKChannelAnnouncement msg;
4130    /**
4131     * The followup channel_update which should be sent.
4132     */
4133    struct LDKChannelUpdate update_msg;
4134 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4135
4136 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
4137    /**
4138     * The node_announcement which should be sent.
4139     */
4140    struct LDKNodeAnnouncement msg;
4141 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
4142
4143 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4144    /**
4145     * The channel_update which should be sent.
4146     */
4147    struct LDKChannelUpdate msg;
4148 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4149
4150 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
4151    /**
4152     * The node_id of the node which should receive this message
4153     */
4154    struct LDKPublicKey node_id;
4155    /**
4156     * The channel_update which should be sent.
4157     */
4158    struct LDKChannelUpdate msg;
4159 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
4160
4161 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4162    /**
4163     * The node_id of the node which should receive this message
4164     */
4165    struct LDKPublicKey node_id;
4166    /**
4167     * The action which should be taken.
4168     */
4169    struct LDKErrorAction action;
4170 } LDKMessageSendEvent_LDKHandleError_Body;
4171
4172 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4173    /**
4174     * The node_id of this message recipient
4175     */
4176    struct LDKPublicKey node_id;
4177    /**
4178     * The query_channel_range which should be sent.
4179     */
4180    struct LDKQueryChannelRange msg;
4181 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4182
4183 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4184    /**
4185     * The node_id of this message recipient
4186     */
4187    struct LDKPublicKey node_id;
4188    /**
4189     * The query_short_channel_ids which should be sent.
4190     */
4191    struct LDKQueryShortChannelIds msg;
4192 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4193
4194 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4195    /**
4196     * The node_id of this message recipient
4197     */
4198    struct LDKPublicKey node_id;
4199    /**
4200     * The reply_channel_range which should be sent.
4201     */
4202    struct LDKReplyChannelRange msg;
4203 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4204
4205 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
4206    /**
4207     * The node_id of this message recipient
4208     */
4209    struct LDKPublicKey node_id;
4210    /**
4211     * The gossip_timestamp_filter which should be sent.
4212     */
4213    struct LDKGossipTimestampFilter msg;
4214 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
4215
4216 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4217    LDKMessageSendEvent_Tag tag;
4218    union {
4219       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4220       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4221       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4222       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4223       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
4224       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4225       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4226       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4227       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4228       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4229       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4230       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4231       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4232       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4233       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4234       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4235       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4236       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4237       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4238       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
4239    };
4240 } LDKMessageSendEvent;
4241
4242 /**
4243  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4244  * This corresponds to std::vector in C++
4245  */
4246 typedef struct LDKCVec_MessageSendEventZ {
4247    /**
4248     * The elements in the array.
4249     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4250     */
4251    struct LDKMessageSendEvent *data;
4252    /**
4253     * The number of elements pointed to by `data`.
4254     */
4255    uintptr_t datalen;
4256 } LDKCVec_MessageSendEventZ;
4257
4258 /**
4259  * The contents of CResult_TxOutAccessErrorZ
4260  */
4261 typedef union LDKCResult_TxOutAccessErrorZPtr {
4262    /**
4263     * A pointer to the contents in the success state.
4264     * Reading from this pointer when `result_ok` is not set is undefined.
4265     */
4266    struct LDKTxOut *result;
4267    /**
4268     * A pointer to the contents in the error state.
4269     * Reading from this pointer when `result_ok` is set is undefined.
4270     */
4271    enum LDKAccessError *err;
4272 } LDKCResult_TxOutAccessErrorZPtr;
4273
4274 /**
4275  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4276  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4277  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4278  */
4279 typedef struct LDKCResult_TxOutAccessErrorZ {
4280    /**
4281     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4282     * `err` or `result` depending on the state of `result_ok`.
4283     */
4284    union LDKCResult_TxOutAccessErrorZPtr contents;
4285    /**
4286     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4287     */
4288    bool result_ok;
4289 } LDKCResult_TxOutAccessErrorZ;
4290
4291 /**
4292  * A tuple of 2 elements. See the individual fields for the types contained.
4293  */
4294 typedef struct LDKC2Tuple_usizeTransactionZ {
4295    /**
4296     * The element at position 0
4297     */
4298    uintptr_t a;
4299    /**
4300     * The element at position 1
4301     */
4302    struct LDKTransaction b;
4303 } LDKC2Tuple_usizeTransactionZ;
4304
4305 /**
4306  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4307  * This corresponds to std::vector in C++
4308  */
4309 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
4310    /**
4311     * The elements in the array.
4312     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4313     */
4314    struct LDKC2Tuple_usizeTransactionZ *data;
4315    /**
4316     * The number of elements pointed to by `data`.
4317     */
4318    uintptr_t datalen;
4319 } LDKCVec_C2Tuple_usizeTransactionZZ;
4320
4321 /**
4322  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4323  * This corresponds to std::vector in C++
4324  */
4325 typedef struct LDKCVec_TxidZ {
4326    /**
4327     * The elements in the array.
4328     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4329     */
4330    struct LDKThirtyTwoBytes *data;
4331    /**
4332     * The number of elements pointed to by `data`.
4333     */
4334    uintptr_t datalen;
4335 } LDKCVec_TxidZ;
4336
4337 /**
4338  * The contents of CResult_NoneChannelMonitorUpdateErrZ
4339  */
4340 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
4341    /**
4342     * Note that this value is always NULL, as there are no contents in the OK variant
4343     */
4344    void *result;
4345    /**
4346     * A pointer to the contents in the error state.
4347     * Reading from this pointer when `result_ok` is set is undefined.
4348     */
4349    enum LDKChannelMonitorUpdateErr *err;
4350 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
4351
4352 /**
4353  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
4354  * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
4355  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4356  */
4357 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
4358    /**
4359     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
4360     * `err` or `result` depending on the state of `result_ok`.
4361     */
4362    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
4363    /**
4364     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
4365     */
4366    bool result_ok;
4367 } LDKCResult_NoneChannelMonitorUpdateErrZ;
4368
4369
4370
4371 /**
4372  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
4373  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
4374  * preimage claim backward will lead to loss of funds.
4375  */
4376 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
4377    /**
4378     * A pointer to the opaque Rust object.
4379     * Nearly everywhere, inner must be non-null, however in places where
4380     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4381     */
4382    LDKnativeHTLCUpdate *inner;
4383    /**
4384     * Indicates that this is the only struct which contains the same pointer.
4385     * Rust functions which take ownership of an object provided via an argument require
4386     * this to be true and invalidate the object pointed to by inner.
4387     */
4388    bool is_owned;
4389 } LDKHTLCUpdate;
4390
4391 /**
4392  * An event to be processed by the ChannelManager.
4393  */
4394 typedef enum LDKMonitorEvent_Tag {
4395    /**
4396     * A monitor event containing an HTLCUpdate.
4397     */
4398    LDKMonitorEvent_HTLCEvent,
4399    /**
4400     * A monitor event that the Channel's commitment transaction was confirmed.
4401     */
4402    LDKMonitorEvent_CommitmentTxConfirmed,
4403    /**
4404     * Indicates a [`ChannelMonitor`] update has completed. See
4405     * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
4406     *
4407     * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
4408     */
4409    LDKMonitorEvent_UpdateCompleted,
4410    /**
4411     * Indicates a [`ChannelMonitor`] update has failed. See
4412     * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
4413     *
4414     * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
4415     */
4416    LDKMonitorEvent_UpdateFailed,
4417    /**
4418     * Must be last for serialization purposes
4419     */
4420    LDKMonitorEvent_Sentinel,
4421 } LDKMonitorEvent_Tag;
4422
4423 typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
4424    /**
4425     * The funding outpoint of the [`ChannelMonitor`] that was updated
4426     */
4427    struct LDKOutPoint funding_txo;
4428    /**
4429     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
4430     * [`ChannelMonitor::get_latest_update_id`].
4431     *
4432     * Note that this should only be set to a given update's ID if all previous updates for the
4433     * same [`ChannelMonitor`] have been applied and persisted.
4434     */
4435    uint64_t monitor_update_id;
4436 } LDKMonitorEvent_LDKUpdateCompleted_Body;
4437
4438 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
4439    LDKMonitorEvent_Tag tag;
4440    union {
4441       struct {
4442          struct LDKHTLCUpdate htlc_event;
4443       };
4444       struct {
4445          struct LDKOutPoint commitment_tx_confirmed;
4446       };
4447       LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
4448       struct {
4449          struct LDKOutPoint update_failed;
4450       };
4451    };
4452 } LDKMonitorEvent;
4453
4454 /**
4455  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4456  * This corresponds to std::vector in C++
4457  */
4458 typedef struct LDKCVec_MonitorEventZ {
4459    /**
4460     * The elements in the array.
4461     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4462     */
4463    struct LDKMonitorEvent *data;
4464    /**
4465     * The number of elements pointed to by `data`.
4466     */
4467    uintptr_t datalen;
4468 } LDKCVec_MonitorEventZ;
4469
4470 /**
4471  * A tuple of 2 elements. See the individual fields for the types contained.
4472  */
4473 typedef struct LDKC2Tuple_OutPointCVec_MonitorEventZZ {
4474    /**
4475     * The element at position 0
4476     */
4477    struct LDKOutPoint a;
4478    /**
4479     * The element at position 1
4480     */
4481    struct LDKCVec_MonitorEventZ b;
4482 } LDKC2Tuple_OutPointCVec_MonitorEventZZ;
4483
4484 /**
4485  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
4486  * This corresponds to std::vector in C++
4487  */
4488 typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
4489    /**
4490     * The elements in the array.
4491     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4492     */
4493    struct LDKC2Tuple_OutPointCVec_MonitorEventZZ *data;
4494    /**
4495     * The number of elements pointed to by `data`.
4496     */
4497    uintptr_t datalen;
4498 } LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ;
4499
4500 /**
4501  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4502  */
4503 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
4504    /**
4505     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4506     */
4507    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
4508    /**
4509     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4510     */
4511    LDKCOption_C2Tuple_usizeTransactionZZ_None,
4512    /**
4513     * Must be last for serialization purposes
4514     */
4515    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
4516 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
4517
4518 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
4519    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
4520    union {
4521       struct {
4522          struct LDKC2Tuple_usizeTransactionZ some;
4523       };
4524    };
4525 } LDKCOption_C2Tuple_usizeTransactionZZ;
4526
4527
4528
4529 /**
4530  * [`Score`] implementation that uses a fixed penalty.
4531  */
4532 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
4533    /**
4534     * A pointer to the opaque Rust object.
4535     * Nearly everywhere, inner must be non-null, however in places where
4536     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4537     */
4538    LDKnativeFixedPenaltyScorer *inner;
4539    /**
4540     * Indicates that this is the only struct which contains the same pointer.
4541     * Rust functions which take ownership of an object provided via an argument require
4542     * this to be true and invalidate the object pointed to by inner.
4543     */
4544    bool is_owned;
4545 } LDKFixedPenaltyScorer;
4546
4547 /**
4548  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4549  */
4550 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
4551    /**
4552     * A pointer to the contents in the success state.
4553     * Reading from this pointer when `result_ok` is not set is undefined.
4554     */
4555    struct LDKFixedPenaltyScorer *result;
4556    /**
4557     * A pointer to the contents in the error state.
4558     * Reading from this pointer when `result_ok` is set is undefined.
4559     */
4560    struct LDKDecodeError *err;
4561 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
4562
4563 /**
4564  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4565  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4566  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4567  */
4568 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
4569    /**
4570     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4571     * `err` or `result` depending on the state of `result_ok`.
4572     */
4573    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
4574    /**
4575     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4576     */
4577    bool result_ok;
4578 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
4579
4580
4581
4582 /**
4583  * A Record, unit of logging output with Metadata to enable filtering
4584  * Module_path, file, line to inform on log's source
4585  */
4586 typedef struct MUST_USE_STRUCT LDKRecord {
4587    /**
4588     * A pointer to the opaque Rust object.
4589     * Nearly everywhere, inner must be non-null, however in places where
4590     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4591     */
4592    LDKnativeRecord *inner;
4593    /**
4594     * Indicates that this is the only struct which contains the same pointer.
4595     * Rust functions which take ownership of an object provided via an argument require
4596     * this to be true and invalidate the object pointed to by inner.
4597     */
4598    bool is_owned;
4599 } LDKRecord;
4600
4601 /**
4602  * A trait encapsulating the operations required of a logger
4603  */
4604 typedef struct LDKLogger {
4605    /**
4606     * An opaque pointer which is passed to your function implementations as an argument.
4607     * This has no meaning in the LDK, and can be NULL or any other value.
4608     */
4609    void *this_arg;
4610    /**
4611     * Logs the `Record`
4612     */
4613    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
4614    /**
4615     * Frees any resources associated with this object given its this_arg pointer.
4616     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4617     */
4618    void (*free)(void *this_arg);
4619 } LDKLogger;
4620
4621
4622
4623 /**
4624  * Represents the network as nodes and channels between them
4625  */
4626 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4627    /**
4628     * A pointer to the opaque Rust object.
4629     * Nearly everywhere, inner must be non-null, however in places where
4630     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4631     */
4632    LDKnativeNetworkGraph *inner;
4633    /**
4634     * Indicates that this is the only struct which contains the same pointer.
4635     * Rust functions which take ownership of an object provided via an argument require
4636     * this to be true and invalidate the object pointed to by inner.
4637     */
4638    bool is_owned;
4639 } LDKNetworkGraph;
4640
4641
4642
4643 /**
4644  * [`Score`] implementation using channel success probability distributions.
4645  *
4646  * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
4647  * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
4648  * distributions are defined based on knowledge learned from successful and unsuccessful attempts.
4649  * Then the negative `log10` of the success probability is used to determine the cost of routing a
4650  * specific HTLC amount through a channel.
4651  *
4652  * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
4653  * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
4654  * [`ProbabilisticScoringParameters`] for details.
4655  *
4656  * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
4657  * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
4658  * volume are more likely to experience failed payment paths, which would need to be retried.
4659  *
4660  * # Note
4661  *
4662  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4663  * behavior.
4664  *
4665  * [1]: https://arxiv.org/abs/2107.05322
4666  */
4667 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
4668    /**
4669     * A pointer to the opaque Rust object.
4670     * Nearly everywhere, inner must be non-null, however in places where
4671     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4672     */
4673    LDKnativeProbabilisticScorer *inner;
4674    /**
4675     * Indicates that this is the only struct which contains the same pointer.
4676     * Rust functions which take ownership of an object provided via an argument require
4677     * this to be true and invalidate the object pointed to by inner.
4678     */
4679    bool is_owned;
4680 } LDKProbabilisticScorer;
4681
4682 /**
4683  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
4684  */
4685 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
4686    /**
4687     * A pointer to the contents in the success state.
4688     * Reading from this pointer when `result_ok` is not set is undefined.
4689     */
4690    struct LDKProbabilisticScorer *result;
4691    /**
4692     * A pointer to the contents in the error state.
4693     * Reading from this pointer when `result_ok` is set is undefined.
4694     */
4695    struct LDKDecodeError *err;
4696 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
4697
4698 /**
4699  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4700  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4701  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4702  */
4703 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
4704    /**
4705     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4706     * `err` or `result` depending on the state of `result_ok`.
4707     */
4708    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
4709    /**
4710     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4711     */
4712    bool result_ok;
4713 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
4714
4715
4716
4717 /**
4718  * Features used within an `init` message.
4719  */
4720 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4721    /**
4722     * A pointer to the opaque Rust object.
4723     * Nearly everywhere, inner must be non-null, however in places where
4724     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4725     */
4726    LDKnativeInitFeatures *inner;
4727    /**
4728     * Indicates that this is the only struct which contains the same pointer.
4729     * Rust functions which take ownership of an object provided via an argument require
4730     * this to be true and invalidate the object pointed to by inner.
4731     */
4732    bool is_owned;
4733 } LDKInitFeatures;
4734
4735 /**
4736  * The contents of CResult_InitFeaturesDecodeErrorZ
4737  */
4738 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4739    /**
4740     * A pointer to the contents in the success state.
4741     * Reading from this pointer when `result_ok` is not set is undefined.
4742     */
4743    struct LDKInitFeatures *result;
4744    /**
4745     * A pointer to the contents in the error state.
4746     * Reading from this pointer when `result_ok` is set is undefined.
4747     */
4748    struct LDKDecodeError *err;
4749 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4750
4751 /**
4752  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4753  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4754  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4755  */
4756 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4757    /**
4758     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4759     * `err` or `result` depending on the state of `result_ok`.
4760     */
4761    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4762    /**
4763     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4764     */
4765    bool result_ok;
4766 } LDKCResult_InitFeaturesDecodeErrorZ;
4767
4768
4769
4770 /**
4771  * Features used within a `channel_announcement` message.
4772  */
4773 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4774    /**
4775     * A pointer to the opaque Rust object.
4776     * Nearly everywhere, inner must be non-null, however in places where
4777     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4778     */
4779    LDKnativeChannelFeatures *inner;
4780    /**
4781     * Indicates that this is the only struct which contains the same pointer.
4782     * Rust functions which take ownership of an object provided via an argument require
4783     * this to be true and invalidate the object pointed to by inner.
4784     */
4785    bool is_owned;
4786 } LDKChannelFeatures;
4787
4788 /**
4789  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4790  */
4791 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4792    /**
4793     * A pointer to the contents in the success state.
4794     * Reading from this pointer when `result_ok` is not set is undefined.
4795     */
4796    struct LDKChannelFeatures *result;
4797    /**
4798     * A pointer to the contents in the error state.
4799     * Reading from this pointer when `result_ok` is set is undefined.
4800     */
4801    struct LDKDecodeError *err;
4802 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4803
4804 /**
4805  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4806  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4807  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4808  */
4809 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4810    /**
4811     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4812     * `err` or `result` depending on the state of `result_ok`.
4813     */
4814    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4815    /**
4816     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4817     */
4818    bool result_ok;
4819 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4820
4821
4822
4823 /**
4824  * Features used within a `node_announcement` message.
4825  */
4826 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4827    /**
4828     * A pointer to the opaque Rust object.
4829     * Nearly everywhere, inner must be non-null, however in places where
4830     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4831     */
4832    LDKnativeNodeFeatures *inner;
4833    /**
4834     * Indicates that this is the only struct which contains the same pointer.
4835     * Rust functions which take ownership of an object provided via an argument require
4836     * this to be true and invalidate the object pointed to by inner.
4837     */
4838    bool is_owned;
4839 } LDKNodeFeatures;
4840
4841 /**
4842  * The contents of CResult_NodeFeaturesDecodeErrorZ
4843  */
4844 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4845    /**
4846     * A pointer to the contents in the success state.
4847     * Reading from this pointer when `result_ok` is not set is undefined.
4848     */
4849    struct LDKNodeFeatures *result;
4850    /**
4851     * A pointer to the contents in the error state.
4852     * Reading from this pointer when `result_ok` is set is undefined.
4853     */
4854    struct LDKDecodeError *err;
4855 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4856
4857 /**
4858  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4859  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4860  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4861  */
4862 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4863    /**
4864     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4865     * `err` or `result` depending on the state of `result_ok`.
4866     */
4867    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4868    /**
4869     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4870     */
4871    bool result_ok;
4872 } LDKCResult_NodeFeaturesDecodeErrorZ;
4873
4874
4875
4876 /**
4877  * Features used within an invoice.
4878  */
4879 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4880    /**
4881     * A pointer to the opaque Rust object.
4882     * Nearly everywhere, inner must be non-null, however in places where
4883     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4884     */
4885    LDKnativeInvoiceFeatures *inner;
4886    /**
4887     * Indicates that this is the only struct which contains the same pointer.
4888     * Rust functions which take ownership of an object provided via an argument require
4889     * this to be true and invalidate the object pointed to by inner.
4890     */
4891    bool is_owned;
4892 } LDKInvoiceFeatures;
4893
4894 /**
4895  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4896  */
4897 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4898    /**
4899     * A pointer to the contents in the success state.
4900     * Reading from this pointer when `result_ok` is not set is undefined.
4901     */
4902    struct LDKInvoiceFeatures *result;
4903    /**
4904     * A pointer to the contents in the error state.
4905     * Reading from this pointer when `result_ok` is set is undefined.
4906     */
4907    struct LDKDecodeError *err;
4908 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4909
4910 /**
4911  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4912  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4913  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4914  */
4915 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4916    /**
4917     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4918     * `err` or `result` depending on the state of `result_ok`.
4919     */
4920    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4921    /**
4922     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4923     */
4924    bool result_ok;
4925 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4926
4927 /**
4928  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4929  */
4930 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
4931    /**
4932     * A pointer to the contents in the success state.
4933     * Reading from this pointer when `result_ok` is not set is undefined.
4934     */
4935    struct LDKChannelTypeFeatures *result;
4936    /**
4937     * A pointer to the contents in the error state.
4938     * Reading from this pointer when `result_ok` is set is undefined.
4939     */
4940    struct LDKDecodeError *err;
4941 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
4942
4943 /**
4944  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4945  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4946  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4947  */
4948 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
4949    /**
4950     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4951     * `err` or `result` depending on the state of `result_ok`.
4952     */
4953    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
4954    /**
4955     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4956     */
4957    bool result_ok;
4958 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
4959
4960 /**
4961  * The contents of CResult_NodeIdDecodeErrorZ
4962  */
4963 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
4964    /**
4965     * A pointer to the contents in the success state.
4966     * Reading from this pointer when `result_ok` is not set is undefined.
4967     */
4968    struct LDKNodeId *result;
4969    /**
4970     * A pointer to the contents in the error state.
4971     * Reading from this pointer when `result_ok` is set is undefined.
4972     */
4973    struct LDKDecodeError *err;
4974 } LDKCResult_NodeIdDecodeErrorZPtr;
4975
4976 /**
4977  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4978  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4979  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4980  */
4981 typedef struct LDKCResult_NodeIdDecodeErrorZ {
4982    /**
4983     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4984     * `err` or `result` depending on the state of `result_ok`.
4985     */
4986    union LDKCResult_NodeIdDecodeErrorZPtr contents;
4987    /**
4988     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4989     */
4990    bool result_ok;
4991 } LDKCResult_NodeIdDecodeErrorZ;
4992
4993 /**
4994  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4995  */
4996 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
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    struct LDKCOption_NetworkUpdateZ *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 LDKDecodeError *err;
5007 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
5008
5009 /**
5010  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5011  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5012  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5013  */
5014 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
5015    /**
5016     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5017     * `err` or `result` depending on the state of `result_ok`.
5018     */
5019    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
5020    /**
5021     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5022     */
5023    bool result_ok;
5024 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
5025
5026 /**
5027  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
5028  * UTXOs.
5029  */
5030 typedef struct LDKAccess {
5031    /**
5032     * An opaque pointer which is passed to your function implementations as an argument.
5033     * This has no meaning in the LDK, and can be NULL or any other value.
5034     */
5035    void *this_arg;
5036    /**
5037     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
5038     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
5039     * is unknown.
5040     *
5041     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
5042     */
5043    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
5044    /**
5045     * Frees any resources associated with this object given its this_arg pointer.
5046     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5047     */
5048    void (*free)(void *this_arg);
5049 } LDKAccess;
5050
5051 /**
5052  * An enum which can either contain a crate::lightning::chain::Access or not
5053  */
5054 typedef enum LDKCOption_AccessZ_Tag {
5055    /**
5056     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5057     */
5058    LDKCOption_AccessZ_Some,
5059    /**
5060     * When we're in this state, this COption_AccessZ contains nothing
5061     */
5062    LDKCOption_AccessZ_None,
5063    /**
5064     * Must be last for serialization purposes
5065     */
5066    LDKCOption_AccessZ_Sentinel,
5067 } LDKCOption_AccessZ_Tag;
5068
5069 typedef struct LDKCOption_AccessZ {
5070    LDKCOption_AccessZ_Tag tag;
5071    union {
5072       struct {
5073          struct LDKAccess some;
5074       };
5075    };
5076 } LDKCOption_AccessZ;
5077
5078 /**
5079  * The contents of CResult_boolLightningErrorZ
5080  */
5081 typedef union LDKCResult_boolLightningErrorZPtr {
5082    /**
5083     * A pointer to the contents in the success state.
5084     * Reading from this pointer when `result_ok` is not set is undefined.
5085     */
5086    bool *result;
5087    /**
5088     * A pointer to the contents in the error state.
5089     * Reading from this pointer when `result_ok` is set is undefined.
5090     */
5091    struct LDKLightningError *err;
5092 } LDKCResult_boolLightningErrorZPtr;
5093
5094 /**
5095  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5096  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5097  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5098  */
5099 typedef struct LDKCResult_boolLightningErrorZ {
5100    /**
5101     * The contents of this CResult_boolLightningErrorZ, accessible via either
5102     * `err` or `result` depending on the state of `result_ok`.
5103     */
5104    union LDKCResult_boolLightningErrorZPtr contents;
5105    /**
5106     * Whether this CResult_boolLightningErrorZ represents a success state.
5107     */
5108    bool result_ok;
5109 } LDKCResult_boolLightningErrorZ;
5110
5111 /**
5112  * A tuple of 3 elements. See the individual fields for the types contained.
5113  */
5114 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5115    /**
5116     * The element at position 0
5117     */
5118    struct LDKChannelAnnouncement a;
5119    /**
5120     * The element at position 1
5121     */
5122    struct LDKChannelUpdate b;
5123    /**
5124     * The element at position 2
5125     */
5126    struct LDKChannelUpdate c;
5127 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5128
5129 /**
5130  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5131  * This corresponds to std::vector in C++
5132  */
5133 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5134    /**
5135     * The elements in the array.
5136     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5137     */
5138    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
5139    /**
5140     * The number of elements pointed to by `data`.
5141     */
5142    uintptr_t datalen;
5143 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5144
5145 /**
5146  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5147  * This corresponds to std::vector in C++
5148  */
5149 typedef struct LDKCVec_NodeAnnouncementZ {
5150    /**
5151     * The elements in the array.
5152     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5153     */
5154    struct LDKNodeAnnouncement *data;
5155    /**
5156     * The number of elements pointed to by `data`.
5157     */
5158    uintptr_t datalen;
5159 } LDKCVec_NodeAnnouncementZ;
5160
5161 /**
5162  * The contents of CResult_NoneLightningErrorZ
5163  */
5164 typedef union LDKCResult_NoneLightningErrorZPtr {
5165    /**
5166     * Note that this value is always NULL, as there are no contents in the OK variant
5167     */
5168    void *result;
5169    /**
5170     * A pointer to the contents in the error state.
5171     * Reading from this pointer when `result_ok` is set is undefined.
5172     */
5173    struct LDKLightningError *err;
5174 } LDKCResult_NoneLightningErrorZPtr;
5175
5176 /**
5177  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5178  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5179  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5180  */
5181 typedef struct LDKCResult_NoneLightningErrorZ {
5182    /**
5183     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5184     * `err` or `result` depending on the state of `result_ok`.
5185     */
5186    union LDKCResult_NoneLightningErrorZPtr contents;
5187    /**
5188     * Whether this CResult_NoneLightningErrorZ represents a success state.
5189     */
5190    bool result_ok;
5191 } LDKCResult_NoneLightningErrorZ;
5192
5193
5194
5195 /**
5196  * Details about one direction of a channel as received within a [`ChannelUpdate`].
5197  */
5198 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
5199    /**
5200     * A pointer to the opaque Rust object.
5201     * Nearly everywhere, inner must be non-null, however in places where
5202     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5203     */
5204    LDKnativeChannelUpdateInfo *inner;
5205    /**
5206     * Indicates that this is the only struct which contains the same pointer.
5207     * Rust functions which take ownership of an object provided via an argument require
5208     * this to be true and invalidate the object pointed to by inner.
5209     */
5210    bool is_owned;
5211 } LDKChannelUpdateInfo;
5212
5213 /**
5214  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5215  */
5216 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
5217    /**
5218     * A pointer to the contents in the success state.
5219     * Reading from this pointer when `result_ok` is not set is undefined.
5220     */
5221    struct LDKChannelUpdateInfo *result;
5222    /**
5223     * A pointer to the contents in the error state.
5224     * Reading from this pointer when `result_ok` is set is undefined.
5225     */
5226    struct LDKDecodeError *err;
5227 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
5228
5229 /**
5230  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5231  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5232  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5233  */
5234 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
5235    /**
5236     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5237     * `err` or `result` depending on the state of `result_ok`.
5238     */
5239    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
5240    /**
5241     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5242     */
5243    bool result_ok;
5244 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
5245
5246
5247
5248 /**
5249  * Details about a channel (both directions).
5250  * Received within a channel announcement.
5251  */
5252 typedef struct MUST_USE_STRUCT LDKChannelInfo {
5253    /**
5254     * A pointer to the opaque Rust object.
5255     * Nearly everywhere, inner must be non-null, however in places where
5256     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5257     */
5258    LDKnativeChannelInfo *inner;
5259    /**
5260     * Indicates that this is the only struct which contains the same pointer.
5261     * Rust functions which take ownership of an object provided via an argument require
5262     * this to be true and invalidate the object pointed to by inner.
5263     */
5264    bool is_owned;
5265 } LDKChannelInfo;
5266
5267 /**
5268  * The contents of CResult_ChannelInfoDecodeErrorZ
5269  */
5270 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
5271    /**
5272     * A pointer to the contents in the success state.
5273     * Reading from this pointer when `result_ok` is not set is undefined.
5274     */
5275    struct LDKChannelInfo *result;
5276    /**
5277     * A pointer to the contents in the error state.
5278     * Reading from this pointer when `result_ok` is set is undefined.
5279     */
5280    struct LDKDecodeError *err;
5281 } LDKCResult_ChannelInfoDecodeErrorZPtr;
5282
5283 /**
5284  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5285  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5286  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5287  */
5288 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
5289    /**
5290     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5291     * `err` or `result` depending on the state of `result_ok`.
5292     */
5293    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
5294    /**
5295     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5296     */
5297    bool result_ok;
5298 } LDKCResult_ChannelInfoDecodeErrorZ;
5299
5300
5301
5302 /**
5303  * Fees for routing via a given channel or a node
5304  */
5305 typedef struct MUST_USE_STRUCT LDKRoutingFees {
5306    /**
5307     * A pointer to the opaque Rust object.
5308     * Nearly everywhere, inner must be non-null, however in places where
5309     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5310     */
5311    LDKnativeRoutingFees *inner;
5312    /**
5313     * Indicates that this is the only struct which contains the same pointer.
5314     * Rust functions which take ownership of an object provided via an argument require
5315     * this to be true and invalidate the object pointed to by inner.
5316     */
5317    bool is_owned;
5318 } LDKRoutingFees;
5319
5320 /**
5321  * The contents of CResult_RoutingFeesDecodeErrorZ
5322  */
5323 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
5324    /**
5325     * A pointer to the contents in the success state.
5326     * Reading from this pointer when `result_ok` is not set is undefined.
5327     */
5328    struct LDKRoutingFees *result;
5329    /**
5330     * A pointer to the contents in the error state.
5331     * Reading from this pointer when `result_ok` is set is undefined.
5332     */
5333    struct LDKDecodeError *err;
5334 } LDKCResult_RoutingFeesDecodeErrorZPtr;
5335
5336 /**
5337  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5338  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5339  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5340  */
5341 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
5342    /**
5343     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5344     * `err` or `result` depending on the state of `result_ok`.
5345     */
5346    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
5347    /**
5348     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5349     */
5350    bool result_ok;
5351 } LDKCResult_RoutingFeesDecodeErrorZ;
5352
5353 /**
5354  * A 4-byte byte array.
5355  */
5356 typedef struct LDKFourBytes {
5357    /**
5358     * The four bytes
5359     */
5360    uint8_t data[4];
5361 } LDKFourBytes;
5362
5363 /**
5364  * A 16-byte byte array.
5365  */
5366 typedef struct LDKSixteenBytes {
5367    /**
5368     * The sixteen bytes
5369     */
5370    uint8_t data[16];
5371 } LDKSixteenBytes;
5372
5373 /**
5374  * A 12-byte byte array.
5375  */
5376 typedef struct LDKTwelveBytes {
5377    /**
5378     * The twelve bytes
5379     */
5380    uint8_t data[12];
5381 } LDKTwelveBytes;
5382
5383 /**
5384  * An address which can be used to connect to a remote peer
5385  */
5386 typedef enum LDKNetAddress_Tag {
5387    /**
5388     * An IPv4 address/port on which the peer is listening.
5389     */
5390    LDKNetAddress_IPv4,
5391    /**
5392     * An IPv6 address/port on which the peer is listening.
5393     */
5394    LDKNetAddress_IPv6,
5395    /**
5396     * An old-style Tor onion address/port on which the peer is listening.
5397     *
5398     * This field is deprecated and the Tor network generally no longer supports V2 Onion
5399     * addresses. Thus, the details are not parsed here.
5400     */
5401    LDKNetAddress_OnionV2,
5402    /**
5403     * A new-style Tor onion address/port on which the peer is listening.
5404     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
5405     * wrap as base32 and append \".onion\".
5406     */
5407    LDKNetAddress_OnionV3,
5408    /**
5409     * Must be last for serialization purposes
5410     */
5411    LDKNetAddress_Sentinel,
5412 } LDKNetAddress_Tag;
5413
5414 typedef struct LDKNetAddress_LDKIPv4_Body {
5415    /**
5416     * The 4-byte IPv4 address
5417     */
5418    struct LDKFourBytes addr;
5419    /**
5420     * The port on which the node is listening
5421     */
5422    uint16_t port;
5423 } LDKNetAddress_LDKIPv4_Body;
5424
5425 typedef struct LDKNetAddress_LDKIPv6_Body {
5426    /**
5427     * The 16-byte IPv6 address
5428     */
5429    struct LDKSixteenBytes addr;
5430    /**
5431     * The port on which the node is listening
5432     */
5433    uint16_t port;
5434 } LDKNetAddress_LDKIPv6_Body;
5435
5436 typedef struct LDKNetAddress_LDKOnionV3_Body {
5437    /**
5438     * The ed25519 long-term public key of the peer
5439     */
5440    struct LDKThirtyTwoBytes ed25519_pubkey;
5441    /**
5442     * The checksum of the pubkey and version, as included in the onion address
5443     */
5444    uint16_t checksum;
5445    /**
5446     * The version byte, as defined by the Tor Onion v3 spec.
5447     */
5448    uint8_t version;
5449    /**
5450     * The port on which the node is listening
5451     */
5452    uint16_t port;
5453 } LDKNetAddress_LDKOnionV3_Body;
5454
5455 typedef struct MUST_USE_STRUCT LDKNetAddress {
5456    LDKNetAddress_Tag tag;
5457    union {
5458       LDKNetAddress_LDKIPv4_Body i_pv4;
5459       LDKNetAddress_LDKIPv6_Body i_pv6;
5460       struct {
5461          struct LDKTwelveBytes onion_v2;
5462       };
5463       LDKNetAddress_LDKOnionV3_Body onion_v3;
5464    };
5465 } LDKNetAddress;
5466
5467 /**
5468  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5469  * This corresponds to std::vector in C++
5470  */
5471 typedef struct LDKCVec_NetAddressZ {
5472    /**
5473     * The elements in the array.
5474     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5475     */
5476    struct LDKNetAddress *data;
5477    /**
5478     * The number of elements pointed to by `data`.
5479     */
5480    uintptr_t datalen;
5481 } LDKCVec_NetAddressZ;
5482
5483
5484
5485 /**
5486  * Information received in the latest node_announcement from this node.
5487  */
5488 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
5489    /**
5490     * A pointer to the opaque Rust object.
5491     * Nearly everywhere, inner must be non-null, however in places where
5492     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5493     */
5494    LDKnativeNodeAnnouncementInfo *inner;
5495    /**
5496     * Indicates that this is the only struct which contains the same pointer.
5497     * Rust functions which take ownership of an object provided via an argument require
5498     * this to be true and invalidate the object pointed to by inner.
5499     */
5500    bool is_owned;
5501 } LDKNodeAnnouncementInfo;
5502
5503 /**
5504  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5505  */
5506 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
5507    /**
5508     * A pointer to the contents in the success state.
5509     * Reading from this pointer when `result_ok` is not set is undefined.
5510     */
5511    struct LDKNodeAnnouncementInfo *result;
5512    /**
5513     * A pointer to the contents in the error state.
5514     * Reading from this pointer when `result_ok` is set is undefined.
5515     */
5516    struct LDKDecodeError *err;
5517 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
5518
5519 /**
5520  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5521  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5522  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5523  */
5524 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
5525    /**
5526     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5527     * `err` or `result` depending on the state of `result_ok`.
5528     */
5529    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
5530    /**
5531     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5532     */
5533    bool result_ok;
5534 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
5535
5536 /**
5537  * A dynamically-allocated array of u64s of arbitrary size.
5538  * This corresponds to std::vector in C++
5539  */
5540 typedef struct LDKCVec_u64Z {
5541    /**
5542     * The elements in the array.
5543     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5544     */
5545    uint64_t *data;
5546    /**
5547     * The number of elements pointed to by `data`.
5548     */
5549    uintptr_t datalen;
5550 } LDKCVec_u64Z;
5551
5552
5553
5554 /**
5555  * Details about a node in the network, known from the network announcement.
5556  */
5557 typedef struct MUST_USE_STRUCT LDKNodeInfo {
5558    /**
5559     * A pointer to the opaque Rust object.
5560     * Nearly everywhere, inner must be non-null, however in places where
5561     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5562     */
5563    LDKnativeNodeInfo *inner;
5564    /**
5565     * Indicates that this is the only struct which contains the same pointer.
5566     * Rust functions which take ownership of an object provided via an argument require
5567     * this to be true and invalidate the object pointed to by inner.
5568     */
5569    bool is_owned;
5570 } LDKNodeInfo;
5571
5572 /**
5573  * The contents of CResult_NodeInfoDecodeErrorZ
5574  */
5575 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
5576    /**
5577     * A pointer to the contents in the success state.
5578     * Reading from this pointer when `result_ok` is not set is undefined.
5579     */
5580    struct LDKNodeInfo *result;
5581    /**
5582     * A pointer to the contents in the error state.
5583     * Reading from this pointer when `result_ok` is set is undefined.
5584     */
5585    struct LDKDecodeError *err;
5586 } LDKCResult_NodeInfoDecodeErrorZPtr;
5587
5588 /**
5589  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5590  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5591  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5592  */
5593 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
5594    /**
5595     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5596     * `err` or `result` depending on the state of `result_ok`.
5597     */
5598    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
5599    /**
5600     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5601     */
5602    bool result_ok;
5603 } LDKCResult_NodeInfoDecodeErrorZ;
5604
5605 /**
5606  * The contents of CResult_NetworkGraphDecodeErrorZ
5607  */
5608 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
5609    /**
5610     * A pointer to the contents in the success state.
5611     * Reading from this pointer when `result_ok` is not set is undefined.
5612     */
5613    struct LDKNetworkGraph *result;
5614    /**
5615     * A pointer to the contents in the error state.
5616     * Reading from this pointer when `result_ok` is set is undefined.
5617     */
5618    struct LDKDecodeError *err;
5619 } LDKCResult_NetworkGraphDecodeErrorZPtr;
5620
5621 /**
5622  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5623  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5624  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5625  */
5626 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
5627    /**
5628     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5629     * `err` or `result` depending on the state of `result_ok`.
5630     */
5631    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
5632    /**
5633     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5634     */
5635    bool result_ok;
5636 } LDKCResult_NetworkGraphDecodeErrorZ;
5637
5638 /**
5639  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
5640  */
5641 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
5642    /**
5643     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
5644     */
5645    LDKCOption_CVec_NetAddressZZ_Some,
5646    /**
5647     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
5648     */
5649    LDKCOption_CVec_NetAddressZZ_None,
5650    /**
5651     * Must be last for serialization purposes
5652     */
5653    LDKCOption_CVec_NetAddressZZ_Sentinel,
5654 } LDKCOption_CVec_NetAddressZZ_Tag;
5655
5656 typedef struct LDKCOption_CVec_NetAddressZZ {
5657    LDKCOption_CVec_NetAddressZZ_Tag tag;
5658    union {
5659       struct {
5660          struct LDKCVec_NetAddressZ some;
5661       };
5662    };
5663 } LDKCOption_CVec_NetAddressZZ;
5664
5665 /**
5666  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
5667  */
5668 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5669    /**
5670     * A pointer to the contents in the success state.
5671     * Reading from this pointer when `result_ok` is not set is undefined.
5672     */
5673    struct LDKDelayedPaymentOutputDescriptor *result;
5674    /**
5675     * A pointer to the contents in the error state.
5676     * Reading from this pointer when `result_ok` is set is undefined.
5677     */
5678    struct LDKDecodeError *err;
5679 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
5680
5681 /**
5682  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5683  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5684  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5685  */
5686 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5687    /**
5688     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
5689     * `err` or `result` depending on the state of `result_ok`.
5690     */
5691    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
5692    /**
5693     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
5694     */
5695    bool result_ok;
5696 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
5697
5698 /**
5699  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
5700  */
5701 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5702    /**
5703     * A pointer to the contents in the success state.
5704     * Reading from this pointer when `result_ok` is not set is undefined.
5705     */
5706    struct LDKStaticPaymentOutputDescriptor *result;
5707    /**
5708     * A pointer to the contents in the error state.
5709     * Reading from this pointer when `result_ok` is set is undefined.
5710     */
5711    struct LDKDecodeError *err;
5712 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
5713
5714 /**
5715  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5716  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5717  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5718  */
5719 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5720    /**
5721     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
5722     * `err` or `result` depending on the state of `result_ok`.
5723     */
5724    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
5725    /**
5726     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
5727     */
5728    bool result_ok;
5729 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
5730
5731 /**
5732  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5733  */
5734 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
5735    /**
5736     * A pointer to the contents in the success state.
5737     * Reading from this pointer when `result_ok` is not set is undefined.
5738     */
5739    struct LDKSpendableOutputDescriptor *result;
5740    /**
5741     * A pointer to the contents in the error state.
5742     * Reading from this pointer when `result_ok` is set is undefined.
5743     */
5744    struct LDKDecodeError *err;
5745 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
5746
5747 /**
5748  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5749  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5750  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5751  */
5752 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
5753    /**
5754     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5755     * `err` or `result` depending on the state of `result_ok`.
5756     */
5757    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
5758    /**
5759     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5760     */
5761    bool result_ok;
5762 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
5763
5764 /**
5765  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
5766  * This corresponds to std::vector in C++
5767  */
5768 typedef struct LDKCVec_PaymentPreimageZ {
5769    /**
5770     * The elements in the array.
5771     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5772     */
5773    struct LDKThirtyTwoBytes *data;
5774    /**
5775     * The number of elements pointed to by `data`.
5776     */
5777    uintptr_t datalen;
5778 } LDKCVec_PaymentPreimageZ;
5779
5780 /**
5781  * A tuple of 2 elements. See the individual fields for the types contained.
5782  */
5783 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
5784    /**
5785     * The element at position 0
5786     */
5787    struct LDKSignature a;
5788    /**
5789     * The element at position 1
5790     */
5791    struct LDKCVec_SignatureZ b;
5792 } LDKC2Tuple_SignatureCVec_SignatureZZ;
5793
5794 /**
5795  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
5796  */
5797 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
5798    /**
5799     * A pointer to the contents in the success state.
5800     * Reading from this pointer when `result_ok` is not set is undefined.
5801     */
5802    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
5803    /**
5804     * Note that this value is always NULL, as there are no contents in the Err variant
5805     */
5806    void *err;
5807 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
5808
5809 /**
5810  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
5811  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
5812  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5813  */
5814 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
5815    /**
5816     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
5817     * `err` or `result` depending on the state of `result_ok`.
5818     */
5819    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
5820    /**
5821     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
5822     */
5823    bool result_ok;
5824 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
5825
5826 /**
5827  * The contents of CResult_SignatureNoneZ
5828  */
5829 typedef union LDKCResult_SignatureNoneZPtr {
5830    /**
5831     * A pointer to the contents in the success state.
5832     * Reading from this pointer when `result_ok` is not set is undefined.
5833     */
5834    struct LDKSignature *result;
5835    /**
5836     * Note that this value is always NULL, as there are no contents in the Err variant
5837     */
5838    void *err;
5839 } LDKCResult_SignatureNoneZPtr;
5840
5841 /**
5842  * A CResult_SignatureNoneZ represents the result of a fallible operation,
5843  * containing a crate::c_types::Signature on success and a () on failure.
5844  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5845  */
5846 typedef struct LDKCResult_SignatureNoneZ {
5847    /**
5848     * The contents of this CResult_SignatureNoneZ, accessible via either
5849     * `err` or `result` depending on the state of `result_ok`.
5850     */
5851    union LDKCResult_SignatureNoneZPtr contents;
5852    /**
5853     * Whether this CResult_SignatureNoneZ represents a success state.
5854     */
5855    bool result_ok;
5856 } LDKCResult_SignatureNoneZ;
5857
5858 /**
5859  * A tuple of 2 elements. See the individual fields for the types contained.
5860  */
5861 typedef struct LDKC2Tuple_SignatureSignatureZ {
5862    /**
5863     * The element at position 0
5864     */
5865    struct LDKSignature a;
5866    /**
5867     * The element at position 1
5868     */
5869    struct LDKSignature b;
5870 } LDKC2Tuple_SignatureSignatureZ;
5871
5872 /**
5873  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
5874  */
5875 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
5876    /**
5877     * A pointer to the contents in the success state.
5878     * Reading from this pointer when `result_ok` is not set is undefined.
5879     */
5880    struct LDKC2Tuple_SignatureSignatureZ *result;
5881    /**
5882     * Note that this value is always NULL, as there are no contents in the Err variant
5883     */
5884    void *err;
5885 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
5886
5887 /**
5888  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
5889  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
5890  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5891  */
5892 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
5893    /**
5894     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
5895     * `err` or `result` depending on the state of `result_ok`.
5896     */
5897    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
5898    /**
5899     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
5900     */
5901    bool result_ok;
5902 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
5903
5904 /**
5905  * The contents of CResult_SecretKeyNoneZ
5906  */
5907 typedef union LDKCResult_SecretKeyNoneZPtr {
5908    /**
5909     * A pointer to the contents in the success state.
5910     * Reading from this pointer when `result_ok` is not set is undefined.
5911     */
5912    struct LDKSecretKey *result;
5913    /**
5914     * Note that this value is always NULL, as there are no contents in the Err variant
5915     */
5916    void *err;
5917 } LDKCResult_SecretKeyNoneZPtr;
5918
5919 /**
5920  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5921  * containing a crate::c_types::SecretKey on success and a () on failure.
5922  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5923  */
5924 typedef struct LDKCResult_SecretKeyNoneZ {
5925    /**
5926     * The contents of this CResult_SecretKeyNoneZ, accessible via either
5927     * `err` or `result` depending on the state of `result_ok`.
5928     */
5929    union LDKCResult_SecretKeyNoneZPtr contents;
5930    /**
5931     * Whether this CResult_SecretKeyNoneZ represents a success state.
5932     */
5933    bool result_ok;
5934 } LDKCResult_SecretKeyNoneZ;
5935
5936
5937
5938 /**
5939  * This class tracks the per-transaction information needed to build a closing transaction and will
5940  * actually build it and sign.
5941  *
5942  * This class can be used inside a signer implementation to generate a signature given the relevant
5943  * secret key.
5944  */
5945 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
5946    /**
5947     * A pointer to the opaque Rust object.
5948     * Nearly everywhere, inner must be non-null, however in places where
5949     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5950     */
5951    LDKnativeClosingTransaction *inner;
5952    /**
5953     * Indicates that this is the only struct which contains the same pointer.
5954     * Rust functions which take ownership of an object provided via an argument require
5955     * this to be true and invalidate the object pointed to by inner.
5956     */
5957    bool is_owned;
5958 } LDKClosingTransaction;
5959
5960
5961
5962 /**
5963  * The unsigned part of a channel_announcement
5964  */
5965 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
5966    /**
5967     * A pointer to the opaque Rust object.
5968     * Nearly everywhere, inner must be non-null, however in places where
5969     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5970     */
5971    LDKnativeUnsignedChannelAnnouncement *inner;
5972    /**
5973     * Indicates that this is the only struct which contains the same pointer.
5974     * Rust functions which take ownership of an object provided via an argument require
5975     * this to be true and invalidate the object pointed to by inner.
5976     */
5977    bool is_owned;
5978 } LDKUnsignedChannelAnnouncement;
5979
5980 /**
5981  * A trait to sign lightning channel transactions as described in BOLT 3.
5982  *
5983  * Signing services could be implemented on a hardware wallet. In this case,
5984  * the current Sign would be a front-end on top of a communication
5985  * channel connected to your secure device and lightning key material wouldn't
5986  * reside on a hot server. Nevertheless, a this deployment would still need
5987  * to trust the ChannelManager to avoid loss of funds as this latest component
5988  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
5989  *
5990  * A more secure iteration would be to use hashlock (or payment points) to pair
5991  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
5992  * at the price of more state and computation on the hardware wallet side. In the future,
5993  * we are looking forward to design such interface.
5994  *
5995  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
5996  * to act, as liveness and breach reply correctness are always going to be hard requirements
5997  * of LN security model, orthogonal of key management issues.
5998  */
5999 typedef struct LDKBaseSign {
6000    /**
6001     * An opaque pointer which is passed to your function implementations as an argument.
6002     * This has no meaning in the LDK, and can be NULL or any other value.
6003     */
6004    void *this_arg;
6005    /**
6006     * Gets the per-commitment point for a specific commitment number
6007     *
6008     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
6009     */
6010    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
6011    /**
6012     * Gets the commitment secret for a specific commitment number as part of the revocation process
6013     *
6014     * An external signer implementation should error here if the commitment was already signed
6015     * and should refuse to sign it in the future.
6016     *
6017     * May be called more than once for the same index.
6018     *
6019     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
6020     */
6021    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
6022    /**
6023     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
6024     *
6025     * This is required in order for the signer to make sure that releasing a commitment
6026     * secret won't leave us without a broadcastable holder transaction.
6027     * Policy checks should be implemented in this function, including checking the amount
6028     * sent to us and checking the HTLCs.
6029     *
6030     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6031     * A validating signer should ensure that an HTLC output is removed only when the matching
6032     * preimage is provided, or when the value to holder is restored.
6033     *
6034     * NOTE: all the relevant preimages will be provided, but there may also be additional
6035     * irrelevant or duplicate preimages.
6036     */
6037    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
6038    /**
6039     * Gets the holder's channel public keys and basepoints
6040     */
6041    struct LDKChannelPublicKeys pubkeys;
6042    /**
6043     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
6044     * Note that this takes a pointer to this object, not the this_ptr like other methods do
6045     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
6046     */
6047    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
6048    /**
6049     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
6050     * some SpendableOutputDescriptor types. This should be sufficient to identify this
6051     * Sign object uniquely and lookup or re-derive its keys.
6052     */
6053    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
6054    /**
6055     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
6056     *
6057     * Note that if signing fails or is rejected, the channel will be force-closed.
6058     *
6059     * Policy checks should be implemented in this function, including checking the amount
6060     * sent to us and checking the HTLCs.
6061     *
6062     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6063     * A validating signer should ensure that an HTLC output is removed only when the matching
6064     * preimage is provided, or when the value to holder is restored.
6065     *
6066     * NOTE: all the relevant preimages will be provided, but there may also be additional
6067     * irrelevant or duplicate preimages.
6068     */
6069    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
6070    /**
6071     * Validate the counterparty's revocation.
6072     *
6073     * This is required in order for the signer to make sure that the state has moved
6074     * forward and it is safe to sign the next counterparty commitment.
6075     */
6076    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
6077    /**
6078     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
6079     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
6080     * latest commitment_tx when we initiate a force-close.
6081     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
6082     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
6083     * the latest.
6084     * This may be called multiple times for the same transaction.
6085     *
6086     * An external signer implementation should check that the commitment has not been revoked.
6087     *
6088     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
6089     */
6090    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
6091    /**
6092     * Create a signature for the given input in a transaction spending an HTLC transaction output
6093     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
6094     *
6095     * A justice transaction may claim multiple outputs at the same time if timelocks are
6096     * similar, but only a signature for the input at index `input` should be signed for here.
6097     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
6098     * to an upcoming timelock expiration.
6099     *
6100     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6101     *
6102     * per_commitment_key is revocation secret which was provided by our counterparty when they
6103     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
6104     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
6105     * so).
6106     */
6107    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]);
6108    /**
6109     * Create a signature for the given input in a transaction spending a commitment transaction
6110     * HTLC output when our counterparty broadcasts an old state.
6111     *
6112     * A justice transaction may claim multiple outputs at the same time if timelocks are
6113     * similar, but only a signature for the input at index `input` should be signed for here.
6114     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
6115     * to an upcoming timelock expiration.
6116     *
6117     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6118     *
6119     * per_commitment_key is revocation secret which was provided by our counterparty when they
6120     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
6121     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
6122     * so).
6123     *
6124     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
6125     * (which is committed to in the BIP 143 signatures).
6126     */
6127    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);
6128    /**
6129     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
6130     * transaction, either offered or received.
6131     *
6132     * Such a transaction may claim multiples offered outputs at same time if we know the
6133     * preimage for each when we create it, but only the input at index `input` should be
6134     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
6135     * needed with regards to an upcoming timelock expiration.
6136     *
6137     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
6138     * outputs.
6139     *
6140     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6141     *
6142     * Per_commitment_point is the dynamic point corresponding to the channel state
6143     * detected onchain. It has been generated by our counterparty and is used to derive
6144     * channel state keys, which are then included in the witness script and committed to in the
6145     * BIP 143 signature.
6146     */
6147    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);
6148    /**
6149     * Create a signature for a (proposed) closing transaction.
6150     *
6151     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
6152     * chosen to forgo their output as dust.
6153     */
6154    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
6155    /**
6156     * Signs a channel announcement message with our funding key and our node secret key (aka
6157     * node_id or network_key), proving it comes from one of the channel participants.
6158     *
6159     * The first returned signature should be from our node secret key, the second from our
6160     * funding key.
6161     *
6162     * Note that if this fails or is rejected, the channel will not be publicly announced and
6163     * our counterparty may (though likely will not) close the channel on us for violating the
6164     * protocol.
6165     */
6166    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
6167    /**
6168     * Set the counterparty static channel data, including basepoints,
6169     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
6170     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
6171     * they MUST NOT be allowed to change to different values once set.
6172     *
6173     * channel_parameters.is_populated() MUST be true.
6174     *
6175     * We bind holder_selected_contest_delay late here for API convenience.
6176     *
6177     * Will be called before any signatures are applied.
6178     */
6179    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
6180    /**
6181     * Frees any resources associated with this object given its this_arg pointer.
6182     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6183     */
6184    void (*free)(void *this_arg);
6185 } LDKBaseSign;
6186
6187 /**
6188  * A cloneable signer.
6189  *
6190  * Although we require signers to be cloneable, it may be useful for developers to be able to use
6191  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
6192  * which implies Sized, into this derived trait.
6193  */
6194 typedef struct LDKSign {
6195    /**
6196     * An opaque pointer which is passed to your function implementations as an argument.
6197     * This has no meaning in the LDK, and can be NULL or any other value.
6198     */
6199    void *this_arg;
6200    /**
6201     * Implementation of BaseSign for this object.
6202     */
6203    struct LDKBaseSign BaseSign;
6204    /**
6205     * Serialize the object into a byte array
6206     */
6207    struct LDKCVec_u8Z (*write)(const void *this_arg);
6208    /**
6209     * Called, if set, after this Sign has been cloned into a duplicate object.
6210     * The new Sign is provided, and should be mutated as needed to perform a
6211     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
6212     */
6213    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
6214    /**
6215     * Frees any resources associated with this object given its this_arg pointer.
6216     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6217     */
6218    void (*free)(void *this_arg);
6219 } LDKSign;
6220
6221 /**
6222  * The contents of CResult_SignDecodeErrorZ
6223  */
6224 typedef union LDKCResult_SignDecodeErrorZPtr {
6225    /**
6226     * A pointer to the contents in the success state.
6227     * Reading from this pointer when `result_ok` is not set is undefined.
6228     */
6229    struct LDKSign *result;
6230    /**
6231     * A pointer to the contents in the error state.
6232     * Reading from this pointer when `result_ok` is set is undefined.
6233     */
6234    struct LDKDecodeError *err;
6235 } LDKCResult_SignDecodeErrorZPtr;
6236
6237 /**
6238  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6239  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6240  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6241  */
6242 typedef struct LDKCResult_SignDecodeErrorZ {
6243    /**
6244     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6245     * `err` or `result` depending on the state of `result_ok`.
6246     */
6247    union LDKCResult_SignDecodeErrorZPtr contents;
6248    /**
6249     * Whether this CResult_SignDecodeErrorZ represents a success state.
6250     */
6251    bool result_ok;
6252 } LDKCResult_SignDecodeErrorZ;
6253
6254 /**
6255  * Integer in the range `0..32`
6256  */
6257 typedef struct LDKu5 {
6258    uint8_t _0;
6259 } LDKu5;
6260
6261 /**
6262  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6263  * This corresponds to std::vector in C++
6264  */
6265 typedef struct LDKCVec_u5Z {
6266    /**
6267     * The elements in the array.
6268     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6269     */
6270    struct LDKu5 *data;
6271    /**
6272     * The number of elements pointed to by `data`.
6273     */
6274    uintptr_t datalen;
6275 } LDKCVec_u5Z;
6276
6277 /**
6278  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
6279  * allows recovering the exact public key which created the signature given the message.
6280  */
6281 typedef struct LDKRecoverableSignature {
6282    /**
6283     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
6284     * recovery.
6285     */
6286    uint8_t serialized_form[68];
6287 } LDKRecoverableSignature;
6288
6289 /**
6290  * The contents of CResult_RecoverableSignatureNoneZ
6291  */
6292 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
6293    /**
6294     * A pointer to the contents in the success state.
6295     * Reading from this pointer when `result_ok` is not set is undefined.
6296     */
6297    struct LDKRecoverableSignature *result;
6298    /**
6299     * Note that this value is always NULL, as there are no contents in the Err variant
6300     */
6301    void *err;
6302 } LDKCResult_RecoverableSignatureNoneZPtr;
6303
6304 /**
6305  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6306  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
6307  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6308  */
6309 typedef struct LDKCResult_RecoverableSignatureNoneZ {
6310    /**
6311     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6312     * `err` or `result` depending on the state of `result_ok`.
6313     */
6314    union LDKCResult_RecoverableSignatureNoneZPtr contents;
6315    /**
6316     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6317     */
6318    bool result_ok;
6319 } LDKCResult_RecoverableSignatureNoneZ;
6320
6321 /**
6322  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6323  * This corresponds to std::vector in C++
6324  */
6325 typedef struct LDKCVec_CVec_u8ZZ {
6326    /**
6327     * The elements in the array.
6328     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6329     */
6330    struct LDKCVec_u8Z *data;
6331    /**
6332     * The number of elements pointed to by `data`.
6333     */
6334    uintptr_t datalen;
6335 } LDKCVec_CVec_u8ZZ;
6336
6337 /**
6338  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6339  */
6340 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6341    /**
6342     * A pointer to the contents in the success state.
6343     * Reading from this pointer when `result_ok` is not set is undefined.
6344     */
6345    struct LDKCVec_CVec_u8ZZ *result;
6346    /**
6347     * Note that this value is always NULL, as there are no contents in the Err variant
6348     */
6349    void *err;
6350 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6351
6352 /**
6353  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6354  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6355  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6356  */
6357 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6358    /**
6359     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6360     * `err` or `result` depending on the state of `result_ok`.
6361     */
6362    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6363    /**
6364     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6365     */
6366    bool result_ok;
6367 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6368
6369
6370
6371 /**
6372  * A simple implementation of Sign that just keeps the private keys in memory.
6373  *
6374  * This implementation performs no policy checks and is insufficient by itself as
6375  * a secure external signer.
6376  */
6377 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
6378    /**
6379     * A pointer to the opaque Rust object.
6380     * Nearly everywhere, inner must be non-null, however in places where
6381     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6382     */
6383    LDKnativeInMemorySigner *inner;
6384    /**
6385     * Indicates that this is the only struct which contains the same pointer.
6386     * Rust functions which take ownership of an object provided via an argument require
6387     * this to be true and invalidate the object pointed to by inner.
6388     */
6389    bool is_owned;
6390 } LDKInMemorySigner;
6391
6392 /**
6393  * The contents of CResult_InMemorySignerDecodeErrorZ
6394  */
6395 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
6396    /**
6397     * A pointer to the contents in the success state.
6398     * Reading from this pointer when `result_ok` is not set is undefined.
6399     */
6400    struct LDKInMemorySigner *result;
6401    /**
6402     * A pointer to the contents in the error state.
6403     * Reading from this pointer when `result_ok` is set is undefined.
6404     */
6405    struct LDKDecodeError *err;
6406 } LDKCResult_InMemorySignerDecodeErrorZPtr;
6407
6408 /**
6409  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6410  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6411  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6412  */
6413 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
6414    /**
6415     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6416     * `err` or `result` depending on the state of `result_ok`.
6417     */
6418    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
6419    /**
6420     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6421     */
6422    bool result_ok;
6423 } LDKCResult_InMemorySignerDecodeErrorZ;
6424
6425 /**
6426  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6427  * This corresponds to std::vector in C++
6428  */
6429 typedef struct LDKCVec_TxOutZ {
6430    /**
6431     * The elements in the array.
6432     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6433     */
6434    struct LDKTxOut *data;
6435    /**
6436     * The number of elements pointed to by `data`.
6437     */
6438    uintptr_t datalen;
6439 } LDKCVec_TxOutZ;
6440
6441 /**
6442  * The contents of CResult_TransactionNoneZ
6443  */
6444 typedef union LDKCResult_TransactionNoneZPtr {
6445    /**
6446     * A pointer to the contents in the success state.
6447     * Reading from this pointer when `result_ok` is not set is undefined.
6448     */
6449    struct LDKTransaction *result;
6450    /**
6451     * Note that this value is always NULL, as there are no contents in the Err variant
6452     */
6453    void *err;
6454 } LDKCResult_TransactionNoneZPtr;
6455
6456 /**
6457  * A CResult_TransactionNoneZ represents the result of a fallible operation,
6458  * containing a crate::c_types::Transaction on success and a () on failure.
6459  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6460  */
6461 typedef struct LDKCResult_TransactionNoneZ {
6462    /**
6463     * The contents of this CResult_TransactionNoneZ, accessible via either
6464     * `err` or `result` depending on the state of `result_ok`.
6465     */
6466    union LDKCResult_TransactionNoneZPtr contents;
6467    /**
6468     * Whether this CResult_TransactionNoneZ represents a success state.
6469     */
6470    bool result_ok;
6471 } LDKCResult_TransactionNoneZ;
6472
6473
6474
6475 /**
6476  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
6477  * on-chain transactions to ensure no loss of funds occurs.
6478  *
6479  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
6480  * information and are actively monitoring the chain.
6481  *
6482  * Pending Events or updated HTLCs which have not yet been read out by
6483  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
6484  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
6485  * gotten are fully handled before re-serializing the new state.
6486  *
6487  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
6488  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6489  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
6490  * returned block hash and the the current chain and then reconnecting blocks to get to the
6491  * best chain) upon deserializing the object!
6492  */
6493 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
6494    /**
6495     * A pointer to the opaque Rust object.
6496     * Nearly everywhere, inner must be non-null, however in places where
6497     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6498     */
6499    LDKnativeChannelMonitor *inner;
6500    /**
6501     * Indicates that this is the only struct which contains the same pointer.
6502     * Rust functions which take ownership of an object provided via an argument require
6503     * this to be true and invalidate the object pointed to by inner.
6504     */
6505    bool is_owned;
6506 } LDKChannelMonitor;
6507
6508 /**
6509  * A tuple of 2 elements. See the individual fields for the types contained.
6510  */
6511 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
6512    /**
6513     * The element at position 0
6514     */
6515    struct LDKThirtyTwoBytes a;
6516    /**
6517     * The element at position 1
6518     */
6519    struct LDKChannelMonitor b;
6520 } LDKC2Tuple_BlockHashChannelMonitorZ;
6521
6522 /**
6523  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
6524  * This corresponds to std::vector in C++
6525  */
6526 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
6527    /**
6528     * The elements in the array.
6529     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6530     */
6531    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
6532    /**
6533     * The number of elements pointed to by `data`.
6534     */
6535    uintptr_t datalen;
6536 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
6537
6538 /**
6539  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
6540  */
6541 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6542    /**
6543     * A pointer to the contents in the success state.
6544     * Reading from this pointer when `result_ok` is not set is undefined.
6545     */
6546    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
6547    /**
6548     * A pointer to the contents in the error state.
6549     * Reading from this pointer when `result_ok` is set is undefined.
6550     */
6551    enum LDKIOError *err;
6552 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
6553
6554 /**
6555  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
6556  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
6557  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6558  */
6559 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6560    /**
6561     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
6562     * `err` or `result` depending on the state of `result_ok`.
6563     */
6564    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
6565    /**
6566     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6567     */
6568    bool result_ok;
6569 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
6570
6571 /**
6572  * An enum which can either contain a u16 or not
6573  */
6574 typedef enum LDKCOption_u16Z_Tag {
6575    /**
6576     * When we're in this state, this COption_u16Z contains a u16
6577     */
6578    LDKCOption_u16Z_Some,
6579    /**
6580     * When we're in this state, this COption_u16Z contains nothing
6581     */
6582    LDKCOption_u16Z_None,
6583    /**
6584     * Must be last for serialization purposes
6585     */
6586    LDKCOption_u16Z_Sentinel,
6587 } LDKCOption_u16Z_Tag;
6588
6589 typedef struct LDKCOption_u16Z {
6590    LDKCOption_u16Z_Tag tag;
6591    union {
6592       struct {
6593          uint16_t some;
6594       };
6595    };
6596 } LDKCOption_u16Z;
6597
6598 /**
6599  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
6600  * too-high values)
6601  */
6602 typedef enum LDKAPIError_Tag {
6603    /**
6604     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
6605     * are documented, but generally indicates some precondition of a function was violated.
6606     */
6607    LDKAPIError_APIMisuseError,
6608    /**
6609     * Due to a high feerate, we were unable to complete the request.
6610     * For example, this may be returned if the feerate implies we cannot open a channel at the
6611     * requested value, but opening a larger channel would succeed.
6612     */
6613    LDKAPIError_FeeRateTooHigh,
6614    /**
6615     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
6616     * too-many-hops, etc).
6617     */
6618    LDKAPIError_RouteError,
6619    /**
6620     * We were unable to complete the request as the Channel required to do so is unable to
6621     * complete the request (or was not found). This can take many forms, including disconnected
6622     * peer, channel at capacity, channel shutting down, etc.
6623     */
6624    LDKAPIError_ChannelUnavailable,
6625    /**
6626     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
6627     * attempted action to fail.
6628     */
6629    LDKAPIError_MonitorUpdateFailed,
6630    /**
6631     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
6632     * with the channel counterparty as negotiated in [`InitFeatures`].
6633     *
6634     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
6635     * a channel or cooperatively close one with this peer (and will have to force-close instead).
6636     *
6637     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
6638     * [`InitFeatures`]: crate::ln::features::InitFeatures
6639     */
6640    LDKAPIError_IncompatibleShutdownScript,
6641    /**
6642     * Must be last for serialization purposes
6643     */
6644    LDKAPIError_Sentinel,
6645 } LDKAPIError_Tag;
6646
6647 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
6648    /**
6649     * A human-readable error message
6650     */
6651    struct LDKStr err;
6652 } LDKAPIError_LDKAPIMisuseError_Body;
6653
6654 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
6655    /**
6656     * A human-readable error message
6657     */
6658    struct LDKStr err;
6659    /**
6660     * The feerate which was too high.
6661     */
6662    uint32_t feerate;
6663 } LDKAPIError_LDKFeeRateTooHigh_Body;
6664
6665 typedef struct LDKAPIError_LDKRouteError_Body {
6666    /**
6667     * A human-readable error message
6668     */
6669    struct LDKStr err;
6670 } LDKAPIError_LDKRouteError_Body;
6671
6672 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
6673    /**
6674     * A human-readable error message
6675     */
6676    struct LDKStr err;
6677 } LDKAPIError_LDKChannelUnavailable_Body;
6678
6679 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
6680    /**
6681     * The incompatible shutdown script.
6682     */
6683    struct LDKShutdownScript script;
6684 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
6685
6686 typedef struct MUST_USE_STRUCT LDKAPIError {
6687    LDKAPIError_Tag tag;
6688    union {
6689       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
6690       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
6691       LDKAPIError_LDKRouteError_Body route_error;
6692       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
6693       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
6694    };
6695 } LDKAPIError;
6696
6697 /**
6698  * The contents of CResult_NoneAPIErrorZ
6699  */
6700 typedef union LDKCResult_NoneAPIErrorZPtr {
6701    /**
6702     * Note that this value is always NULL, as there are no contents in the OK variant
6703     */
6704    void *result;
6705    /**
6706     * A pointer to the contents in the error state.
6707     * Reading from this pointer when `result_ok` is set is undefined.
6708     */
6709    struct LDKAPIError *err;
6710 } LDKCResult_NoneAPIErrorZPtr;
6711
6712 /**
6713  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6714  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
6715  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6716  */
6717 typedef struct LDKCResult_NoneAPIErrorZ {
6718    /**
6719     * The contents of this CResult_NoneAPIErrorZ, accessible via either
6720     * `err` or `result` depending on the state of `result_ok`.
6721     */
6722    union LDKCResult_NoneAPIErrorZPtr contents;
6723    /**
6724     * Whether this CResult_NoneAPIErrorZ represents a success state.
6725     */
6726    bool result_ok;
6727 } LDKCResult_NoneAPIErrorZ;
6728
6729 /**
6730  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6731  * This corresponds to std::vector in C++
6732  */
6733 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
6734    /**
6735     * The elements in the array.
6736     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6737     */
6738    struct LDKCResult_NoneAPIErrorZ *data;
6739    /**
6740     * The number of elements pointed to by `data`.
6741     */
6742    uintptr_t datalen;
6743 } LDKCVec_CResult_NoneAPIErrorZZ;
6744
6745 /**
6746  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6747  * This corresponds to std::vector in C++
6748  */
6749 typedef struct LDKCVec_APIErrorZ {
6750    /**
6751     * The elements in the array.
6752     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6753     */
6754    struct LDKAPIError *data;
6755    /**
6756     * The number of elements pointed to by `data`.
6757     */
6758    uintptr_t datalen;
6759 } LDKCVec_APIErrorZ;
6760
6761 /**
6762  * The contents of CResult__u832APIErrorZ
6763  */
6764 typedef union LDKCResult__u832APIErrorZPtr {
6765    /**
6766     * A pointer to the contents in the success state.
6767     * Reading from this pointer when `result_ok` is not set is undefined.
6768     */
6769    struct LDKThirtyTwoBytes *result;
6770    /**
6771     * A pointer to the contents in the error state.
6772     * Reading from this pointer when `result_ok` is set is undefined.
6773     */
6774    struct LDKAPIError *err;
6775 } LDKCResult__u832APIErrorZPtr;
6776
6777 /**
6778  * A CResult__u832APIErrorZ represents the result of a fallible operation,
6779  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6780  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6781  */
6782 typedef struct LDKCResult__u832APIErrorZ {
6783    /**
6784     * The contents of this CResult__u832APIErrorZ, accessible via either
6785     * `err` or `result` depending on the state of `result_ok`.
6786     */
6787    union LDKCResult__u832APIErrorZPtr contents;
6788    /**
6789     * Whether this CResult__u832APIErrorZ represents a success state.
6790     */
6791    bool result_ok;
6792 } LDKCResult__u832APIErrorZ;
6793
6794 /**
6795  * If a payment fails to send, it can be in one of several states. This enum is returned as the
6796  * Err() type describing which state the payment is in, see the description of individual enum
6797  * states for more.
6798  */
6799 typedef enum LDKPaymentSendFailure_Tag {
6800    /**
6801     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
6802     * send the payment at all. No channel state has been changed or messages sent to peers, and
6803     * once you've changed the parameter at error, you can freely retry the payment in full.
6804     */
6805    LDKPaymentSendFailure_ParameterError,
6806    /**
6807     * A parameter in a single path which was passed to send_payment was invalid, preventing us
6808     * from attempting to send the payment at all. No channel state has been changed or messages
6809     * sent to peers, and once you've changed the parameter at error, you can freely retry the
6810     * payment in full.
6811     *
6812     * The results here are ordered the same as the paths in the route object which was passed to
6813     * send_payment.
6814     */
6815    LDKPaymentSendFailure_PathParameterError,
6816    /**
6817     * All paths which were attempted failed to send, with no channel state change taking place.
6818     * You can freely retry the payment in full (though you probably want to do so over different
6819     * paths than the ones selected).
6820     */
6821    LDKPaymentSendFailure_AllFailedRetrySafe,
6822    /**
6823     * Some paths which were attempted failed to send, though possibly not all. At least some
6824     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
6825     * in over-/re-payment.
6826     *
6827     * The results here are ordered the same as the paths in the route object which was passed to
6828     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
6829     * retried (though there is currently no API with which to do so).
6830     *
6831     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
6832     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
6833     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
6834     * with the latest update_id.
6835     */
6836    LDKPaymentSendFailure_PartialFailure,
6837    /**
6838     * Must be last for serialization purposes
6839     */
6840    LDKPaymentSendFailure_Sentinel,
6841 } LDKPaymentSendFailure_Tag;
6842
6843 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
6844    /**
6845     * The errors themselves, in the same order as the route hops.
6846     */
6847    struct LDKCVec_CResult_NoneAPIErrorZZ results;
6848    /**
6849     * If some paths failed without irrevocably committing to the new HTLC(s), this will
6850     * contain a [`RouteParameters`] object which can be used to calculate a new route that
6851     * will pay all remaining unpaid balance.
6852     *
6853     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6854     */
6855    struct LDKRouteParameters failed_paths_retry;
6856    /**
6857     * The payment id for the payment, which is now at least partially pending.
6858     */
6859    struct LDKThirtyTwoBytes payment_id;
6860 } LDKPaymentSendFailure_LDKPartialFailure_Body;
6861
6862 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
6863    LDKPaymentSendFailure_Tag tag;
6864    union {
6865       struct {
6866          struct LDKAPIError parameter_error;
6867       };
6868       struct {
6869          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
6870       };
6871       struct {
6872          struct LDKCVec_APIErrorZ all_failed_retry_safe;
6873       };
6874       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
6875    };
6876 } LDKPaymentSendFailure;
6877
6878 /**
6879  * The contents of CResult_PaymentIdPaymentSendFailureZ
6880  */
6881 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
6882    /**
6883     * A pointer to the contents in the success state.
6884     * Reading from this pointer when `result_ok` is not set is undefined.
6885     */
6886    struct LDKThirtyTwoBytes *result;
6887    /**
6888     * A pointer to the contents in the error state.
6889     * Reading from this pointer when `result_ok` is set is undefined.
6890     */
6891    struct LDKPaymentSendFailure *err;
6892 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
6893
6894 /**
6895  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6896  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6897  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6898  */
6899 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
6900    /**
6901     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6902     * `err` or `result` depending on the state of `result_ok`.
6903     */
6904    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
6905    /**
6906     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6907     */
6908    bool result_ok;
6909 } LDKCResult_PaymentIdPaymentSendFailureZ;
6910
6911 /**
6912  * The contents of CResult_NonePaymentSendFailureZ
6913  */
6914 typedef union LDKCResult_NonePaymentSendFailureZPtr {
6915    /**
6916     * Note that this value is always NULL, as there are no contents in the OK variant
6917     */
6918    void *result;
6919    /**
6920     * A pointer to the contents in the error state.
6921     * Reading from this pointer when `result_ok` is set is undefined.
6922     */
6923    struct LDKPaymentSendFailure *err;
6924 } LDKCResult_NonePaymentSendFailureZPtr;
6925
6926 /**
6927  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6928  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6929  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6930  */
6931 typedef struct LDKCResult_NonePaymentSendFailureZ {
6932    /**
6933     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6934     * `err` or `result` depending on the state of `result_ok`.
6935     */
6936    union LDKCResult_NonePaymentSendFailureZPtr contents;
6937    /**
6938     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
6939     */
6940    bool result_ok;
6941 } LDKCResult_NonePaymentSendFailureZ;
6942
6943 /**
6944  * A tuple of 2 elements. See the individual fields for the types contained.
6945  */
6946 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
6947    /**
6948     * The element at position 0
6949     */
6950    struct LDKThirtyTwoBytes a;
6951    /**
6952     * The element at position 1
6953     */
6954    struct LDKThirtyTwoBytes b;
6955 } LDKC2Tuple_PaymentHashPaymentIdZ;
6956
6957 /**
6958  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6959  */
6960 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6961    /**
6962     * A pointer to the contents in the success state.
6963     * Reading from this pointer when `result_ok` is not set is undefined.
6964     */
6965    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
6966    /**
6967     * A pointer to the contents in the error state.
6968     * Reading from this pointer when `result_ok` is set is undefined.
6969     */
6970    struct LDKPaymentSendFailure *err;
6971 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
6972
6973 /**
6974  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6975  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6976  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6977  */
6978 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6979    /**
6980     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6981     * `err` or `result` depending on the state of `result_ok`.
6982     */
6983    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
6984    /**
6985     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6986     */
6987    bool result_ok;
6988 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
6989
6990 /**
6991  * A tuple of 2 elements. See the individual fields for the types contained.
6992  */
6993 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
6994    /**
6995     * The element at position 0
6996     */
6997    struct LDKThirtyTwoBytes a;
6998    /**
6999     * The element at position 1
7000     */
7001    struct LDKThirtyTwoBytes b;
7002 } LDKC2Tuple_PaymentHashPaymentSecretZ;
7003
7004 /**
7005  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
7006  */
7007 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
7008    /**
7009     * A pointer to the contents in the success state.
7010     * Reading from this pointer when `result_ok` is not set is undefined.
7011     */
7012    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
7013    /**
7014     * Note that this value is always NULL, as there are no contents in the Err variant
7015     */
7016    void *err;
7017 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
7018
7019 /**
7020  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
7021  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
7022  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7023  */
7024 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
7025    /**
7026     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
7027     * `err` or `result` depending on the state of `result_ok`.
7028     */
7029    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
7030    /**
7031     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
7032     */
7033    bool result_ok;
7034 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
7035
7036 /**
7037  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
7038  */
7039 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
7040    /**
7041     * A pointer to the contents in the success state.
7042     * Reading from this pointer when `result_ok` is not set is undefined.
7043     */
7044    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
7045    /**
7046     * A pointer to the contents in the error state.
7047     * Reading from this pointer when `result_ok` is set is undefined.
7048     */
7049    struct LDKAPIError *err;
7050 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
7051
7052 /**
7053  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
7054  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
7055  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7056  */
7057 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
7058    /**
7059     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
7060     * `err` or `result` depending on the state of `result_ok`.
7061     */
7062    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
7063    /**
7064     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
7065     */
7066    bool result_ok;
7067 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
7068
7069 /**
7070  * The contents of CResult_PaymentSecretNoneZ
7071  */
7072 typedef union LDKCResult_PaymentSecretNoneZPtr {
7073    /**
7074     * A pointer to the contents in the success state.
7075     * Reading from this pointer when `result_ok` is not set is undefined.
7076     */
7077    struct LDKThirtyTwoBytes *result;
7078    /**
7079     * Note that this value is always NULL, as there are no contents in the Err variant
7080     */
7081    void *err;
7082 } LDKCResult_PaymentSecretNoneZPtr;
7083
7084 /**
7085  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
7086  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7087  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7088  */
7089 typedef struct LDKCResult_PaymentSecretNoneZ {
7090    /**
7091     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
7092     * `err` or `result` depending on the state of `result_ok`.
7093     */
7094    union LDKCResult_PaymentSecretNoneZPtr contents;
7095    /**
7096     * Whether this CResult_PaymentSecretNoneZ represents a success state.
7097     */
7098    bool result_ok;
7099 } LDKCResult_PaymentSecretNoneZ;
7100
7101 /**
7102  * The contents of CResult_PaymentSecretAPIErrorZ
7103  */
7104 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
7105    /**
7106     * A pointer to the contents in the success state.
7107     * Reading from this pointer when `result_ok` is not set is undefined.
7108     */
7109    struct LDKThirtyTwoBytes *result;
7110    /**
7111     * A pointer to the contents in the error state.
7112     * Reading from this pointer when `result_ok` is set is undefined.
7113     */
7114    struct LDKAPIError *err;
7115 } LDKCResult_PaymentSecretAPIErrorZPtr;
7116
7117 /**
7118  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7119  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7120  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7121  */
7122 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
7123    /**
7124     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7125     * `err` or `result` depending on the state of `result_ok`.
7126     */
7127    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
7128    /**
7129     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7130     */
7131    bool result_ok;
7132 } LDKCResult_PaymentSecretAPIErrorZ;
7133
7134 /**
7135  * The contents of CResult_PaymentPreimageAPIErrorZ
7136  */
7137 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
7138    /**
7139     * A pointer to the contents in the success state.
7140     * Reading from this pointer when `result_ok` is not set is undefined.
7141     */
7142    struct LDKThirtyTwoBytes *result;
7143    /**
7144     * A pointer to the contents in the error state.
7145     * Reading from this pointer when `result_ok` is set is undefined.
7146     */
7147    struct LDKAPIError *err;
7148 } LDKCResult_PaymentPreimageAPIErrorZPtr;
7149
7150 /**
7151  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7152  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7153  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7154  */
7155 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
7156    /**
7157     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7158     * `err` or `result` depending on the state of `result_ok`.
7159     */
7160    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
7161    /**
7162     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7163     */
7164    bool result_ok;
7165 } LDKCResult_PaymentPreimageAPIErrorZ;
7166
7167
7168
7169 /**
7170  * Information needed for constructing an invoice route hint for this channel.
7171  */
7172 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
7173    /**
7174     * A pointer to the opaque Rust object.
7175     * Nearly everywhere, inner must be non-null, however in places where
7176     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7177     */
7178    LDKnativeCounterpartyForwardingInfo *inner;
7179    /**
7180     * Indicates that this is the only struct which contains the same pointer.
7181     * Rust functions which take ownership of an object provided via an argument require
7182     * this to be true and invalidate the object pointed to by inner.
7183     */
7184    bool is_owned;
7185 } LDKCounterpartyForwardingInfo;
7186
7187 /**
7188  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7189  */
7190 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7191    /**
7192     * A pointer to the contents in the success state.
7193     * Reading from this pointer when `result_ok` is not set is undefined.
7194     */
7195    struct LDKCounterpartyForwardingInfo *result;
7196    /**
7197     * A pointer to the contents in the error state.
7198     * Reading from this pointer when `result_ok` is set is undefined.
7199     */
7200    struct LDKDecodeError *err;
7201 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
7202
7203 /**
7204  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7205  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7206  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7207  */
7208 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
7209    /**
7210     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7211     * `err` or `result` depending on the state of `result_ok`.
7212     */
7213    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
7214    /**
7215     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7216     */
7217    bool result_ok;
7218 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
7219
7220
7221
7222 /**
7223  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
7224  * to better separate parameters.
7225  */
7226 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
7227    /**
7228     * A pointer to the opaque Rust object.
7229     * Nearly everywhere, inner must be non-null, however in places where
7230     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7231     */
7232    LDKnativeChannelCounterparty *inner;
7233    /**
7234     * Indicates that this is the only struct which contains the same pointer.
7235     * Rust functions which take ownership of an object provided via an argument require
7236     * this to be true and invalidate the object pointed to by inner.
7237     */
7238    bool is_owned;
7239 } LDKChannelCounterparty;
7240
7241 /**
7242  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
7243  */
7244 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
7245    /**
7246     * A pointer to the contents in the success state.
7247     * Reading from this pointer when `result_ok` is not set is undefined.
7248     */
7249    struct LDKChannelCounterparty *result;
7250    /**
7251     * A pointer to the contents in the error state.
7252     * Reading from this pointer when `result_ok` is set is undefined.
7253     */
7254    struct LDKDecodeError *err;
7255 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
7256
7257 /**
7258  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7259  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7260  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7261  */
7262 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
7263    /**
7264     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7265     * `err` or `result` depending on the state of `result_ok`.
7266     */
7267    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
7268    /**
7269     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7270     */
7271    bool result_ok;
7272 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
7273
7274 /**
7275  * The contents of CResult_ChannelDetailsDecodeErrorZ
7276  */
7277 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
7278    /**
7279     * A pointer to the contents in the success state.
7280     * Reading from this pointer when `result_ok` is not set is undefined.
7281     */
7282    struct LDKChannelDetails *result;
7283    /**
7284     * A pointer to the contents in the error state.
7285     * Reading from this pointer when `result_ok` is set is undefined.
7286     */
7287    struct LDKDecodeError *err;
7288 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
7289
7290 /**
7291  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7292  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7293  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7294  */
7295 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
7296    /**
7297     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7298     * `err` or `result` depending on the state of `result_ok`.
7299     */
7300    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
7301    /**
7302     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7303     */
7304    bool result_ok;
7305 } LDKCResult_ChannelDetailsDecodeErrorZ;
7306
7307
7308
7309 /**
7310  * Route hints used in constructing invoices for [phantom node payents].
7311  *
7312  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
7313  */
7314 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
7315    /**
7316     * A pointer to the opaque Rust object.
7317     * Nearly everywhere, inner must be non-null, however in places where
7318     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7319     */
7320    LDKnativePhantomRouteHints *inner;
7321    /**
7322     * Indicates that this is the only struct which contains the same pointer.
7323     * Rust functions which take ownership of an object provided via an argument require
7324     * this to be true and invalidate the object pointed to by inner.
7325     */
7326    bool is_owned;
7327 } LDKPhantomRouteHints;
7328
7329 /**
7330  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
7331  */
7332 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
7333    /**
7334     * A pointer to the contents in the success state.
7335     * Reading from this pointer when `result_ok` is not set is undefined.
7336     */
7337    struct LDKPhantomRouteHints *result;
7338    /**
7339     * A pointer to the contents in the error state.
7340     * Reading from this pointer when `result_ok` is set is undefined.
7341     */
7342    struct LDKDecodeError *err;
7343 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
7344
7345 /**
7346  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7347  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7348  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7349  */
7350 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
7351    /**
7352     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7353     * `err` or `result` depending on the state of `result_ok`.
7354     */
7355    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
7356    /**
7357     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7358     */
7359    bool result_ok;
7360 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
7361
7362 /**
7363  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7364  * This corresponds to std::vector in C++
7365  */
7366 typedef struct LDKCVec_ChannelMonitorZ {
7367    /**
7368     * The elements in the array.
7369     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7370     */
7371    struct LDKChannelMonitor *data;
7372    /**
7373     * The number of elements pointed to by `data`.
7374     */
7375    uintptr_t datalen;
7376 } LDKCVec_ChannelMonitorZ;
7377
7378
7379
7380 /**
7381  * An update generated by the underlying Channel itself which contains some new information the
7382  * ChannelMonitor should be made aware of.
7383  */
7384 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
7385    /**
7386     * A pointer to the opaque Rust object.
7387     * Nearly everywhere, inner must be non-null, however in places where
7388     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7389     */
7390    LDKnativeChannelMonitorUpdate *inner;
7391    /**
7392     * Indicates that this is the only struct which contains the same pointer.
7393     * Rust functions which take ownership of an object provided via an argument require
7394     * this to be true and invalidate the object pointed to by inner.
7395     */
7396    bool is_owned;
7397 } LDKChannelMonitorUpdate;
7398
7399 /**
7400  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
7401  * blocks are connected and disconnected.
7402  *
7403  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
7404  * responsible for maintaining a set of monitors such that they can be updated accordingly as
7405  * channel state changes and HTLCs are resolved. See method documentation for specific
7406  * requirements.
7407  *
7408  * Implementations **must** ensure that updates are successfully applied and persisted upon method
7409  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
7410  * without taking any further action such as persisting the current state.
7411  *
7412  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
7413  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
7414  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
7415  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
7416  * multiple instances.
7417  *
7418  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
7419  */
7420 typedef struct LDKWatch {
7421    /**
7422     * An opaque pointer which is passed to your function implementations as an argument.
7423     * This has no meaning in the LDK, and can be NULL or any other value.
7424     */
7425    void *this_arg;
7426    /**
7427     * Watches a channel identified by `funding_txo` using `monitor`.
7428     *
7429     * Implementations are responsible for watching the chain for the funding transaction along
7430     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
7431     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
7432     *
7433     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
7434     * the given `funding_txo` has previously been registered via `watch_channel`.
7435     *
7436     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
7437     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
7438     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
7439     */
7440    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
7441    /**
7442     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
7443     *
7444     * Implementations must call [`update_monitor`] with the given update. See
7445     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
7446     *
7447     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
7448     */
7449    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
7450    /**
7451     * Returns any monitor events since the last call. Subsequent calls must only return new
7452     * events.
7453     *
7454     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
7455     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
7456     * to disk.
7457     *
7458     * For details on asynchronous [`ChannelMonitor`] updating and returning
7459     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
7460     */
7461    struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ (*release_pending_monitor_events)(const void *this_arg);
7462    /**
7463     * Frees any resources associated with this object given its this_arg pointer.
7464     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7465     */
7466    void (*free)(void *this_arg);
7467 } LDKWatch;
7468
7469 /**
7470  * An interface to send a transaction to the Bitcoin network.
7471  */
7472 typedef struct LDKBroadcasterInterface {
7473    /**
7474     * An opaque pointer which is passed to your function implementations as an argument.
7475     * This has no meaning in the LDK, and can be NULL or any other value.
7476     */
7477    void *this_arg;
7478    /**
7479     * Sends a transaction out to (hopefully) be mined.
7480     */
7481    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
7482    /**
7483     * Frees any resources associated with this object given its this_arg pointer.
7484     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7485     */
7486    void (*free)(void *this_arg);
7487 } LDKBroadcasterInterface;
7488
7489 /**
7490  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
7491  * own the memory pointed to by data.
7492  */
7493 typedef struct LDKu8slice {
7494    /**
7495     * A pointer to the byte buffer
7496     */
7497    const uint8_t *data;
7498    /**
7499     * The number of bytes pointed to by `data`.
7500     */
7501    uintptr_t datalen;
7502 } LDKu8slice;
7503
7504 /**
7505  * A trait to describe an object which can get user secrets and key material.
7506  */
7507 typedef struct LDKKeysInterface {
7508    /**
7509     * An opaque pointer which is passed to your function implementations as an argument.
7510     * This has no meaning in the LDK, and can be NULL or any other value.
7511     */
7512    void *this_arg;
7513    /**
7514     * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`].
7515     *
7516     * This method must return the same value each time it is called with a given `Recipient`
7517     * parameter.
7518     */
7519    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
7520    /**
7521     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
7522     *
7523     * This method should return a different value each time it is called, to avoid linking
7524     * on-chain funds across channels as controlled to the same user.
7525     */
7526    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
7527    /**
7528     * Get a script pubkey which we will send funds to when closing a channel.
7529     *
7530     * This method should return a different value each time it is called, to avoid linking
7531     * on-chain funds across channels as controlled to the same user.
7532     */
7533    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
7534    /**
7535     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
7536     * restarted with some stale data!
7537     *
7538     * This method must return a different value each time it is called.
7539     */
7540    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
7541    /**
7542     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
7543     * onion packets and for temporary channel IDs. There is no requirement that these be
7544     * persisted anywhere, though they must be unique across restarts.
7545     *
7546     * This method must return a different value each time it is called.
7547     */
7548    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
7549    /**
7550     * Reads a `Signer` for this `KeysInterface` from the given input stream.
7551     * This is only called during deserialization of other objects which contain
7552     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
7553     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
7554     * contain no versioning scheme. You may wish to include your own version prefix and ensure
7555     * you've read all of the provided bytes to ensure no corruption occurred.
7556     */
7557    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
7558    /**
7559     * Sign an invoice.
7560     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
7561     * this trait to parse the invoice and make sure they're signing what they expect, rather than
7562     * blindly signing the hash.
7563     * The hrp is ascii bytes, while the invoice data is base32.
7564     *
7565     * The secret key used to sign the invoice is dependent on the [`Recipient`].
7566     */
7567    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
7568    /**
7569     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
7570     *
7571     * If the implementor of this trait supports [phantom node payments], then every node that is
7572     * intended to be included in the phantom invoice route hints must return the same value from
7573     * this method.
7574     *
7575     * This method must return the same value each time it is called.
7576     *
7577     * [phantom node payments]: PhantomKeysManager
7578     */
7579    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
7580    /**
7581     * Frees any resources associated with this object given its this_arg pointer.
7582     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7583     */
7584    void (*free)(void *this_arg);
7585 } LDKKeysInterface;
7586
7587 /**
7588  * A trait which should be implemented to provide feerate information on a number of time
7589  * horizons.
7590  *
7591  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
7592  * called from inside the library in response to chain events, P2P events, or timer events).
7593  */
7594 typedef struct LDKFeeEstimator {
7595    /**
7596     * An opaque pointer which is passed to your function implementations as an argument.
7597     * This has no meaning in the LDK, and can be NULL or any other value.
7598     */
7599    void *this_arg;
7600    /**
7601     * Gets estimated satoshis of fee required per 1000 Weight-Units.
7602     *
7603     * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
7604     * round-downs don't put us below 1 satoshi-per-byte).
7605     *
7606     * This method can be implemented with the following unit conversions:
7607     *  * max(satoshis-per-byte * 250, 253)
7608     *  * max(satoshis-per-kbyte / 4, 253)
7609     */
7610    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
7611    /**
7612     * Frees any resources associated with this object given its this_arg pointer.
7613     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7614     */
7615    void (*free)(void *this_arg);
7616 } LDKFeeEstimator;
7617
7618
7619
7620 /**
7621  * Manager which keeps track of a number of channels and sends messages to the appropriate
7622  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
7623  *
7624  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
7625  * to individual Channels.
7626  *
7627  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
7628  * all peers during write/read (though does not modify this instance, only the instance being
7629  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
7630  * called funding_transaction_generated for outbound channels).
7631  *
7632  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
7633  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
7634  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
7635  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
7636  * the serialization process). If the deserialized version is out-of-date compared to the
7637  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
7638  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
7639  *
7640  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
7641  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7642  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
7643  * block_connected() to step towards your best block) upon deserialization before using the
7644  * object!
7645  *
7646  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
7647  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
7648  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
7649  * offline for a full minute. In order to track this, you must call
7650  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
7651  *
7652  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
7653  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
7654  * essentially you should default to using a SimpleRefChannelManager, and use a
7655  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
7656  * you're using lightning-net-tokio.
7657  */
7658 typedef struct MUST_USE_STRUCT LDKChannelManager {
7659    /**
7660     * A pointer to the opaque Rust object.
7661     * Nearly everywhere, inner must be non-null, however in places where
7662     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7663     */
7664    LDKnativeChannelManager *inner;
7665    /**
7666     * Indicates that this is the only struct which contains the same pointer.
7667     * Rust functions which take ownership of an object provided via an argument require
7668     * this to be true and invalidate the object pointed to by inner.
7669     */
7670    bool is_owned;
7671 } LDKChannelManager;
7672
7673 /**
7674  * A tuple of 2 elements. See the individual fields for the types contained.
7675  */
7676 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
7677    /**
7678     * The element at position 0
7679     */
7680    struct LDKThirtyTwoBytes a;
7681    /**
7682     * The element at position 1
7683     */
7684    struct LDKChannelManager b;
7685 } LDKC2Tuple_BlockHashChannelManagerZ;
7686
7687 /**
7688  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7689  */
7690 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7691    /**
7692     * A pointer to the contents in the success state.
7693     * Reading from this pointer when `result_ok` is not set is undefined.
7694     */
7695    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
7696    /**
7697     * A pointer to the contents in the error state.
7698     * Reading from this pointer when `result_ok` is set is undefined.
7699     */
7700    struct LDKDecodeError *err;
7701 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
7702
7703 /**
7704  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7705  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7706  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7707  */
7708 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7709    /**
7710     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7711     * `err` or `result` depending on the state of `result_ok`.
7712     */
7713    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
7714    /**
7715     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7716     */
7717    bool result_ok;
7718 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
7719
7720
7721
7722 /**
7723  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
7724  * with our counterparty.
7725  */
7726 typedef struct MUST_USE_STRUCT LDKChannelConfig {
7727    /**
7728     * A pointer to the opaque Rust object.
7729     * Nearly everywhere, inner must be non-null, however in places where
7730     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7731     */
7732    LDKnativeChannelConfig *inner;
7733    /**
7734     * Indicates that this is the only struct which contains the same pointer.
7735     * Rust functions which take ownership of an object provided via an argument require
7736     * this to be true and invalidate the object pointed to by inner.
7737     */
7738    bool is_owned;
7739 } LDKChannelConfig;
7740
7741 /**
7742  * The contents of CResult_ChannelConfigDecodeErrorZ
7743  */
7744 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
7745    /**
7746     * A pointer to the contents in the success state.
7747     * Reading from this pointer when `result_ok` is not set is undefined.
7748     */
7749    struct LDKChannelConfig *result;
7750    /**
7751     * A pointer to the contents in the error state.
7752     * Reading from this pointer when `result_ok` is set is undefined.
7753     */
7754    struct LDKDecodeError *err;
7755 } LDKCResult_ChannelConfigDecodeErrorZPtr;
7756
7757 /**
7758  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7759  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7760  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7761  */
7762 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
7763    /**
7764     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7765     * `err` or `result` depending on the state of `result_ok`.
7766     */
7767    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
7768    /**
7769     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7770     */
7771    bool result_ok;
7772 } LDKCResult_ChannelConfigDecodeErrorZ;
7773
7774 /**
7775  * The contents of CResult_OutPointDecodeErrorZ
7776  */
7777 typedef union LDKCResult_OutPointDecodeErrorZPtr {
7778    /**
7779     * A pointer to the contents in the success state.
7780     * Reading from this pointer when `result_ok` is not set is undefined.
7781     */
7782    struct LDKOutPoint *result;
7783    /**
7784     * A pointer to the contents in the error state.
7785     * Reading from this pointer when `result_ok` is set is undefined.
7786     */
7787    struct LDKDecodeError *err;
7788 } LDKCResult_OutPointDecodeErrorZPtr;
7789
7790 /**
7791  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7792  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7793  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7794  */
7795 typedef struct LDKCResult_OutPointDecodeErrorZ {
7796    /**
7797     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7798     * `err` or `result` depending on the state of `result_ok`.
7799     */
7800    union LDKCResult_OutPointDecodeErrorZPtr contents;
7801    /**
7802     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
7803     */
7804    bool result_ok;
7805 } LDKCResult_OutPointDecodeErrorZ;
7806
7807 /**
7808  * Defines a type identifier for sending messages over the wire.
7809  *
7810  * Messages implementing this trait specify a type and must be [`Writeable`].
7811  */
7812 typedef struct LDKType {
7813    /**
7814     * An opaque pointer which is passed to your function implementations as an argument.
7815     * This has no meaning in the LDK, and can be NULL or any other value.
7816     */
7817    void *this_arg;
7818    /**
7819     * Returns the type identifying the message payload.
7820     */
7821    uint16_t (*type_id)(const void *this_arg);
7822    /**
7823     * Return a human-readable "debug" string describing this object
7824     */
7825    struct LDKStr (*debug_str)(const void *this_arg);
7826    /**
7827     * Serialize the object into a byte array
7828     */
7829    struct LDKCVec_u8Z (*write)(const void *this_arg);
7830    /**
7831     * Frees any resources associated with this object given its this_arg pointer.
7832     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7833     */
7834    void (*free)(void *this_arg);
7835 } LDKType;
7836
7837 /**
7838  * An enum which can either contain a crate::lightning::ln::wire::Type or not
7839  */
7840 typedef enum LDKCOption_TypeZ_Tag {
7841    /**
7842     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7843     */
7844    LDKCOption_TypeZ_Some,
7845    /**
7846     * When we're in this state, this COption_TypeZ contains nothing
7847     */
7848    LDKCOption_TypeZ_None,
7849    /**
7850     * Must be last for serialization purposes
7851     */
7852    LDKCOption_TypeZ_Sentinel,
7853 } LDKCOption_TypeZ_Tag;
7854
7855 typedef struct LDKCOption_TypeZ {
7856    LDKCOption_TypeZ_Tag tag;
7857    union {
7858       struct {
7859          struct LDKType some;
7860       };
7861    };
7862 } LDKCOption_TypeZ;
7863
7864 /**
7865  * The contents of CResult_COption_TypeZDecodeErrorZ
7866  */
7867 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
7868    /**
7869     * A pointer to the contents in the success state.
7870     * Reading from this pointer when `result_ok` is not set is undefined.
7871     */
7872    struct LDKCOption_TypeZ *result;
7873    /**
7874     * A pointer to the contents in the error state.
7875     * Reading from this pointer when `result_ok` is set is undefined.
7876     */
7877    struct LDKDecodeError *err;
7878 } LDKCResult_COption_TypeZDecodeErrorZPtr;
7879
7880 /**
7881  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7882  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7883  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7884  */
7885 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
7886    /**
7887     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7888     * `err` or `result` depending on the state of `result_ok`.
7889     */
7890    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
7891    /**
7892     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7893     */
7894    bool result_ok;
7895 } LDKCResult_COption_TypeZDecodeErrorZ;
7896
7897 /**
7898  * An error that may occur when making a payment.
7899  */
7900 typedef enum LDKPaymentError_Tag {
7901    /**
7902     * An error resulting from the provided [`Invoice`] or payment hash.
7903     */
7904    LDKPaymentError_Invoice,
7905    /**
7906     * An error occurring when finding a route.
7907     */
7908    LDKPaymentError_Routing,
7909    /**
7910     * An error occurring when sending a payment.
7911     */
7912    LDKPaymentError_Sending,
7913    /**
7914     * Must be last for serialization purposes
7915     */
7916    LDKPaymentError_Sentinel,
7917 } LDKPaymentError_Tag;
7918
7919 typedef struct MUST_USE_STRUCT LDKPaymentError {
7920    LDKPaymentError_Tag tag;
7921    union {
7922       struct {
7923          struct LDKStr invoice;
7924       };
7925       struct {
7926          struct LDKLightningError routing;
7927       };
7928       struct {
7929          struct LDKPaymentSendFailure sending;
7930       };
7931    };
7932 } LDKPaymentError;
7933
7934 /**
7935  * The contents of CResult_PaymentIdPaymentErrorZ
7936  */
7937 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
7938    /**
7939     * A pointer to the contents in the success state.
7940     * Reading from this pointer when `result_ok` is not set is undefined.
7941     */
7942    struct LDKThirtyTwoBytes *result;
7943    /**
7944     * A pointer to the contents in the error state.
7945     * Reading from this pointer when `result_ok` is set is undefined.
7946     */
7947    struct LDKPaymentError *err;
7948 } LDKCResult_PaymentIdPaymentErrorZPtr;
7949
7950 /**
7951  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
7952  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7953  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7954  */
7955 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
7956    /**
7957     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7958     * `err` or `result` depending on the state of `result_ok`.
7959     */
7960    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
7961    /**
7962     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7963     */
7964    bool result_ok;
7965 } LDKCResult_PaymentIdPaymentErrorZ;
7966
7967 /**
7968  * Sub-errors which don't have specific information in them use this type.
7969  */
7970 typedef struct LDKError {
7971    /**
7972     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
7973     */
7974    uint8_t _dummy;
7975 } LDKError;
7976
7977 /**
7978  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
7979  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
7980  */
7981 typedef enum LDKParseError_Tag {
7982    LDKParseError_Bech32Error,
7983    LDKParseError_ParseAmountError,
7984    LDKParseError_MalformedSignature,
7985    LDKParseError_BadPrefix,
7986    LDKParseError_UnknownCurrency,
7987    LDKParseError_UnknownSiPrefix,
7988    LDKParseError_MalformedHRP,
7989    LDKParseError_TooShortDataPart,
7990    LDKParseError_UnexpectedEndOfTaggedFields,
7991    LDKParseError_DescriptionDecodeError,
7992    LDKParseError_PaddingError,
7993    LDKParseError_IntegerOverflowError,
7994    LDKParseError_InvalidSegWitProgramLength,
7995    LDKParseError_InvalidPubKeyHashLength,
7996    LDKParseError_InvalidScriptHashLength,
7997    LDKParseError_InvalidRecoveryId,
7998    LDKParseError_InvalidSliceLength,
7999    /**
8000     * Not an error, but used internally to signal that a part of the invoice should be ignored
8001     * according to BOLT11
8002     */
8003    LDKParseError_Skip,
8004    /**
8005     * Must be last for serialization purposes
8006     */
8007    LDKParseError_Sentinel,
8008 } LDKParseError_Tag;
8009
8010 typedef struct MUST_USE_STRUCT LDKParseError {
8011    LDKParseError_Tag tag;
8012    union {
8013       struct {
8014          struct LDKBech32Error bech32_error;
8015       };
8016       struct {
8017          struct LDKError parse_amount_error;
8018       };
8019       struct {
8020          enum LDKSecp256k1Error malformed_signature;
8021       };
8022       struct {
8023          struct LDKError description_decode_error;
8024       };
8025       struct {
8026          struct LDKStr invalid_slice_length;
8027       };
8028    };
8029 } LDKParseError;
8030
8031 /**
8032  * The contents of CResult_SiPrefixParseErrorZ
8033  */
8034 typedef union LDKCResult_SiPrefixParseErrorZPtr {
8035    /**
8036     * A pointer to the contents in the success state.
8037     * Reading from this pointer when `result_ok` is not set is undefined.
8038     */
8039    enum LDKSiPrefix *result;
8040    /**
8041     * A pointer to the contents in the error state.
8042     * Reading from this pointer when `result_ok` is set is undefined.
8043     */
8044    struct LDKParseError *err;
8045 } LDKCResult_SiPrefixParseErrorZPtr;
8046
8047 /**
8048  * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
8049  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
8050  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8051  */
8052 typedef struct LDKCResult_SiPrefixParseErrorZ {
8053    /**
8054     * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
8055     * `err` or `result` depending on the state of `result_ok`.
8056     */
8057    union LDKCResult_SiPrefixParseErrorZPtr contents;
8058    /**
8059     * Whether this CResult_SiPrefixParseErrorZ represents a success state.
8060     */
8061    bool result_ok;
8062 } LDKCResult_SiPrefixParseErrorZ;
8063
8064
8065
8066 /**
8067  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
8068  *
8069  * There are three ways to construct an `Invoice`:
8070  *  1. using `InvoiceBuilder`
8071  *  2. using `Invoice::from_signed(SignedRawInvoice)`
8072  *  3. using `str::parse::<Invoice>(&str)`
8073  */
8074 typedef struct MUST_USE_STRUCT LDKInvoice {
8075    /**
8076     * A pointer to the opaque Rust object.
8077     * Nearly everywhere, inner must be non-null, however in places where
8078     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8079     */
8080    LDKnativeInvoice *inner;
8081    /**
8082     * Indicates that this is the only struct which contains the same pointer.
8083     * Rust functions which take ownership of an object provided via an argument require
8084     * this to be true and invalidate the object pointed to by inner.
8085     */
8086    bool is_owned;
8087 } LDKInvoice;
8088
8089 /**
8090  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
8091  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
8092  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
8093  */
8094 typedef enum LDKParseOrSemanticError_Tag {
8095    /**
8096     * The invoice couldn't be decoded
8097     */
8098    LDKParseOrSemanticError_ParseError,
8099    /**
8100     * The invoice could be decoded but violates the BOLT11 standard
8101     */
8102    LDKParseOrSemanticError_SemanticError,
8103    /**
8104     * Must be last for serialization purposes
8105     */
8106    LDKParseOrSemanticError_Sentinel,
8107 } LDKParseOrSemanticError_Tag;
8108
8109 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
8110    LDKParseOrSemanticError_Tag tag;
8111    union {
8112       struct {
8113          struct LDKParseError parse_error;
8114       };
8115       struct {
8116          enum LDKSemanticError semantic_error;
8117       };
8118    };
8119 } LDKParseOrSemanticError;
8120
8121 /**
8122  * The contents of CResult_InvoiceParseOrSemanticErrorZ
8123  */
8124 typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
8125    /**
8126     * A pointer to the contents in the success state.
8127     * Reading from this pointer when `result_ok` is not set is undefined.
8128     */
8129    struct LDKInvoice *result;
8130    /**
8131     * A pointer to the contents in the error state.
8132     * Reading from this pointer when `result_ok` is set is undefined.
8133     */
8134    struct LDKParseOrSemanticError *err;
8135 } LDKCResult_InvoiceParseOrSemanticErrorZPtr;
8136
8137 /**
8138  * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
8139  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
8140  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8141  */
8142 typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
8143    /**
8144     * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
8145     * `err` or `result` depending on the state of `result_ok`.
8146     */
8147    union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
8148    /**
8149     * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
8150     */
8151    bool result_ok;
8152 } LDKCResult_InvoiceParseOrSemanticErrorZ;
8153
8154
8155
8156 /**
8157  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
8158  * invalid.
8159  *
8160  * # Invariants
8161  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
8162  */
8163 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
8164    /**
8165     * A pointer to the opaque Rust object.
8166     * Nearly everywhere, inner must be non-null, however in places where
8167     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8168     */
8169    LDKnativeSignedRawInvoice *inner;
8170    /**
8171     * Indicates that this is the only struct which contains the same pointer.
8172     * Rust functions which take ownership of an object provided via an argument require
8173     * this to be true and invalidate the object pointed to by inner.
8174     */
8175    bool is_owned;
8176 } LDKSignedRawInvoice;
8177
8178 /**
8179  * The contents of CResult_SignedRawInvoiceParseErrorZ
8180  */
8181 typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
8182    /**
8183     * A pointer to the contents in the success state.
8184     * Reading from this pointer when `result_ok` is not set is undefined.
8185     */
8186    struct LDKSignedRawInvoice *result;
8187    /**
8188     * A pointer to the contents in the error state.
8189     * Reading from this pointer when `result_ok` is set is undefined.
8190     */
8191    struct LDKParseError *err;
8192 } LDKCResult_SignedRawInvoiceParseErrorZPtr;
8193
8194 /**
8195  * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
8196  * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
8197  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8198  */
8199 typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
8200    /**
8201     * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
8202     * `err` or `result` depending on the state of `result_ok`.
8203     */
8204    union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
8205    /**
8206     * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
8207     */
8208    bool result_ok;
8209 } LDKCResult_SignedRawInvoiceParseErrorZ;
8210
8211
8212
8213 /**
8214  * Represents an syntactically correct Invoice for a payment on the lightning network,
8215  * but without the signature information.
8216  * De- and encoding should not lead to information loss but may lead to different hashes.
8217  *
8218  * For methods without docs see the corresponding methods in `Invoice`.
8219  */
8220 typedef struct MUST_USE_STRUCT LDKRawInvoice {
8221    /**
8222     * A pointer to the opaque Rust object.
8223     * Nearly everywhere, inner must be non-null, however in places where
8224     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8225     */
8226    LDKnativeRawInvoice *inner;
8227    /**
8228     * Indicates that this is the only struct which contains the same pointer.
8229     * Rust functions which take ownership of an object provided via an argument require
8230     * this to be true and invalidate the object pointed to by inner.
8231     */
8232    bool is_owned;
8233 } LDKRawInvoice;
8234
8235
8236
8237 /**
8238  * Recoverable signature
8239  */
8240 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
8241    /**
8242     * A pointer to the opaque Rust object.
8243     * Nearly everywhere, inner must be non-null, however in places where
8244     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8245     */
8246    LDKnativeInvoiceSignature *inner;
8247    /**
8248     * Indicates that this is the only struct which contains the same pointer.
8249     * Rust functions which take ownership of an object provided via an argument require
8250     * this to be true and invalidate the object pointed to by inner.
8251     */
8252    bool is_owned;
8253 } LDKInvoiceSignature;
8254
8255 /**
8256  * A tuple of 3 elements. See the individual fields for the types contained.
8257  */
8258 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
8259    /**
8260     * The element at position 0
8261     */
8262    struct LDKRawInvoice a;
8263    /**
8264     * The element at position 1
8265     */
8266    struct LDKThirtyTwoBytes b;
8267    /**
8268     * The element at position 2
8269     */
8270    struct LDKInvoiceSignature c;
8271 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
8272
8273
8274
8275 /**
8276  * Payee public key
8277  */
8278 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
8279    /**
8280     * A pointer to the opaque Rust object.
8281     * Nearly everywhere, inner must be non-null, however in places where
8282     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8283     */
8284    LDKnativePayeePubKey *inner;
8285    /**
8286     * Indicates that this is the only struct which contains the same pointer.
8287     * Rust functions which take ownership of an object provided via an argument require
8288     * this to be true and invalidate the object pointed to by inner.
8289     */
8290    bool is_owned;
8291 } LDKPayeePubKey;
8292
8293 /**
8294  * The contents of CResult_PayeePubKeyErrorZ
8295  */
8296 typedef union LDKCResult_PayeePubKeyErrorZPtr {
8297    /**
8298     * A pointer to the contents in the success state.
8299     * Reading from this pointer when `result_ok` is not set is undefined.
8300     */
8301    struct LDKPayeePubKey *result;
8302    /**
8303     * A pointer to the contents in the error state.
8304     * Reading from this pointer when `result_ok` is set is undefined.
8305     */
8306    enum LDKSecp256k1Error *err;
8307 } LDKCResult_PayeePubKeyErrorZPtr;
8308
8309 /**
8310  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8311  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8312  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8313  */
8314 typedef struct LDKCResult_PayeePubKeyErrorZ {
8315    /**
8316     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8317     * `err` or `result` depending on the state of `result_ok`.
8318     */
8319    union LDKCResult_PayeePubKeyErrorZPtr contents;
8320    /**
8321     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
8322     */
8323    bool result_ok;
8324 } LDKCResult_PayeePubKeyErrorZ;
8325
8326
8327
8328 /**
8329  * Private routing information
8330  *
8331  * # Invariants
8332  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
8333  *
8334  */
8335 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
8336    /**
8337     * A pointer to the opaque Rust object.
8338     * Nearly everywhere, inner must be non-null, however in places where
8339     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8340     */
8341    LDKnativePrivateRoute *inner;
8342    /**
8343     * Indicates that this is the only struct which contains the same pointer.
8344     * Rust functions which take ownership of an object provided via an argument require
8345     * this to be true and invalidate the object pointed to by inner.
8346     */
8347    bool is_owned;
8348 } LDKPrivateRoute;
8349
8350 /**
8351  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8352  * This corresponds to std::vector in C++
8353  */
8354 typedef struct LDKCVec_PrivateRouteZ {
8355    /**
8356     * The elements in the array.
8357     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8358     */
8359    struct LDKPrivateRoute *data;
8360    /**
8361     * The number of elements pointed to by `data`.
8362     */
8363    uintptr_t datalen;
8364 } LDKCVec_PrivateRouteZ;
8365
8366
8367
8368 /**
8369  * A timestamp that refers to a date after 1 January 1970.
8370  *
8371  * # Invariants
8372  *
8373  * The Unix timestamp representing the stored time has to be positive and no greater than
8374  * [`MAX_TIMESTAMP`].
8375  */
8376 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
8377    /**
8378     * A pointer to the opaque Rust object.
8379     * Nearly everywhere, inner must be non-null, however in places where
8380     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8381     */
8382    LDKnativePositiveTimestamp *inner;
8383    /**
8384     * Indicates that this is the only struct which contains the same pointer.
8385     * Rust functions which take ownership of an object provided via an argument require
8386     * this to be true and invalidate the object pointed to by inner.
8387     */
8388    bool is_owned;
8389 } LDKPositiveTimestamp;
8390
8391 /**
8392  * The contents of CResult_PositiveTimestampCreationErrorZ
8393  */
8394 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
8395    /**
8396     * A pointer to the contents in the success state.
8397     * Reading from this pointer when `result_ok` is not set is undefined.
8398     */
8399    struct LDKPositiveTimestamp *result;
8400    /**
8401     * A pointer to the contents in the error state.
8402     * Reading from this pointer when `result_ok` is set is undefined.
8403     */
8404    enum LDKCreationError *err;
8405 } LDKCResult_PositiveTimestampCreationErrorZPtr;
8406
8407 /**
8408  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8409  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8410  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8411  */
8412 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
8413    /**
8414     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8415     * `err` or `result` depending on the state of `result_ok`.
8416     */
8417    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
8418    /**
8419     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8420     */
8421    bool result_ok;
8422 } LDKCResult_PositiveTimestampCreationErrorZ;
8423
8424 /**
8425  * The contents of CResult_NoneSemanticErrorZ
8426  */
8427 typedef union LDKCResult_NoneSemanticErrorZPtr {
8428    /**
8429     * Note that this value is always NULL, as there are no contents in the OK variant
8430     */
8431    void *result;
8432    /**
8433     * A pointer to the contents in the error state.
8434     * Reading from this pointer when `result_ok` is set is undefined.
8435     */
8436    enum LDKSemanticError *err;
8437 } LDKCResult_NoneSemanticErrorZPtr;
8438
8439 /**
8440  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8441  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8442  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8443  */
8444 typedef struct LDKCResult_NoneSemanticErrorZ {
8445    /**
8446     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
8447     * `err` or `result` depending on the state of `result_ok`.
8448     */
8449    union LDKCResult_NoneSemanticErrorZPtr contents;
8450    /**
8451     * Whether this CResult_NoneSemanticErrorZ represents a success state.
8452     */
8453    bool result_ok;
8454 } LDKCResult_NoneSemanticErrorZ;
8455
8456 /**
8457  * The contents of CResult_InvoiceSemanticErrorZ
8458  */
8459 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
8460    /**
8461     * A pointer to the contents in the success state.
8462     * Reading from this pointer when `result_ok` is not set is undefined.
8463     */
8464    struct LDKInvoice *result;
8465    /**
8466     * A pointer to the contents in the error state.
8467     * Reading from this pointer when `result_ok` is set is undefined.
8468     */
8469    enum LDKSemanticError *err;
8470 } LDKCResult_InvoiceSemanticErrorZPtr;
8471
8472 /**
8473  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8474  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8475  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8476  */
8477 typedef struct LDKCResult_InvoiceSemanticErrorZ {
8478    /**
8479     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8480     * `err` or `result` depending on the state of `result_ok`.
8481     */
8482    union LDKCResult_InvoiceSemanticErrorZPtr contents;
8483    /**
8484     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8485     */
8486    bool result_ok;
8487 } LDKCResult_InvoiceSemanticErrorZ;
8488
8489
8490
8491 /**
8492  * Description string
8493  *
8494  * # Invariants
8495  * The description can be at most 639 __bytes__ long
8496  */
8497 typedef struct MUST_USE_STRUCT LDKDescription {
8498    /**
8499     * A pointer to the opaque Rust object.
8500     * Nearly everywhere, inner must be non-null, however in places where
8501     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8502     */
8503    LDKnativeDescription *inner;
8504    /**
8505     * Indicates that this is the only struct which contains the same pointer.
8506     * Rust functions which take ownership of an object provided via an argument require
8507     * this to be true and invalidate the object pointed to by inner.
8508     */
8509    bool is_owned;
8510 } LDKDescription;
8511
8512 /**
8513  * The contents of CResult_DescriptionCreationErrorZ
8514  */
8515 typedef union LDKCResult_DescriptionCreationErrorZPtr {
8516    /**
8517     * A pointer to the contents in the success state.
8518     * Reading from this pointer when `result_ok` is not set is undefined.
8519     */
8520    struct LDKDescription *result;
8521    /**
8522     * A pointer to the contents in the error state.
8523     * Reading from this pointer when `result_ok` is set is undefined.
8524     */
8525    enum LDKCreationError *err;
8526 } LDKCResult_DescriptionCreationErrorZPtr;
8527
8528 /**
8529  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8530  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8531  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8532  */
8533 typedef struct LDKCResult_DescriptionCreationErrorZ {
8534    /**
8535     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8536     * `err` or `result` depending on the state of `result_ok`.
8537     */
8538    union LDKCResult_DescriptionCreationErrorZPtr contents;
8539    /**
8540     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
8541     */
8542    bool result_ok;
8543 } LDKCResult_DescriptionCreationErrorZ;
8544
8545 /**
8546  * The contents of CResult_PrivateRouteCreationErrorZ
8547  */
8548 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
8549    /**
8550     * A pointer to the contents in the success state.
8551     * Reading from this pointer when `result_ok` is not set is undefined.
8552     */
8553    struct LDKPrivateRoute *result;
8554    /**
8555     * A pointer to the contents in the error state.
8556     * Reading from this pointer when `result_ok` is set is undefined.
8557     */
8558    enum LDKCreationError *err;
8559 } LDKCResult_PrivateRouteCreationErrorZPtr;
8560
8561 /**
8562  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8563  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8564  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8565  */
8566 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
8567    /**
8568     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8569     * `err` or `result` depending on the state of `result_ok`.
8570     */
8571    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
8572    /**
8573     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8574     */
8575    bool result_ok;
8576 } LDKCResult_PrivateRouteCreationErrorZ;
8577
8578 /**
8579  * The contents of CResult_StringErrorZ
8580  */
8581 typedef union LDKCResult_StringErrorZPtr {
8582    /**
8583     * A pointer to the contents in the success state.
8584     * Reading from this pointer when `result_ok` is not set is undefined.
8585     */
8586    struct LDKStr *result;
8587    /**
8588     * A pointer to the contents in the error state.
8589     * Reading from this pointer when `result_ok` is set is undefined.
8590     */
8591    enum LDKSecp256k1Error *err;
8592 } LDKCResult_StringErrorZPtr;
8593
8594 /**
8595  * A CResult_StringErrorZ represents the result of a fallible operation,
8596  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
8597  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8598  */
8599 typedef struct LDKCResult_StringErrorZ {
8600    /**
8601     * The contents of this CResult_StringErrorZ, accessible via either
8602     * `err` or `result` depending on the state of `result_ok`.
8603     */
8604    union LDKCResult_StringErrorZPtr contents;
8605    /**
8606     * Whether this CResult_StringErrorZ represents a success state.
8607     */
8608    bool result_ok;
8609 } LDKCResult_StringErrorZ;
8610
8611 /**
8612  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
8613  */
8614 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
8615    /**
8616     * A pointer to the contents in the success state.
8617     * Reading from this pointer when `result_ok` is not set is undefined.
8618     */
8619    struct LDKChannelMonitorUpdate *result;
8620    /**
8621     * A pointer to the contents in the error state.
8622     * Reading from this pointer when `result_ok` is set is undefined.
8623     */
8624    struct LDKDecodeError *err;
8625 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
8626
8627 /**
8628  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
8629  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8630  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8631  */
8632 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
8633    /**
8634     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
8635     * `err` or `result` depending on the state of `result_ok`.
8636     */
8637    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
8638    /**
8639     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
8640     */
8641    bool result_ok;
8642 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
8643
8644 /**
8645  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
8646  */
8647 typedef enum LDKCOption_MonitorEventZ_Tag {
8648    /**
8649     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
8650     */
8651    LDKCOption_MonitorEventZ_Some,
8652    /**
8653     * When we're in this state, this COption_MonitorEventZ contains nothing
8654     */
8655    LDKCOption_MonitorEventZ_None,
8656    /**
8657     * Must be last for serialization purposes
8658     */
8659    LDKCOption_MonitorEventZ_Sentinel,
8660 } LDKCOption_MonitorEventZ_Tag;
8661
8662 typedef struct LDKCOption_MonitorEventZ {
8663    LDKCOption_MonitorEventZ_Tag tag;
8664    union {
8665       struct {
8666          struct LDKMonitorEvent some;
8667       };
8668    };
8669 } LDKCOption_MonitorEventZ;
8670
8671 /**
8672  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
8673  */
8674 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
8675    /**
8676     * A pointer to the contents in the success state.
8677     * Reading from this pointer when `result_ok` is not set is undefined.
8678     */
8679    struct LDKCOption_MonitorEventZ *result;
8680    /**
8681     * A pointer to the contents in the error state.
8682     * Reading from this pointer when `result_ok` is set is undefined.
8683     */
8684    struct LDKDecodeError *err;
8685 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
8686
8687 /**
8688  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
8689  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8690  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8691  */
8692 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
8693    /**
8694     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
8695     * `err` or `result` depending on the state of `result_ok`.
8696     */
8697    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
8698    /**
8699     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
8700     */
8701    bool result_ok;
8702 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
8703
8704 /**
8705  * The contents of CResult_HTLCUpdateDecodeErrorZ
8706  */
8707 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
8708    /**
8709     * A pointer to the contents in the success state.
8710     * Reading from this pointer when `result_ok` is not set is undefined.
8711     */
8712    struct LDKHTLCUpdate *result;
8713    /**
8714     * A pointer to the contents in the error state.
8715     * Reading from this pointer when `result_ok` is set is undefined.
8716     */
8717    struct LDKDecodeError *err;
8718 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
8719
8720 /**
8721  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
8722  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8723  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8724  */
8725 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
8726    /**
8727     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
8728     * `err` or `result` depending on the state of `result_ok`.
8729     */
8730    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
8731    /**
8732     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
8733     */
8734    bool result_ok;
8735 } LDKCResult_HTLCUpdateDecodeErrorZ;
8736
8737 /**
8738  * A tuple of 2 elements. See the individual fields for the types contained.
8739  */
8740 typedef struct LDKC2Tuple_OutPointScriptZ {
8741    /**
8742     * The element at position 0
8743     */
8744    struct LDKOutPoint a;
8745    /**
8746     * The element at position 1
8747     */
8748    struct LDKCVec_u8Z b;
8749 } LDKC2Tuple_OutPointScriptZ;
8750
8751 /**
8752  * A tuple of 2 elements. See the individual fields for the types contained.
8753  */
8754 typedef struct LDKC2Tuple_u32ScriptZ {
8755    /**
8756     * The element at position 0
8757     */
8758    uint32_t a;
8759    /**
8760     * The element at position 1
8761     */
8762    struct LDKCVec_u8Z b;
8763 } LDKC2Tuple_u32ScriptZ;
8764
8765 /**
8766  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
8767  * This corresponds to std::vector in C++
8768  */
8769 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
8770    /**
8771     * The elements in the array.
8772     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8773     */
8774    struct LDKC2Tuple_u32ScriptZ *data;
8775    /**
8776     * The number of elements pointed to by `data`.
8777     */
8778    uintptr_t datalen;
8779 } LDKCVec_C2Tuple_u32ScriptZZ;
8780
8781 /**
8782  * A tuple of 2 elements. See the individual fields for the types contained.
8783  */
8784 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8785    /**
8786     * The element at position 0
8787     */
8788    struct LDKThirtyTwoBytes a;
8789    /**
8790     * The element at position 1
8791     */
8792    struct LDKCVec_C2Tuple_u32ScriptZZ b;
8793 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
8794
8795 /**
8796  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
8797  * This corresponds to std::vector in C++
8798  */
8799 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8800    /**
8801     * The elements in the array.
8802     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8803     */
8804    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
8805    /**
8806     * The number of elements pointed to by `data`.
8807     */
8808    uintptr_t datalen;
8809 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
8810
8811 /**
8812  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
8813  * This corresponds to std::vector in C++
8814  */
8815 typedef struct LDKCVec_EventZ {
8816    /**
8817     * The elements in the array.
8818     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8819     */
8820    struct LDKEvent *data;
8821    /**
8822     * The number of elements pointed to by `data`.
8823     */
8824    uintptr_t datalen;
8825 } LDKCVec_EventZ;
8826
8827 /**
8828  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8829  * This corresponds to std::vector in C++
8830  */
8831 typedef struct LDKCVec_TransactionZ {
8832    /**
8833     * The elements in the array.
8834     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8835     */
8836    struct LDKTransaction *data;
8837    /**
8838     * The number of elements pointed to by `data`.
8839     */
8840    uintptr_t datalen;
8841 } LDKCVec_TransactionZ;
8842
8843 /**
8844  * A tuple of 2 elements. See the individual fields for the types contained.
8845  */
8846 typedef struct LDKC2Tuple_u32TxOutZ {
8847    /**
8848     * The element at position 0
8849     */
8850    uint32_t a;
8851    /**
8852     * The element at position 1
8853     */
8854    struct LDKTxOut b;
8855 } LDKC2Tuple_u32TxOutZ;
8856
8857 /**
8858  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
8859  * This corresponds to std::vector in C++
8860  */
8861 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
8862    /**
8863     * The elements in the array.
8864     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8865     */
8866    struct LDKC2Tuple_u32TxOutZ *data;
8867    /**
8868     * The number of elements pointed to by `data`.
8869     */
8870    uintptr_t datalen;
8871 } LDKCVec_C2Tuple_u32TxOutZZ;
8872
8873 /**
8874  * A tuple of 2 elements. See the individual fields for the types contained.
8875  */
8876 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8877    /**
8878     * The element at position 0
8879     */
8880    struct LDKThirtyTwoBytes a;
8881    /**
8882     * The element at position 1
8883     */
8884    struct LDKCVec_C2Tuple_u32TxOutZZ b;
8885 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
8886
8887 /**
8888  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
8889  * This corresponds to std::vector in C++
8890  */
8891 typedef struct LDKCVec_TransactionOutputsZ {
8892    /**
8893     * The elements in the array.
8894     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8895     */
8896    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
8897    /**
8898     * The number of elements pointed to by `data`.
8899     */
8900    uintptr_t datalen;
8901 } LDKCVec_TransactionOutputsZ;
8902
8903 /**
8904  * Details about the balance(s) available for spending once the channel appears on chain.
8905  *
8906  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
8907  * be provided.
8908  */
8909 typedef enum LDKBalance_Tag {
8910    /**
8911     * The channel is not yet closed (or the commitment or closing transaction has not yet
8912     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
8913     * force-closed now.
8914     */
8915    LDKBalance_ClaimableOnChannelClose,
8916    /**
8917     * The channel has been closed, and the given balance is ours but awaiting confirmations until
8918     * we consider it spendable.
8919     */
8920    LDKBalance_ClaimableAwaitingConfirmations,
8921    /**
8922     * The channel has been closed, and the given balance should be ours but awaiting spending
8923     * transaction confirmation. If the spending transaction does not confirm in time, it is
8924     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
8925     *
8926     * Once the spending transaction confirms, before it has reached enough confirmations to be
8927     * considered safe from chain reorganizations, the balance will instead be provided via
8928     * [`Balance::ClaimableAwaitingConfirmations`].
8929     */
8930    LDKBalance_ContentiousClaimable,
8931    /**
8932     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
8933     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
8934     * likely to be claimed by our counterparty before we do.
8935     */
8936    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
8937    /**
8938     * Must be last for serialization purposes
8939     */
8940    LDKBalance_Sentinel,
8941 } LDKBalance_Tag;
8942
8943 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
8944    /**
8945     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8946     * required to do so.
8947     */
8948    uint64_t claimable_amount_satoshis;
8949 } LDKBalance_LDKClaimableOnChannelClose_Body;
8950
8951 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
8952    /**
8953     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
8954     * were spent in broadcasting the transaction.
8955     */
8956    uint64_t claimable_amount_satoshis;
8957    /**
8958     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
8959     * amount.
8960     */
8961    uint32_t confirmation_height;
8962 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
8963
8964 typedef struct LDKBalance_LDKContentiousClaimable_Body {
8965    /**
8966     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8967     * required to do so.
8968     */
8969    uint64_t claimable_amount_satoshis;
8970    /**
8971     * The height at which the counterparty may be able to claim the balance if we have not
8972     * done so.
8973     */
8974    uint32_t timeout_height;
8975 } LDKBalance_LDKContentiousClaimable_Body;
8976
8977 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
8978    /**
8979     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8980     * required to do so.
8981     */
8982    uint64_t claimable_amount_satoshis;
8983    /**
8984     * The height at which we will be able to claim the balance if our counterparty has not
8985     * done so.
8986     */
8987    uint32_t claimable_height;
8988 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
8989
8990 typedef struct MUST_USE_STRUCT LDKBalance {
8991    LDKBalance_Tag tag;
8992    union {
8993       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
8994       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
8995       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
8996       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
8997    };
8998 } LDKBalance;
8999
9000 /**
9001  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9002  * This corresponds to std::vector in C++
9003  */
9004 typedef struct LDKCVec_BalanceZ {
9005    /**
9006     * The elements in the array.
9007     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9008     */
9009    struct LDKBalance *data;
9010    /**
9011     * The number of elements pointed to by `data`.
9012     */
9013    uintptr_t datalen;
9014 } LDKCVec_BalanceZ;
9015
9016 /**
9017  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9018  */
9019 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9020    /**
9021     * A pointer to the contents in the success state.
9022     * Reading from this pointer when `result_ok` is not set is undefined.
9023     */
9024    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
9025    /**
9026     * A pointer to the contents in the error state.
9027     * Reading from this pointer when `result_ok` is set is undefined.
9028     */
9029    struct LDKDecodeError *err;
9030 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
9031
9032 /**
9033  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9034  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9035  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9036  */
9037 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9038    /**
9039     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9040     * `err` or `result` depending on the state of `result_ok`.
9041     */
9042    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
9043    /**
9044     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9045     */
9046    bool result_ok;
9047 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
9048
9049 /**
9050  * A tuple of 2 elements. See the individual fields for the types contained.
9051  */
9052 typedef struct LDKC2Tuple_PublicKeyTypeZ {
9053    /**
9054     * The element at position 0
9055     */
9056    struct LDKPublicKey a;
9057    /**
9058     * The element at position 1
9059     */
9060    struct LDKType b;
9061 } LDKC2Tuple_PublicKeyTypeZ;
9062
9063 /**
9064  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9065  * This corresponds to std::vector in C++
9066  */
9067 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
9068    /**
9069     * The elements in the array.
9070     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9071     */
9072    struct LDKC2Tuple_PublicKeyTypeZ *data;
9073    /**
9074     * The number of elements pointed to by `data`.
9075     */
9076    uintptr_t datalen;
9077 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
9078
9079 /**
9080  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
9081  */
9082 typedef enum LDKCOption_NetAddressZ_Tag {
9083    /**
9084     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
9085     */
9086    LDKCOption_NetAddressZ_Some,
9087    /**
9088     * When we're in this state, this COption_NetAddressZ contains nothing
9089     */
9090    LDKCOption_NetAddressZ_None,
9091    /**
9092     * Must be last for serialization purposes
9093     */
9094    LDKCOption_NetAddressZ_Sentinel,
9095 } LDKCOption_NetAddressZ_Tag;
9096
9097 typedef struct LDKCOption_NetAddressZ {
9098    LDKCOption_NetAddressZ_Tag tag;
9099    union {
9100       struct {
9101          struct LDKNetAddress some;
9102       };
9103    };
9104 } LDKCOption_NetAddressZ;
9105
9106
9107
9108 /**
9109  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
9110  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
9111  * descriptor.
9112  */
9113 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
9114    /**
9115     * A pointer to the opaque Rust object.
9116     * Nearly everywhere, inner must be non-null, however in places where
9117     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9118     */
9119    LDKnativePeerHandleError *inner;
9120    /**
9121     * Indicates that this is the only struct which contains the same pointer.
9122     * Rust functions which take ownership of an object provided via an argument require
9123     * this to be true and invalidate the object pointed to by inner.
9124     */
9125    bool is_owned;
9126 } LDKPeerHandleError;
9127
9128 /**
9129  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
9130  */
9131 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
9132    /**
9133     * A pointer to the contents in the success state.
9134     * Reading from this pointer when `result_ok` is not set is undefined.
9135     */
9136    struct LDKCVec_u8Z *result;
9137    /**
9138     * A pointer to the contents in the error state.
9139     * Reading from this pointer when `result_ok` is set is undefined.
9140     */
9141    struct LDKPeerHandleError *err;
9142 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
9143
9144 /**
9145  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9146  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9147  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9148  */
9149 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
9150    /**
9151     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9152     * `err` or `result` depending on the state of `result_ok`.
9153     */
9154    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
9155    /**
9156     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9157     */
9158    bool result_ok;
9159 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
9160
9161 /**
9162  * The contents of CResult_NonePeerHandleErrorZ
9163  */
9164 typedef union LDKCResult_NonePeerHandleErrorZPtr {
9165    /**
9166     * Note that this value is always NULL, as there are no contents in the OK variant
9167     */
9168    void *result;
9169    /**
9170     * A pointer to the contents in the error state.
9171     * Reading from this pointer when `result_ok` is set is undefined.
9172     */
9173    struct LDKPeerHandleError *err;
9174 } LDKCResult_NonePeerHandleErrorZPtr;
9175
9176 /**
9177  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9178  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9179  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9180  */
9181 typedef struct LDKCResult_NonePeerHandleErrorZ {
9182    /**
9183     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9184     * `err` or `result` depending on the state of `result_ok`.
9185     */
9186    union LDKCResult_NonePeerHandleErrorZPtr contents;
9187    /**
9188     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
9189     */
9190    bool result_ok;
9191 } LDKCResult_NonePeerHandleErrorZ;
9192
9193 /**
9194  * The contents of CResult_boolPeerHandleErrorZ
9195  */
9196 typedef union LDKCResult_boolPeerHandleErrorZPtr {
9197    /**
9198     * A pointer to the contents in the success state.
9199     * Reading from this pointer when `result_ok` is not set is undefined.
9200     */
9201    bool *result;
9202    /**
9203     * A pointer to the contents in the error state.
9204     * Reading from this pointer when `result_ok` is set is undefined.
9205     */
9206    struct LDKPeerHandleError *err;
9207 } LDKCResult_boolPeerHandleErrorZPtr;
9208
9209 /**
9210  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9211  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9212  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9213  */
9214 typedef struct LDKCResult_boolPeerHandleErrorZ {
9215    /**
9216     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9217     * `err` or `result` depending on the state of `result_ok`.
9218     */
9219    union LDKCResult_boolPeerHandleErrorZPtr contents;
9220    /**
9221     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
9222     */
9223    bool result_ok;
9224 } LDKCResult_boolPeerHandleErrorZ;
9225
9226 /**
9227  * All-encompassing standard error type that processing can return
9228  */
9229 typedef enum LDKGraphSyncError_Tag {
9230    /**
9231     * Error trying to read the update data, typically due to an erroneous data length indication
9232     * that is greater than the actual amount of data provided
9233     */
9234    LDKGraphSyncError_DecodeError,
9235    /**
9236     * Error applying the patch to the network graph, usually the result of updates that are too
9237     * old or missing prerequisite data to the application of updates out of order
9238     */
9239    LDKGraphSyncError_LightningError,
9240    /**
9241     * Must be last for serialization purposes
9242     */
9243    LDKGraphSyncError_Sentinel,
9244 } LDKGraphSyncError_Tag;
9245
9246 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
9247    LDKGraphSyncError_Tag tag;
9248    union {
9249       struct {
9250          struct LDKDecodeError decode_error;
9251       };
9252       struct {
9253          struct LDKLightningError lightning_error;
9254       };
9255    };
9256 } LDKGraphSyncError;
9257
9258 /**
9259  * The contents of CResult_u32GraphSyncErrorZ
9260  */
9261 typedef union LDKCResult_u32GraphSyncErrorZPtr {
9262    /**
9263     * A pointer to the contents in the success state.
9264     * Reading from this pointer when `result_ok` is not set is undefined.
9265     */
9266    uint32_t *result;
9267    /**
9268     * A pointer to the contents in the error state.
9269     * Reading from this pointer when `result_ok` is set is undefined.
9270     */
9271    struct LDKGraphSyncError *err;
9272 } LDKCResult_u32GraphSyncErrorZPtr;
9273
9274 /**
9275  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
9276  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
9277  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9278  */
9279 typedef struct LDKCResult_u32GraphSyncErrorZ {
9280    /**
9281     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
9282     * `err` or `result` depending on the state of `result_ok`.
9283     */
9284    union LDKCResult_u32GraphSyncErrorZPtr contents;
9285    /**
9286     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
9287     */
9288    bool result_ok;
9289 } LDKCResult_u32GraphSyncErrorZ;
9290
9291 /**
9292  * The contents of CResult_NetAddressDecodeErrorZ
9293  */
9294 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
9295    /**
9296     * A pointer to the contents in the success state.
9297     * Reading from this pointer when `result_ok` is not set is undefined.
9298     */
9299    struct LDKNetAddress *result;
9300    /**
9301     * A pointer to the contents in the error state.
9302     * Reading from this pointer when `result_ok` is set is undefined.
9303     */
9304    struct LDKDecodeError *err;
9305 } LDKCResult_NetAddressDecodeErrorZPtr;
9306
9307 /**
9308  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9309  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9310  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9311  */
9312 typedef struct LDKCResult_NetAddressDecodeErrorZ {
9313    /**
9314     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9315     * `err` or `result` depending on the state of `result_ok`.
9316     */
9317    union LDKCResult_NetAddressDecodeErrorZPtr contents;
9318    /**
9319     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9320     */
9321    bool result_ok;
9322 } LDKCResult_NetAddressDecodeErrorZ;
9323
9324
9325
9326 /**
9327  * An update_add_htlc message to be sent or received from a peer
9328  */
9329 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
9330    /**
9331     * A pointer to the opaque Rust object.
9332     * Nearly everywhere, inner must be non-null, however in places where
9333     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9334     */
9335    LDKnativeUpdateAddHTLC *inner;
9336    /**
9337     * Indicates that this is the only struct which contains the same pointer.
9338     * Rust functions which take ownership of an object provided via an argument require
9339     * this to be true and invalidate the object pointed to by inner.
9340     */
9341    bool is_owned;
9342 } LDKUpdateAddHTLC;
9343
9344 /**
9345  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9346  * This corresponds to std::vector in C++
9347  */
9348 typedef struct LDKCVec_UpdateAddHTLCZ {
9349    /**
9350     * The elements in the array.
9351     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9352     */
9353    struct LDKUpdateAddHTLC *data;
9354    /**
9355     * The number of elements pointed to by `data`.
9356     */
9357    uintptr_t datalen;
9358 } LDKCVec_UpdateAddHTLCZ;
9359
9360
9361
9362 /**
9363  * An update_fulfill_htlc message to be sent or received from a peer
9364  */
9365 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
9366    /**
9367     * A pointer to the opaque Rust object.
9368     * Nearly everywhere, inner must be non-null, however in places where
9369     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9370     */
9371    LDKnativeUpdateFulfillHTLC *inner;
9372    /**
9373     * Indicates that this is the only struct which contains the same pointer.
9374     * Rust functions which take ownership of an object provided via an argument require
9375     * this to be true and invalidate the object pointed to by inner.
9376     */
9377    bool is_owned;
9378 } LDKUpdateFulfillHTLC;
9379
9380 /**
9381  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9382  * This corresponds to std::vector in C++
9383  */
9384 typedef struct LDKCVec_UpdateFulfillHTLCZ {
9385    /**
9386     * The elements in the array.
9387     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9388     */
9389    struct LDKUpdateFulfillHTLC *data;
9390    /**
9391     * The number of elements pointed to by `data`.
9392     */
9393    uintptr_t datalen;
9394 } LDKCVec_UpdateFulfillHTLCZ;
9395
9396
9397
9398 /**
9399  * An update_fail_htlc message to be sent or received from a peer
9400  */
9401 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
9402    /**
9403     * A pointer to the opaque Rust object.
9404     * Nearly everywhere, inner must be non-null, however in places where
9405     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9406     */
9407    LDKnativeUpdateFailHTLC *inner;
9408    /**
9409     * Indicates that this is the only struct which contains the same pointer.
9410     * Rust functions which take ownership of an object provided via an argument require
9411     * this to be true and invalidate the object pointed to by inner.
9412     */
9413    bool is_owned;
9414 } LDKUpdateFailHTLC;
9415
9416 /**
9417  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9418  * This corresponds to std::vector in C++
9419  */
9420 typedef struct LDKCVec_UpdateFailHTLCZ {
9421    /**
9422     * The elements in the array.
9423     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9424     */
9425    struct LDKUpdateFailHTLC *data;
9426    /**
9427     * The number of elements pointed to by `data`.
9428     */
9429    uintptr_t datalen;
9430 } LDKCVec_UpdateFailHTLCZ;
9431
9432
9433
9434 /**
9435  * An update_fail_malformed_htlc message to be sent or received from a peer
9436  */
9437 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
9438    /**
9439     * A pointer to the opaque Rust object.
9440     * Nearly everywhere, inner must be non-null, however in places where
9441     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9442     */
9443    LDKnativeUpdateFailMalformedHTLC *inner;
9444    /**
9445     * Indicates that this is the only struct which contains the same pointer.
9446     * Rust functions which take ownership of an object provided via an argument require
9447     * this to be true and invalidate the object pointed to by inner.
9448     */
9449    bool is_owned;
9450 } LDKUpdateFailMalformedHTLC;
9451
9452 /**
9453  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9454  * This corresponds to std::vector in C++
9455  */
9456 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
9457    /**
9458     * The elements in the array.
9459     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9460     */
9461    struct LDKUpdateFailMalformedHTLC *data;
9462    /**
9463     * The number of elements pointed to by `data`.
9464     */
9465    uintptr_t datalen;
9466 } LDKCVec_UpdateFailMalformedHTLCZ;
9467
9468 /**
9469  * The contents of CResult_AcceptChannelDecodeErrorZ
9470  */
9471 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
9472    /**
9473     * A pointer to the contents in the success state.
9474     * Reading from this pointer when `result_ok` is not set is undefined.
9475     */
9476    struct LDKAcceptChannel *result;
9477    /**
9478     * A pointer to the contents in the error state.
9479     * Reading from this pointer when `result_ok` is set is undefined.
9480     */
9481    struct LDKDecodeError *err;
9482 } LDKCResult_AcceptChannelDecodeErrorZPtr;
9483
9484 /**
9485  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9486  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9487  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9488  */
9489 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
9490    /**
9491     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9492     * `err` or `result` depending on the state of `result_ok`.
9493     */
9494    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
9495    /**
9496     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9497     */
9498    bool result_ok;
9499 } LDKCResult_AcceptChannelDecodeErrorZ;
9500
9501 /**
9502  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9503  */
9504 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
9505    /**
9506     * A pointer to the contents in the success state.
9507     * Reading from this pointer when `result_ok` is not set is undefined.
9508     */
9509    struct LDKAnnouncementSignatures *result;
9510    /**
9511     * A pointer to the contents in the error state.
9512     * Reading from this pointer when `result_ok` is set is undefined.
9513     */
9514    struct LDKDecodeError *err;
9515 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
9516
9517 /**
9518  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9519  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9520  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9521  */
9522 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
9523    /**
9524     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9525     * `err` or `result` depending on the state of `result_ok`.
9526     */
9527    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
9528    /**
9529     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9530     */
9531    bool result_ok;
9532 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
9533
9534 /**
9535  * The contents of CResult_ChannelReestablishDecodeErrorZ
9536  */
9537 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
9538    /**
9539     * A pointer to the contents in the success state.
9540     * Reading from this pointer when `result_ok` is not set is undefined.
9541     */
9542    struct LDKChannelReestablish *result;
9543    /**
9544     * A pointer to the contents in the error state.
9545     * Reading from this pointer when `result_ok` is set is undefined.
9546     */
9547    struct LDKDecodeError *err;
9548 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
9549
9550 /**
9551  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9552  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9554  */
9555 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
9556    /**
9557     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9558     * `err` or `result` depending on the state of `result_ok`.
9559     */
9560    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
9561    /**
9562     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9563     */
9564    bool result_ok;
9565 } LDKCResult_ChannelReestablishDecodeErrorZ;
9566
9567 /**
9568  * The contents of CResult_ClosingSignedDecodeErrorZ
9569  */
9570 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
9571    /**
9572     * A pointer to the contents in the success state.
9573     * Reading from this pointer when `result_ok` is not set is undefined.
9574     */
9575    struct LDKClosingSigned *result;
9576    /**
9577     * A pointer to the contents in the error state.
9578     * Reading from this pointer when `result_ok` is set is undefined.
9579     */
9580    struct LDKDecodeError *err;
9581 } LDKCResult_ClosingSignedDecodeErrorZPtr;
9582
9583 /**
9584  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9585  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9586  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9587  */
9588 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
9589    /**
9590     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9591     * `err` or `result` depending on the state of `result_ok`.
9592     */
9593    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
9594    /**
9595     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9596     */
9597    bool result_ok;
9598 } LDKCResult_ClosingSignedDecodeErrorZ;
9599
9600
9601
9602 /**
9603  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
9604  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
9605  * to use.
9606  */
9607 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
9608    /**
9609     * A pointer to the opaque Rust object.
9610     * Nearly everywhere, inner must be non-null, however in places where
9611     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9612     */
9613    LDKnativeClosingSignedFeeRange *inner;
9614    /**
9615     * Indicates that this is the only struct which contains the same pointer.
9616     * Rust functions which take ownership of an object provided via an argument require
9617     * this to be true and invalidate the object pointed to by inner.
9618     */
9619    bool is_owned;
9620 } LDKClosingSignedFeeRange;
9621
9622 /**
9623  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9624  */
9625 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9626    /**
9627     * A pointer to the contents in the success state.
9628     * Reading from this pointer when `result_ok` is not set is undefined.
9629     */
9630    struct LDKClosingSignedFeeRange *result;
9631    /**
9632     * A pointer to the contents in the error state.
9633     * Reading from this pointer when `result_ok` is set is undefined.
9634     */
9635    struct LDKDecodeError *err;
9636 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
9637
9638 /**
9639  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9640  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9641  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9642  */
9643 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
9644    /**
9645     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9646     * `err` or `result` depending on the state of `result_ok`.
9647     */
9648    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
9649    /**
9650     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9651     */
9652    bool result_ok;
9653 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
9654
9655
9656
9657 /**
9658  * A commitment_signed message to be sent or received from a peer
9659  */
9660 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
9661    /**
9662     * A pointer to the opaque Rust object.
9663     * Nearly everywhere, inner must be non-null, however in places where
9664     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9665     */
9666    LDKnativeCommitmentSigned *inner;
9667    /**
9668     * Indicates that this is the only struct which contains the same pointer.
9669     * Rust functions which take ownership of an object provided via an argument require
9670     * this to be true and invalidate the object pointed to by inner.
9671     */
9672    bool is_owned;
9673 } LDKCommitmentSigned;
9674
9675 /**
9676  * The contents of CResult_CommitmentSignedDecodeErrorZ
9677  */
9678 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
9679    /**
9680     * A pointer to the contents in the success state.
9681     * Reading from this pointer when `result_ok` is not set is undefined.
9682     */
9683    struct LDKCommitmentSigned *result;
9684    /**
9685     * A pointer to the contents in the error state.
9686     * Reading from this pointer when `result_ok` is set is undefined.
9687     */
9688    struct LDKDecodeError *err;
9689 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
9690
9691 /**
9692  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9693  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9694  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9695  */
9696 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
9697    /**
9698     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9699     * `err` or `result` depending on the state of `result_ok`.
9700     */
9701    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
9702    /**
9703     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9704     */
9705    bool result_ok;
9706 } LDKCResult_CommitmentSignedDecodeErrorZ;
9707
9708 /**
9709  * The contents of CResult_FundingCreatedDecodeErrorZ
9710  */
9711 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
9712    /**
9713     * A pointer to the contents in the success state.
9714     * Reading from this pointer when `result_ok` is not set is undefined.
9715     */
9716    struct LDKFundingCreated *result;
9717    /**
9718     * A pointer to the contents in the error state.
9719     * Reading from this pointer when `result_ok` is set is undefined.
9720     */
9721    struct LDKDecodeError *err;
9722 } LDKCResult_FundingCreatedDecodeErrorZPtr;
9723
9724 /**
9725  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9726  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9727  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9728  */
9729 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
9730    /**
9731     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9732     * `err` or `result` depending on the state of `result_ok`.
9733     */
9734    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
9735    /**
9736     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9737     */
9738    bool result_ok;
9739 } LDKCResult_FundingCreatedDecodeErrorZ;
9740
9741 /**
9742  * The contents of CResult_FundingSignedDecodeErrorZ
9743  */
9744 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
9745    /**
9746     * A pointer to the contents in the success state.
9747     * Reading from this pointer when `result_ok` is not set is undefined.
9748     */
9749    struct LDKFundingSigned *result;
9750    /**
9751     * A pointer to the contents in the error state.
9752     * Reading from this pointer when `result_ok` is set is undefined.
9753     */
9754    struct LDKDecodeError *err;
9755 } LDKCResult_FundingSignedDecodeErrorZPtr;
9756
9757 /**
9758  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9759  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9760  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9761  */
9762 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
9763    /**
9764     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9765     * `err` or `result` depending on the state of `result_ok`.
9766     */
9767    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
9768    /**
9769     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9770     */
9771    bool result_ok;
9772 } LDKCResult_FundingSignedDecodeErrorZ;
9773
9774 /**
9775  * The contents of CResult_ChannelReadyDecodeErrorZ
9776  */
9777 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
9778    /**
9779     * A pointer to the contents in the success state.
9780     * Reading from this pointer when `result_ok` is not set is undefined.
9781     */
9782    struct LDKChannelReady *result;
9783    /**
9784     * A pointer to the contents in the error state.
9785     * Reading from this pointer when `result_ok` is set is undefined.
9786     */
9787    struct LDKDecodeError *err;
9788 } LDKCResult_ChannelReadyDecodeErrorZPtr;
9789
9790 /**
9791  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
9792  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
9793  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9794  */
9795 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
9796    /**
9797     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
9798     * `err` or `result` depending on the state of `result_ok`.
9799     */
9800    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
9801    /**
9802     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
9803     */
9804    bool result_ok;
9805 } LDKCResult_ChannelReadyDecodeErrorZ;
9806
9807
9808
9809 /**
9810  * An init message to be sent or received from a peer
9811  */
9812 typedef struct MUST_USE_STRUCT LDKInit {
9813    /**
9814     * A pointer to the opaque Rust object.
9815     * Nearly everywhere, inner must be non-null, however in places where
9816     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9817     */
9818    LDKnativeInit *inner;
9819    /**
9820     * Indicates that this is the only struct which contains the same pointer.
9821     * Rust functions which take ownership of an object provided via an argument require
9822     * this to be true and invalidate the object pointed to by inner.
9823     */
9824    bool is_owned;
9825 } LDKInit;
9826
9827 /**
9828  * The contents of CResult_InitDecodeErrorZ
9829  */
9830 typedef union LDKCResult_InitDecodeErrorZPtr {
9831    /**
9832     * A pointer to the contents in the success state.
9833     * Reading from this pointer when `result_ok` is not set is undefined.
9834     */
9835    struct LDKInit *result;
9836    /**
9837     * A pointer to the contents in the error state.
9838     * Reading from this pointer when `result_ok` is set is undefined.
9839     */
9840    struct LDKDecodeError *err;
9841 } LDKCResult_InitDecodeErrorZPtr;
9842
9843 /**
9844  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9845  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9846  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9847  */
9848 typedef struct LDKCResult_InitDecodeErrorZ {
9849    /**
9850     * The contents of this CResult_InitDecodeErrorZ, accessible via either
9851     * `err` or `result` depending on the state of `result_ok`.
9852     */
9853    union LDKCResult_InitDecodeErrorZPtr contents;
9854    /**
9855     * Whether this CResult_InitDecodeErrorZ represents a success state.
9856     */
9857    bool result_ok;
9858 } LDKCResult_InitDecodeErrorZ;
9859
9860 /**
9861  * The contents of CResult_OpenChannelDecodeErrorZ
9862  */
9863 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
9864    /**
9865     * A pointer to the contents in the success state.
9866     * Reading from this pointer when `result_ok` is not set is undefined.
9867     */
9868    struct LDKOpenChannel *result;
9869    /**
9870     * A pointer to the contents in the error state.
9871     * Reading from this pointer when `result_ok` is set is undefined.
9872     */
9873    struct LDKDecodeError *err;
9874 } LDKCResult_OpenChannelDecodeErrorZPtr;
9875
9876 /**
9877  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9878  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9879  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9880  */
9881 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
9882    /**
9883     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9884     * `err` or `result` depending on the state of `result_ok`.
9885     */
9886    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
9887    /**
9888     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9889     */
9890    bool result_ok;
9891 } LDKCResult_OpenChannelDecodeErrorZ;
9892
9893 /**
9894  * The contents of CResult_RevokeAndACKDecodeErrorZ
9895  */
9896 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
9897    /**
9898     * A pointer to the contents in the success state.
9899     * Reading from this pointer when `result_ok` is not set is undefined.
9900     */
9901    struct LDKRevokeAndACK *result;
9902    /**
9903     * A pointer to the contents in the error state.
9904     * Reading from this pointer when `result_ok` is set is undefined.
9905     */
9906    struct LDKDecodeError *err;
9907 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
9908
9909 /**
9910  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9911  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9912  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9913  */
9914 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
9915    /**
9916     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9917     * `err` or `result` depending on the state of `result_ok`.
9918     */
9919    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
9920    /**
9921     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9922     */
9923    bool result_ok;
9924 } LDKCResult_RevokeAndACKDecodeErrorZ;
9925
9926 /**
9927  * The contents of CResult_ShutdownDecodeErrorZ
9928  */
9929 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
9930    /**
9931     * A pointer to the contents in the success state.
9932     * Reading from this pointer when `result_ok` is not set is undefined.
9933     */
9934    struct LDKShutdown *result;
9935    /**
9936     * A pointer to the contents in the error state.
9937     * Reading from this pointer when `result_ok` is set is undefined.
9938     */
9939    struct LDKDecodeError *err;
9940 } LDKCResult_ShutdownDecodeErrorZPtr;
9941
9942 /**
9943  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9944  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9945  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9946  */
9947 typedef struct LDKCResult_ShutdownDecodeErrorZ {
9948    /**
9949     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9950     * `err` or `result` depending on the state of `result_ok`.
9951     */
9952    union LDKCResult_ShutdownDecodeErrorZPtr contents;
9953    /**
9954     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9955     */
9956    bool result_ok;
9957 } LDKCResult_ShutdownDecodeErrorZ;
9958
9959 /**
9960  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
9961  */
9962 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
9963    /**
9964     * A pointer to the contents in the success state.
9965     * Reading from this pointer when `result_ok` is not set is undefined.
9966     */
9967    struct LDKUpdateFailHTLC *result;
9968    /**
9969     * A pointer to the contents in the error state.
9970     * Reading from this pointer when `result_ok` is set is undefined.
9971     */
9972    struct LDKDecodeError *err;
9973 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
9974
9975 /**
9976  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9977  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9978  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9979  */
9980 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
9981    /**
9982     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9983     * `err` or `result` depending on the state of `result_ok`.
9984     */
9985    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
9986    /**
9987     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9988     */
9989    bool result_ok;
9990 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
9991
9992 /**
9993  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9994  */
9995 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9996    /**
9997     * A pointer to the contents in the success state.
9998     * Reading from this pointer when `result_ok` is not set is undefined.
9999     */
10000    struct LDKUpdateFailMalformedHTLC *result;
10001    /**
10002     * A pointer to the contents in the error state.
10003     * Reading from this pointer when `result_ok` is set is undefined.
10004     */
10005    struct LDKDecodeError *err;
10006 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
10007
10008 /**
10009  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10010  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10011  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10012  */
10013 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
10014    /**
10015     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10016     * `err` or `result` depending on the state of `result_ok`.
10017     */
10018    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
10019    /**
10020     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10021     */
10022    bool result_ok;
10023 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
10024
10025
10026
10027 /**
10028  * An update_fee message to be sent or received from a peer
10029  */
10030 typedef struct MUST_USE_STRUCT LDKUpdateFee {
10031    /**
10032     * A pointer to the opaque Rust object.
10033     * Nearly everywhere, inner must be non-null, however in places where
10034     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10035     */
10036    LDKnativeUpdateFee *inner;
10037    /**
10038     * Indicates that this is the only struct which contains the same pointer.
10039     * Rust functions which take ownership of an object provided via an argument require
10040     * this to be true and invalidate the object pointed to by inner.
10041     */
10042    bool is_owned;
10043 } LDKUpdateFee;
10044
10045 /**
10046  * The contents of CResult_UpdateFeeDecodeErrorZ
10047  */
10048 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
10049    /**
10050     * A pointer to the contents in the success state.
10051     * Reading from this pointer when `result_ok` is not set is undefined.
10052     */
10053    struct LDKUpdateFee *result;
10054    /**
10055     * A pointer to the contents in the error state.
10056     * Reading from this pointer when `result_ok` is set is undefined.
10057     */
10058    struct LDKDecodeError *err;
10059 } LDKCResult_UpdateFeeDecodeErrorZPtr;
10060
10061 /**
10062  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10063  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10064  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10065  */
10066 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
10067    /**
10068     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10069     * `err` or `result` depending on the state of `result_ok`.
10070     */
10071    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
10072    /**
10073     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10074     */
10075    bool result_ok;
10076 } LDKCResult_UpdateFeeDecodeErrorZ;
10077
10078 /**
10079  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
10080  */
10081 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
10082    /**
10083     * A pointer to the contents in the success state.
10084     * Reading from this pointer when `result_ok` is not set is undefined.
10085     */
10086    struct LDKUpdateFulfillHTLC *result;
10087    /**
10088     * A pointer to the contents in the error state.
10089     * Reading from this pointer when `result_ok` is set is undefined.
10090     */
10091    struct LDKDecodeError *err;
10092 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
10093
10094 /**
10095  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
10096  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10097  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10098  */
10099 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
10100    /**
10101     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
10102     * `err` or `result` depending on the state of `result_ok`.
10103     */
10104    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
10105    /**
10106     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
10107     */
10108    bool result_ok;
10109 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
10110
10111 /**
10112  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
10113  */
10114 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
10115    /**
10116     * A pointer to the contents in the success state.
10117     * Reading from this pointer when `result_ok` is not set is undefined.
10118     */
10119    struct LDKUpdateAddHTLC *result;
10120    /**
10121     * A pointer to the contents in the error state.
10122     * Reading from this pointer when `result_ok` is set is undefined.
10123     */
10124    struct LDKDecodeError *err;
10125 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
10126
10127 /**
10128  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
10129  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10130  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10131  */
10132 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
10133    /**
10134     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
10135     * `err` or `result` depending on the state of `result_ok`.
10136     */
10137    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
10138    /**
10139     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
10140     */
10141    bool result_ok;
10142 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
10143
10144
10145
10146 /**
10147  * A ping message to be sent or received from a peer
10148  */
10149 typedef struct MUST_USE_STRUCT LDKPing {
10150    /**
10151     * A pointer to the opaque Rust object.
10152     * Nearly everywhere, inner must be non-null, however in places where
10153     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10154     */
10155    LDKnativePing *inner;
10156    /**
10157     * Indicates that this is the only struct which contains the same pointer.
10158     * Rust functions which take ownership of an object provided via an argument require
10159     * this to be true and invalidate the object pointed to by inner.
10160     */
10161    bool is_owned;
10162 } LDKPing;
10163
10164 /**
10165  * The contents of CResult_PingDecodeErrorZ
10166  */
10167 typedef union LDKCResult_PingDecodeErrorZPtr {
10168    /**
10169     * A pointer to the contents in the success state.
10170     * Reading from this pointer when `result_ok` is not set is undefined.
10171     */
10172    struct LDKPing *result;
10173    /**
10174     * A pointer to the contents in the error state.
10175     * Reading from this pointer when `result_ok` is set is undefined.
10176     */
10177    struct LDKDecodeError *err;
10178 } LDKCResult_PingDecodeErrorZPtr;
10179
10180 /**
10181  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10182  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10183  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10184  */
10185 typedef struct LDKCResult_PingDecodeErrorZ {
10186    /**
10187     * The contents of this CResult_PingDecodeErrorZ, accessible via either
10188     * `err` or `result` depending on the state of `result_ok`.
10189     */
10190    union LDKCResult_PingDecodeErrorZPtr contents;
10191    /**
10192     * Whether this CResult_PingDecodeErrorZ represents a success state.
10193     */
10194    bool result_ok;
10195 } LDKCResult_PingDecodeErrorZ;
10196
10197
10198
10199 /**
10200  * A pong message to be sent or received from a peer
10201  */
10202 typedef struct MUST_USE_STRUCT LDKPong {
10203    /**
10204     * A pointer to the opaque Rust object.
10205     * Nearly everywhere, inner must be non-null, however in places where
10206     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10207     */
10208    LDKnativePong *inner;
10209    /**
10210     * Indicates that this is the only struct which contains the same pointer.
10211     * Rust functions which take ownership of an object provided via an argument require
10212     * this to be true and invalidate the object pointed to by inner.
10213     */
10214    bool is_owned;
10215 } LDKPong;
10216
10217 /**
10218  * The contents of CResult_PongDecodeErrorZ
10219  */
10220 typedef union LDKCResult_PongDecodeErrorZPtr {
10221    /**
10222     * A pointer to the contents in the success state.
10223     * Reading from this pointer when `result_ok` is not set is undefined.
10224     */
10225    struct LDKPong *result;
10226    /**
10227     * A pointer to the contents in the error state.
10228     * Reading from this pointer when `result_ok` is set is undefined.
10229     */
10230    struct LDKDecodeError *err;
10231 } LDKCResult_PongDecodeErrorZPtr;
10232
10233 /**
10234  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
10235  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
10236  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10237  */
10238 typedef struct LDKCResult_PongDecodeErrorZ {
10239    /**
10240     * The contents of this CResult_PongDecodeErrorZ, accessible via either
10241     * `err` or `result` depending on the state of `result_ok`.
10242     */
10243    union LDKCResult_PongDecodeErrorZPtr contents;
10244    /**
10245     * Whether this CResult_PongDecodeErrorZ represents a success state.
10246     */
10247    bool result_ok;
10248 } LDKCResult_PongDecodeErrorZ;
10249
10250 /**
10251  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
10252  */
10253 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10254    /**
10255     * A pointer to the contents in the success state.
10256     * Reading from this pointer when `result_ok` is not set is undefined.
10257     */
10258    struct LDKUnsignedChannelAnnouncement *result;
10259    /**
10260     * A pointer to the contents in the error state.
10261     * Reading from this pointer when `result_ok` is set is undefined.
10262     */
10263    struct LDKDecodeError *err;
10264 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
10265
10266 /**
10267  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10268  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10269  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10270  */
10271 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
10272    /**
10273     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10274     * `err` or `result` depending on the state of `result_ok`.
10275     */
10276    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
10277    /**
10278     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10279     */
10280    bool result_ok;
10281 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
10282
10283 /**
10284  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
10285  */
10286 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
10287    /**
10288     * A pointer to the contents in the success state.
10289     * Reading from this pointer when `result_ok` is not set is undefined.
10290     */
10291    struct LDKChannelAnnouncement *result;
10292    /**
10293     * A pointer to the contents in the error state.
10294     * Reading from this pointer when `result_ok` is set is undefined.
10295     */
10296    struct LDKDecodeError *err;
10297 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
10298
10299 /**
10300  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10301  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10302  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10303  */
10304 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
10305    /**
10306     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10307     * `err` or `result` depending on the state of `result_ok`.
10308     */
10309    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
10310    /**
10311     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10312     */
10313    bool result_ok;
10314 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
10315
10316
10317
10318 /**
10319  * The unsigned part of a channel_update
10320  */
10321 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
10322    /**
10323     * A pointer to the opaque Rust object.
10324     * Nearly everywhere, inner must be non-null, however in places where
10325     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10326     */
10327    LDKnativeUnsignedChannelUpdate *inner;
10328    /**
10329     * Indicates that this is the only struct which contains the same pointer.
10330     * Rust functions which take ownership of an object provided via an argument require
10331     * this to be true and invalidate the object pointed to by inner.
10332     */
10333    bool is_owned;
10334 } LDKUnsignedChannelUpdate;
10335
10336 /**
10337  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10338  */
10339 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
10340    /**
10341     * A pointer to the contents in the success state.
10342     * Reading from this pointer when `result_ok` is not set is undefined.
10343     */
10344    struct LDKUnsignedChannelUpdate *result;
10345    /**
10346     * A pointer to the contents in the error state.
10347     * Reading from this pointer when `result_ok` is set is undefined.
10348     */
10349    struct LDKDecodeError *err;
10350 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
10351
10352 /**
10353  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10354  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10355  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10356  */
10357 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
10358    /**
10359     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10360     * `err` or `result` depending on the state of `result_ok`.
10361     */
10362    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
10363    /**
10364     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10365     */
10366    bool result_ok;
10367 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
10368
10369 /**
10370  * The contents of CResult_ChannelUpdateDecodeErrorZ
10371  */
10372 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
10373    /**
10374     * A pointer to the contents in the success state.
10375     * Reading from this pointer when `result_ok` is not set is undefined.
10376     */
10377    struct LDKChannelUpdate *result;
10378    /**
10379     * A pointer to the contents in the error state.
10380     * Reading from this pointer when `result_ok` is set is undefined.
10381     */
10382    struct LDKDecodeError *err;
10383 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
10384
10385 /**
10386  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10387  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10388  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10389  */
10390 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
10391    /**
10392     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10393     * `err` or `result` depending on the state of `result_ok`.
10394     */
10395    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
10396    /**
10397     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10398     */
10399    bool result_ok;
10400 } LDKCResult_ChannelUpdateDecodeErrorZ;
10401
10402 /**
10403  * The contents of CResult_ErrorMessageDecodeErrorZ
10404  */
10405 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
10406    /**
10407     * A pointer to the contents in the success state.
10408     * Reading from this pointer when `result_ok` is not set is undefined.
10409     */
10410    struct LDKErrorMessage *result;
10411    /**
10412     * A pointer to the contents in the error state.
10413     * Reading from this pointer when `result_ok` is set is undefined.
10414     */
10415    struct LDKDecodeError *err;
10416 } LDKCResult_ErrorMessageDecodeErrorZPtr;
10417
10418 /**
10419  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10420  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10421  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10422  */
10423 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
10424    /**
10425     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10426     * `err` or `result` depending on the state of `result_ok`.
10427     */
10428    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
10429    /**
10430     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10431     */
10432    bool result_ok;
10433 } LDKCResult_ErrorMessageDecodeErrorZ;
10434
10435 /**
10436  * The contents of CResult_WarningMessageDecodeErrorZ
10437  */
10438 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
10439    /**
10440     * A pointer to the contents in the success state.
10441     * Reading from this pointer when `result_ok` is not set is undefined.
10442     */
10443    struct LDKWarningMessage *result;
10444    /**
10445     * A pointer to the contents in the error state.
10446     * Reading from this pointer when `result_ok` is set is undefined.
10447     */
10448    struct LDKDecodeError *err;
10449 } LDKCResult_WarningMessageDecodeErrorZPtr;
10450
10451 /**
10452  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
10453  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10454  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10455  */
10456 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
10457    /**
10458     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
10459     * `err` or `result` depending on the state of `result_ok`.
10460     */
10461    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
10462    /**
10463     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
10464     */
10465    bool result_ok;
10466 } LDKCResult_WarningMessageDecodeErrorZ;
10467
10468
10469
10470 /**
10471  * The unsigned part of a node_announcement
10472  */
10473 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
10474    /**
10475     * A pointer to the opaque Rust object.
10476     * Nearly everywhere, inner must be non-null, however in places where
10477     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10478     */
10479    LDKnativeUnsignedNodeAnnouncement *inner;
10480    /**
10481     * Indicates that this is the only struct which contains the same pointer.
10482     * Rust functions which take ownership of an object provided via an argument require
10483     * this to be true and invalidate the object pointed to by inner.
10484     */
10485    bool is_owned;
10486 } LDKUnsignedNodeAnnouncement;
10487
10488 /**
10489  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10490  */
10491 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10492    /**
10493     * A pointer to the contents in the success state.
10494     * Reading from this pointer when `result_ok` is not set is undefined.
10495     */
10496    struct LDKUnsignedNodeAnnouncement *result;
10497    /**
10498     * A pointer to the contents in the error state.
10499     * Reading from this pointer when `result_ok` is set is undefined.
10500     */
10501    struct LDKDecodeError *err;
10502 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
10503
10504 /**
10505  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10506  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10507  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10508  */
10509 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
10510    /**
10511     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10512     * `err` or `result` depending on the state of `result_ok`.
10513     */
10514    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
10515    /**
10516     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10517     */
10518    bool result_ok;
10519 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
10520
10521 /**
10522  * The contents of CResult_NodeAnnouncementDecodeErrorZ
10523  */
10524 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
10525    /**
10526     * A pointer to the contents in the success state.
10527     * Reading from this pointer when `result_ok` is not set is undefined.
10528     */
10529    struct LDKNodeAnnouncement *result;
10530    /**
10531     * A pointer to the contents in the error state.
10532     * Reading from this pointer when `result_ok` is set is undefined.
10533     */
10534    struct LDKDecodeError *err;
10535 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
10536
10537 /**
10538  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10539  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10540  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10541  */
10542 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
10543    /**
10544     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10545     * `err` or `result` depending on the state of `result_ok`.
10546     */
10547    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
10548    /**
10549     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10550     */
10551    bool result_ok;
10552 } LDKCResult_NodeAnnouncementDecodeErrorZ;
10553
10554 /**
10555  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10556  */
10557 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
10558    /**
10559     * A pointer to the contents in the success state.
10560     * Reading from this pointer when `result_ok` is not set is undefined.
10561     */
10562    struct LDKQueryShortChannelIds *result;
10563    /**
10564     * A pointer to the contents in the error state.
10565     * Reading from this pointer when `result_ok` is set is undefined.
10566     */
10567    struct LDKDecodeError *err;
10568 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
10569
10570 /**
10571  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10572  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10573  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10574  */
10575 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
10576    /**
10577     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10578     * `err` or `result` depending on the state of `result_ok`.
10579     */
10580    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
10581    /**
10582     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10583     */
10584    bool result_ok;
10585 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
10586
10587
10588
10589 /**
10590  * A reply_short_channel_ids_end message is sent as a reply to a
10591  * query_short_channel_ids message. The query recipient makes a best
10592  * effort to respond based on their local network view which may not be
10593  * a perfect view of the network.
10594  */
10595 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
10596    /**
10597     * A pointer to the opaque Rust object.
10598     * Nearly everywhere, inner must be non-null, however in places where
10599     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10600     */
10601    LDKnativeReplyShortChannelIdsEnd *inner;
10602    /**
10603     * Indicates that this is the only struct which contains the same pointer.
10604     * Rust functions which take ownership of an object provided via an argument require
10605     * this to be true and invalidate the object pointed to by inner.
10606     */
10607    bool is_owned;
10608 } LDKReplyShortChannelIdsEnd;
10609
10610 /**
10611  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10612  */
10613 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10614    /**
10615     * A pointer to the contents in the success state.
10616     * Reading from this pointer when `result_ok` is not set is undefined.
10617     */
10618    struct LDKReplyShortChannelIdsEnd *result;
10619    /**
10620     * A pointer to the contents in the error state.
10621     * Reading from this pointer when `result_ok` is set is undefined.
10622     */
10623    struct LDKDecodeError *err;
10624 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
10625
10626 /**
10627  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10628  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10629  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10630  */
10631 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
10632    /**
10633     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10634     * `err` or `result` depending on the state of `result_ok`.
10635     */
10636    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
10637    /**
10638     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10639     */
10640    bool result_ok;
10641 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
10642
10643 /**
10644  * The contents of CResult_QueryChannelRangeDecodeErrorZ
10645  */
10646 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
10647    /**
10648     * A pointer to the contents in the success state.
10649     * Reading from this pointer when `result_ok` is not set is undefined.
10650     */
10651    struct LDKQueryChannelRange *result;
10652    /**
10653     * A pointer to the contents in the error state.
10654     * Reading from this pointer when `result_ok` is set is undefined.
10655     */
10656    struct LDKDecodeError *err;
10657 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
10658
10659 /**
10660  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10661  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10662  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10663  */
10664 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
10665    /**
10666     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10667     * `err` or `result` depending on the state of `result_ok`.
10668     */
10669    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
10670    /**
10671     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10672     */
10673    bool result_ok;
10674 } LDKCResult_QueryChannelRangeDecodeErrorZ;
10675
10676 /**
10677  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
10678  */
10679 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
10680    /**
10681     * A pointer to the contents in the success state.
10682     * Reading from this pointer when `result_ok` is not set is undefined.
10683     */
10684    struct LDKReplyChannelRange *result;
10685    /**
10686     * A pointer to the contents in the error state.
10687     * Reading from this pointer when `result_ok` is set is undefined.
10688     */
10689    struct LDKDecodeError *err;
10690 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
10691
10692 /**
10693  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10694  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10695  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10696  */
10697 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
10698    /**
10699     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10700     * `err` or `result` depending on the state of `result_ok`.
10701     */
10702    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
10703    /**
10704     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10705     */
10706    bool result_ok;
10707 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
10708
10709 /**
10710  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
10711  */
10712 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
10713    /**
10714     * A pointer to the contents in the success state.
10715     * Reading from this pointer when `result_ok` is not set is undefined.
10716     */
10717    struct LDKGossipTimestampFilter *result;
10718    /**
10719     * A pointer to the contents in the error state.
10720     * Reading from this pointer when `result_ok` is set is undefined.
10721     */
10722    struct LDKDecodeError *err;
10723 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
10724
10725 /**
10726  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10727  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10728  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10729  */
10730 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
10731    /**
10732     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10733     * `err` or `result` depending on the state of `result_ok`.
10734     */
10735    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
10736    /**
10737     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10738     */
10739    bool result_ok;
10740 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
10741
10742 /**
10743  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
10744  * This corresponds to std::vector in C++
10745  */
10746 typedef struct LDKCVec_PhantomRouteHintsZ {
10747    /**
10748     * The elements in the array.
10749     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10750     */
10751    struct LDKPhantomRouteHints *data;
10752    /**
10753     * The number of elements pointed to by `data`.
10754     */
10755    uintptr_t datalen;
10756 } LDKCVec_PhantomRouteHintsZ;
10757
10758 /**
10759  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
10760  * may occur.
10761  */
10762 typedef enum LDKSignOrCreationError_Tag {
10763    /**
10764     * An error occurred during signing
10765     */
10766    LDKSignOrCreationError_SignError,
10767    /**
10768     * An error occurred while building the transaction
10769     */
10770    LDKSignOrCreationError_CreationError,
10771    /**
10772     * Must be last for serialization purposes
10773     */
10774    LDKSignOrCreationError_Sentinel,
10775 } LDKSignOrCreationError_Tag;
10776
10777 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
10778    LDKSignOrCreationError_Tag tag;
10779    union {
10780       struct {
10781          enum LDKCreationError creation_error;
10782       };
10783    };
10784 } LDKSignOrCreationError;
10785
10786 /**
10787  * The contents of CResult_InvoiceSignOrCreationErrorZ
10788  */
10789 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
10790    /**
10791     * A pointer to the contents in the success state.
10792     * Reading from this pointer when `result_ok` is not set is undefined.
10793     */
10794    struct LDKInvoice *result;
10795    /**
10796     * A pointer to the contents in the error state.
10797     * Reading from this pointer when `result_ok` is set is undefined.
10798     */
10799    struct LDKSignOrCreationError *err;
10800 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
10801
10802 /**
10803  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10804  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10805  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10806  */
10807 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
10808    /**
10809     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
10810     * `err` or `result` depending on the state of `result_ok`.
10811     */
10812    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
10813    /**
10814     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
10815     */
10816    bool result_ok;
10817 } LDKCResult_InvoiceSignOrCreationErrorZ;
10818
10819
10820
10821 /**
10822  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
10823  *
10824  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
10825  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
10826  * the return value of [`Filter::register_output`].
10827  *
10828  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
10829  * may have been spent there. See [`Filter::register_output`] for details.
10830  *
10831  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
10832  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
10833  */
10834 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
10835    /**
10836     * A pointer to the opaque Rust object.
10837     * Nearly everywhere, inner must be non-null, however in places where
10838     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10839     */
10840    LDKnativeWatchedOutput *inner;
10841    /**
10842     * Indicates that this is the only struct which contains the same pointer.
10843     * Rust functions which take ownership of an object provided via an argument require
10844     * this to be true and invalidate the object pointed to by inner.
10845     */
10846    bool is_owned;
10847 } LDKWatchedOutput;
10848
10849 /**
10850  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
10851  * channels.
10852  *
10853  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
10854  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
10855  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
10856  * receiving full blocks from a chain source, any further filtering is unnecessary.
10857  *
10858  * After an output has been registered, subsequent block retrievals from the chain source must not
10859  * exclude any transactions matching the new criteria nor any in-block descendants of such
10860  * transactions.
10861  *
10862  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
10863  * should not block on I/O. Implementations should instead queue the newly monitored data to be
10864  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
10865  * invocation that has called the `Filter` must return [`TemporaryFailure`].
10866  *
10867  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
10868  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
10869  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
10870  */
10871 typedef struct LDKFilter {
10872    /**
10873     * An opaque pointer which is passed to your function implementations as an argument.
10874     * This has no meaning in the LDK, and can be NULL or any other value.
10875     */
10876    void *this_arg;
10877    /**
10878     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
10879     * a spending condition.
10880     */
10881    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
10882    /**
10883     * Registers interest in spends of a transaction output.
10884     *
10885     * Optionally, when `output.block_hash` is set, should return any transaction spending the
10886     * output that is found in the corresponding block along with its index.
10887     *
10888     * This return value is useful for Electrum clients in order to supply in-block descendant
10889     * transactions which otherwise were not included. This is not necessary for other clients if
10890     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
10891     * full block).
10892     */
10893    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
10894    /**
10895     * Frees any resources associated with this object given its this_arg pointer.
10896     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10897     */
10898    void (*free)(void *this_arg);
10899 } LDKFilter;
10900
10901 /**
10902  * An enum which can either contain a crate::lightning::chain::Filter or not
10903  */
10904 typedef enum LDKCOption_FilterZ_Tag {
10905    /**
10906     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
10907     */
10908    LDKCOption_FilterZ_Some,
10909    /**
10910     * When we're in this state, this COption_FilterZ contains nothing
10911     */
10912    LDKCOption_FilterZ_None,
10913    /**
10914     * Must be last for serialization purposes
10915     */
10916    LDKCOption_FilterZ_Sentinel,
10917 } LDKCOption_FilterZ_Tag;
10918
10919 typedef struct LDKCOption_FilterZ {
10920    LDKCOption_FilterZ_Tag tag;
10921    union {
10922       struct {
10923          struct LDKFilter some;
10924       };
10925    };
10926 } LDKCOption_FilterZ;
10927
10928
10929
10930 /**
10931  * A read-only reference to a current ChannelMonitor.
10932  *
10933  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
10934  * released.
10935  */
10936 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
10937    /**
10938     * A pointer to the opaque Rust object.
10939     * Nearly everywhere, inner must be non-null, however in places where
10940     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10941     */
10942    LDKnativeLockedChannelMonitor *inner;
10943    /**
10944     * Indicates that this is the only struct which contains the same pointer.
10945     * Rust functions which take ownership of an object provided via an argument require
10946     * this to be true and invalidate the object pointed to by inner.
10947     */
10948    bool is_owned;
10949 } LDKLockedChannelMonitor;
10950
10951 /**
10952  * The contents of CResult_LockedChannelMonitorNoneZ
10953  */
10954 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
10955    /**
10956     * A pointer to the contents in the success state.
10957     * Reading from this pointer when `result_ok` is not set is undefined.
10958     */
10959    struct LDKLockedChannelMonitor *result;
10960    /**
10961     * Note that this value is always NULL, as there are no contents in the Err variant
10962     */
10963    void *err;
10964 } LDKCResult_LockedChannelMonitorNoneZPtr;
10965
10966 /**
10967  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
10968  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
10969  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10970  */
10971 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
10972    /**
10973     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
10974     * `err` or `result` depending on the state of `result_ok`.
10975     */
10976    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
10977    /**
10978     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
10979     */
10980    bool result_ok;
10981 } LDKCResult_LockedChannelMonitorNoneZ;
10982
10983 /**
10984  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
10985  * This corresponds to std::vector in C++
10986  */
10987 typedef struct LDKCVec_OutPointZ {
10988    /**
10989     * The elements in the array.
10990     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10991     */
10992    struct LDKOutPoint *data;
10993    /**
10994     * The number of elements pointed to by `data`.
10995     */
10996    uintptr_t datalen;
10997 } LDKCVec_OutPointZ;
10998
10999 /**
11000  * A trait indicating an object may generate message send events
11001  */
11002 typedef struct LDKMessageSendEventsProvider {
11003    /**
11004     * An opaque pointer which is passed to your function implementations as an argument.
11005     * This has no meaning in the LDK, and can be NULL or any other value.
11006     */
11007    void *this_arg;
11008    /**
11009     * Gets the list of pending events which were generated by previous actions, clearing the list
11010     * in the process.
11011     */
11012    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
11013    /**
11014     * Frees any resources associated with this object given its this_arg pointer.
11015     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11016     */
11017    void (*free)(void *this_arg);
11018 } LDKMessageSendEventsProvider;
11019
11020 /**
11021  * A trait implemented for objects handling events from [`EventsProvider`].
11022  */
11023 typedef struct LDKEventHandler {
11024    /**
11025     * An opaque pointer which is passed to your function implementations as an argument.
11026     * This has no meaning in the LDK, and can be NULL or any other value.
11027     */
11028    void *this_arg;
11029    /**
11030     * Handles the given [`Event`].
11031     *
11032     * See [`EventsProvider`] for details that must be considered when implementing this method.
11033     */
11034    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
11035    /**
11036     * Frees any resources associated with this object given its this_arg pointer.
11037     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11038     */
11039    void (*free)(void *this_arg);
11040 } LDKEventHandler;
11041
11042 /**
11043  * A trait indicating an object may generate events.
11044  *
11045  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
11046  *
11047  * # Requirements
11048  *
11049  * See [`process_pending_events`] for requirements around event processing.
11050  *
11051  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
11052  * event since the last invocation. The handler must either act upon the event immediately
11053  * or preserve it for later handling.
11054  *
11055  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
11056  * consult the provider's documentation on the implication of processing events and how a handler
11057  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
11058  * [`ChainMonitor::process_pending_events`]).
11059  *
11060  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
11061  * own type(s).
11062  *
11063  * [`process_pending_events`]: Self::process_pending_events
11064  * [`handle_event`]: EventHandler::handle_event
11065  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
11066  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
11067  */
11068 typedef struct LDKEventsProvider {
11069    /**
11070     * An opaque pointer which is passed to your function implementations as an argument.
11071     * This has no meaning in the LDK, and can be NULL or any other value.
11072     */
11073    void *this_arg;
11074    /**
11075     * Processes any events generated since the last call using the given event handler.
11076     *
11077     * Subsequent calls must only process new events. However, handlers must be capable of handling
11078     * duplicate events across process restarts. This may occur if the provider was recovered from
11079     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
11080     */
11081    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
11082    /**
11083     * Frees any resources associated with this object given its this_arg pointer.
11084     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11085     */
11086    void (*free)(void *this_arg);
11087 } LDKEventsProvider;
11088
11089
11090
11091 /**
11092  * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's
11093  * variable-length integers except that it is serialized in big-endian instead of little-endian.
11094  *
11095  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
11096  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
11097  * you're looking for an example of a variable-length integer to use for your own project, move
11098  * along, this is a rather poor design.
11099  */
11100 typedef struct MUST_USE_STRUCT LDKBigSize {
11101    /**
11102     * A pointer to the opaque Rust object.
11103     * Nearly everywhere, inner must be non-null, however in places where
11104     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11105     */
11106    LDKnativeBigSize *inner;
11107    /**
11108     * Indicates that this is the only struct which contains the same pointer.
11109     * Rust functions which take ownership of an object provided via an argument require
11110     * this to be true and invalidate the object pointed to by inner.
11111     */
11112    bool is_owned;
11113 } LDKBigSize;
11114
11115 /**
11116  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk.
11117  */
11118 typedef struct LDKPersister {
11119    /**
11120     * An opaque pointer which is passed to your function implementations as an argument.
11121     * This has no meaning in the LDK, and can be NULL or any other value.
11122     */
11123    void *this_arg;
11124    /**
11125     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
11126     */
11127    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
11128    /**
11129     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
11130     */
11131    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
11132    /**
11133     * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed.
11134     */
11135    struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer);
11136    /**
11137     * Frees any resources associated with this object given its this_arg pointer.
11138     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11139     */
11140    void (*free)(void *this_arg);
11141 } LDKPersister;
11142
11143
11144
11145 /**
11146  * Configuration we set when applicable.
11147  *
11148  * Default::default() provides sane defaults.
11149  */
11150 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
11151    /**
11152     * A pointer to the opaque Rust object.
11153     * Nearly everywhere, inner must be non-null, however in places where
11154     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11155     */
11156    LDKnativeChannelHandshakeConfig *inner;
11157    /**
11158     * Indicates that this is the only struct which contains the same pointer.
11159     * Rust functions which take ownership of an object provided via an argument require
11160     * this to be true and invalidate the object pointed to by inner.
11161     */
11162    bool is_owned;
11163 } LDKChannelHandshakeConfig;
11164
11165
11166
11167 /**
11168  * Optional channel limits which are applied during channel creation.
11169  *
11170  * These limits are only applied to our counterparty's limits, not our own.
11171  *
11172  * Use 0/<type>::max_value() as appropriate to skip checking.
11173  *
11174  * Provides sane defaults for most configurations.
11175  *
11176  * Most additional limits are disabled except those with which specify a default in individual
11177  * field documentation. Note that this may result in barely-usable channels, but since they
11178  * are applied mostly only to incoming channels that's not much of a problem.
11179  */
11180 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
11181    /**
11182     * A pointer to the opaque Rust object.
11183     * Nearly everywhere, inner must be non-null, however in places where
11184     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11185     */
11186    LDKnativeChannelHandshakeLimits *inner;
11187    /**
11188     * Indicates that this is the only struct which contains the same pointer.
11189     * Rust functions which take ownership of an object provided via an argument require
11190     * this to be true and invalidate the object pointed to by inner.
11191     */
11192    bool is_owned;
11193 } LDKChannelHandshakeLimits;
11194
11195
11196
11197 /**
11198  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
11199  *
11200  * Default::default() provides sane defaults for most configurations
11201  * (but currently with 0 relay fees!)
11202  */
11203 typedef struct MUST_USE_STRUCT LDKUserConfig {
11204    /**
11205     * A pointer to the opaque Rust object.
11206     * Nearly everywhere, inner must be non-null, however in places where
11207     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11208     */
11209    LDKnativeUserConfig *inner;
11210    /**
11211     * Indicates that this is the only struct which contains the same pointer.
11212     * Rust functions which take ownership of an object provided via an argument require
11213     * this to be true and invalidate the object pointed to by inner.
11214     */
11215    bool is_owned;
11216 } LDKUserConfig;
11217
11218
11219
11220 /**
11221  * The best known block as identified by its hash and height.
11222  */
11223 typedef struct MUST_USE_STRUCT LDKBestBlock {
11224    /**
11225     * A pointer to the opaque Rust object.
11226     * Nearly everywhere, inner must be non-null, however in places where
11227     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11228     */
11229    LDKnativeBestBlock *inner;
11230    /**
11231     * Indicates that this is the only struct which contains the same pointer.
11232     * Rust functions which take ownership of an object provided via an argument require
11233     * this to be true and invalidate the object pointed to by inner.
11234     */
11235    bool is_owned;
11236 } LDKBestBlock;
11237
11238 /**
11239  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
11240  * chain.
11241  *
11242  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
11243  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
11244  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
11245  * when needed.
11246  *
11247  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
11248  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
11249  * other similar filtering.
11250  */
11251 typedef struct LDKListen {
11252    /**
11253     * An opaque pointer which is passed to your function implementations as an argument.
11254     * This has no meaning in the LDK, and can be NULL or any other value.
11255     */
11256    void *this_arg;
11257    /**
11258     * Notifies the listener that a block was added at the given height, with the transaction data
11259     * possibly filtered.
11260     */
11261    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
11262    /**
11263     * Notifies the listener that a block was added at the given height.
11264     */
11265    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
11266    /**
11267     * Notifies the listener that a block was removed at the given height.
11268     */
11269    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
11270    /**
11271     * Frees any resources associated with this object given its this_arg pointer.
11272     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11273     */
11274    void (*free)(void *this_arg);
11275 } LDKListen;
11276
11277 /**
11278  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
11279  * unconfirmed during a chain reorganization.
11280  *
11281  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
11282  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
11283  * related to registered transactions and outputs. Upon notification, it would pass along the
11284  * matching transactions using this interface.
11285  *
11286  * # Use
11287  *
11288  * The intended use is as follows:
11289  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
11290  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
11291  *   that has been reorganized out of the chain.
11292  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
11293  *
11294  * # Order
11295  *
11296  * Clients must call these methods in chain order. Specifically:
11297  * - Transactions confirmed in a block must be given before transactions confirmed in a later
11298  *   block.
11299  * - Dependent transactions within the same block must be given in topological order, possibly in
11300  *   separate calls.
11301  * - Unconfirmed transactions must be given after the original confirmations and before any
11302  *   reconfirmation.
11303  *
11304  * See individual method documentation for further details.
11305  *
11306  * [`transactions_confirmed`]: Self::transactions_confirmed
11307  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11308  * [`best_block_updated`]: Self::best_block_updated
11309  * [`get_relevant_txids`]: Self::get_relevant_txids
11310  */
11311 typedef struct LDKConfirm {
11312    /**
11313     * An opaque pointer which is passed to your function implementations as an argument.
11314     * This has no meaning in the LDK, and can be NULL or any other value.
11315     */
11316    void *this_arg;
11317    /**
11318     * Processes transactions confirmed in a block with a given header and height.
11319     *
11320     * Should be called for any transactions registered by [`Filter::register_tx`] or any
11321     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
11322     * appearing in the same block do not need to be included in the same call; instead, multiple
11323     * calls with additional transactions may be made so long as they are made in [chain order].
11324     *
11325     * May be called before or after [`best_block_updated`] for the corresponding block. However,
11326     * in the event of a chain reorganization, it must not be called with a `header` that is no
11327     * longer in the chain as of the last call to [`best_block_updated`].
11328     *
11329     * [chain order]: Confirm#Order
11330     * [`best_block_updated`]: Self::best_block_updated
11331     */
11332    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
11333    /**
11334     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
11335     *
11336     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
11337     * reorganized out of the best chain. Once called, the given transaction should not be returned
11338     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
11339     *
11340     * [`get_relevant_txids`]: Self::get_relevant_txids
11341     * [`transactions_confirmed`]: Self::transactions_confirmed
11342     */
11343    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
11344    /**
11345     * Processes an update to the best header connected at the given height.
11346     *
11347     * Should be called when a new header is available but may be skipped for intermediary blocks
11348     * if they become available at the same time.
11349     */
11350    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
11351    /**
11352     * Returns transactions that should be monitored for reorganization out of the chain.
11353     *
11354     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
11355     * confirmations to be safe from a chain reorganization. Should not include any transactions
11356     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
11357     *
11358     * May be called to determine the subset of transactions that must still be monitored for
11359     * reorganization. Will be idempotent between calls but may change as a result of calls to the
11360     * other interface methods. Thus, this is useful to determine which transactions may need to be
11361     * given to [`transaction_unconfirmed`].
11362     *
11363     * [`transactions_confirmed`]: Self::transactions_confirmed
11364     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11365     */
11366    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
11367    /**
11368     * Frees any resources associated with this object given its this_arg pointer.
11369     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11370     */
11371    void (*free)(void *this_arg);
11372 } LDKConfirm;
11373
11374
11375
11376 /**
11377  * An opaque identifier describing a specific [`Persist`] method call.
11378  */
11379 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
11380    /**
11381     * A pointer to the opaque Rust object.
11382     * Nearly everywhere, inner must be non-null, however in places where
11383     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11384     */
11385    LDKnativeMonitorUpdateId *inner;
11386    /**
11387     * Indicates that this is the only struct which contains the same pointer.
11388     * Rust functions which take ownership of an object provided via an argument require
11389     * this to be true and invalidate the object pointed to by inner.
11390     */
11391    bool is_owned;
11392 } LDKMonitorUpdateId;
11393
11394 /**
11395  * `Persist` defines behavior for persisting channel monitors: this could mean
11396  * writing once to disk, and/or uploading to one or more backup services.
11397  *
11398  * Each method can return three possible values:
11399  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
11400  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
11401  *  * If persistence happens asynchronously, implementations should first ensure the
11402  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
11403  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
11404  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
11405  *    called with the corresponding [`MonitorUpdateId`].
11406  *
11407  *    Note that unlike the direct [`chain::Watch`] interface,
11408  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
11409  *
11410  *  * If persistence fails for some reason, implementations should return
11411  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
11412  *    closed without broadcasting the latest state. See
11413  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
11414  */
11415 typedef struct LDKPersist {
11416    /**
11417     * An opaque pointer which is passed to your function implementations as an argument.
11418     * This has no meaning in the LDK, and can be NULL or any other value.
11419     */
11420    void *this_arg;
11421    /**
11422     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
11423     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
11424     *
11425     * The data can be stored any way you want, but the identifier provided by LDK is the
11426     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
11427     * and the stored channel data). Note that you **must** persist every new monitor to disk.
11428     *
11429     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11430     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11431     *
11432     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
11433     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11434     *
11435     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11436     * [`Writeable::write`]: crate::util::ser::Writeable::write
11437     */
11438    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
11439    /**
11440     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
11441     * update.
11442     *
11443     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
11444     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
11445     * details.
11446     *
11447     * During blockchain synchronization operations, this may be called with no
11448     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
11449     * Note that after the full [`ChannelMonitor`] is persisted any previous
11450     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
11451     * applied to the persisted [`ChannelMonitor`] as they were already applied.
11452     *
11453     * If an implementer chooses to persist the updates only, they need to make
11454     * sure that all the updates are applied to the `ChannelMonitors` *before*
11455     * the set of channel monitors is given to the `ChannelManager`
11456     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
11457     * applying a monitor update to a monitor. If full `ChannelMonitors` are
11458     * persisted, then there is no need to persist individual updates.
11459     *
11460     * Note that there could be a performance tradeoff between persisting complete
11461     * channel monitors on every update vs. persisting only updates and applying
11462     * them in batches. The size of each monitor grows `O(number of state updates)`
11463     * whereas updates are small and `O(1)`.
11464     *
11465     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11466     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11467     *
11468     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
11469     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
11470     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11471     *
11472     * [`Writeable::write`]: crate::util::ser::Writeable::write
11473     *
11474     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
11475     */
11476    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);
11477    /**
11478     * Frees any resources associated with this object given its this_arg pointer.
11479     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11480     */
11481    void (*free)(void *this_arg);
11482 } LDKPersist;
11483
11484
11485
11486 /**
11487  * An implementation of [`chain::Watch`] for monitoring channels.
11488  *
11489  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
11490  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
11491  * or used independently to monitor channels remotely. See the [module-level documentation] for
11492  * details.
11493  *
11494  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11495  * [module-level documentation]: crate::chain::chainmonitor
11496  */
11497 typedef struct MUST_USE_STRUCT LDKChainMonitor {
11498    /**
11499     * A pointer to the opaque Rust object.
11500     * Nearly everywhere, inner must be non-null, however in places where
11501     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11502     */
11503    LDKnativeChainMonitor *inner;
11504    /**
11505     * Indicates that this is the only struct which contains the same pointer.
11506     * Rust functions which take ownership of an object provided via an argument require
11507     * this to be true and invalidate the object pointed to by inner.
11508     */
11509    bool is_owned;
11510 } LDKChainMonitor;
11511
11512
11513
11514 /**
11515  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
11516  * and derives keys from that.
11517  *
11518  * Your node_id is seed/0'
11519  * ChannelMonitor closes may use seed/1'
11520  * Cooperative closes may use seed/2'
11521  * The two close keys may be needed to claim on-chain funds!
11522  *
11523  * This struct cannot be used for nodes that wish to support receiving phantom payments;
11524  * [`PhantomKeysManager`] must be used instead.
11525  *
11526  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
11527  * previously issued invoices and attempts to pay previous invoices will fail.
11528  */
11529 typedef struct MUST_USE_STRUCT LDKKeysManager {
11530    /**
11531     * A pointer to the opaque Rust object.
11532     * Nearly everywhere, inner must be non-null, however in places where
11533     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11534     */
11535    LDKnativeKeysManager *inner;
11536    /**
11537     * Indicates that this is the only struct which contains the same pointer.
11538     * Rust functions which take ownership of an object provided via an argument require
11539     * this to be true and invalidate the object pointed to by inner.
11540     */
11541    bool is_owned;
11542 } LDKKeysManager;
11543
11544
11545
11546 /**
11547  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
11548  * payments.
11549  *
11550  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
11551  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
11552  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
11553  * itself without ever needing to forward to this fake node.
11554  *
11555  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
11556  * provide some fault tolerance, because payers will automatically retry paying other provided
11557  * nodes in the case that one node goes down.
11558  *
11559  * Note that multi-path payments are not supported in phantom invoices for security reasons.
11560  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
11561  * invoices and attempts to pay previous invoices will fail.
11562  */
11563 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
11564    /**
11565     * A pointer to the opaque Rust object.
11566     * Nearly everywhere, inner must be non-null, however in places where
11567     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11568     */
11569    LDKnativePhantomKeysManager *inner;
11570    /**
11571     * Indicates that this is the only struct which contains the same pointer.
11572     * Rust functions which take ownership of an object provided via an argument require
11573     * this to be true and invalidate the object pointed to by inner.
11574     */
11575    bool is_owned;
11576 } LDKPhantomKeysManager;
11577
11578
11579
11580 /**
11581  * Chain-related parameters used to construct a new `ChannelManager`.
11582  *
11583  * Typically, the block-specific parameters are derived from the best block hash for the network,
11584  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
11585  * are not needed when deserializing a previously constructed `ChannelManager`.
11586  */
11587 typedef struct MUST_USE_STRUCT LDKChainParameters {
11588    /**
11589     * A pointer to the opaque Rust object.
11590     * Nearly everywhere, inner must be non-null, however in places where
11591     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11592     */
11593    LDKnativeChainParameters *inner;
11594    /**
11595     * Indicates that this is the only struct which contains the same pointer.
11596     * Rust functions which take ownership of an object provided via an argument require
11597     * this to be true and invalidate the object pointed to by inner.
11598     */
11599    bool is_owned;
11600 } LDKChainParameters;
11601
11602 /**
11603  * A 3-byte byte array.
11604  */
11605 typedef struct LDKThreeBytes {
11606    /**
11607     * The three bytes
11608     */
11609    uint8_t data[3];
11610 } LDKThreeBytes;
11611
11612 /**
11613  * A trait to describe an object which can receive channel messages.
11614  *
11615  * Messages MAY be called in parallel when they originate from different their_node_ids, however
11616  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
11617  */
11618 typedef struct LDKChannelMessageHandler {
11619    /**
11620     * An opaque pointer which is passed to your function implementations as an argument.
11621     * This has no meaning in the LDK, and can be NULL or any other value.
11622     */
11623    void *this_arg;
11624    /**
11625     * Handle an incoming open_channel message from the given peer.
11626     */
11627    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
11628    /**
11629     * Handle an incoming accept_channel message from the given peer.
11630     */
11631    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
11632    /**
11633     * Handle an incoming funding_created message from the given peer.
11634     */
11635    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
11636    /**
11637     * Handle an incoming funding_signed message from the given peer.
11638     */
11639    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
11640    /**
11641     * Handle an incoming channel_ready message from the given peer.
11642     */
11643    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
11644    /**
11645     * Handle an incoming shutdown message from the given peer.
11646     */
11647    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);
11648    /**
11649     * Handle an incoming closing_signed message from the given peer.
11650     */
11651    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
11652    /**
11653     * Handle an incoming update_add_htlc message from the given peer.
11654     */
11655    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
11656    /**
11657     * Handle an incoming update_fulfill_htlc message from the given peer.
11658     */
11659    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
11660    /**
11661     * Handle an incoming update_fail_htlc message from the given peer.
11662     */
11663    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
11664    /**
11665     * Handle an incoming update_fail_malformed_htlc message from the given peer.
11666     */
11667    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
11668    /**
11669     * Handle an incoming commitment_signed message from the given peer.
11670     */
11671    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
11672    /**
11673     * Handle an incoming revoke_and_ack message from the given peer.
11674     */
11675    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
11676    /**
11677     * Handle an incoming update_fee message from the given peer.
11678     */
11679    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
11680    /**
11681     * Handle an incoming announcement_signatures message from the given peer.
11682     */
11683    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
11684    /**
11685     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
11686     * is believed to be possible in the future (eg they're sending us messages we don't
11687     * understand or indicate they require unknown feature bits), no_connection_possible is set
11688     * and any outstanding channels should be failed.
11689     */
11690    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
11691    /**
11692     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
11693     */
11694    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
11695    /**
11696     * Handle an incoming channel_reestablish message from the given peer.
11697     */
11698    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
11699    /**
11700     * Handle an incoming channel update from the given peer.
11701     */
11702    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
11703    /**
11704     * Handle an incoming error message from the given peer.
11705     */
11706    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
11707    /**
11708     * Implementation of MessageSendEventsProvider for this object.
11709     */
11710    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11711    /**
11712     * Frees any resources associated with this object given its this_arg pointer.
11713     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11714     */
11715    void (*free)(void *this_arg);
11716 } LDKChannelMessageHandler;
11717
11718
11719
11720 /**
11721  * Arguments for the creation of a ChannelManager that are not deserialized.
11722  *
11723  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
11724  * is:
11725  * 1) Deserialize all stored [`ChannelMonitor`]s.
11726  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
11727  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
11728  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
11729  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
11730  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
11731  *    same way you would handle a [`chain::Filter`] call using
11732  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
11733  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
11734  * 5) Disconnect/connect blocks on the [`ChannelManager`].
11735  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
11736  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
11737  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
11738  *    the next step.
11739  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
11740  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
11741  *
11742  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
11743  * call any other methods on the newly-deserialized [`ChannelManager`].
11744  *
11745  * Note that because some channels may be closed during deserialization, it is critical that you
11746  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
11747  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
11748  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
11749  * not force-close the same channels but consider them live), you may end up revoking a state for
11750  * which you've already broadcasted the transaction.
11751  *
11752  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
11753  */
11754 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
11755    /**
11756     * A pointer to the opaque Rust object.
11757     * Nearly everywhere, inner must be non-null, however in places where
11758     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11759     */
11760    LDKnativeChannelManagerReadArgs *inner;
11761    /**
11762     * Indicates that this is the only struct which contains the same pointer.
11763     * Rust functions which take ownership of an object provided via an argument require
11764     * this to be true and invalidate the object pointed to by inner.
11765     */
11766    bool is_owned;
11767 } LDKChannelManagerReadArgs;
11768
11769
11770
11771 /**
11772  * A set of keys that were HKDF-expanded from an initial call to
11773  * [`KeysInterface::get_inbound_payment_key_material`].
11774  *
11775  * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material
11776  */
11777 typedef struct MUST_USE_STRUCT LDKExpandedKey {
11778    /**
11779     * A pointer to the opaque Rust object.
11780     * Nearly everywhere, inner must be non-null, however in places where
11781     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11782     */
11783    LDKnativeExpandedKey *inner;
11784    /**
11785     * Indicates that this is the only struct which contains the same pointer.
11786     * Rust functions which take ownership of an object provided via an argument require
11787     * this to be true and invalidate the object pointed to by inner.
11788     */
11789    bool is_owned;
11790 } LDKExpandedKey;
11791
11792
11793
11794 /**
11795  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
11796  * This is used to convince the recipient that the channel is at a certain commitment
11797  * number even if they lost that data due to a local failure.  Of course, the peer may lie
11798  * and even later commitments may have been revoked.
11799  */
11800 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
11801    /**
11802     * A pointer to the opaque Rust object.
11803     * Nearly everywhere, inner must be non-null, however in places where
11804     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11805     */
11806    LDKnativeDataLossProtect *inner;
11807    /**
11808     * Indicates that this is the only struct which contains the same pointer.
11809     * Rust functions which take ownership of an object provided via an argument require
11810     * this to be true and invalidate the object pointed to by inner.
11811     */
11812    bool is_owned;
11813 } LDKDataLossProtect;
11814
11815 /**
11816  * A trait to describe an object which can receive routing messages.
11817  *
11818  * # Implementor DoS Warnings
11819  *
11820  * For `gossip_queries` messages there are potential DoS vectors when handling
11821  * inbound queries. Implementors using an on-disk network graph should be aware of
11822  * repeated disk I/O for queries accessing different parts of the network graph.
11823  */
11824 typedef struct LDKRoutingMessageHandler {
11825    /**
11826     * An opaque pointer which is passed to your function implementations as an argument.
11827     * This has no meaning in the LDK, and can be NULL or any other value.
11828     */
11829    void *this_arg;
11830    /**
11831     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
11832     * false or returning an Err otherwise.
11833     */
11834    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
11835    /**
11836     * Handle a channel_announcement message, returning true if it should be forwarded on, false
11837     * or returning an Err otherwise.
11838     */
11839    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
11840    /**
11841     * Handle an incoming channel_update message, returning true if it should be forwarded on,
11842     * false or returning an Err otherwise.
11843     */
11844    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
11845    /**
11846     * Gets a subset of the channel announcements and updates required to dump our routing table
11847     * to a remote node, starting at the short_channel_id indicated by starting_point and
11848     * including the batch_amount entries immediately higher in numerical value than starting_point.
11849     */
11850    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
11851    /**
11852     * Gets a subset of the node announcements required to dump our routing table to a remote node,
11853     * starting at the node *after* the provided publickey and including batch_amount entries
11854     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
11855     * If None is provided for starting_point, we start at the first node.
11856     *
11857     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
11858     */
11859    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
11860    /**
11861     * Called when a connection is established with a peer. This can be used to
11862     * perform routing table synchronization using a strategy defined by the
11863     * implementor.
11864     */
11865    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
11866    /**
11867     * Handles the reply of a query we initiated to learn about channels
11868     * for a given range of blocks. We can expect to receive one or more
11869     * replies to a single query.
11870     */
11871    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
11872    /**
11873     * Handles the reply of a query we initiated asking for routing gossip
11874     * messages for a list of channels. We should receive this message when
11875     * a node has completed its best effort to send us the pertaining routing
11876     * gossip messages.
11877     */
11878    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
11879    /**
11880     * Handles when a peer asks us to send a list of short_channel_ids
11881     * for the requested range of blocks.
11882     */
11883    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
11884    /**
11885     * Handles when a peer asks us to send routing gossip messages for a
11886     * list of short_channel_ids.
11887     */
11888    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
11889    /**
11890     * Implementation of MessageSendEventsProvider for this object.
11891     */
11892    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11893    /**
11894     * Frees any resources associated with this object given its this_arg pointer.
11895     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11896     */
11897    void (*free)(void *this_arg);
11898 } LDKRoutingMessageHandler;
11899
11900 /**
11901  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
11902  * decoders.
11903  */
11904 typedef struct LDKCustomMessageReader {
11905    /**
11906     * An opaque pointer which is passed to your function implementations as an argument.
11907     * This has no meaning in the LDK, and can be NULL or any other value.
11908     */
11909    void *this_arg;
11910    /**
11911     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
11912     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
11913     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
11914     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
11915     */
11916    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
11917    /**
11918     * Frees any resources associated with this object given its this_arg pointer.
11919     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11920     */
11921    void (*free)(void *this_arg);
11922 } LDKCustomMessageReader;
11923
11924 /**
11925  * Handler for BOLT1-compliant messages.
11926  */
11927 typedef struct LDKCustomMessageHandler {
11928    /**
11929     * An opaque pointer which is passed to your function implementations as an argument.
11930     * This has no meaning in the LDK, and can be NULL or any other value.
11931     */
11932    void *this_arg;
11933    /**
11934     * Called with the message type that was received and the buffer to be read.
11935     * Can return a `MessageHandlingError` if the message could not be handled.
11936     */
11937    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
11938    /**
11939     * Gets the list of pending messages which were generated by the custom message
11940     * handler, clearing the list in the process. The first tuple element must
11941     * correspond to the intended recipients node ids. If no connection to one of the
11942     * specified node does not exist, the message is simply not sent to it.
11943     */
11944    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
11945    /**
11946     * Implementation of CustomMessageReader for this object.
11947     */
11948    struct LDKCustomMessageReader CustomMessageReader;
11949    /**
11950     * Frees any resources associated with this object given its this_arg pointer.
11951     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11952     */
11953    void (*free)(void *this_arg);
11954 } LDKCustomMessageHandler;
11955
11956
11957
11958 /**
11959  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
11960  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
11961  */
11962 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
11963    /**
11964     * A pointer to the opaque Rust object.
11965     * Nearly everywhere, inner must be non-null, however in places where
11966     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11967     */
11968    LDKnativeIgnoringMessageHandler *inner;
11969    /**
11970     * Indicates that this is the only struct which contains the same pointer.
11971     * Rust functions which take ownership of an object provided via an argument require
11972     * this to be true and invalidate the object pointed to by inner.
11973     */
11974    bool is_owned;
11975 } LDKIgnoringMessageHandler;
11976
11977
11978
11979 /**
11980  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
11981  * You can provide one of these as the route_handler in a MessageHandler.
11982  */
11983 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
11984    /**
11985     * A pointer to the opaque Rust object.
11986     * Nearly everywhere, inner must be non-null, however in places where
11987     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11988     */
11989    LDKnativeErroringMessageHandler *inner;
11990    /**
11991     * Indicates that this is the only struct which contains the same pointer.
11992     * Rust functions which take ownership of an object provided via an argument require
11993     * this to be true and invalidate the object pointed to by inner.
11994     */
11995    bool is_owned;
11996 } LDKErroringMessageHandler;
11997
11998
11999
12000 /**
12001  * Provides references to trait impls which handle different types of messages.
12002  */
12003 typedef struct MUST_USE_STRUCT LDKMessageHandler {
12004    /**
12005     * A pointer to the opaque Rust object.
12006     * Nearly everywhere, inner must be non-null, however in places where
12007     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12008     */
12009    LDKnativeMessageHandler *inner;
12010    /**
12011     * Indicates that this is the only struct which contains the same pointer.
12012     * Rust functions which take ownership of an object provided via an argument require
12013     * this to be true and invalidate the object pointed to by inner.
12014     */
12015    bool is_owned;
12016 } LDKMessageHandler;
12017
12018 /**
12019  * Provides an object which can be used to send data to and which uniquely identifies a connection
12020  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
12021  * implement Hash to meet the PeerManager API.
12022  *
12023  * For efficiency, Clone should be relatively cheap for this type.
12024  *
12025  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
12026  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
12027  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
12028  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
12029  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
12030  * to simply use another value which is guaranteed to be globally unique instead.
12031  */
12032 typedef struct LDKSocketDescriptor {
12033    /**
12034     * An opaque pointer which is passed to your function implementations as an argument.
12035     * This has no meaning in the LDK, and can be NULL or any other value.
12036     */
12037    void *this_arg;
12038    /**
12039     * Attempts to send some data from the given slice to the peer.
12040     *
12041     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
12042     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
12043     * called and further write attempts may occur until that time.
12044     *
12045     * If the returned size is smaller than `data.len()`, a
12046     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
12047     * written. Additionally, until a `send_data` event completes fully, no further
12048     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
12049     * prevent denial-of-service issues, you should not read or buffer any data from the socket
12050     * until then.
12051     *
12052     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
12053     * (indicating that read events should be paused to prevent DoS in the send buffer),
12054     * `resume_read` may be set indicating that read events on this descriptor should resume. A
12055     * `resume_read` of false carries no meaning, and should not cause any action.
12056     */
12057    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
12058    /**
12059     * Disconnect the socket pointed to by this SocketDescriptor.
12060     *
12061     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
12062     * call (doing so is a noop).
12063     */
12064    void (*disconnect_socket)(void *this_arg);
12065    /**
12066     * Checks if two objects are equal given this object's this_arg pointer and another object.
12067     */
12068    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
12069    /**
12070     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
12071     * This is used, for example, for inclusion of this object in a hash map.
12072     */
12073    uint64_t (*hash)(const void *this_arg);
12074    /**
12075     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
12076     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
12077     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
12078     */
12079    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
12080    /**
12081     * Frees any resources associated with this object given its this_arg pointer.
12082     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12083     */
12084    void (*free)(void *this_arg);
12085 } LDKSocketDescriptor;
12086
12087
12088
12089 /**
12090  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
12091  * socket events into messages which it passes on to its [`MessageHandler`].
12092  *
12093  * Locks are taken internally, so you must never assume that reentrancy from a
12094  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
12095  *
12096  * Calls to [`read_event`] will decode relevant messages and pass them to the
12097  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
12098  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
12099  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
12100  * calls only after previous ones have returned.
12101  *
12102  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
12103  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
12104  * essentially you should default to using a SimpleRefPeerManager, and use a
12105  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
12106  * you're using lightning-net-tokio.
12107  *
12108  * [`read_event`]: PeerManager::read_event
12109  */
12110 typedef struct MUST_USE_STRUCT LDKPeerManager {
12111    /**
12112     * A pointer to the opaque Rust object.
12113     * Nearly everywhere, inner must be non-null, however in places where
12114     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12115     */
12116    LDKnativePeerManager *inner;
12117    /**
12118     * Indicates that this is the only struct which contains the same pointer.
12119     * Rust functions which take ownership of an object provided via an argument require
12120     * this to be true and invalidate the object pointed to by inner.
12121     */
12122    bool is_owned;
12123 } LDKPeerManager;
12124
12125
12126
12127 /**
12128  * Static channel fields used to build transactions given per-commitment fields, organized by
12129  * broadcaster/countersignatory.
12130  *
12131  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
12132  * as_holder_broadcastable and as_counterparty_broadcastable functions.
12133  */
12134 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
12135    /**
12136     * A pointer to the opaque Rust object.
12137     * Nearly everywhere, inner must be non-null, however in places where
12138     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12139     */
12140    LDKnativeDirectedChannelTransactionParameters *inner;
12141    /**
12142     * Indicates that this is the only struct which contains the same pointer.
12143     * Rust functions which take ownership of an object provided via an argument require
12144     * this to be true and invalidate the object pointed to by inner.
12145     */
12146    bool is_owned;
12147 } LDKDirectedChannelTransactionParameters;
12148
12149 /**
12150  * Integer in the range `0..=16`
12151  */
12152 typedef struct LDKWitnessVersion {
12153    uint8_t _0;
12154 } LDKWitnessVersion;
12155
12156
12157
12158 /**
12159  * A read-only view of [`NetworkGraph`].
12160  */
12161 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
12162    /**
12163     * A pointer to the opaque Rust object.
12164     * Nearly everywhere, inner must be non-null, however in places where
12165     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12166     */
12167    LDKnativeReadOnlyNetworkGraph *inner;
12168    /**
12169     * Indicates that this is the only struct which contains the same pointer.
12170     * Rust functions which take ownership of an object provided via an argument require
12171     * this to be true and invalidate the object pointed to by inner.
12172     */
12173    bool is_owned;
12174 } LDKReadOnlyNetworkGraph;
12175
12176
12177
12178 /**
12179  * Receives and validates network updates from peers,
12180  * stores authentic and relevant data as a network graph.
12181  * This network graph is then used for routing payments.
12182  * Provides interface to help with initial routing sync by
12183  * serving historical announcements.
12184  *
12185  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
12186  * [`NetworkGraph`].
12187  */
12188 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
12189    /**
12190     * A pointer to the opaque Rust object.
12191     * Nearly everywhere, inner must be non-null, however in places where
12192     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12193     */
12194    LDKnativeP2PGossipSync *inner;
12195    /**
12196     * Indicates that this is the only struct which contains the same pointer.
12197     * Rust functions which take ownership of an object provided via an argument require
12198     * this to be true and invalidate the object pointed to by inner.
12199     */
12200    bool is_owned;
12201 } LDKP2PGossipSync;
12202
12203
12204
12205 /**
12206  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
12207  * source node to a target node.
12208  */
12209 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
12210    /**
12211     * A pointer to the opaque Rust object.
12212     * Nearly everywhere, inner must be non-null, however in places where
12213     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12214     */
12215    LDKnativeDirectedChannelInfo *inner;
12216    /**
12217     * Indicates that this is the only struct which contains the same pointer.
12218     * Rust functions which take ownership of an object provided via an argument require
12219     * this to be true and invalidate the object pointed to by inner.
12220     */
12221    bool is_owned;
12222 } LDKDirectedChannelInfo;
12223
12224 /**
12225  * The effective capacity of a channel for routing purposes.
12226  *
12227  * While this may be smaller than the actual channel capacity, amounts greater than
12228  * [`Self::as_msat`] should not be routed through the channel.
12229  */
12230 typedef enum LDKEffectiveCapacity_Tag {
12231    /**
12232     * The available liquidity in the channel known from being a channel counterparty, and thus a
12233     * direct hop.
12234     */
12235    LDKEffectiveCapacity_ExactLiquidity,
12236    /**
12237     * The maximum HTLC amount in one direction as advertised on the gossip network.
12238     */
12239    LDKEffectiveCapacity_MaximumHTLC,
12240    /**
12241     * The total capacity of the channel as determined by the funding transaction.
12242     */
12243    LDKEffectiveCapacity_Total,
12244    /**
12245     * A capacity sufficient to route any payment, typically used for private channels provided by
12246     * an invoice.
12247     */
12248    LDKEffectiveCapacity_Infinite,
12249    /**
12250     * A capacity that is unknown possibly because either the chain state is unavailable to know
12251     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
12252     */
12253    LDKEffectiveCapacity_Unknown,
12254    /**
12255     * Must be last for serialization purposes
12256     */
12257    LDKEffectiveCapacity_Sentinel,
12258 } LDKEffectiveCapacity_Tag;
12259
12260 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
12261    /**
12262     * Either the inbound or outbound liquidity depending on the direction, denominated in
12263     * millisatoshi.
12264     */
12265    uint64_t liquidity_msat;
12266 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
12267
12268 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
12269    /**
12270     * The maximum HTLC amount denominated in millisatoshi.
12271     */
12272    uint64_t amount_msat;
12273 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
12274
12275 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
12276    /**
12277     * The funding amount denominated in millisatoshi.
12278     */
12279    uint64_t capacity_msat;
12280 } LDKEffectiveCapacity_LDKTotal_Body;
12281
12282 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
12283    LDKEffectiveCapacity_Tag tag;
12284    union {
12285       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
12286       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
12287       LDKEffectiveCapacity_LDKTotal_Body total;
12288    };
12289 } LDKEffectiveCapacity;
12290
12291
12292
12293 /**
12294  * A concrete implementation of [`LockableScore`] which supports multi-threading.
12295  */
12296 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
12297    /**
12298     * A pointer to the opaque Rust object.
12299     * Nearly everywhere, inner must be non-null, however in places where
12300     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12301     */
12302    LDKnativeMultiThreadedLockableScore *inner;
12303    /**
12304     * Indicates that this is the only struct which contains the same pointer.
12305     * Rust functions which take ownership of an object provided via an argument require
12306     * this to be true and invalidate the object pointed to by inner.
12307     */
12308    bool is_owned;
12309 } LDKMultiThreadedLockableScore;
12310
12311
12312
12313 /**
12314  * Parameters for configuring [`ProbabilisticScorer`].
12315  *
12316  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
12317  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
12318  */
12319 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
12320    /**
12321     * A pointer to the opaque Rust object.
12322     * Nearly everywhere, inner must be non-null, however in places where
12323     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12324     */
12325    LDKnativeProbabilisticScoringParameters *inner;
12326    /**
12327     * Indicates that this is the only struct which contains the same pointer.
12328     * Rust functions which take ownership of an object provided via an argument require
12329     * this to be true and invalidate the object pointed to by inner.
12330     */
12331    bool is_owned;
12332 } LDKProbabilisticScoringParameters;
12333
12334
12335
12336 /**
12337  * FilesystemPersister persists channel data on disk, where each channel's
12338  * data is stored in a file named after its funding outpoint.
12339  *
12340  * Warning: this module does the best it can with calls to persist data, but it
12341  * can only guarantee that the data is passed to the drive. It is up to the
12342  * drive manufacturers to do the actual persistence properly, which they often
12343  * don't (especially on consumer-grade hardware). Therefore, it is up to the
12344  * user to validate their entire storage stack, to ensure the writes are
12345  * persistent.
12346  * Corollary: especially when dealing with larger amounts of money, it is best
12347  * practice to have multiple channel data backups and not rely only on one
12348  * FilesystemPersister.
12349  */
12350 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
12351    /**
12352     * A pointer to the opaque Rust object.
12353     * Nearly everywhere, inner must be non-null, however in places where
12354     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12355     */
12356    LDKnativeFilesystemPersister *inner;
12357    /**
12358     * Indicates that this is the only struct which contains the same pointer.
12359     * Rust functions which take ownership of an object provided via an argument require
12360     * this to be true and invalidate the object pointed to by inner.
12361     */
12362    bool is_owned;
12363 } LDKFilesystemPersister;
12364
12365
12366
12367 /**
12368  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
12369  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
12370  * responsibilities are:
12371  * * Processing [`Event`]s with a user-provided [`EventHandler`].
12372  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
12373  *   writing it to disk/backups by invoking the callback given to it at startup.
12374  *   [`ChannelManager`] persistence should be done in the background.
12375  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
12376  *   at the appropriate intervals.
12377  * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
12378  *   is provided to [`BackgroundProcessor::start`]).
12379  *
12380  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
12381  * upon as doing so may result in high latency.
12382  *
12383  * # Note
12384  *
12385  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
12386  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
12387  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
12388  * unilateral chain closure fees are at risk.
12389  *
12390  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
12391  * [`Event`]: lightning::util::events::Event
12392  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
12393  */
12394 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
12395    /**
12396     * A pointer to the opaque Rust object.
12397     * Nearly everywhere, inner must be non-null, however in places where
12398     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12399     */
12400    LDKnativeBackgroundProcessor *inner;
12401    /**
12402     * Indicates that this is the only struct which contains the same pointer.
12403     * Rust functions which take ownership of an object provided via an argument require
12404     * this to be true and invalidate the object pointed to by inner.
12405     */
12406    bool is_owned;
12407 } LDKBackgroundProcessor;
12408
12409
12410
12411 /**
12412  * Rapid Gossip Sync struct
12413  * See [crate-level documentation] for usage.
12414  *
12415  * [crate-level documentation]: crate
12416  */
12417 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
12418    /**
12419     * A pointer to the opaque Rust object.
12420     * Nearly everywhere, inner must be non-null, however in places where
12421     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12422     */
12423    LDKnativeRapidGossipSync *inner;
12424    /**
12425     * Indicates that this is the only struct which contains the same pointer.
12426     * Rust functions which take ownership of an object provided via an argument require
12427     * this to be true and invalidate the object pointed to by inner.
12428     */
12429    bool is_owned;
12430 } LDKRapidGossipSync;
12431
12432 /**
12433  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
12434  */
12435 typedef enum LDKGossipSync_Tag {
12436    /**
12437     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
12438     */
12439    LDKGossipSync_P2P,
12440    /**
12441     * Rapid gossip sync from a trusted server.
12442     */
12443    LDKGossipSync_Rapid,
12444    /**
12445     * No gossip sync.
12446     */
12447    LDKGossipSync_None,
12448    /**
12449     * Must be last for serialization purposes
12450     */
12451    LDKGossipSync_Sentinel,
12452 } LDKGossipSync_Tag;
12453
12454 typedef struct MUST_USE_STRUCT LDKGossipSync {
12455    LDKGossipSync_Tag tag;
12456    union {
12457       struct {
12458          struct LDKP2PGossipSync p2p;
12459       };
12460       struct {
12461          struct LDKRapidGossipSync rapid;
12462       };
12463    };
12464 } LDKGossipSync;
12465
12466
12467
12468 /**
12469  * Data of the `RawInvoice` that is encoded in the data part
12470  */
12471 typedef struct MUST_USE_STRUCT LDKRawDataPart {
12472    /**
12473     * A pointer to the opaque Rust object.
12474     * Nearly everywhere, inner must be non-null, however in places where
12475     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12476     */
12477    LDKnativeRawDataPart *inner;
12478    /**
12479     * Indicates that this is the only struct which contains the same pointer.
12480     * Rust functions which take ownership of an object provided via an argument require
12481     * this to be true and invalidate the object pointed to by inner.
12482     */
12483    bool is_owned;
12484 } LDKRawDataPart;
12485
12486
12487
12488 /**
12489  * SHA-256 hash
12490  */
12491 typedef struct MUST_USE_STRUCT LDKSha256 {
12492    /**
12493     * A pointer to the opaque Rust object.
12494     * Nearly everywhere, inner must be non-null, however in places where
12495     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12496     */
12497    LDKnativeSha256 *inner;
12498    /**
12499     * Indicates that this is the only struct which contains the same pointer.
12500     * Rust functions which take ownership of an object provided via an argument require
12501     * this to be true and invalidate the object pointed to by inner.
12502     */
12503    bool is_owned;
12504 } LDKSha256;
12505
12506
12507
12508 /**
12509  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
12510  * expires
12511  */
12512 typedef struct MUST_USE_STRUCT LDKExpiryTime {
12513    /**
12514     * A pointer to the opaque Rust object.
12515     * Nearly everywhere, inner must be non-null, however in places where
12516     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12517     */
12518    LDKnativeExpiryTime *inner;
12519    /**
12520     * Indicates that this is the only struct which contains the same pointer.
12521     * Rust functions which take ownership of an object provided via an argument require
12522     * this to be true and invalidate the object pointed to by inner.
12523     */
12524    bool is_owned;
12525 } LDKExpiryTime;
12526
12527
12528
12529 /**
12530  * `min_final_cltv_expiry` to use for the last HTLC in the route
12531  */
12532 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
12533    /**
12534     * A pointer to the opaque Rust object.
12535     * Nearly everywhere, inner must be non-null, however in places where
12536     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12537     */
12538    LDKnativeMinFinalCltvExpiry *inner;
12539    /**
12540     * Indicates that this is the only struct which contains the same pointer.
12541     * Rust functions which take ownership of an object provided via an argument require
12542     * this to be true and invalidate the object pointed to by inner.
12543     */
12544    bool is_owned;
12545 } LDKMinFinalCltvExpiry;
12546
12547 /**
12548  * A 20-byte byte array.
12549  */
12550 typedef struct LDKTwentyBytes {
12551    /**
12552     * The twenty bytes
12553     */
12554    uint8_t data[20];
12555 } LDKTwentyBytes;
12556
12557 /**
12558  * Fallback address in case no LN payment is possible
12559  */
12560 typedef enum LDKFallback_Tag {
12561    LDKFallback_SegWitProgram,
12562    LDKFallback_PubKeyHash,
12563    LDKFallback_ScriptHash,
12564    /**
12565     * Must be last for serialization purposes
12566     */
12567    LDKFallback_Sentinel,
12568 } LDKFallback_Tag;
12569
12570 typedef struct LDKFallback_LDKSegWitProgram_Body {
12571    struct LDKu5 version;
12572    struct LDKCVec_u8Z program;
12573 } LDKFallback_LDKSegWitProgram_Body;
12574
12575 typedef struct MUST_USE_STRUCT LDKFallback {
12576    LDKFallback_Tag tag;
12577    union {
12578       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
12579       struct {
12580          struct LDKTwentyBytes pub_key_hash;
12581       };
12582       struct {
12583          struct LDKTwentyBytes script_hash;
12584       };
12585    };
12586 } LDKFallback;
12587
12588 /**
12589  * A trait defining behavior of an [`Invoice`] payer.
12590  */
12591 typedef struct LDKPayer {
12592    /**
12593     * An opaque pointer which is passed to your function implementations as an argument.
12594     * This has no meaning in the LDK, and can be NULL or any other value.
12595     */
12596    void *this_arg;
12597    /**
12598     * Returns the payer's node id.
12599     */
12600    struct LDKPublicKey (*node_id)(const void *this_arg);
12601    /**
12602     * Returns the payer's channels.
12603     */
12604    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
12605    /**
12606     * Sends a payment over the Lightning Network using the given [`Route`].
12607     *
12608     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
12609     */
12610    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
12611    /**
12612     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
12613     */
12614    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
12615    /**
12616     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
12617     */
12618    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
12619    /**
12620     * Signals that no further retries for the given payment will occur.
12621     */
12622    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
12623    /**
12624     * Frees any resources associated with this object given its this_arg pointer.
12625     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12626     */
12627    void (*free)(void *this_arg);
12628 } LDKPayer;
12629
12630 /**
12631  * A trait defining behavior for routing an [`Invoice`] payment.
12632  */
12633 typedef struct LDKRouter {
12634    /**
12635     * An opaque pointer which is passed to your function implementations as an argument.
12636     * This has no meaning in the LDK, and can be NULL or any other value.
12637     */
12638    void *this_arg;
12639    /**
12640     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
12641     *
12642     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
12643     */
12644    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);
12645    /**
12646     * Frees any resources associated with this object given its this_arg pointer.
12647     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12648     */
12649    void (*free)(void *this_arg);
12650 } LDKRouter;
12651
12652
12653
12654 /**
12655  * A utility for paying [`Invoice`]s and sending spontaneous payments.
12656  *
12657  * See [module-level documentation] for details.
12658  *
12659  * [module-level documentation]: crate::payment
12660  */
12661 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
12662    /**
12663     * A pointer to the opaque Rust object.
12664     * Nearly everywhere, inner must be non-null, however in places where
12665     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12666     */
12667    LDKnativeInvoicePayer *inner;
12668    /**
12669     * Indicates that this is the only struct which contains the same pointer.
12670     * Rust functions which take ownership of an object provided via an argument require
12671     * this to be true and invalidate the object pointed to by inner.
12672     */
12673    bool is_owned;
12674 } LDKInvoicePayer;
12675
12676 /**
12677  * Strategies available to retry payment path failures for an [`Invoice`].
12678  *
12679  */
12680 typedef enum LDKRetry_Tag {
12681    /**
12682     * Max number of attempts to retry payment.
12683     *
12684     * Note that this is the number of *path* failures, not full payment retries. For multi-path
12685     * payments, if this is less than the total number of paths, we will never even retry all of the
12686     * payment's paths.
12687     */
12688    LDKRetry_Attempts,
12689    /**
12690     * Time elapsed before abandoning retries for a payment.
12691     */
12692    LDKRetry_Timeout,
12693    /**
12694     * Must be last for serialization purposes
12695     */
12696    LDKRetry_Sentinel,
12697 } LDKRetry_Tag;
12698
12699 typedef struct MUST_USE_STRUCT LDKRetry {
12700    LDKRetry_Tag tag;
12701    union {
12702       struct {
12703          uintptr_t attempts;
12704       };
12705       struct {
12706          uint64_t timeout;
12707       };
12708    };
12709 } LDKRetry;
12710
12711
12712
12713 /**
12714  * A [`Router`] implemented using [`find_route`].
12715  */
12716 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
12717    /**
12718     * A pointer to the opaque Rust object.
12719     * Nearly everywhere, inner must be non-null, however in places where
12720     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12721     */
12722    LDKnativeDefaultRouter *inner;
12723    /**
12724     * Indicates that this is the only struct which contains the same pointer.
12725     * Rust functions which take ownership of an object provided via an argument require
12726     * this to be true and invalidate the object pointed to by inner.
12727     */
12728    bool is_owned;
12729 } LDKDefaultRouter;
12730
12731 extern const uintptr_t MAX_BUF_SIZE;
12732
12733 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
12734
12735 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
12736
12737 extern const uint32_t ANTI_REORG_DELAY;
12738
12739 extern const uint16_t BREAKDOWN_TIMEOUT;
12740
12741 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
12742
12743 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
12744
12745 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
12746
12747 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
12748
12749 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
12750
12751 extern const uint64_t MAX_TIMESTAMP;
12752
12753 extern const uint64_t DEFAULT_EXPIRY_TIME;
12754
12755 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
12756
12757 extern const uint8_t TAG_PAYMENT_HASH;
12758
12759 extern const uint8_t TAG_DESCRIPTION;
12760
12761 extern const uint8_t TAG_PAYEE_PUB_KEY;
12762
12763 extern const uint8_t TAG_DESCRIPTION_HASH;
12764
12765 extern const uint8_t TAG_EXPIRY_TIME;
12766
12767 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
12768
12769 extern const uint8_t TAG_FALLBACK;
12770
12771 extern const uint8_t TAG_PRIVATE_ROUTE;
12772
12773 extern const uint8_t TAG_PAYMENT_SECRET;
12774
12775 extern const uint8_t TAG_FEATURES;
12776
12777 struct LDKStr _ldk_get_compiled_version(void);
12778
12779 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
12780
12781 /**
12782  * Creates a new Bech32Error which has the same data as `orig`
12783  */
12784 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
12785
12786 /**
12787  * Releases any memory held by the given `Bech32Error` (which is currently none)
12788  */
12789 void Bech32Error_free(struct LDKBech32Error o);
12790
12791 /**
12792  * Frees the data buffer, if data_is_owned is set and datalen > 0.
12793  */
12794 void Transaction_free(struct LDKTransaction _res);
12795
12796 /**
12797  * Convenience function for constructing a new TxOut
12798  */
12799 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
12800
12801 /**
12802  * Frees the data pointed to by script_pubkey.
12803  */
12804 void TxOut_free(struct LDKTxOut _res);
12805
12806 /**
12807  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
12808  */
12809 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
12810
12811 /**
12812  * Frees the data buffer, if chars_is_owned is set and len > 0.
12813  */
12814 void Str_free(struct LDKStr _res);
12815
12816 #if defined(LDK_DEBUG_BUILD)
12817 /**
12818  * This function exists for memory safety testing purposes. It should never be used in production
12819  * code
12820  */
12821 const void *__unmangle_inner_ptr(const void *ptr);
12822 #endif
12823
12824 /**
12825  * Creates a new CResult_NoneNoneZ in the success state.
12826  */
12827 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
12828
12829 /**
12830  * Creates a new CResult_NoneNoneZ in the error state.
12831  */
12832 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
12833
12834 /**
12835  * Checks if the given object is currently in the success state
12836  */
12837 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
12838
12839 /**
12840  * Frees any resources used by the CResult_NoneNoneZ.
12841  */
12842 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
12843
12844 /**
12845  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
12846  * but with all dynamically-allocated buffers duplicated in new buffers.
12847  */
12848 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
12849
12850 /**
12851  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
12852  */
12853 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
12854
12855 /**
12856  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
12857  */
12858 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
12859
12860 /**
12861  * Checks if the given object is currently in the success state
12862  */
12863 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
12864
12865 /**
12866  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
12867  */
12868 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
12869
12870 /**
12871  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
12872  * but with all dynamically-allocated buffers duplicated in new buffers.
12873  */
12874 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
12875
12876 /**
12877  * Creates a new CResult_SecretKeyErrorZ in the success state.
12878  */
12879 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
12880
12881 /**
12882  * Creates a new CResult_SecretKeyErrorZ in the error state.
12883  */
12884 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
12885
12886 /**
12887  * Checks if the given object is currently in the success state
12888  */
12889 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
12890
12891 /**
12892  * Frees any resources used by the CResult_SecretKeyErrorZ.
12893  */
12894 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
12895
12896 /**
12897  * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
12898  * but with all dynamically-allocated buffers duplicated in new buffers.
12899  */
12900 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
12901
12902 /**
12903  * Creates a new CResult_PublicKeyErrorZ in the success state.
12904  */
12905 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
12906
12907 /**
12908  * Creates a new CResult_PublicKeyErrorZ in the error state.
12909  */
12910 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
12911
12912 /**
12913  * Checks if the given object is currently in the success state
12914  */
12915 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
12916
12917 /**
12918  * Frees any resources used by the CResult_PublicKeyErrorZ.
12919  */
12920 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
12921
12922 /**
12923  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
12924  * but with all dynamically-allocated buffers duplicated in new buffers.
12925  */
12926 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
12927
12928 /**
12929  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
12930  */
12931 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
12932
12933 /**
12934  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
12935  */
12936 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
12937
12938 /**
12939  * Checks if the given object is currently in the success state
12940  */
12941 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
12942
12943 /**
12944  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
12945  */
12946 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
12947
12948 /**
12949  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
12950  * but with all dynamically-allocated buffers duplicated in new buffers.
12951  */
12952 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
12953
12954 /**
12955  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
12956  */
12957 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
12958
12959 /**
12960  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
12961  */
12962 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
12963
12964 /**
12965  * Checks if the given object is currently in the success state
12966  */
12967 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
12968
12969 /**
12970  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
12971  */
12972 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
12973
12974 /**
12975  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
12976  * but with all dynamically-allocated buffers duplicated in new buffers.
12977  */
12978 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
12979
12980 /**
12981  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
12982  */
12983 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
12984
12985 /**
12986  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
12987  */
12988 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
12989
12990 /**
12991  * Checks if the given object is currently in the success state
12992  */
12993 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
12994
12995 /**
12996  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
12997  */
12998 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
12999
13000 /**
13001  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
13002  * but with all dynamically-allocated buffers duplicated in new buffers.
13003  */
13004 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
13005
13006 /**
13007  * Constructs a new COption_u32Z containing a u32
13008  */
13009 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
13010
13011 /**
13012  * Constructs a new COption_u32Z containing nothing
13013  */
13014 struct LDKCOption_u32Z COption_u32Z_none(void);
13015
13016 /**
13017  * Frees any resources associated with the u32, if we are in the Some state
13018  */
13019 void COption_u32Z_free(struct LDKCOption_u32Z _res);
13020
13021 /**
13022  * Creates a new COption_u32Z which has the same data as `orig`
13023  * but with all dynamically-allocated buffers duplicated in new buffers.
13024  */
13025 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
13026
13027 /**
13028  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
13029  */
13030 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
13031
13032 /**
13033  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
13034  */
13035 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
13036
13037 /**
13038  * Checks if the given object is currently in the success state
13039  */
13040 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
13041
13042 /**
13043  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
13044  */
13045 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
13046
13047 /**
13048  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
13049  * but with all dynamically-allocated buffers duplicated in new buffers.
13050  */
13051 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
13052
13053 /**
13054  * Constructs a new COption_NoneZ containing a
13055  */
13056 enum LDKCOption_NoneZ COption_NoneZ_some(void);
13057
13058 /**
13059  * Constructs a new COption_NoneZ containing nothing
13060  */
13061 enum LDKCOption_NoneZ COption_NoneZ_none(void);
13062
13063 /**
13064  * Frees any resources associated with the , if we are in the Some state
13065  */
13066 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
13067
13068 /**
13069  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
13070  */
13071 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
13072
13073 /**
13074  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
13075  */
13076 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
13077
13078 /**
13079  * Checks if the given object is currently in the success state
13080  */
13081 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
13082
13083 /**
13084  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
13085  */
13086 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
13087
13088 /**
13089  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
13090  * but with all dynamically-allocated buffers duplicated in new buffers.
13091  */
13092 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
13093
13094 /**
13095  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
13096  */
13097 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
13098
13099 /**
13100  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
13101  */
13102 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
13103
13104 /**
13105  * Checks if the given object is currently in the success state
13106  */
13107 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
13108
13109 /**
13110  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
13111  */
13112 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
13113
13114 /**
13115  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
13116  * but with all dynamically-allocated buffers duplicated in new buffers.
13117  */
13118 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
13119
13120 /**
13121  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13122  */
13123 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
13124
13125 /**
13126  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
13127  */
13128 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
13129
13130 /**
13131  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
13132  */
13133 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13134
13135 /**
13136  * Checks if the given object is currently in the success state
13137  */
13138 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13139
13140 /**
13141  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
13142  */
13143 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
13144
13145 /**
13146  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
13147  * but with all dynamically-allocated buffers duplicated in new buffers.
13148  */
13149 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13150
13151 /**
13152  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
13153  */
13154 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
13155
13156 /**
13157  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
13158  */
13159 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13160
13161 /**
13162  * Checks if the given object is currently in the success state
13163  */
13164 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13165
13166 /**
13167  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
13168  */
13169 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
13170
13171 /**
13172  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
13173  * but with all dynamically-allocated buffers duplicated in new buffers.
13174  */
13175 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13176
13177 /**
13178  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
13179  */
13180 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
13181
13182 /**
13183  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
13184  */
13185 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
13186
13187 /**
13188  * Checks if the given object is currently in the success state
13189  */
13190 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
13191
13192 /**
13193  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
13194  */
13195 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
13196
13197 /**
13198  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
13199  */
13200 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
13201
13202 /**
13203  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
13204  */
13205 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13206
13207 /**
13208  * Checks if the given object is currently in the success state
13209  */
13210 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13211
13212 /**
13213  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
13214  */
13215 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
13216
13217 /**
13218  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
13219  * but with all dynamically-allocated buffers duplicated in new buffers.
13220  */
13221 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13222
13223 /**
13224  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
13225  */
13226 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
13227
13228 /**
13229  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
13230  */
13231 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
13232
13233 /**
13234  * Checks if the given object is currently in the success state
13235  */
13236 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
13237
13238 /**
13239  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
13240  */
13241 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
13242
13243 /**
13244  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
13245  */
13246 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
13247
13248 /**
13249  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
13250  */
13251 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
13252
13253 /**
13254  * Checks if the given object is currently in the success state
13255  */
13256 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
13257
13258 /**
13259  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
13260  */
13261 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
13262
13263 /**
13264  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
13265  * but with all dynamically-allocated buffers duplicated in new buffers.
13266  */
13267 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
13268
13269 /**
13270  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
13271  */
13272 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
13273
13274 /**
13275  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
13276  */
13277 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
13278
13279 /**
13280  * Checks if the given object is currently in the success state
13281  */
13282 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
13283
13284 /**
13285  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
13286  */
13287 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
13288
13289 /**
13290  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
13291  * but with all dynamically-allocated buffers duplicated in new buffers.
13292  */
13293 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
13294
13295 /**
13296  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
13297  */
13298 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
13299
13300 /**
13301  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
13302  */
13303 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
13304
13305 /**
13306  * Checks if the given object is currently in the success state
13307  */
13308 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
13309
13310 /**
13311  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
13312  */
13313 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
13314
13315 /**
13316  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
13317  * but with all dynamically-allocated buffers duplicated in new buffers.
13318  */
13319 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
13320
13321 /**
13322  * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
13323  */
13324 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o);
13325
13326 /**
13327  * Constructs a new COption_WriteableScoreZ containing nothing
13328  */
13329 struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void);
13330
13331 /**
13332  * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state
13333  */
13334 void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res);
13335
13336 /**
13337  * Creates a new CResult_NoneErrorZ in the success state.
13338  */
13339 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
13340
13341 /**
13342  * Creates a new CResult_NoneErrorZ in the error state.
13343  */
13344 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
13345
13346 /**
13347  * Checks if the given object is currently in the success state
13348  */
13349 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
13350
13351 /**
13352  * Frees any resources used by the CResult_NoneErrorZ.
13353  */
13354 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
13355
13356 /**
13357  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
13358  * but with all dynamically-allocated buffers duplicated in new buffers.
13359  */
13360 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
13361
13362 /**
13363  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
13364  */
13365 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
13366
13367 /**
13368  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
13369  */
13370 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
13371
13372 /**
13373  * Checks if the given object is currently in the success state
13374  */
13375 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
13376
13377 /**
13378  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
13379  */
13380 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
13381
13382 /**
13383  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
13384  * but with all dynamically-allocated buffers duplicated in new buffers.
13385  */
13386 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
13387
13388 /**
13389  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13390  */
13391 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
13392
13393 /**
13394  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13395  */
13396 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
13397
13398 /**
13399  * Creates a new CResult_RouteDecodeErrorZ in the success state.
13400  */
13401 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
13402
13403 /**
13404  * Creates a new CResult_RouteDecodeErrorZ in the error state.
13405  */
13406 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
13407
13408 /**
13409  * Checks if the given object is currently in the success state
13410  */
13411 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
13412
13413 /**
13414  * Frees any resources used by the CResult_RouteDecodeErrorZ.
13415  */
13416 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
13417
13418 /**
13419  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
13420  * but with all dynamically-allocated buffers duplicated in new buffers.
13421  */
13422 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
13423
13424 /**
13425  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
13426  */
13427 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
13428
13429 /**
13430  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
13431  */
13432 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
13433
13434 /**
13435  * Checks if the given object is currently in the success state
13436  */
13437 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
13438
13439 /**
13440  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
13441  */
13442 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
13443
13444 /**
13445  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
13446  * but with all dynamically-allocated buffers duplicated in new buffers.
13447  */
13448 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
13449
13450 /**
13451  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13452  */
13453 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
13454
13455 /**
13456  * Constructs a new COption_u64Z containing a u64
13457  */
13458 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
13459
13460 /**
13461  * Constructs a new COption_u64Z containing nothing
13462  */
13463 struct LDKCOption_u64Z COption_u64Z_none(void);
13464
13465 /**
13466  * Frees any resources associated with the u64, if we are in the Some state
13467  */
13468 void COption_u64Z_free(struct LDKCOption_u64Z _res);
13469
13470 /**
13471  * Creates a new COption_u64Z which has the same data as `orig`
13472  * but with all dynamically-allocated buffers duplicated in new buffers.
13473  */
13474 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
13475
13476 /**
13477  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
13478  */
13479 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
13480
13481 /**
13482  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
13483  */
13484 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
13485
13486 /**
13487  * Checks if the given object is currently in the success state
13488  */
13489 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
13490
13491 /**
13492  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
13493  */
13494 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
13495
13496 /**
13497  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
13498  * but with all dynamically-allocated buffers duplicated in new buffers.
13499  */
13500 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
13501
13502 /**
13503  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13504  */
13505 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
13506
13507 /**
13508  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
13509  */
13510 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
13511
13512 /**
13513  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
13514  */
13515 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
13516
13517 /**
13518  * Checks if the given object is currently in the success state
13519  */
13520 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
13521
13522 /**
13523  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
13524  */
13525 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
13526
13527 /**
13528  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
13529  * but with all dynamically-allocated buffers duplicated in new buffers.
13530  */
13531 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
13532
13533 /**
13534  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
13535  */
13536 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
13537
13538 /**
13539  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
13540  */
13541 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
13542
13543 /**
13544  * Checks if the given object is currently in the success state
13545  */
13546 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
13547
13548 /**
13549  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
13550  */
13551 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
13552
13553 /**
13554  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
13555  * but with all dynamically-allocated buffers duplicated in new buffers.
13556  */
13557 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
13558
13559 /**
13560  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13561  */
13562 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
13563
13564 /**
13565  * Creates a new CResult_RouteLightningErrorZ in the success state.
13566  */
13567 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
13568
13569 /**
13570  * Creates a new CResult_RouteLightningErrorZ in the error state.
13571  */
13572 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
13573
13574 /**
13575  * Checks if the given object is currently in the success state
13576  */
13577 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
13578
13579 /**
13580  * Frees any resources used by the CResult_RouteLightningErrorZ.
13581  */
13582 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
13583
13584 /**
13585  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
13586  * but with all dynamically-allocated buffers duplicated in new buffers.
13587  */
13588 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
13589
13590 /**
13591  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13592  */
13593 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
13594
13595 /**
13596  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
13597  */
13598 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
13599
13600 /**
13601  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
13602  */
13603 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
13604
13605 /**
13606  * Checks if the given object is currently in the success state
13607  */
13608 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
13609
13610 /**
13611  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
13612  */
13613 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
13614
13615 /**
13616  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
13617  * but with all dynamically-allocated buffers duplicated in new buffers.
13618  */
13619 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
13620
13621 /**
13622  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
13623  */
13624 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
13625
13626 /**
13627  * Constructs a new COption_ClosureReasonZ containing nothing
13628  */
13629 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
13630
13631 /**
13632  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
13633  */
13634 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
13635
13636 /**
13637  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
13638  * but with all dynamically-allocated buffers duplicated in new buffers.
13639  */
13640 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
13641
13642 /**
13643  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
13644  */
13645 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
13646
13647 /**
13648  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
13649  */
13650 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
13651
13652 /**
13653  * Checks if the given object is currently in the success state
13654  */
13655 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
13656
13657 /**
13658  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
13659  */
13660 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
13661
13662 /**
13663  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
13664  * but with all dynamically-allocated buffers duplicated in new buffers.
13665  */
13666 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
13667
13668 /**
13669  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
13670  */
13671 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
13672
13673 /**
13674  * Constructs a new COption_NetworkUpdateZ containing nothing
13675  */
13676 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
13677
13678 /**
13679  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
13680  */
13681 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
13682
13683 /**
13684  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
13685  * but with all dynamically-allocated buffers duplicated in new buffers.
13686  */
13687 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
13688
13689 /**
13690  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13691  */
13692 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
13693
13694 /**
13695  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
13696  */
13697 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
13698
13699 /**
13700  * Constructs a new COption_EventZ containing nothing
13701  */
13702 struct LDKCOption_EventZ COption_EventZ_none(void);
13703
13704 /**
13705  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
13706  */
13707 void COption_EventZ_free(struct LDKCOption_EventZ _res);
13708
13709 /**
13710  * Creates a new COption_EventZ which has the same data as `orig`
13711  * but with all dynamically-allocated buffers duplicated in new buffers.
13712  */
13713 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
13714
13715 /**
13716  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
13717  */
13718 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
13719
13720 /**
13721  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
13722  */
13723 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
13724
13725 /**
13726  * Checks if the given object is currently in the success state
13727  */
13728 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
13729
13730 /**
13731  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
13732  */
13733 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
13734
13735 /**
13736  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
13737  * but with all dynamically-allocated buffers duplicated in new buffers.
13738  */
13739 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
13740
13741 /**
13742  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13743  */
13744 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
13745
13746 /**
13747  * Creates a new CResult_TxOutAccessErrorZ in the success state.
13748  */
13749 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
13750
13751 /**
13752  * Creates a new CResult_TxOutAccessErrorZ in the error state.
13753  */
13754 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
13755
13756 /**
13757  * Checks if the given object is currently in the success state
13758  */
13759 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
13760
13761 /**
13762  * Frees any resources used by the CResult_TxOutAccessErrorZ.
13763  */
13764 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
13765
13766 /**
13767  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
13768  * but with all dynamically-allocated buffers duplicated in new buffers.
13769  */
13770 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
13771
13772 /**
13773  * Creates a new tuple which has the same data as `orig`
13774  * but with all dynamically-allocated buffers duplicated in new buffers.
13775  */
13776 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
13777
13778 /**
13779  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
13780  */
13781 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
13782
13783 /**
13784  * Frees any resources used by the C2Tuple_usizeTransactionZ.
13785  */
13786 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
13787
13788 /**
13789  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13790  */
13791 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
13792
13793 /**
13794  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13795  */
13796 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
13797
13798 /**
13799  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
13800  */
13801 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
13802
13803 /**
13804  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
13805  */
13806 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
13807
13808 /**
13809  * Checks if the given object is currently in the success state
13810  */
13811 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
13812
13813 /**
13814  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
13815  */
13816 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
13817
13818 /**
13819  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
13820  * but with all dynamically-allocated buffers duplicated in new buffers.
13821  */
13822 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
13823
13824 /**
13825  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13826  */
13827 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
13828
13829 /**
13830  * Creates a new tuple which has the same data as `orig`
13831  * but with all dynamically-allocated buffers duplicated in new buffers.
13832  */
13833 struct LDKC2Tuple_OutPointCVec_MonitorEventZZ C2Tuple_OutPointCVec_MonitorEventZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR orig);
13834
13835 /**
13836  * Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
13837  */
13838 struct LDKC2Tuple_OutPointCVec_MonitorEventZZ C2Tuple_OutPointCVec_MonitorEventZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b);
13839
13840 /**
13841  * Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
13842  */
13843 void C2Tuple_OutPointCVec_MonitorEventZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorEventZZ _res);
13844
13845 /**
13846  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13847  */
13848 void CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res);
13849
13850 /**
13851  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
13852  */
13853 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
13854
13855 /**
13856  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
13857  */
13858 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
13859
13860 /**
13861  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
13862  */
13863 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
13864
13865 /**
13866  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
13867  * but with all dynamically-allocated buffers duplicated in new buffers.
13868  */
13869 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
13870
13871 /**
13872  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
13873  */
13874 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
13875
13876 /**
13877  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
13878  */
13879 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
13880
13881 /**
13882  * Checks if the given object is currently in the success state
13883  */
13884 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
13885
13886 /**
13887  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
13888  */
13889 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
13890
13891 /**
13892  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
13893  * but with all dynamically-allocated buffers duplicated in new buffers.
13894  */
13895 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
13896
13897 /**
13898  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
13899  */
13900 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
13901
13902 /**
13903  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
13904  */
13905 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
13906
13907 /**
13908  * Checks if the given object is currently in the success state
13909  */
13910 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
13911
13912 /**
13913  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
13914  */
13915 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
13916
13917 /**
13918  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
13919  */
13920 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
13921
13922 /**
13923  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
13924  */
13925 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13926
13927 /**
13928  * Checks if the given object is currently in the success state
13929  */
13930 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
13931
13932 /**
13933  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
13934  */
13935 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
13936
13937 /**
13938  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
13939  * but with all dynamically-allocated buffers duplicated in new buffers.
13940  */
13941 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
13942
13943 /**
13944  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
13945  */
13946 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
13947
13948 /**
13949  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
13950  */
13951 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13952
13953 /**
13954  * Checks if the given object is currently in the success state
13955  */
13956 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
13957
13958 /**
13959  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
13960  */
13961 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
13962
13963 /**
13964  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
13965  * but with all dynamically-allocated buffers duplicated in new buffers.
13966  */
13967 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
13968
13969 /**
13970  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
13971  */
13972 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
13973
13974 /**
13975  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
13976  */
13977 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13978
13979 /**
13980  * Checks if the given object is currently in the success state
13981  */
13982 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
13983
13984 /**
13985  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
13986  */
13987 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
13988
13989 /**
13990  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
13991  * but with all dynamically-allocated buffers duplicated in new buffers.
13992  */
13993 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
13994
13995 /**
13996  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
13997  */
13998 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
13999
14000 /**
14001  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
14002  */
14003 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14004
14005 /**
14006  * Checks if the given object is currently in the success state
14007  */
14008 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
14009
14010 /**
14011  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
14012  */
14013 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
14014
14015 /**
14016  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
14017  * but with all dynamically-allocated buffers duplicated in new buffers.
14018  */
14019 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
14020
14021 /**
14022  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
14023  */
14024 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
14025
14026 /**
14027  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
14028  */
14029 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14030
14031 /**
14032  * Checks if the given object is currently in the success state
14033  */
14034 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
14035
14036 /**
14037  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
14038  */
14039 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
14040
14041 /**
14042  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
14043  * but with all dynamically-allocated buffers duplicated in new buffers.
14044  */
14045 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
14046
14047 /**
14048  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
14049  */
14050 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
14051
14052 /**
14053  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
14054  */
14055 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
14056
14057 /**
14058  * Checks if the given object is currently in the success state
14059  */
14060 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
14061
14062 /**
14063  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
14064  */
14065 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
14066
14067 /**
14068  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
14069  * but with all dynamically-allocated buffers duplicated in new buffers.
14070  */
14071 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
14072
14073 /**
14074  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
14075  */
14076 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
14077
14078 /**
14079  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
14080  */
14081 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
14082
14083 /**
14084  * Checks if the given object is currently in the success state
14085  */
14086 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
14087
14088 /**
14089  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
14090  */
14091 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
14092
14093 /**
14094  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
14095  * but with all dynamically-allocated buffers duplicated in new buffers.
14096  */
14097 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
14098
14099 /**
14100  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
14101  */
14102 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
14103
14104 /**
14105  * Constructs a new COption_AccessZ containing nothing
14106  */
14107 struct LDKCOption_AccessZ COption_AccessZ_none(void);
14108
14109 /**
14110  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
14111  */
14112 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
14113
14114 /**
14115  * Creates a new CResult_boolLightningErrorZ in the success state.
14116  */
14117 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
14118
14119 /**
14120  * Creates a new CResult_boolLightningErrorZ in the error state.
14121  */
14122 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
14123
14124 /**
14125  * Checks if the given object is currently in the success state
14126  */
14127 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
14128
14129 /**
14130  * Frees any resources used by the CResult_boolLightningErrorZ.
14131  */
14132 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
14133
14134 /**
14135  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
14136  * but with all dynamically-allocated buffers duplicated in new buffers.
14137  */
14138 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
14139
14140 /**
14141  * Creates a new tuple which has the same data as `orig`
14142  * but with all dynamically-allocated buffers duplicated in new buffers.
14143  */
14144 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
14145
14146 /**
14147  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
14148  */
14149 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
14150
14151 /**
14152  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
14153  */
14154 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
14155
14156 /**
14157  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14158  */
14159 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
14160
14161 /**
14162  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14163  */
14164 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
14165
14166 /**
14167  * Creates a new CResult_NoneLightningErrorZ in the success state.
14168  */
14169 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
14170
14171 /**
14172  * Creates a new CResult_NoneLightningErrorZ in the error state.
14173  */
14174 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
14175
14176 /**
14177  * Checks if the given object is currently in the success state
14178  */
14179 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
14180
14181 /**
14182  * Frees any resources used by the CResult_NoneLightningErrorZ.
14183  */
14184 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
14185
14186 /**
14187  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
14188  * but with all dynamically-allocated buffers duplicated in new buffers.
14189  */
14190 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
14191
14192 /**
14193  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
14194  */
14195 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
14196
14197 /**
14198  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
14199  */
14200 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
14201
14202 /**
14203  * Checks if the given object is currently in the success state
14204  */
14205 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
14206
14207 /**
14208  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
14209  */
14210 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
14211
14212 /**
14213  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
14214  * but with all dynamically-allocated buffers duplicated in new buffers.
14215  */
14216 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
14217
14218 /**
14219  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
14220  */
14221 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
14222
14223 /**
14224  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
14225  */
14226 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
14227
14228 /**
14229  * Checks if the given object is currently in the success state
14230  */
14231 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
14232
14233 /**
14234  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
14235  */
14236 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
14237
14238 /**
14239  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
14240  * but with all dynamically-allocated buffers duplicated in new buffers.
14241  */
14242 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
14243
14244 /**
14245  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
14246  */
14247 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
14248
14249 /**
14250  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
14251  */
14252 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
14253
14254 /**
14255  * Checks if the given object is currently in the success state
14256  */
14257 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
14258
14259 /**
14260  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
14261  */
14262 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
14263
14264 /**
14265  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
14266  * but with all dynamically-allocated buffers duplicated in new buffers.
14267  */
14268 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
14269
14270 /**
14271  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14272  */
14273 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
14274
14275 /**
14276  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
14277  */
14278 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
14279
14280 /**
14281  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
14282  */
14283 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
14284
14285 /**
14286  * Checks if the given object is currently in the success state
14287  */
14288 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
14289
14290 /**
14291  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
14292  */
14293 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
14294
14295 /**
14296  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
14297  * but with all dynamically-allocated buffers duplicated in new buffers.
14298  */
14299 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
14300
14301 /**
14302  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14303  */
14304 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
14305
14306 /**
14307  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
14308  */
14309 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
14310
14311 /**
14312  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
14313  */
14314 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
14315
14316 /**
14317  * Checks if the given object is currently in the success state
14318  */
14319 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
14320
14321 /**
14322  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
14323  */
14324 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
14325
14326 /**
14327  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
14328  * but with all dynamically-allocated buffers duplicated in new buffers.
14329  */
14330 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
14331
14332 /**
14333  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
14334  */
14335 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
14336
14337 /**
14338  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
14339  */
14340 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
14341
14342 /**
14343  * Checks if the given object is currently in the success state
14344  */
14345 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
14346
14347 /**
14348  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
14349  */
14350 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
14351
14352 /**
14353  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
14354  */
14355 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
14356
14357 /**
14358  * Constructs a new COption_CVec_NetAddressZZ containing nothing
14359  */
14360 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
14361
14362 /**
14363  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
14364  */
14365 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
14366
14367 /**
14368  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
14369  * but with all dynamically-allocated buffers duplicated in new buffers.
14370  */
14371 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
14372
14373 /**
14374  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
14375  */
14376 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
14377
14378 /**
14379  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
14380  */
14381 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14382
14383 /**
14384  * Checks if the given object is currently in the success state
14385  */
14386 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14387
14388 /**
14389  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
14390  */
14391 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
14392
14393 /**
14394  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
14395  * but with all dynamically-allocated buffers duplicated in new buffers.
14396  */
14397 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14398
14399 /**
14400  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
14401  */
14402 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
14403
14404 /**
14405  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
14406  */
14407 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14408
14409 /**
14410  * Checks if the given object is currently in the success state
14411  */
14412 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14413
14414 /**
14415  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
14416  */
14417 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
14418
14419 /**
14420  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
14421  * but with all dynamically-allocated buffers duplicated in new buffers.
14422  */
14423 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14424
14425 /**
14426  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
14427  */
14428 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
14429
14430 /**
14431  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
14432  */
14433 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14434
14435 /**
14436  * Checks if the given object is currently in the success state
14437  */
14438 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14439
14440 /**
14441  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
14442  */
14443 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
14444
14445 /**
14446  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
14447  * but with all dynamically-allocated buffers duplicated in new buffers.
14448  */
14449 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14450
14451 /**
14452  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14453  */
14454 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
14455
14456 /**
14457  * Creates a new tuple which has the same data as `orig`
14458  * but with all dynamically-allocated buffers duplicated in new buffers.
14459  */
14460 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
14461
14462 /**
14463  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
14464  */
14465 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
14466
14467 /**
14468  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
14469  */
14470 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
14471
14472 /**
14473  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
14474  */
14475 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
14476
14477 /**
14478  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
14479  */
14480 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
14481
14482 /**
14483  * Checks if the given object is currently in the success state
14484  */
14485 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
14486
14487 /**
14488  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
14489  */
14490 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
14491
14492 /**
14493  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
14494  * but with all dynamically-allocated buffers duplicated in new buffers.
14495  */
14496 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
14497
14498 /**
14499  * Creates a new CResult_SignatureNoneZ in the success state.
14500  */
14501 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
14502
14503 /**
14504  * Creates a new CResult_SignatureNoneZ in the error state.
14505  */
14506 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
14507
14508 /**
14509  * Checks if the given object is currently in the success state
14510  */
14511 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
14512
14513 /**
14514  * Frees any resources used by the CResult_SignatureNoneZ.
14515  */
14516 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
14517
14518 /**
14519  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
14520  * but with all dynamically-allocated buffers duplicated in new buffers.
14521  */
14522 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
14523
14524 /**
14525  * Creates a new tuple which has the same data as `orig`
14526  * but with all dynamically-allocated buffers duplicated in new buffers.
14527  */
14528 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
14529
14530 /**
14531  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
14532  */
14533 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
14534
14535 /**
14536  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
14537  */
14538 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
14539
14540 /**
14541  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
14542  */
14543 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
14544
14545 /**
14546  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
14547  */
14548 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
14549
14550 /**
14551  * Checks if the given object is currently in the success state
14552  */
14553 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
14554
14555 /**
14556  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
14557  */
14558 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
14559
14560 /**
14561  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
14562  * but with all dynamically-allocated buffers duplicated in new buffers.
14563  */
14564 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
14565
14566 /**
14567  * Creates a new CResult_SecretKeyNoneZ in the success state.
14568  */
14569 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
14570
14571 /**
14572  * Creates a new CResult_SecretKeyNoneZ in the error state.
14573  */
14574 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
14575
14576 /**
14577  * Checks if the given object is currently in the success state
14578  */
14579 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
14580
14581 /**
14582  * Frees any resources used by the CResult_SecretKeyNoneZ.
14583  */
14584 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
14585
14586 /**
14587  * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
14588  * but with all dynamically-allocated buffers duplicated in new buffers.
14589  */
14590 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
14591
14592 /**
14593  * Creates a new CResult_SignDecodeErrorZ in the success state.
14594  */
14595 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
14596
14597 /**
14598  * Creates a new CResult_SignDecodeErrorZ in the error state.
14599  */
14600 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
14601
14602 /**
14603  * Checks if the given object is currently in the success state
14604  */
14605 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
14606
14607 /**
14608  * Frees any resources used by the CResult_SignDecodeErrorZ.
14609  */
14610 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
14611
14612 /**
14613  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
14614  * but with all dynamically-allocated buffers duplicated in new buffers.
14615  */
14616 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
14617
14618 /**
14619  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14620  */
14621 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
14622
14623 /**
14624  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
14625  */
14626 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
14627
14628 /**
14629  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
14630  */
14631 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
14632
14633 /**
14634  * Checks if the given object is currently in the success state
14635  */
14636 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
14637
14638 /**
14639  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
14640  */
14641 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
14642
14643 /**
14644  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
14645  * but with all dynamically-allocated buffers duplicated in new buffers.
14646  */
14647 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
14648
14649 /**
14650  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14651  */
14652 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
14653
14654 /**
14655  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14656  */
14657 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
14658
14659 /**
14660  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
14661  */
14662 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
14663
14664 /**
14665  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
14666  */
14667 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
14668
14669 /**
14670  * Checks if the given object is currently in the success state
14671  */
14672 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
14673
14674 /**
14675  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
14676  */
14677 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
14678
14679 /**
14680  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
14681  * but with all dynamically-allocated buffers duplicated in new buffers.
14682  */
14683 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
14684
14685 /**
14686  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
14687  */
14688 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
14689
14690 /**
14691  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
14692  */
14693 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
14694
14695 /**
14696  * Checks if the given object is currently in the success state
14697  */
14698 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
14699
14700 /**
14701  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
14702  */
14703 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
14704
14705 /**
14706  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
14707  * but with all dynamically-allocated buffers duplicated in new buffers.
14708  */
14709 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
14710
14711 /**
14712  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14713  */
14714 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
14715
14716 /**
14717  * Creates a new CResult_TransactionNoneZ in the success state.
14718  */
14719 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
14720
14721 /**
14722  * Creates a new CResult_TransactionNoneZ in the error state.
14723  */
14724 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
14725
14726 /**
14727  * Checks if the given object is currently in the success state
14728  */
14729 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
14730
14731 /**
14732  * Frees any resources used by the CResult_TransactionNoneZ.
14733  */
14734 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
14735
14736 /**
14737  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
14738  * but with all dynamically-allocated buffers duplicated in new buffers.
14739  */
14740 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
14741
14742 /**
14743  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
14744  */
14745 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
14746
14747 /**
14748  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
14749  */
14750 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
14751
14752 /**
14753  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14754  */
14755 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
14756
14757 /**
14758  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
14759  */
14760 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
14761
14762 /**
14763  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
14764  */
14765 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
14766
14767 /**
14768  * Checks if the given object is currently in the success state
14769  */
14770 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
14771
14772 /**
14773  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
14774  */
14775 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
14776
14777 /**
14778  * Constructs a new COption_u16Z containing a u16
14779  */
14780 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
14781
14782 /**
14783  * Constructs a new COption_u16Z containing nothing
14784  */
14785 struct LDKCOption_u16Z COption_u16Z_none(void);
14786
14787 /**
14788  * Frees any resources associated with the u16, if we are in the Some state
14789  */
14790 void COption_u16Z_free(struct LDKCOption_u16Z _res);
14791
14792 /**
14793  * Creates a new COption_u16Z which has the same data as `orig`
14794  * but with all dynamically-allocated buffers duplicated in new buffers.
14795  */
14796 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
14797
14798 /**
14799  * Creates a new CResult_NoneAPIErrorZ in the success state.
14800  */
14801 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
14802
14803 /**
14804  * Creates a new CResult_NoneAPIErrorZ in the error state.
14805  */
14806 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
14807
14808 /**
14809  * Checks if the given object is currently in the success state
14810  */
14811 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
14812
14813 /**
14814  * Frees any resources used by the CResult_NoneAPIErrorZ.
14815  */
14816 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
14817
14818 /**
14819  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
14820  * but with all dynamically-allocated buffers duplicated in new buffers.
14821  */
14822 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
14823
14824 /**
14825  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14826  */
14827 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
14828
14829 /**
14830  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14831  */
14832 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
14833
14834 /**
14835  * Creates a new CResult__u832APIErrorZ in the success state.
14836  */
14837 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
14838
14839 /**
14840  * Creates a new CResult__u832APIErrorZ in the error state.
14841  */
14842 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
14843
14844 /**
14845  * Checks if the given object is currently in the success state
14846  */
14847 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
14848
14849 /**
14850  * Frees any resources used by the CResult__u832APIErrorZ.
14851  */
14852 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
14853
14854 /**
14855  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
14856  * but with all dynamically-allocated buffers duplicated in new buffers.
14857  */
14858 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
14859
14860 /**
14861  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
14862  */
14863 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
14864
14865 /**
14866  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
14867  */
14868 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14869
14870 /**
14871  * Checks if the given object is currently in the success state
14872  */
14873 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
14874
14875 /**
14876  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
14877  */
14878 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
14879
14880 /**
14881  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
14882  * but with all dynamically-allocated buffers duplicated in new buffers.
14883  */
14884 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
14885
14886 /**
14887  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
14888  */
14889 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
14890
14891 /**
14892  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
14893  */
14894 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14895
14896 /**
14897  * Checks if the given object is currently in the success state
14898  */
14899 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
14900
14901 /**
14902  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
14903  */
14904 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
14905
14906 /**
14907  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
14908  * but with all dynamically-allocated buffers duplicated in new buffers.
14909  */
14910 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
14911
14912 /**
14913  * Creates a new tuple which has the same data as `orig`
14914  * but with all dynamically-allocated buffers duplicated in new buffers.
14915  */
14916 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
14917
14918 /**
14919  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
14920  */
14921 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14922
14923 /**
14924  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
14925  */
14926 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
14927
14928 /**
14929  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
14930  */
14931 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
14932
14933 /**
14934  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
14935  */
14936 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14937
14938 /**
14939  * Checks if the given object is currently in the success state
14940  */
14941 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
14942
14943 /**
14944  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
14945  */
14946 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
14947
14948 /**
14949  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
14950  * but with all dynamically-allocated buffers duplicated in new buffers.
14951  */
14952 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
14953
14954 /**
14955  * Creates a new tuple which has the same data as `orig`
14956  * but with all dynamically-allocated buffers duplicated in new buffers.
14957  */
14958 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
14959
14960 /**
14961  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
14962  */
14963 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14964
14965 /**
14966  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
14967  */
14968 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
14969
14970 /**
14971  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
14972  */
14973 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14974
14975 /**
14976  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
14977  */
14978 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
14979
14980 /**
14981  * Checks if the given object is currently in the success state
14982  */
14983 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
14984
14985 /**
14986  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
14987  */
14988 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
14989
14990 /**
14991  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
14992  * but with all dynamically-allocated buffers duplicated in new buffers.
14993  */
14994 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
14995
14996 /**
14997  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
14998  */
14999 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
15000
15001 /**
15002  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
15003  */
15004 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
15005
15006 /**
15007  * Checks if the given object is currently in the success state
15008  */
15009 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
15010
15011 /**
15012  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
15013  */
15014 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
15015
15016 /**
15017  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
15018  * but with all dynamically-allocated buffers duplicated in new buffers.
15019  */
15020 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
15021
15022 /**
15023  * Creates a new CResult_PaymentSecretNoneZ in the success state.
15024  */
15025 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
15026
15027 /**
15028  * Creates a new CResult_PaymentSecretNoneZ in the error state.
15029  */
15030 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
15031
15032 /**
15033  * Checks if the given object is currently in the success state
15034  */
15035 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
15036
15037 /**
15038  * Frees any resources used by the CResult_PaymentSecretNoneZ.
15039  */
15040 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
15041
15042 /**
15043  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
15044  * but with all dynamically-allocated buffers duplicated in new buffers.
15045  */
15046 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
15047
15048 /**
15049  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
15050  */
15051 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
15052
15053 /**
15054  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
15055  */
15056 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
15057
15058 /**
15059  * Checks if the given object is currently in the success state
15060  */
15061 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
15062
15063 /**
15064  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
15065  */
15066 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
15067
15068 /**
15069  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
15070  * but with all dynamically-allocated buffers duplicated in new buffers.
15071  */
15072 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
15073
15074 /**
15075  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
15076  */
15077 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
15078
15079 /**
15080  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
15081  */
15082 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
15083
15084 /**
15085  * Checks if the given object is currently in the success state
15086  */
15087 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
15088
15089 /**
15090  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
15091  */
15092 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
15093
15094 /**
15095  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
15096  * but with all dynamically-allocated buffers duplicated in new buffers.
15097  */
15098 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
15099
15100 /**
15101  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
15102  */
15103 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
15104
15105 /**
15106  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
15107  */
15108 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
15109
15110 /**
15111  * Checks if the given object is currently in the success state
15112  */
15113 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
15114
15115 /**
15116  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
15117  */
15118 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
15119
15120 /**
15121  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
15122  * but with all dynamically-allocated buffers duplicated in new buffers.
15123  */
15124 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
15125
15126 /**
15127  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
15128  */
15129 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
15130
15131 /**
15132  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
15133  */
15134 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
15135
15136 /**
15137  * Checks if the given object is currently in the success state
15138  */
15139 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
15140
15141 /**
15142  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
15143  */
15144 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
15145
15146 /**
15147  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
15148  * but with all dynamically-allocated buffers duplicated in new buffers.
15149  */
15150 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
15151
15152 /**
15153  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
15154  */
15155 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
15156
15157 /**
15158  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
15159  */
15160 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
15161
15162 /**
15163  * Checks if the given object is currently in the success state
15164  */
15165 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
15166
15167 /**
15168  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
15169  */
15170 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
15171
15172 /**
15173  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
15174  * but with all dynamically-allocated buffers duplicated in new buffers.
15175  */
15176 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
15177
15178 /**
15179  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
15180  */
15181 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
15182
15183 /**
15184  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
15185  */
15186 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
15187
15188 /**
15189  * Checks if the given object is currently in the success state
15190  */
15191 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
15192
15193 /**
15194  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
15195  */
15196 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
15197
15198 /**
15199  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
15200  * but with all dynamically-allocated buffers duplicated in new buffers.
15201  */
15202 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
15203
15204 /**
15205  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15206  */
15207 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
15208
15209 /**
15210  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
15211  */
15212 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
15213
15214 /**
15215  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
15216  */
15217 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
15218
15219 /**
15220  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
15221  */
15222 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
15223
15224 /**
15225  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
15226  */
15227 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
15228
15229 /**
15230  * Checks if the given object is currently in the success state
15231  */
15232 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
15233
15234 /**
15235  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
15236  */
15237 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
15238
15239 /**
15240  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
15241  */
15242 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
15243
15244 /**
15245  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
15246  */
15247 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
15248
15249 /**
15250  * Checks if the given object is currently in the success state
15251  */
15252 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
15253
15254 /**
15255  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
15256  */
15257 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
15258
15259 /**
15260  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
15261  * but with all dynamically-allocated buffers duplicated in new buffers.
15262  */
15263 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
15264
15265 /**
15266  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
15267  */
15268 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
15269
15270 /**
15271  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
15272  */
15273 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
15274
15275 /**
15276  * Checks if the given object is currently in the success state
15277  */
15278 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
15279
15280 /**
15281  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
15282  */
15283 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
15284
15285 /**
15286  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
15287  * but with all dynamically-allocated buffers duplicated in new buffers.
15288  */
15289 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
15290
15291 /**
15292  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
15293  */
15294 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
15295
15296 /**
15297  * Constructs a new COption_TypeZ containing nothing
15298  */
15299 struct LDKCOption_TypeZ COption_TypeZ_none(void);
15300
15301 /**
15302  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
15303  */
15304 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
15305
15306 /**
15307  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
15308  */
15309 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
15310
15311 /**
15312  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
15313  */
15314 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
15315
15316 /**
15317  * Checks if the given object is currently in the success state
15318  */
15319 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
15320
15321 /**
15322  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
15323  */
15324 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
15325
15326 /**
15327  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
15328  */
15329 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
15330
15331 /**
15332  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
15333  */
15334 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
15335
15336 /**
15337  * Checks if the given object is currently in the success state
15338  */
15339 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
15340
15341 /**
15342  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
15343  */
15344 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
15345
15346 /**
15347  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
15348  * but with all dynamically-allocated buffers duplicated in new buffers.
15349  */
15350 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
15351
15352 /**
15353  * Creates a new CResult_SiPrefixParseErrorZ in the success state.
15354  */
15355 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
15356
15357 /**
15358  * Creates a new CResult_SiPrefixParseErrorZ in the error state.
15359  */
15360 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
15361
15362 /**
15363  * Checks if the given object is currently in the success state
15364  */
15365 bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
15366
15367 /**
15368  * Frees any resources used by the CResult_SiPrefixParseErrorZ.
15369  */
15370 void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
15371
15372 /**
15373  * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
15374  * but with all dynamically-allocated buffers duplicated in new buffers.
15375  */
15376 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
15377
15378 /**
15379  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
15380  */
15381 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
15382
15383 /**
15384  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
15385  */
15386 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
15387
15388 /**
15389  * Checks if the given object is currently in the success state
15390  */
15391 bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
15392
15393 /**
15394  * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
15395  */
15396 void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
15397
15398 /**
15399  * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
15400  * but with all dynamically-allocated buffers duplicated in new buffers.
15401  */
15402 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
15403
15404 /**
15405  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
15406  */
15407 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
15408
15409 /**
15410  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
15411  */
15412 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
15413
15414 /**
15415  * Checks if the given object is currently in the success state
15416  */
15417 bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
15418
15419 /**
15420  * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
15421  */
15422 void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
15423
15424 /**
15425  * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
15426  * but with all dynamically-allocated buffers duplicated in new buffers.
15427  */
15428 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
15429
15430 /**
15431  * Creates a new tuple which has the same data as `orig`
15432  * but with all dynamically-allocated buffers duplicated in new buffers.
15433  */
15434 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
15435
15436 /**
15437  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
15438  */
15439 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
15440
15441 /**
15442  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
15443  */
15444 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
15445
15446 /**
15447  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
15448  */
15449 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
15450
15451 /**
15452  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
15453  */
15454 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
15455
15456 /**
15457  * Checks if the given object is currently in the success state
15458  */
15459 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
15460
15461 /**
15462  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
15463  */
15464 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
15465
15466 /**
15467  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
15468  * but with all dynamically-allocated buffers duplicated in new buffers.
15469  */
15470 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
15471
15472 /**
15473  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15474  */
15475 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
15476
15477 /**
15478  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
15479  */
15480 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
15481
15482 /**
15483  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
15484  */
15485 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
15486
15487 /**
15488  * Checks if the given object is currently in the success state
15489  */
15490 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
15491
15492 /**
15493  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
15494  */
15495 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
15496
15497 /**
15498  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
15499  * but with all dynamically-allocated buffers duplicated in new buffers.
15500  */
15501 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
15502
15503 /**
15504  * Creates a new CResult_NoneSemanticErrorZ in the success state.
15505  */
15506 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
15507
15508 /**
15509  * Creates a new CResult_NoneSemanticErrorZ in the error state.
15510  */
15511 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
15512
15513 /**
15514  * Checks if the given object is currently in the success state
15515  */
15516 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
15517
15518 /**
15519  * Frees any resources used by the CResult_NoneSemanticErrorZ.
15520  */
15521 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
15522
15523 /**
15524  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
15525  * but with all dynamically-allocated buffers duplicated in new buffers.
15526  */
15527 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
15528
15529 /**
15530  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
15531  */
15532 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
15533
15534 /**
15535  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
15536  */
15537 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
15538
15539 /**
15540  * Checks if the given object is currently in the success state
15541  */
15542 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
15543
15544 /**
15545  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
15546  */
15547 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
15548
15549 /**
15550  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
15551  * but with all dynamically-allocated buffers duplicated in new buffers.
15552  */
15553 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
15554
15555 /**
15556  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
15557  */
15558 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
15559
15560 /**
15561  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
15562  */
15563 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
15564
15565 /**
15566  * Checks if the given object is currently in the success state
15567  */
15568 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
15569
15570 /**
15571  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
15572  */
15573 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
15574
15575 /**
15576  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
15577  * but with all dynamically-allocated buffers duplicated in new buffers.
15578  */
15579 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
15580
15581 /**
15582  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
15583  */
15584 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
15585
15586 /**
15587  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
15588  */
15589 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
15590
15591 /**
15592  * Checks if the given object is currently in the success state
15593  */
15594 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
15595
15596 /**
15597  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
15598  */
15599 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
15600
15601 /**
15602  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
15603  * but with all dynamically-allocated buffers duplicated in new buffers.
15604  */
15605 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
15606
15607 /**
15608  * Creates a new CResult_StringErrorZ in the success state.
15609  */
15610 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
15611
15612 /**
15613  * Creates a new CResult_StringErrorZ in the error state.
15614  */
15615 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
15616
15617 /**
15618  * Checks if the given object is currently in the success state
15619  */
15620 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
15621
15622 /**
15623  * Frees any resources used by the CResult_StringErrorZ.
15624  */
15625 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
15626
15627 /**
15628  * Creates a new CResult_StringErrorZ which has the same data as `orig`
15629  * but with all dynamically-allocated buffers duplicated in new buffers.
15630  */
15631 struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
15632
15633 /**
15634  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
15635  */
15636 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
15637
15638 /**
15639  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
15640  */
15641 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15642
15643 /**
15644  * Checks if the given object is currently in the success state
15645  */
15646 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
15647
15648 /**
15649  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
15650  */
15651 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
15652
15653 /**
15654  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
15655  * but with all dynamically-allocated buffers duplicated in new buffers.
15656  */
15657 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
15658
15659 /**
15660  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
15661  */
15662 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
15663
15664 /**
15665  * Constructs a new COption_MonitorEventZ containing nothing
15666  */
15667 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
15668
15669 /**
15670  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
15671  */
15672 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
15673
15674 /**
15675  * Creates a new COption_MonitorEventZ which has the same data as `orig`
15676  * but with all dynamically-allocated buffers duplicated in new buffers.
15677  */
15678 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
15679
15680 /**
15681  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
15682  */
15683 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
15684
15685 /**
15686  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
15687  */
15688 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
15689
15690 /**
15691  * Checks if the given object is currently in the success state
15692  */
15693 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
15694
15695 /**
15696  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
15697  */
15698 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
15699
15700 /**
15701  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
15702  * but with all dynamically-allocated buffers duplicated in new buffers.
15703  */
15704 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
15705
15706 /**
15707  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
15708  */
15709 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
15710
15711 /**
15712  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
15713  */
15714 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15715
15716 /**
15717  * Checks if the given object is currently in the success state
15718  */
15719 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
15720
15721 /**
15722  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
15723  */
15724 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
15725
15726 /**
15727  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
15728  * but with all dynamically-allocated buffers duplicated in new buffers.
15729  */
15730 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
15731
15732 /**
15733  * Creates a new tuple which has the same data as `orig`
15734  * but with all dynamically-allocated buffers duplicated in new buffers.
15735  */
15736 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
15737
15738 /**
15739  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
15740  */
15741 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
15742
15743 /**
15744  * Frees any resources used by the C2Tuple_OutPointScriptZ.
15745  */
15746 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
15747
15748 /**
15749  * Creates a new tuple which has the same data as `orig`
15750  * but with all dynamically-allocated buffers duplicated in new buffers.
15751  */
15752 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
15753
15754 /**
15755  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
15756  */
15757 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
15758
15759 /**
15760  * Frees any resources used by the C2Tuple_u32ScriptZ.
15761  */
15762 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
15763
15764 /**
15765  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15766  */
15767 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
15768
15769 /**
15770  * Creates a new tuple which has the same data as `orig`
15771  * but with all dynamically-allocated buffers duplicated in new buffers.
15772  */
15773 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
15774
15775 /**
15776  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
15777  */
15778 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
15779
15780 /**
15781  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
15782  */
15783 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
15784
15785 /**
15786  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15787  */
15788 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
15789
15790 /**
15791  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15792  */
15793 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
15794
15795 /**
15796  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15797  */
15798 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
15799
15800 /**
15801  * Creates a new tuple which has the same data as `orig`
15802  * but with all dynamically-allocated buffers duplicated in new buffers.
15803  */
15804 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
15805
15806 /**
15807  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
15808  */
15809 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
15810
15811 /**
15812  * Frees any resources used by the C2Tuple_u32TxOutZ.
15813  */
15814 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
15815
15816 /**
15817  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15818  */
15819 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
15820
15821 /**
15822  * Creates a new tuple which has the same data as `orig`
15823  * but with all dynamically-allocated buffers duplicated in new buffers.
15824  */
15825 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
15826
15827 /**
15828  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
15829  */
15830 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
15831
15832 /**
15833  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
15834  */
15835 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
15836
15837 /**
15838  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15839  */
15840 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
15841
15842 /**
15843  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15844  */
15845 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
15846
15847 /**
15848  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
15849  */
15850 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
15851
15852 /**
15853  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
15854  */
15855 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
15856
15857 /**
15858  * Checks if the given object is currently in the success state
15859  */
15860 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
15861
15862 /**
15863  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
15864  */
15865 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
15866
15867 /**
15868  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
15869  */
15870 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
15871
15872 /**
15873  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
15874  */
15875 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
15876
15877 /**
15878  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15879  */
15880 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
15881
15882 /**
15883  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
15884  */
15885 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
15886
15887 /**
15888  * Constructs a new COption_NetAddressZ containing nothing
15889  */
15890 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
15891
15892 /**
15893  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
15894  */
15895 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
15896
15897 /**
15898  * Creates a new COption_NetAddressZ which has the same data as `orig`
15899  * but with all dynamically-allocated buffers duplicated in new buffers.
15900  */
15901 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
15902
15903 /**
15904  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
15905  */
15906 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
15907
15908 /**
15909  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
15910  */
15911 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15912
15913 /**
15914  * Checks if the given object is currently in the success state
15915  */
15916 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
15917
15918 /**
15919  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
15920  */
15921 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
15922
15923 /**
15924  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
15925  * but with all dynamically-allocated buffers duplicated in new buffers.
15926  */
15927 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
15928
15929 /**
15930  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
15931  */
15932 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
15933
15934 /**
15935  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
15936  */
15937 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
15938
15939 /**
15940  * Checks if the given object is currently in the success state
15941  */
15942 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
15943
15944 /**
15945  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
15946  */
15947 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
15948
15949 /**
15950  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
15951  * but with all dynamically-allocated buffers duplicated in new buffers.
15952  */
15953 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
15954
15955 /**
15956  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
15957  */
15958 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
15959
15960 /**
15961  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
15962  */
15963 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15964
15965 /**
15966  * Checks if the given object is currently in the success state
15967  */
15968 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
15969
15970 /**
15971  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
15972  */
15973 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
15974
15975 /**
15976  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
15977  * but with all dynamically-allocated buffers duplicated in new buffers.
15978  */
15979 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
15980
15981 /**
15982  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
15983  */
15984 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
15985
15986 /**
15987  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
15988  */
15989 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
15990
15991 /**
15992  * Checks if the given object is currently in the success state
15993  */
15994 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
15995
15996 /**
15997  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
15998  */
15999 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
16000
16001 /**
16002  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
16003  */
16004 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
16005
16006 /**
16007  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
16008  */
16009 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
16010
16011 /**
16012  * Checks if the given object is currently in the success state
16013  */
16014 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
16015
16016 /**
16017  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
16018  */
16019 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
16020
16021 /**
16022  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
16023  * but with all dynamically-allocated buffers duplicated in new buffers.
16024  */
16025 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
16026
16027 /**
16028  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16029  */
16030 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
16031
16032 /**
16033  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16034  */
16035 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
16036
16037 /**
16038  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16039  */
16040 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
16041
16042 /**
16043  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16044  */
16045 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
16046
16047 /**
16048  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
16049  */
16050 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
16051
16052 /**
16053  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
16054  */
16055 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
16056
16057 /**
16058  * Checks if the given object is currently in the success state
16059  */
16060 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
16061
16062 /**
16063  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
16064  */
16065 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
16066
16067 /**
16068  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
16069  * but with all dynamically-allocated buffers duplicated in new buffers.
16070  */
16071 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
16072
16073 /**
16074  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
16075  */
16076 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
16077
16078 /**
16079  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
16080  */
16081 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
16082
16083 /**
16084  * Checks if the given object is currently in the success state
16085  */
16086 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
16087
16088 /**
16089  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
16090  */
16091 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
16092
16093 /**
16094  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
16095  * but with all dynamically-allocated buffers duplicated in new buffers.
16096  */
16097 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
16098
16099 /**
16100  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
16101  */
16102 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
16103
16104 /**
16105  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
16106  */
16107 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
16108
16109 /**
16110  * Checks if the given object is currently in the success state
16111  */
16112 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
16113
16114 /**
16115  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
16116  */
16117 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
16118
16119 /**
16120  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
16121  * but with all dynamically-allocated buffers duplicated in new buffers.
16122  */
16123 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
16124
16125 /**
16126  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
16127  */
16128 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
16129
16130 /**
16131  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
16132  */
16133 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
16134
16135 /**
16136  * Checks if the given object is currently in the success state
16137  */
16138 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
16139
16140 /**
16141  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
16142  */
16143 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
16144
16145 /**
16146  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
16147  * but with all dynamically-allocated buffers duplicated in new buffers.
16148  */
16149 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
16150
16151 /**
16152  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
16153  */
16154 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
16155
16156 /**
16157  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
16158  */
16159 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
16160
16161 /**
16162  * Checks if the given object is currently in the success state
16163  */
16164 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
16165
16166 /**
16167  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
16168  */
16169 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
16170
16171 /**
16172  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
16173  * but with all dynamically-allocated buffers duplicated in new buffers.
16174  */
16175 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
16176
16177 /**
16178  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
16179  */
16180 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
16181
16182 /**
16183  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
16184  */
16185 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
16186
16187 /**
16188  * Checks if the given object is currently in the success state
16189  */
16190 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
16191
16192 /**
16193  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
16194  */
16195 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
16196
16197 /**
16198  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
16199  * but with all dynamically-allocated buffers duplicated in new buffers.
16200  */
16201 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
16202
16203 /**
16204  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
16205  */
16206 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
16207
16208 /**
16209  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
16210  */
16211 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
16212
16213 /**
16214  * Checks if the given object is currently in the success state
16215  */
16216 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
16217
16218 /**
16219  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
16220  */
16221 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
16222
16223 /**
16224  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
16225  * but with all dynamically-allocated buffers duplicated in new buffers.
16226  */
16227 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
16228
16229 /**
16230  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
16231  */
16232 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
16233
16234 /**
16235  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
16236  */
16237 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
16238
16239 /**
16240  * Checks if the given object is currently in the success state
16241  */
16242 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
16243
16244 /**
16245  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
16246  */
16247 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
16248
16249 /**
16250  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
16251  * but with all dynamically-allocated buffers duplicated in new buffers.
16252  */
16253 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
16254
16255 /**
16256  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
16257  */
16258 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
16259
16260 /**
16261  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
16262  */
16263 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
16264
16265 /**
16266  * Checks if the given object is currently in the success state
16267  */
16268 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
16269
16270 /**
16271  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
16272  */
16273 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
16274
16275 /**
16276  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
16277  * but with all dynamically-allocated buffers duplicated in new buffers.
16278  */
16279 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
16280
16281 /**
16282  * Creates a new CResult_InitDecodeErrorZ in the success state.
16283  */
16284 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
16285
16286 /**
16287  * Creates a new CResult_InitDecodeErrorZ in the error state.
16288  */
16289 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
16290
16291 /**
16292  * Checks if the given object is currently in the success state
16293  */
16294 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
16295
16296 /**
16297  * Frees any resources used by the CResult_InitDecodeErrorZ.
16298  */
16299 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
16300
16301 /**
16302  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
16303  * but with all dynamically-allocated buffers duplicated in new buffers.
16304  */
16305 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
16306
16307 /**
16308  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
16309  */
16310 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
16311
16312 /**
16313  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
16314  */
16315 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
16316
16317 /**
16318  * Checks if the given object is currently in the success state
16319  */
16320 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
16321
16322 /**
16323  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
16324  */
16325 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
16326
16327 /**
16328  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
16329  * but with all dynamically-allocated buffers duplicated in new buffers.
16330  */
16331 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
16332
16333 /**
16334  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
16335  */
16336 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
16337
16338 /**
16339  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
16340  */
16341 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
16342
16343 /**
16344  * Checks if the given object is currently in the success state
16345  */
16346 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
16347
16348 /**
16349  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
16350  */
16351 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
16352
16353 /**
16354  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
16355  * but with all dynamically-allocated buffers duplicated in new buffers.
16356  */
16357 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
16358
16359 /**
16360  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
16361  */
16362 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
16363
16364 /**
16365  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
16366  */
16367 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
16368
16369 /**
16370  * Checks if the given object is currently in the success state
16371  */
16372 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
16373
16374 /**
16375  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
16376  */
16377 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
16378
16379 /**
16380  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
16381  * but with all dynamically-allocated buffers duplicated in new buffers.
16382  */
16383 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
16384
16385 /**
16386  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
16387  */
16388 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
16389
16390 /**
16391  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
16392  */
16393 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16394
16395 /**
16396  * Checks if the given object is currently in the success state
16397  */
16398 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
16399
16400 /**
16401  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
16402  */
16403 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
16404
16405 /**
16406  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
16407  * but with all dynamically-allocated buffers duplicated in new buffers.
16408  */
16409 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
16410
16411 /**
16412  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
16413  */
16414 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
16415
16416 /**
16417  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
16418  */
16419 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16420
16421 /**
16422  * Checks if the given object is currently in the success state
16423  */
16424 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
16425
16426 /**
16427  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
16428  */
16429 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
16430
16431 /**
16432  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
16433  * but with all dynamically-allocated buffers duplicated in new buffers.
16434  */
16435 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
16436
16437 /**
16438  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16439  */
16440 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
16441
16442 /**
16443  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16444  */
16445 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
16446
16447 /**
16448  * Checks if the given object is currently in the success state
16449  */
16450 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
16451
16452 /**
16453  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16454  */
16455 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
16456
16457 /**
16458  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16459  * but with all dynamically-allocated buffers duplicated in new buffers.
16460  */
16461 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
16462
16463 /**
16464  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16465  */
16466 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
16467
16468 /**
16469  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16470  */
16471 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16472
16473 /**
16474  * Checks if the given object is currently in the success state
16475  */
16476 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
16477
16478 /**
16479  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16480  */
16481 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
16482
16483 /**
16484  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16485  * but with all dynamically-allocated buffers duplicated in new buffers.
16486  */
16487 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
16488
16489 /**
16490  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16491  */
16492 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
16493
16494 /**
16495  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16496  */
16497 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16498
16499 /**
16500  * Checks if the given object is currently in the success state
16501  */
16502 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
16503
16504 /**
16505  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16506  */
16507 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
16508
16509 /**
16510  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16511  * but with all dynamically-allocated buffers duplicated in new buffers.
16512  */
16513 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
16514
16515 /**
16516  * Creates a new CResult_PingDecodeErrorZ in the success state.
16517  */
16518 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
16519
16520 /**
16521  * Creates a new CResult_PingDecodeErrorZ in the error state.
16522  */
16523 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
16524
16525 /**
16526  * Checks if the given object is currently in the success state
16527  */
16528 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
16529
16530 /**
16531  * Frees any resources used by the CResult_PingDecodeErrorZ.
16532  */
16533 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
16534
16535 /**
16536  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16537  * but with all dynamically-allocated buffers duplicated in new buffers.
16538  */
16539 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
16540
16541 /**
16542  * Creates a new CResult_PongDecodeErrorZ in the success state.
16543  */
16544 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
16545
16546 /**
16547  * Creates a new CResult_PongDecodeErrorZ in the error state.
16548  */
16549 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
16550
16551 /**
16552  * Checks if the given object is currently in the success state
16553  */
16554 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
16555
16556 /**
16557  * Frees any resources used by the CResult_PongDecodeErrorZ.
16558  */
16559 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
16560
16561 /**
16562  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16563  * but with all dynamically-allocated buffers duplicated in new buffers.
16564  */
16565 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
16566
16567 /**
16568  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16569  */
16570 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
16571
16572 /**
16573  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16574  */
16575 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16576
16577 /**
16578  * Checks if the given object is currently in the success state
16579  */
16580 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16581
16582 /**
16583  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16584  */
16585 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
16586
16587 /**
16588  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16589  * but with all dynamically-allocated buffers duplicated in new buffers.
16590  */
16591 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16592
16593 /**
16594  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16595  */
16596 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
16597
16598 /**
16599  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16600  */
16601 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16602
16603 /**
16604  * Checks if the given object is currently in the success state
16605  */
16606 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16607
16608 /**
16609  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16610  */
16611 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
16612
16613 /**
16614  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16615  * but with all dynamically-allocated buffers duplicated in new buffers.
16616  */
16617 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16618
16619 /**
16620  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16621  */
16622 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
16623
16624 /**
16625  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16626  */
16627 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16628
16629 /**
16630  * Checks if the given object is currently in the success state
16631  */
16632 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16633
16634 /**
16635  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16636  */
16637 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
16638
16639 /**
16640  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16641  * but with all dynamically-allocated buffers duplicated in new buffers.
16642  */
16643 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16644
16645 /**
16646  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16647  */
16648 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
16649
16650 /**
16651  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16652  */
16653 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16654
16655 /**
16656  * Checks if the given object is currently in the success state
16657  */
16658 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16659
16660 /**
16661  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16662  */
16663 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
16664
16665 /**
16666  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16667  * but with all dynamically-allocated buffers duplicated in new buffers.
16668  */
16669 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16670
16671 /**
16672  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16673  */
16674 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
16675
16676 /**
16677  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16678  */
16679 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
16680
16681 /**
16682  * Checks if the given object is currently in the success state
16683  */
16684 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
16685
16686 /**
16687  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16688  */
16689 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
16690
16691 /**
16692  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16693  * but with all dynamically-allocated buffers duplicated in new buffers.
16694  */
16695 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
16696
16697 /**
16698  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16699  */
16700 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
16701
16702 /**
16703  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16704  */
16705 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
16706
16707 /**
16708  * Checks if the given object is currently in the success state
16709  */
16710 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
16711
16712 /**
16713  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16714  */
16715 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
16716
16717 /**
16718  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16719  * but with all dynamically-allocated buffers duplicated in new buffers.
16720  */
16721 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
16722
16723 /**
16724  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16725  */
16726 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
16727
16728 /**
16729  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16730  */
16731 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16732
16733 /**
16734  * Checks if the given object is currently in the success state
16735  */
16736 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16737
16738 /**
16739  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16740  */
16741 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
16742
16743 /**
16744  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16745  * but with all dynamically-allocated buffers duplicated in new buffers.
16746  */
16747 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16748
16749 /**
16750  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16751  */
16752 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
16753
16754 /**
16755  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16756  */
16757 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16758
16759 /**
16760  * Checks if the given object is currently in the success state
16761  */
16762 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16763
16764 /**
16765  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16766  */
16767 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
16768
16769 /**
16770  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16771  * but with all dynamically-allocated buffers duplicated in new buffers.
16772  */
16773 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16774
16775 /**
16776  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16777  */
16778 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
16779
16780 /**
16781  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16782  */
16783 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
16784
16785 /**
16786  * Checks if the given object is currently in the success state
16787  */
16788 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
16789
16790 /**
16791  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16792  */
16793 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
16794
16795 /**
16796  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16797  * but with all dynamically-allocated buffers duplicated in new buffers.
16798  */
16799 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
16800
16801 /**
16802  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16803  */
16804 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
16805
16806 /**
16807  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16808  */
16809 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
16810
16811 /**
16812  * Checks if the given object is currently in the success state
16813  */
16814 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
16815
16816 /**
16817  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16818  */
16819 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
16820
16821 /**
16822  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16823  * but with all dynamically-allocated buffers duplicated in new buffers.
16824  */
16825 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
16826
16827 /**
16828  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16829  */
16830 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
16831
16832 /**
16833  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16834  */
16835 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16836
16837 /**
16838  * Checks if the given object is currently in the success state
16839  */
16840 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
16841
16842 /**
16843  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16844  */
16845 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
16846
16847 /**
16848  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16849  * but with all dynamically-allocated buffers duplicated in new buffers.
16850  */
16851 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16852
16853 /**
16854  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16855  */
16856 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
16857
16858 /**
16859  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16860  */
16861 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16862
16863 /**
16864  * Checks if the given object is currently in the success state
16865  */
16866 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
16867
16868 /**
16869  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16870  */
16871 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
16872
16873 /**
16874  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16875  * but with all dynamically-allocated buffers duplicated in new buffers.
16876  */
16877 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16878
16879 /**
16880  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16881  */
16882 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
16883
16884 /**
16885  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16886  */
16887 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
16888
16889 /**
16890  * Checks if the given object is currently in the success state
16891  */
16892 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
16893
16894 /**
16895  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16896  */
16897 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
16898
16899 /**
16900  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16901  * but with all dynamically-allocated buffers duplicated in new buffers.
16902  */
16903 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
16904
16905 /**
16906  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16907  */
16908 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
16909
16910 /**
16911  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16912  */
16913 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
16914
16915 /**
16916  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16917  */
16918 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
16919
16920 /**
16921  * Checks if the given object is currently in the success state
16922  */
16923 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
16924
16925 /**
16926  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16927  */
16928 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
16929
16930 /**
16931  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16932  * but with all dynamically-allocated buffers duplicated in new buffers.
16933  */
16934 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
16935
16936 /**
16937  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16938  */
16939 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
16940
16941 /**
16942  * Constructs a new COption_FilterZ containing nothing
16943  */
16944 struct LDKCOption_FilterZ COption_FilterZ_none(void);
16945
16946 /**
16947  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16948  */
16949 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
16950
16951 /**
16952  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16953  */
16954 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
16955
16956 /**
16957  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16958  */
16959 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
16960
16961 /**
16962  * Checks if the given object is currently in the success state
16963  */
16964 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
16965
16966 /**
16967  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16968  */
16969 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
16970
16971 /**
16972  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16973  */
16974 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
16975
16976 /**
16977  * Frees any resources used by the PaymentPurpose
16978  */
16979 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
16980
16981 /**
16982  * Creates a copy of the PaymentPurpose
16983  */
16984 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
16985
16986 /**
16987  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
16988  */
16989 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
16990
16991 /**
16992  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
16993  */
16994 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
16995
16996 /**
16997  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
16998  */
16999 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
17000
17001 /**
17002  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
17003  */
17004 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
17005
17006 /**
17007  * Frees any resources used by the ClosureReason
17008  */
17009 void ClosureReason_free(struct LDKClosureReason this_ptr);
17010
17011 /**
17012  * Creates a copy of the ClosureReason
17013  */
17014 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
17015
17016 /**
17017  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
17018  */
17019 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
17020
17021 /**
17022  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
17023  */
17024 struct LDKClosureReason ClosureReason_holder_force_closed(void);
17025
17026 /**
17027  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
17028  */
17029 struct LDKClosureReason ClosureReason_cooperative_closure(void);
17030
17031 /**
17032  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
17033  */
17034 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
17035
17036 /**
17037  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
17038  */
17039 struct LDKClosureReason ClosureReason_funding_timed_out(void);
17040
17041 /**
17042  * Utility method to constructs a new ProcessingError-variant ClosureReason
17043  */
17044 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
17045
17046 /**
17047  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
17048  */
17049 struct LDKClosureReason ClosureReason_disconnected_peer(void);
17050
17051 /**
17052  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
17053  */
17054 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
17055
17056 /**
17057  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
17058  */
17059 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
17060
17061 /**
17062  * Read a ClosureReason from a byte array, created by ClosureReason_write
17063  */
17064 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
17065
17066 /**
17067  * Frees any resources used by the Event
17068  */
17069 void Event_free(struct LDKEvent this_ptr);
17070
17071 /**
17072  * Creates a copy of the Event
17073  */
17074 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
17075
17076 /**
17077  * Utility method to constructs a new FundingGenerationReady-variant Event
17078  */
17079 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);
17080
17081 /**
17082  * Utility method to constructs a new PaymentReceived-variant Event
17083  */
17084 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
17085
17086 /**
17087  * Utility method to constructs a new PaymentClaimed-variant Event
17088  */
17089 struct LDKEvent Event_payment_claimed(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
17090
17091 /**
17092  * Utility method to constructs a new PaymentSent-variant Event
17093  */
17094 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
17095
17096 /**
17097  * Utility method to constructs a new PaymentFailed-variant Event
17098  */
17099 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
17100
17101 /**
17102  * Utility method to constructs a new PaymentPathSuccessful-variant Event
17103  */
17104 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
17105
17106 /**
17107  * Utility method to constructs a new PaymentPathFailed-variant Event
17108  */
17109 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);
17110
17111 /**
17112  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
17113  */
17114 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
17115
17116 /**
17117  * Utility method to constructs a new SpendableOutputs-variant Event
17118  */
17119 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
17120
17121 /**
17122  * Utility method to constructs a new PaymentForwarded-variant Event
17123  */
17124 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);
17125
17126 /**
17127  * Utility method to constructs a new ChannelClosed-variant Event
17128  */
17129 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
17130
17131 /**
17132  * Utility method to constructs a new DiscardFunding-variant Event
17133  */
17134 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
17135
17136 /**
17137  * Utility method to constructs a new OpenChannelRequest-variant Event
17138  */
17139 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);
17140
17141 /**
17142  * Serialize the Event object into a byte array which can be read by Event_read
17143  */
17144 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
17145
17146 /**
17147  * Read a Event from a byte array, created by Event_write
17148  */
17149 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
17150
17151 /**
17152  * Frees any resources used by the MessageSendEvent
17153  */
17154 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
17155
17156 /**
17157  * Creates a copy of the MessageSendEvent
17158  */
17159 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
17160
17161 /**
17162  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
17163  */
17164 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
17165
17166 /**
17167  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
17168  */
17169 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
17170
17171 /**
17172  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
17173  */
17174 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
17175
17176 /**
17177  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
17178  */
17179 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
17180
17181 /**
17182  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
17183  */
17184 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
17185
17186 /**
17187  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
17188  */
17189 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
17190
17191 /**
17192  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
17193  */
17194 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
17195
17196 /**
17197  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
17198  */
17199 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
17200
17201 /**
17202  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
17203  */
17204 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
17205
17206 /**
17207  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
17208  */
17209 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
17210
17211 /**
17212  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
17213  */
17214 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
17215
17216 /**
17217  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
17218  */
17219 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
17220
17221 /**
17222  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
17223  */
17224 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
17225
17226 /**
17227  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
17228  */
17229 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
17230
17231 /**
17232  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
17233  */
17234 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
17235
17236 /**
17237  * Utility method to constructs a new HandleError-variant MessageSendEvent
17238  */
17239 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
17240
17241 /**
17242  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
17243  */
17244 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
17245
17246 /**
17247  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
17248  */
17249 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
17250
17251 /**
17252  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
17253  */
17254 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
17255
17256 /**
17257  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
17258  */
17259 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
17260
17261 /**
17262  * Calls the free function if one is set
17263  */
17264 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
17265
17266 /**
17267  * Calls the free function if one is set
17268  */
17269 void EventsProvider_free(struct LDKEventsProvider this_ptr);
17270
17271 /**
17272  * Calls the free function if one is set
17273  */
17274 void EventHandler_free(struct LDKEventHandler this_ptr);
17275
17276 /**
17277  * Frees any resources used by the APIError
17278  */
17279 void APIError_free(struct LDKAPIError this_ptr);
17280
17281 /**
17282  * Creates a copy of the APIError
17283  */
17284 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
17285
17286 /**
17287  * Utility method to constructs a new APIMisuseError-variant APIError
17288  */
17289 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
17290
17291 /**
17292  * Utility method to constructs a new FeeRateTooHigh-variant APIError
17293  */
17294 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
17295
17296 /**
17297  * Utility method to constructs a new RouteError-variant APIError
17298  */
17299 struct LDKAPIError APIError_route_error(struct LDKStr err);
17300
17301 /**
17302  * Utility method to constructs a new ChannelUnavailable-variant APIError
17303  */
17304 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
17305
17306 /**
17307  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
17308  */
17309 struct LDKAPIError APIError_monitor_update_failed(void);
17310
17311 /**
17312  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
17313  */
17314 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
17315
17316 /**
17317  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
17318  */
17319 void BigSize_free(struct LDKBigSize this_obj);
17320
17321 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
17322
17323 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
17324
17325 /**
17326  * Constructs a new BigSize given each field
17327  */
17328 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
17329
17330 /**
17331  * Creates a digital signature of a message given a SecretKey, like the node's secret.
17332  * 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.
17333  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
17334  */
17335 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
17336
17337 /**
17338  * Recovers the PublicKey of the signer of the message given the message and the signature.
17339  */
17340 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
17341
17342 /**
17343  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
17344  * and the PublicKey.
17345  */
17346 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
17347
17348 /**
17349  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
17350  */
17351 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
17352
17353 /**
17354  * Calls the free function if one is set
17355  */
17356 void Persister_free(struct LDKPersister this_ptr);
17357
17358 /**
17359  * Creates a copy of the Level
17360  */
17361 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
17362
17363 /**
17364  * Utility method to constructs a new Gossip-variant Level
17365  */
17366 enum LDKLevel Level_gossip(void);
17367
17368 /**
17369  * Utility method to constructs a new Trace-variant Level
17370  */
17371 enum LDKLevel Level_trace(void);
17372
17373 /**
17374  * Utility method to constructs a new Debug-variant Level
17375  */
17376 enum LDKLevel Level_debug(void);
17377
17378 /**
17379  * Utility method to constructs a new Info-variant Level
17380  */
17381 enum LDKLevel Level_info(void);
17382
17383 /**
17384  * Utility method to constructs a new Warn-variant Level
17385  */
17386 enum LDKLevel Level_warn(void);
17387
17388 /**
17389  * Utility method to constructs a new Error-variant Level
17390  */
17391 enum LDKLevel Level_error(void);
17392
17393 /**
17394  * Checks if two Levels contain equal inner contents.
17395  * This ignores pointers and is_owned flags and looks at the values in fields.
17396  */
17397 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
17398
17399 /**
17400  * Checks if two Levels contain equal inner contents.
17401  */
17402 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
17403
17404 /**
17405  * Returns the most verbose logging level.
17406  */
17407 MUST_USE_RES enum LDKLevel Level_max(void);
17408
17409 /**
17410  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
17411  */
17412 void Record_free(struct LDKRecord this_obj);
17413
17414 /**
17415  * The verbosity level of the message.
17416  */
17417 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
17418
17419 /**
17420  * The verbosity level of the message.
17421  */
17422 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
17423
17424 /**
17425  * The message body.
17426  */
17427 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
17428
17429 /**
17430  * The message body.
17431  */
17432 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17433
17434 /**
17435  * The module path of the message.
17436  */
17437 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
17438
17439 /**
17440  * The module path of the message.
17441  */
17442 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17443
17444 /**
17445  * The source file containing the message.
17446  */
17447 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
17448
17449 /**
17450  * The source file containing the message.
17451  */
17452 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17453
17454 /**
17455  * The line containing the message.
17456  */
17457 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
17458
17459 /**
17460  * The line containing the message.
17461  */
17462 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
17463
17464 /**
17465  * Creates a copy of the Record
17466  */
17467 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
17468
17469 /**
17470  * Calls the free function if one is set
17471  */
17472 void Logger_free(struct LDKLogger this_ptr);
17473
17474 /**
17475  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
17476  */
17477 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
17478
17479 /**
17480  * Confirmations we will wait for before considering the channel locked in.
17481  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
17482  * equivalent limit applied to outbound channels).
17483  *
17484  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
17485  * transaction before operation. If you wish to accept channels with zero confirmations, see
17486  * [`UserConfig::manually_accept_inbound_channels`] and
17487  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
17488  *
17489  * Default value: 6.
17490  *
17491  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
17492  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
17493  */
17494 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17495
17496 /**
17497  * Confirmations we will wait for before considering the channel locked in.
17498  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
17499  * equivalent limit applied to outbound channels).
17500  *
17501  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
17502  * transaction before operation. If you wish to accept channels with zero confirmations, see
17503  * [`UserConfig::manually_accept_inbound_channels`] and
17504  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
17505  *
17506  * Default value: 6.
17507  *
17508  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
17509  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
17510  */
17511 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
17512
17513 /**
17514  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
17515  * the number of blocks we have to punish our counterparty if they broadcast a revoked
17516  * transaction).
17517  *
17518  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
17519  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
17520  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
17521  * possibly with time in between to RBF the spending transaction).
17522  *
17523  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
17524  * case of an honest unilateral channel close, which implicitly decrease the economic value of
17525  * our channel.
17526  *
17527  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
17528  * can tweak config to ask for more security, not less.
17529  */
17530 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17531
17532 /**
17533  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
17534  * the number of blocks we have to punish our counterparty if they broadcast a revoked
17535  * transaction).
17536  *
17537  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
17538  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
17539  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
17540  * possibly with time in between to RBF the spending transaction).
17541  *
17542  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
17543  * case of an honest unilateral channel close, which implicitly decrease the economic value of
17544  * our channel.
17545  *
17546  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
17547  * can tweak config to ask for more security, not less.
17548  */
17549 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
17550
17551 /**
17552  * Set to the smallest value HTLC we will accept to process.
17553  *
17554  * This value is sent to our counterparty on channel-open and we close the channel any time
17555  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
17556  *
17557  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
17558  * by the protocol.
17559  */
17560 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17561
17562 /**
17563  * Set to the smallest value HTLC we will accept to process.
17564  *
17565  * This value is sent to our counterparty on channel-open and we close the channel any time
17566  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
17567  *
17568  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
17569  * by the protocol.
17570  */
17571 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
17572
17573 /**
17574  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
17575  * HTLCs to.
17576  *
17577  * This can be set to a value between 1-100, where the value corresponds to the percent of the
17578  * channel value in whole percentages.
17579  *
17580  * Note that:
17581  * * If configured to another value than the default value 10, any new channels created with
17582  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
17583  * `ChannelManager`.
17584  *
17585  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
17586  * no way to configure the cap for the total value of outbound HTLCs in-flight.
17587  *
17588  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
17589  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
17590  * restrict exposure to loss due to being offline for too long.
17591  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
17592  * for more information.
17593  *
17594  * Default value: 10.
17595  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
17596  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
17597  */
17598 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17599
17600 /**
17601  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
17602  * HTLCs to.
17603  *
17604  * This can be set to a value between 1-100, where the value corresponds to the percent of the
17605  * channel value in whole percentages.
17606  *
17607  * Note that:
17608  * * If configured to another value than the default value 10, any new channels created with
17609  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
17610  * `ChannelManager`.
17611  *
17612  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
17613  * no way to configure the cap for the total value of outbound HTLCs in-flight.
17614  *
17615  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
17616  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
17617  * restrict exposure to loss due to being offline for too long.
17618  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
17619  * for more information.
17620  *
17621  * Default value: 10.
17622  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
17623  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
17624  */
17625 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
17626
17627 /**
17628  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
17629  * BOLTs) option for outbound private channels. This provides better privacy by not including
17630  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
17631  * relay HTLCs to us using the channel's SCID alias.
17632  *
17633  * If this option is set, channels may be created that will not be readable by LDK versions
17634  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
17635  * [`DecodeError:InvalidValue`].
17636  *
17637  * Note that setting this to true does *not* prevent us from opening channels with
17638  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
17639  * private channel without that option.
17640  *
17641  * Ignored if the channel is negotiated to be announced, see
17642  * [`ChannelConfig::announced_channel`] and
17643  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
17644  *
17645  * Default value: false. This value is likely to change to true in the future.
17646  *
17647  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17648  * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
17649  */
17650 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17651
17652 /**
17653  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
17654  * BOLTs) option for outbound private channels. This provides better privacy by not including
17655  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
17656  * relay HTLCs to us using the channel's SCID alias.
17657  *
17658  * If this option is set, channels may be created that will not be readable by LDK versions
17659  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
17660  * [`DecodeError:InvalidValue`].
17661  *
17662  * Note that setting this to true does *not* prevent us from opening channels with
17663  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
17664  * private channel without that option.
17665  *
17666  * Ignored if the channel is negotiated to be announced, see
17667  * [`ChannelConfig::announced_channel`] and
17668  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
17669  *
17670  * Default value: false. This value is likely to change to true in the future.
17671  *
17672  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17673  * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
17674  */
17675 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
17676
17677 /**
17678  * Constructs a new ChannelHandshakeConfig given each field
17679  */
17680 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);
17681
17682 /**
17683  * Creates a copy of the ChannelHandshakeConfig
17684  */
17685 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
17686
17687 /**
17688  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
17689  */
17690 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
17691
17692 /**
17693  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
17694  */
17695 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
17696
17697 /**
17698  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
17699  * only applies to inbound channels.
17700  *
17701  * Default value: 0.
17702  */
17703 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17704
17705 /**
17706  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
17707  * only applies to inbound channels.
17708  *
17709  * Default value: 0.
17710  */
17711 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17712
17713 /**
17714  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
17715  * only applies to inbound channels.
17716  *
17717  * Default value: 2^24 - 1.
17718  */
17719 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17720
17721 /**
17722  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
17723  * only applies to inbound channels.
17724  *
17725  * Default value: 2^24 - 1.
17726  */
17727 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17728
17729 /**
17730  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
17731  * you to limit the maximum minimum-size they can require.
17732  *
17733  * Default value: u64::max_value.
17734  */
17735 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17736
17737 /**
17738  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
17739  * you to limit the maximum minimum-size they can require.
17740  *
17741  * Default value: u64::max_value.
17742  */
17743 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17744
17745 /**
17746  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17747  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17748  *
17749  * Default value: 0.
17750  */
17751 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17752
17753 /**
17754  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17755  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17756  *
17757  * Default value: 0.
17758  */
17759 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17760
17761 /**
17762  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17763  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17764  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17765  *
17766  * Default value: u64::max_value.
17767  */
17768 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17769
17770 /**
17771  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17772  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17773  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17774  *
17775  * Default value: u64::max_value.
17776  */
17777 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17778
17779 /**
17780  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17781  * time. This allows you to set a minimum such value.
17782  *
17783  * Default value: 0.
17784  */
17785 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17786
17787 /**
17788  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17789  * time. This allows you to set a minimum such value.
17790  *
17791  * Default value: 0.
17792  */
17793 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17794
17795 /**
17796  * Before a channel is usable the funding transaction will need to be confirmed by at least a
17797  * certain number of blocks, specified by the node which is not the funder (as the funder can
17798  * assume they aren't going to double-spend themselves).
17799  * This config allows you to set a limit on the maximum amount of time to wait.
17800  *
17801  * Default value: 144, or roughly one day and only applies to outbound channels.
17802  */
17803 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17804
17805 /**
17806  * Before a channel is usable the funding transaction will need to be confirmed by at least a
17807  * certain number of blocks, specified by the node which is not the funder (as the funder can
17808  * assume they aren't going to double-spend themselves).
17809  * This config allows you to set a limit on the maximum amount of time to wait.
17810  *
17811  * Default value: 144, or roughly one day and only applies to outbound channels.
17812  */
17813 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
17814
17815 /**
17816  * Whether we implicitly trust funding transactions generated by us for our own outbound
17817  * channels to not be double-spent.
17818  *
17819  * If this is set, we assume that our own funding transactions are *never* double-spent, and
17820  * thus we can trust them without any confirmations. This is generally a reasonable
17821  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
17822  * control of the signing keys).
17823  *
17824  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
17825  * double-spend the funding transaction to RBF with an alternative channel open.
17826  *
17827  * This only applies if our counterparty set their confirmations-required value to 0, and we
17828  * always trust our own funding transaction at 1 confirmation irrespective of this value.
17829  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
17830  * `true` (0) and `false` (1).
17831  *
17832  * Default value: true
17833  */
17834 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17835
17836 /**
17837  * Whether we implicitly trust funding transactions generated by us for our own outbound
17838  * channels to not be double-spent.
17839  *
17840  * If this is set, we assume that our own funding transactions are *never* double-spent, and
17841  * thus we can trust them without any confirmations. This is generally a reasonable
17842  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
17843  * control of the signing keys).
17844  *
17845  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
17846  * double-spend the funding transaction to RBF with an alternative channel open.
17847  *
17848  * This only applies if our counterparty set their confirmations-required value to 0, and we
17849  * always trust our own funding transaction at 1 confirmation irrespective of this value.
17850  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
17851  * `true` (0) and `false` (1).
17852  *
17853  * Default value: true
17854  */
17855 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
17856
17857 /**
17858  * Set to force an incoming channel to match our announced channel preference in
17859  * [`ChannelConfig::announced_channel`].
17860  *
17861  * For a node which is not online reliably, this should be set to true and
17862  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
17863  * channels will ever be opened.
17864  *
17865  * Default value: true.
17866  */
17867 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17868
17869 /**
17870  * Set to force an incoming channel to match our announced channel preference in
17871  * [`ChannelConfig::announced_channel`].
17872  *
17873  * For a node which is not online reliably, this should be set to true and
17874  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
17875  * channels will ever be opened.
17876  *
17877  * Default value: true.
17878  */
17879 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
17880
17881 /**
17882  * Set to the amount of time we're willing to wait to claim money back to us.
17883  *
17884  * Not checking this value would be a security issue, as our peer would be able to set it to
17885  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17886  *
17887  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17888  * reduce the loss of having useless locked funds (if your peer accepts)
17889  */
17890 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17891
17892 /**
17893  * Set to the amount of time we're willing to wait to claim money back to us.
17894  *
17895  * Not checking this value would be a security issue, as our peer would be able to set it to
17896  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17897  *
17898  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17899  * reduce the loss of having useless locked funds (if your peer accepts)
17900  */
17901 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17902
17903 /**
17904  * Constructs a new ChannelHandshakeLimits given each field
17905  */
17906 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);
17907
17908 /**
17909  * Creates a copy of the ChannelHandshakeLimits
17910  */
17911 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
17912
17913 /**
17914  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
17915  */
17916 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
17917
17918 /**
17919  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
17920  */
17921 void ChannelConfig_free(struct LDKChannelConfig this_obj);
17922
17923 /**
17924  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17925  * over the channel.
17926  * This may be allowed to change at runtime in a later update, however doing so must result in
17927  * update messages sent to notify all nodes of our updated relay fee.
17928  *
17929  * Default value: 0.
17930  */
17931 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17932
17933 /**
17934  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17935  * over the channel.
17936  * This may be allowed to change at runtime in a later update, however doing so must result in
17937  * update messages sent to notify all nodes of our updated relay fee.
17938  *
17939  * Default value: 0.
17940  */
17941 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17942
17943 /**
17944  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17945  * excess of [`forwarding_fee_proportional_millionths`].
17946  * This may be allowed to change at runtime in a later update, however doing so must result in
17947  * update messages sent to notify all nodes of our updated relay fee.
17948  *
17949  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17950  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17951  * this node.
17952  *
17953  * Default value: 1000.
17954  *
17955  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17956  */
17957 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17958
17959 /**
17960  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17961  * excess of [`forwarding_fee_proportional_millionths`].
17962  * This may be allowed to change at runtime in a later update, however doing so must result in
17963  * update messages sent to notify all nodes of our updated relay fee.
17964  *
17965  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17966  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17967  * this node.
17968  *
17969  * Default value: 1000.
17970  *
17971  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17972  */
17973 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17974
17975 /**
17976  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17977  * the channel this config applies to.
17978  *
17979  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17980  * HTLC balance when a channel appears on-chain whereas
17981  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17982  * (non-HTLC-encumbered) balance.
17983  *
17984  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17985  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17986  * commitment transaction at least once per this many blocks (minus some margin to allow us
17987  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17988  * the spending transaction).
17989  *
17990  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17991  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17992  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17993  *
17994  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17995  */
17996 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17997
17998 /**
17999  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
18000  * the channel this config applies to.
18001  *
18002  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
18003  * HTLC balance when a channel appears on-chain whereas
18004  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
18005  * (non-HTLC-encumbered) balance.
18006  *
18007  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
18008  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
18009  * commitment transaction at least once per this many blocks (minus some margin to allow us
18010  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
18011  * the spending transaction).
18012  *
18013  * Default value: 72 (12 hours at an average of 6 blocks/hour).
18014  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
18015  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
18016  *
18017  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
18018  */
18019 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
18020
18021 /**
18022  * Set to announce the channel publicly and notify all nodes that they can route via this
18023  * channel.
18024  *
18025  * This should only be set to true for nodes which expect to be online reliably.
18026  *
18027  * As the node which funds a channel picks this value this will only apply for new outbound
18028  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
18029  *
18030  * This cannot be changed after the initial channel handshake.
18031  *
18032  * Default value: false.
18033  */
18034 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18035
18036 /**
18037  * Set to announce the channel publicly and notify all nodes that they can route via this
18038  * channel.
18039  *
18040  * This should only be set to true for nodes which expect to be online reliably.
18041  *
18042  * As the node which funds a channel picks this value this will only apply for new outbound
18043  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
18044  *
18045  * This cannot be changed after the initial channel handshake.
18046  *
18047  * Default value: false.
18048  */
18049 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
18050
18051 /**
18052  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
18053  * supports it, they will then enforce the mutual-close output to us matches what we provided
18054  * at intialization, preventing us from closing to an alternate pubkey.
18055  *
18056  * This is set to true by default to provide a slight increase in security, though ultimately
18057  * any attacker who is able to take control of a channel can just as easily send the funds via
18058  * lightning payments, so we never require that our counterparties support this option.
18059  *
18060  * This cannot be changed after a channel has been initialized.
18061  *
18062  * Default value: true.
18063  */
18064 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18065
18066 /**
18067  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
18068  * supports it, they will then enforce the mutual-close output to us matches what we provided
18069  * at intialization, preventing us from closing to an alternate pubkey.
18070  *
18071  * This is set to true by default to provide a slight increase in security, though ultimately
18072  * any attacker who is able to take control of a channel can just as easily send the funds via
18073  * lightning payments, so we never require that our counterparties support this option.
18074  *
18075  * This cannot be changed after a channel has been initialized.
18076  *
18077  * Default value: true.
18078  */
18079 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
18080
18081 /**
18082  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
18083  * small to claim on-chain.
18084  *
18085  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
18086  * not be claimable on-chain, instead being turned into additional miner fees if either
18087  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
18088  * to such payments may be sustantial if there are many dust HTLCs present when the
18089  * channel is force-closed.
18090  *
18091  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
18092  * exposure across all three types per-channel. Setting this too low may prevent the
18093  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
18094  * important to prevent stealing of dust HTLCs by miners.
18095  *
18096  * Default value: 5_000_000 msat.
18097  */
18098 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18099
18100 /**
18101  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
18102  * small to claim on-chain.
18103  *
18104  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
18105  * not be claimable on-chain, instead being turned into additional miner fees if either
18106  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
18107  * to such payments may be sustantial if there are many dust HTLCs present when the
18108  * channel is force-closed.
18109  *
18110  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
18111  * exposure across all three types per-channel. Setting this too low may prevent the
18112  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
18113  * important to prevent stealing of dust HTLCs by miners.
18114  *
18115  * Default value: 5_000_000 msat.
18116  */
18117 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
18118
18119 /**
18120  * The additional fee we're willing to pay to avoid waiting for the counterparty's
18121  * `to_self_delay` to reclaim funds.
18122  *
18123  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
18124  * closing transaction which both sides find acceptable, ultimately paid by the channel
18125  * funder/initiator.
18126  *
18127  * When we are the funder, because we have to pay the channel closing fee, we bound the
18128  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
18129  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
18130  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
18131  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
18132  * funds.
18133  *
18134  * When we are not the funder, we require the closing transaction fee pay at least our
18135  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
18136  * Thus, this value is ignored when we are not the funder.
18137  *
18138  * Default value: 1000 satoshis.
18139  *
18140  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
18141  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
18142  */
18143 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18144
18145 /**
18146  * The additional fee we're willing to pay to avoid waiting for the counterparty's
18147  * `to_self_delay` to reclaim funds.
18148  *
18149  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
18150  * closing transaction which both sides find acceptable, ultimately paid by the channel
18151  * funder/initiator.
18152  *
18153  * When we are the funder, because we have to pay the channel closing fee, we bound the
18154  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
18155  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
18156  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
18157  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
18158  * funds.
18159  *
18160  * When we are not the funder, we require the closing transaction fee pay at least our
18161  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
18162  * Thus, this value is ignored when we are not the funder.
18163  *
18164  * Default value: 1000 satoshis.
18165  *
18166  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
18167  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
18168  */
18169 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
18170
18171 /**
18172  * Constructs a new ChannelConfig given each field
18173  */
18174 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
18175
18176 /**
18177  * Creates a copy of the ChannelConfig
18178  */
18179 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
18180
18181 /**
18182  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
18183  */
18184 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
18185
18186 /**
18187  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
18188  */
18189 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
18190
18191 /**
18192  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
18193  */
18194 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
18195
18196 /**
18197  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
18198  */
18199 void UserConfig_free(struct LDKUserConfig this_obj);
18200
18201 /**
18202  * Channel config that we propose to our counterparty.
18203  */
18204 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18205
18206 /**
18207  * Channel config that we propose to our counterparty.
18208  */
18209 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
18210
18211 /**
18212  * Limits applied to our counterparty's proposed channel config settings.
18213  */
18214 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18215
18216 /**
18217  * Limits applied to our counterparty's proposed channel config settings.
18218  */
18219 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
18220
18221 /**
18222  * Channel config which affects behavior during channel lifetime.
18223  */
18224 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18225
18226 /**
18227  * Channel config which affects behavior during channel lifetime.
18228  */
18229 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
18230
18231 /**
18232  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
18233  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
18234  * node which is not online reliably.
18235  *
18236  * For nodes which are not online reliably, you should set all channels to *not* be announced
18237  * (using [`ChannelConfig::announced_channel`] and
18238  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
18239  * ensure you are not exposed to any forwarding risk.
18240  *
18241  * Note that because you cannot change a channel's announced state after creation, there is no
18242  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
18243  * from a publicly-announced forwarding node to a private non-forwarding node you must close
18244  * all your channels and open new ones. For privacy, you should also change your node_id
18245  * (swapping all private and public key material for new ones) at that time.
18246  *
18247  * Default value: false.
18248  */
18249 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18250
18251 /**
18252  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
18253  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
18254  * node which is not online reliably.
18255  *
18256  * For nodes which are not online reliably, you should set all channels to *not* be announced
18257  * (using [`ChannelConfig::announced_channel`] and
18258  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
18259  * ensure you are not exposed to any forwarding risk.
18260  *
18261  * Note that because you cannot change a channel's announced state after creation, there is no
18262  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
18263  * from a publicly-announced forwarding node to a private non-forwarding node you must close
18264  * all your channels and open new ones. For privacy, you should also change your node_id
18265  * (swapping all private and public key material for new ones) at that time.
18266  *
18267  * Default value: false.
18268  */
18269 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18270
18271 /**
18272  * If this is set to false, we do not accept inbound requests to open a new channel.
18273  * Default value: true.
18274  */
18275 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18276
18277 /**
18278  * If this is set to false, we do not accept inbound requests to open a new channel.
18279  * Default value: true.
18280  */
18281 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18282
18283 /**
18284  * If this is set to true, the user needs to manually accept inbound requests to open a new
18285  * channel.
18286  *
18287  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
18288  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
18289  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
18290  * user explicitly chooses to accept the request.
18291  *
18292  * Default value: false.
18293  *
18294  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
18295  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
18296  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
18297  */
18298 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18299
18300 /**
18301  * If this is set to true, the user needs to manually accept inbound requests to open a new
18302  * channel.
18303  *
18304  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
18305  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
18306  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
18307  * user explicitly chooses to accept the request.
18308  *
18309  * Default value: false.
18310  *
18311  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
18312  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
18313  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
18314  */
18315 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18316
18317 /**
18318  * Constructs a new UserConfig given each field
18319  */
18320 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg);
18321
18322 /**
18323  * Creates a copy of the UserConfig
18324  */
18325 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
18326
18327 /**
18328  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
18329  */
18330 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
18331
18332 /**
18333  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
18334  */
18335 void BestBlock_free(struct LDKBestBlock this_obj);
18336
18337 /**
18338  * Creates a copy of the BestBlock
18339  */
18340 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
18341
18342 /**
18343  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
18344  * network.
18345  */
18346 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
18347
18348 /**
18349  * Returns a `BestBlock` as identified by the given block hash and height.
18350  */
18351 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
18352
18353 /**
18354  * Returns the best block hash.
18355  */
18356 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
18357
18358 /**
18359  * Returns the best block height.
18360  */
18361 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
18362
18363 /**
18364  * Creates a copy of the AccessError
18365  */
18366 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
18367
18368 /**
18369  * Utility method to constructs a new UnknownChain-variant AccessError
18370  */
18371 enum LDKAccessError AccessError_unknown_chain(void);
18372
18373 /**
18374  * Utility method to constructs a new UnknownTx-variant AccessError
18375  */
18376 enum LDKAccessError AccessError_unknown_tx(void);
18377
18378 /**
18379  * Calls the free function if one is set
18380  */
18381 void Access_free(struct LDKAccess this_ptr);
18382
18383 /**
18384  * Calls the free function if one is set
18385  */
18386 void Listen_free(struct LDKListen this_ptr);
18387
18388 /**
18389  * Calls the free function if one is set
18390  */
18391 void Confirm_free(struct LDKConfirm this_ptr);
18392
18393 /**
18394  * Creates a copy of the ChannelMonitorUpdateErr
18395  */
18396 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
18397
18398 /**
18399  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
18400  */
18401 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
18402
18403 /**
18404  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
18405  */
18406 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
18407
18408 /**
18409  * Calls the free function if one is set
18410  */
18411 void Watch_free(struct LDKWatch this_ptr);
18412
18413 /**
18414  * Calls the free function if one is set
18415  */
18416 void Filter_free(struct LDKFilter this_ptr);
18417
18418 /**
18419  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
18420  */
18421 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
18422
18423 /**
18424  * First block where the transaction output may have been spent.
18425  *
18426  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18427  */
18428 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18429
18430 /**
18431  * First block where the transaction output may have been spent.
18432  *
18433  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18434  */
18435 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18436
18437 /**
18438  * Outpoint identifying the transaction output.
18439  */
18440 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18441
18442 /**
18443  * Outpoint identifying the transaction output.
18444  */
18445 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18446
18447 /**
18448  * Spending condition of the transaction output.
18449  */
18450 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18451
18452 /**
18453  * Spending condition of the transaction output.
18454  */
18455 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
18456
18457 /**
18458  * Constructs a new WatchedOutput given each field
18459  */
18460 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
18461
18462 /**
18463  * Creates a copy of the WatchedOutput
18464  */
18465 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
18466
18467 /**
18468  * Checks if two WatchedOutputs contain equal inner contents.
18469  */
18470 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
18471
18472 /**
18473  * Calls the free function if one is set
18474  */
18475 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
18476
18477 /**
18478  * Creates a copy of the ConfirmationTarget
18479  */
18480 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
18481
18482 /**
18483  * Utility method to constructs a new Background-variant ConfirmationTarget
18484  */
18485 enum LDKConfirmationTarget ConfirmationTarget_background(void);
18486
18487 /**
18488  * Utility method to constructs a new Normal-variant ConfirmationTarget
18489  */
18490 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
18491
18492 /**
18493  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
18494  */
18495 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
18496
18497 /**
18498  * Checks if two ConfirmationTargets contain equal inner contents.
18499  * This ignores pointers and is_owned flags and looks at the values in fields.
18500  */
18501 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
18502
18503 /**
18504  * Calls the free function if one is set
18505  */
18506 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
18507
18508 /**
18509  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
18510  */
18511 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
18512
18513 /**
18514  * Creates a copy of the MonitorUpdateId
18515  */
18516 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
18517
18518 /**
18519  * Checks if two MonitorUpdateIds contain equal inner contents.
18520  */
18521 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
18522
18523 /**
18524  * Checks if two MonitorUpdateIds contain equal inner contents.
18525  * This ignores pointers and is_owned flags and looks at the values in fields.
18526  * Two objects with NULL inner values will be considered "equal" here.
18527  */
18528 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
18529
18530 /**
18531  * Calls the free function if one is set
18532  */
18533 void Persist_free(struct LDKPersist this_ptr);
18534
18535 /**
18536  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
18537  */
18538 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
18539
18540 /**
18541  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
18542  */
18543 void ChainMonitor_free(struct LDKChainMonitor this_obj);
18544
18545 /**
18546  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
18547  *
18548  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
18549  * will call back to it indicating transactions and outputs of interest. This allows clients to
18550  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
18551  * always need to fetch full blocks absent another means for determining which blocks contain
18552  * transactions relevant to the watched channels.
18553  */
18554 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
18555
18556 /**
18557  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
18558  * claims which are awaiting confirmation.
18559  *
18560  * Includes the balances from each [`ChannelMonitor`] *except* those included in
18561  * `ignored_channels`, allowing you to filter out balances from channels which are still open
18562  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
18563  *
18564  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
18565  * inclusion in the return value.
18566  */
18567 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
18568
18569 /**
18570  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
18571  * such [`ChannelMonitor`] is currently being monitored for.
18572  *
18573  * Note that the result holds a mutex over our monitor set, and should not be held
18574  * indefinitely.
18575  */
18576 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
18577
18578 /**
18579  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
18580  *
18581  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
18582  * monitoring for on-chain state resolutions.
18583  */
18584 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18585
18586 /**
18587  * Indicates the persistence of a [`ChannelMonitor`] has completed after
18588  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
18589  *
18590  * Thus, the anticipated use is, at a high level:
18591  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
18592  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
18593  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
18594  *  2) once all remote copies are updated, you call this function with the
18595  *     `completed_update_id` that completed, and once all pending updates have completed the
18596  *     channel will be re-enabled.
18597  *
18598  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
18599  * registered [`ChannelMonitor`]s.
18600  */
18601 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);
18602
18603 /**
18604  * Constructs a new Listen which calls the relevant methods on this_arg.
18605  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
18606  */
18607 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18608
18609 /**
18610  * Constructs a new Confirm which calls the relevant methods on this_arg.
18611  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
18612  */
18613 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18614
18615 /**
18616  * Constructs a new Watch which calls the relevant methods on this_arg.
18617  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
18618  */
18619 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18620
18621 /**
18622  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
18623  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
18624  */
18625 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18626
18627 /**
18628  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
18629  */
18630 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
18631
18632 /**
18633  * The sequence number of this update. Updates *must* be replayed in-order according to this
18634  * sequence number (and updates may panic if they are not). The update_id values are strictly
18635  * increasing and increase by one for each new update, with one exception specified below.
18636  *
18637  * This sequence number is also used to track up to which points updates which returned
18638  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
18639  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
18640  *
18641  * The only instance where update_id values are not strictly increasing is the case where we
18642  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
18643  * its docs for more details.
18644  */
18645 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
18646
18647 /**
18648  * The sequence number of this update. Updates *must* be replayed in-order according to this
18649  * sequence number (and updates may panic if they are not). The update_id values are strictly
18650  * increasing and increase by one for each new update, with one exception specified below.
18651  *
18652  * This sequence number is also used to track up to which points updates which returned
18653  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
18654  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
18655  *
18656  * The only instance where update_id values are not strictly increasing is the case where we
18657  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
18658  * its docs for more details.
18659  */
18660 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
18661
18662 /**
18663  * Creates a copy of the ChannelMonitorUpdate
18664  */
18665 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
18666
18667 /**
18668  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
18669  */
18670 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
18671
18672 /**
18673  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
18674  */
18675 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
18676
18677 /**
18678  * Frees any resources used by the MonitorEvent
18679  */
18680 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
18681
18682 /**
18683  * Creates a copy of the MonitorEvent
18684  */
18685 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
18686
18687 /**
18688  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
18689  */
18690 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
18691
18692 /**
18693  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
18694  */
18695 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
18696
18697 /**
18698  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
18699  */
18700 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
18701
18702 /**
18703  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
18704  */
18705 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
18706
18707 /**
18708  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
18709  */
18710 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
18711
18712 /**
18713  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
18714  */
18715 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
18716
18717 /**
18718  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
18719  */
18720 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
18721
18722 /**
18723  * Creates a copy of the HTLCUpdate
18724  */
18725 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
18726
18727 /**
18728  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
18729  */
18730 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
18731
18732 /**
18733  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
18734  */
18735 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
18736
18737 /**
18738  * Frees any resources used by the Balance
18739  */
18740 void Balance_free(struct LDKBalance this_ptr);
18741
18742 /**
18743  * Creates a copy of the Balance
18744  */
18745 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
18746
18747 /**
18748  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
18749  */
18750 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
18751
18752 /**
18753  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
18754  */
18755 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
18756
18757 /**
18758  * Utility method to constructs a new ContentiousClaimable-variant Balance
18759  */
18760 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
18761
18762 /**
18763  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
18764  */
18765 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
18766
18767 /**
18768  * Checks if two Balances contain equal inner contents.
18769  * This ignores pointers and is_owned flags and looks at the values in fields.
18770  */
18771 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
18772
18773 /**
18774  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
18775  */
18776 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
18777
18778 /**
18779  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
18780  */
18781 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
18782
18783 /**
18784  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
18785  * itself.
18786  *
18787  * panics if the given update is not the next update by update_id.
18788  */
18789 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);
18790
18791 /**
18792  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
18793  * ChannelMonitor.
18794  */
18795 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18796
18797 /**
18798  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
18799  */
18800 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18801
18802 /**
18803  * Gets a list of txids, with their output scripts (in the order they appear in the
18804  * transaction), which we must learn about spends of via block_connected().
18805  */
18806 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18807
18808 /**
18809  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
18810  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
18811  * have been registered.
18812  */
18813 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
18814
18815 /**
18816  * Get the list of HTLCs who's status has been updated on chain. This should be called by
18817  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
18818  */
18819 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18820
18821 /**
18822  * Gets the list of pending events which were generated by previous actions, clearing the list
18823  * in the process.
18824  *
18825  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
18826  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
18827  * no internal locking in ChannelMonitors.
18828  */
18829 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18830
18831 /**
18832  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
18833  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
18834  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
18835  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
18836  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
18837  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
18838  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
18839  * out-of-band the other node operator to coordinate with him if option is available to you.
18840  * In any-case, choice is up to the user.
18841  */
18842 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);
18843
18844 /**
18845  * Processes transactions in a newly connected block, which may result in any of the following:
18846  * - update the monitor's state against resolved HTLCs
18847  * - punish the counterparty in the case of seeing a revoked commitment transaction
18848  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
18849  * - detect settled outputs for later spending
18850  * - schedule and bump any in-flight claims
18851  *
18852  * Returns any new outputs to watch from `txdata`; after called, these are also included in
18853  * [`get_outputs_to_watch`].
18854  *
18855  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
18856  */
18857 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);
18858
18859 /**
18860  * Determines if the disconnected block contained any transactions of interest and updates
18861  * appropriately.
18862  */
18863 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);
18864
18865 /**
18866  * Processes transactions confirmed in a block with the given header and height, returning new
18867  * outputs to watch. See [`block_connected`] for details.
18868  *
18869  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
18870  * blocks. See [`chain::Confirm`] for calling expectations.
18871  *
18872  * [`block_connected`]: Self::block_connected
18873  */
18874 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);
18875
18876 /**
18877  * Processes a transaction that was reorganized out of the chain.
18878  *
18879  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
18880  * than blocks. See [`chain::Confirm`] for calling expectations.
18881  *
18882  * [`block_disconnected`]: Self::block_disconnected
18883  */
18884 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);
18885
18886 /**
18887  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
18888  * [`block_connected`] for details.
18889  *
18890  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
18891  * blocks. See [`chain::Confirm`] for calling expectations.
18892  *
18893  * [`block_connected`]: Self::block_connected
18894  */
18895 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);
18896
18897 /**
18898  * Returns the set of txids that should be monitored for re-organization out of the chain.
18899  */
18900 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18901
18902 /**
18903  * Gets the latest best block which was connected either via the [`chain::Listen`] or
18904  * [`chain::Confirm`] interfaces.
18905  */
18906 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18907
18908 /**
18909  * Gets the balances in this channel which are either claimable by us if we were to
18910  * force-close the channel now or which are claimable on-chain (possibly awaiting
18911  * confirmation).
18912  *
18913  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
18914  * included here until an [`Event::SpendableOutputs`] event has been generated for the
18915  * balance, or until our counterparty has claimed the balance and accrued several
18916  * confirmations on the claim transaction.
18917  *
18918  * Note that the balances available when you or your counterparty have broadcasted revoked
18919  * state(s) may not be fully captured here.
18920  *
18921  * See [`Balance`] for additional details on the types of claimable balances which
18922  * may be returned here and their meanings.
18923  */
18924 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18925
18926 /**
18927  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
18928  */
18929 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
18930
18931 /**
18932  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
18933  */
18934 void OutPoint_free(struct LDKOutPoint this_obj);
18935
18936 /**
18937  * The referenced transaction's txid.
18938  */
18939 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
18940
18941 /**
18942  * The referenced transaction's txid.
18943  */
18944 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18945
18946 /**
18947  * The index of the referenced output in its transaction's vout.
18948  */
18949 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
18950
18951 /**
18952  * The index of the referenced output in its transaction's vout.
18953  */
18954 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
18955
18956 /**
18957  * Constructs a new OutPoint given each field
18958  */
18959 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
18960
18961 /**
18962  * Creates a copy of the OutPoint
18963  */
18964 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
18965
18966 /**
18967  * Checks if two OutPoints contain equal inner contents.
18968  * This ignores pointers and is_owned flags and looks at the values in fields.
18969  * Two objects with NULL inner values will be considered "equal" here.
18970  */
18971 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
18972
18973 /**
18974  * Checks if two OutPoints contain equal inner contents.
18975  */
18976 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
18977
18978 /**
18979  * Convert an `OutPoint` to a lightning channel id.
18980  */
18981 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
18982
18983 /**
18984  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
18985  */
18986 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
18987
18988 /**
18989  * Read a OutPoint from a byte array, created by OutPoint_write
18990  */
18991 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
18992
18993 /**
18994  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
18995  */
18996 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
18997
18998 /**
18999  * The outpoint which is spendable
19000  */
19001 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19002
19003 /**
19004  * The outpoint which is spendable
19005  */
19006 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19007
19008 /**
19009  * Per commitment point to derive delayed_payment_key by key holder
19010  */
19011 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19012
19013 /**
19014  * Per commitment point to derive delayed_payment_key by key holder
19015  */
19016 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19017
19018 /**
19019  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
19020  * the witness_script.
19021  */
19022 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19023
19024 /**
19025  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
19026  * the witness_script.
19027  */
19028 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
19029
19030 /**
19031  * The output which is referenced by the given outpoint
19032  */
19033 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
19034
19035 /**
19036  * The revocation point specific to the commitment transaction which was broadcast. Used to
19037  * derive the witnessScript for this output.
19038  */
19039 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19040
19041 /**
19042  * The revocation point specific to the commitment transaction which was broadcast. Used to
19043  * derive the witnessScript for this output.
19044  */
19045 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19046
19047 /**
19048  * Arbitrary identification information returned by a call to
19049  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19050  * the channel to spend the output.
19051  */
19052 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
19053
19054 /**
19055  * Arbitrary identification information returned by a call to
19056  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19057  * the channel to spend the output.
19058  */
19059 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19060
19061 /**
19062  * The value of the channel which this output originated from, possibly indirectly.
19063  */
19064 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19065
19066 /**
19067  * The value of the channel which this output originated from, possibly indirectly.
19068  */
19069 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
19070
19071 /**
19072  * Constructs a new DelayedPaymentOutputDescriptor given each field
19073  */
19074 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);
19075
19076 /**
19077  * Creates a copy of the DelayedPaymentOutputDescriptor
19078  */
19079 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
19080
19081 /**
19082  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
19083  */
19084 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
19085
19086 /**
19087  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
19088  */
19089 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
19090
19091 /**
19092  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
19093  */
19094 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
19095
19096 /**
19097  * The outpoint which is spendable
19098  */
19099 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19100
19101 /**
19102  * The outpoint which is spendable
19103  */
19104 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19105
19106 /**
19107  * The output which is referenced by the given outpoint
19108  */
19109 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
19110
19111 /**
19112  * Arbitrary identification information returned by a call to
19113  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19114  * the channel to spend the output.
19115  */
19116 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
19117
19118 /**
19119  * Arbitrary identification information returned by a call to
19120  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19121  * the channel to spend the output.
19122  */
19123 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19124
19125 /**
19126  * The value of the channel which this transactions spends.
19127  */
19128 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19129
19130 /**
19131  * The value of the channel which this transactions spends.
19132  */
19133 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
19134
19135 /**
19136  * Constructs a new StaticPaymentOutputDescriptor given each field
19137  */
19138 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);
19139
19140 /**
19141  * Creates a copy of the StaticPaymentOutputDescriptor
19142  */
19143 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
19144
19145 /**
19146  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
19147  */
19148 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
19149
19150 /**
19151  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
19152  */
19153 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
19154
19155 /**
19156  * Frees any resources used by the SpendableOutputDescriptor
19157  */
19158 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
19159
19160 /**
19161  * Creates a copy of the SpendableOutputDescriptor
19162  */
19163 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
19164
19165 /**
19166  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
19167  */
19168 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
19169
19170 /**
19171  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
19172  */
19173 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
19174
19175 /**
19176  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
19177  */
19178 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
19179
19180 /**
19181  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
19182  */
19183 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
19184
19185 /**
19186  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
19187  */
19188 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
19189
19190 /**
19191  * Calls the free function if one is set
19192  */
19193 void BaseSign_free(struct LDKBaseSign this_ptr);
19194
19195 /**
19196  * Creates a copy of a Sign
19197  */
19198 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
19199
19200 /**
19201  * Calls the free function if one is set
19202  */
19203 void Sign_free(struct LDKSign this_ptr);
19204
19205 /**
19206  * Creates a copy of the Recipient
19207  */
19208 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
19209
19210 /**
19211  * Utility method to constructs a new Node-variant Recipient
19212  */
19213 enum LDKRecipient Recipient_node(void);
19214
19215 /**
19216  * Utility method to constructs a new PhantomNode-variant Recipient
19217  */
19218 enum LDKRecipient Recipient_phantom_node(void);
19219
19220 /**
19221  * Calls the free function if one is set
19222  */
19223 void KeysInterface_free(struct LDKKeysInterface this_ptr);
19224
19225 /**
19226  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
19227  */
19228 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
19229
19230 /**
19231  * Private key of anchor tx
19232  */
19233 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19234
19235 /**
19236  * Private key of anchor tx
19237  */
19238 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19239
19240 /**
19241  * Holder secret key for blinded revocation pubkey
19242  */
19243 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19244
19245 /**
19246  * Holder secret key for blinded revocation pubkey
19247  */
19248 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19249
19250 /**
19251  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
19252  */
19253 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19254
19255 /**
19256  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
19257  */
19258 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19259
19260 /**
19261  * Holder secret key used in HTLC tx
19262  */
19263 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19264
19265 /**
19266  * Holder secret key used in HTLC tx
19267  */
19268 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19269
19270 /**
19271  * Holder htlc secret key used in commitment tx htlc outputs
19272  */
19273 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19274
19275 /**
19276  * Holder htlc secret key used in commitment tx htlc outputs
19277  */
19278 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19279
19280 /**
19281  * Commitment seed
19282  */
19283 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19284
19285 /**
19286  * Commitment seed
19287  */
19288 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19289
19290 /**
19291  * Creates a copy of the InMemorySigner
19292  */
19293 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
19294
19295 /**
19296  * Create a new InMemorySigner
19297  */
19298 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);
19299
19300 /**
19301  * Counterparty pubkeys.
19302  * Will panic if ready_channel wasn't called.
19303  */
19304 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19305
19306 /**
19307  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
19308  * transactions, ie the amount of time that we have to wait to recover our funds if we
19309  * broadcast a transaction.
19310  * Will panic if ready_channel wasn't called.
19311  */
19312 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19313
19314 /**
19315  * The contest_delay value specified by us and applied on transactions broadcastable
19316  * by our counterparty, ie the amount of time that they have to wait to recover their funds
19317  * if they broadcast a transaction.
19318  * Will panic if ready_channel wasn't called.
19319  */
19320 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19321
19322 /**
19323  * Whether the holder is the initiator
19324  * Will panic if ready_channel wasn't called.
19325  */
19326 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19327
19328 /**
19329  * Funding outpoint
19330  * Will panic if ready_channel wasn't called.
19331  */
19332 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19333
19334 /**
19335  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
19336  * building transactions.
19337  *
19338  * Will panic if ready_channel wasn't called.
19339  */
19340 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19341
19342 /**
19343  * Whether anchors should be used.
19344  * Will panic if ready_channel wasn't called.
19345  */
19346 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19347
19348 /**
19349  * Sign the single input of spend_tx at index `input_idx` which spends the output
19350  * described by descriptor, returning the witness stack for the input.
19351  *
19352  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
19353  * is not spending the outpoint described by `descriptor.outpoint`,
19354  * or if an output descriptor script_pubkey does not match the one we can spend.
19355  */
19356 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);
19357
19358 /**
19359  * Sign the single input of spend_tx at index `input_idx` which spends the output
19360  * described by descriptor, returning the witness stack for the input.
19361  *
19362  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
19363  * is not spending the outpoint described by `descriptor.outpoint`, does not have a
19364  * sequence set to `descriptor.to_self_delay`, or if an output descriptor
19365  * script_pubkey does not match the one we can spend.
19366  */
19367 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);
19368
19369 /**
19370  * Constructs a new BaseSign which calls the relevant methods on this_arg.
19371  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
19372  */
19373 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19374
19375 /**
19376  * Constructs a new Sign which calls the relevant methods on this_arg.
19377  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
19378  */
19379 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19380
19381 /**
19382  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
19383  */
19384 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
19385
19386 /**
19387  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
19388  */
19389 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
19390
19391 /**
19392  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
19393  */
19394 void KeysManager_free(struct LDKKeysManager this_obj);
19395
19396 /**
19397  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
19398  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
19399  * starting_time isn't strictly required to actually be a time, but it must absolutely,
19400  * without a doubt, be unique to this instance. ie if you start multiple times with the same
19401  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
19402  * simply use the current time (with very high precision).
19403  *
19404  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
19405  * obviously, starting_time should be unique every time you reload the library - it is only
19406  * used to generate new ephemeral key data (which will be stored by the individual channel if
19407  * necessary).
19408  *
19409  * Note that the seed is required to recover certain on-chain funds independent of
19410  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
19411  * channel, and some on-chain during-closing funds.
19412  *
19413  * Note that until the 0.1 release there is no guarantee of backward compatibility between
19414  * versions. Once the library is more fully supported, the docs will be updated to include a
19415  * detailed description of the guarantee.
19416  */
19417 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
19418
19419 /**
19420  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
19421  *
19422  * Key derivation parameters are accessible through a per-channel secrets
19423  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
19424  * onchain output detection for which a corresponding delayed_payment_key must be derived.
19425  */
19426 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]);
19427
19428 /**
19429  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
19430  * output to the given change destination (if sufficient change value remains). The
19431  * transaction will have a feerate, at least, of the given value.
19432  *
19433  * Returns `Err(())` if the output value is greater than the input value minus required fee,
19434  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
19435  * does not match the one we can spend.
19436  *
19437  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
19438  *
19439  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
19440  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
19441  */
19442 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);
19443
19444 /**
19445  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
19446  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
19447  */
19448 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
19449
19450 /**
19451  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
19452  */
19453 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
19454
19455 /**
19456  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
19457  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
19458  */
19459 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
19460
19461 /**
19462  * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
19463  * that is shared across all nodes that intend to participate in [phantom node payments] together.
19464  *
19465  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
19466  * `starting_time_nanos`.
19467  *
19468  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
19469  * same across restarts, or else inbound payments may fail.
19470  *
19471  * [phantom node payments]: PhantomKeysManager
19472  */
19473 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]);
19474
19475 /**
19476  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
19477  */
19478 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);
19479
19480 /**
19481  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
19482  */
19483 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]);
19484
19485 /**
19486  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
19487  */
19488 void ChannelManager_free(struct LDKChannelManager this_obj);
19489
19490 /**
19491  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
19492  */
19493 void ChainParameters_free(struct LDKChainParameters this_obj);
19494
19495 /**
19496  * The network for determining the `chain_hash` in Lightning messages.
19497  */
19498 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
19499
19500 /**
19501  * The network for determining the `chain_hash` in Lightning messages.
19502  */
19503 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
19504
19505 /**
19506  * The hash and height of the latest block successfully connected.
19507  *
19508  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
19509  */
19510 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
19511
19512 /**
19513  * The hash and height of the latest block successfully connected.
19514  *
19515  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
19516  */
19517 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
19518
19519 /**
19520  * Constructs a new ChainParameters given each field
19521  */
19522 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
19523
19524 /**
19525  * Creates a copy of the ChainParameters
19526  */
19527 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
19528
19529 /**
19530  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
19531  */
19532 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
19533
19534 /**
19535  * Base routing fee in millisatoshis.
19536  */
19537 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19538
19539 /**
19540  * Base routing fee in millisatoshis.
19541  */
19542 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
19543
19544 /**
19545  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
19546  */
19547 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19548
19549 /**
19550  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
19551  */
19552 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
19553
19554 /**
19555  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
19556  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
19557  * `cltv_expiry_delta` for more details.
19558  */
19559 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19560
19561 /**
19562  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
19563  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
19564  * `cltv_expiry_delta` for more details.
19565  */
19566 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
19567
19568 /**
19569  * Constructs a new CounterpartyForwardingInfo given each field
19570  */
19571 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);
19572
19573 /**
19574  * Creates a copy of the CounterpartyForwardingInfo
19575  */
19576 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
19577
19578 /**
19579  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
19580  */
19581 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
19582
19583 /**
19584  * The node_id of our counterparty
19585  */
19586 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19587
19588 /**
19589  * The node_id of our counterparty
19590  */
19591 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19592
19593 /**
19594  * The Features the channel counterparty provided upon last connection.
19595  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
19596  * many routing-relevant features are present in the init context.
19597  */
19598 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19599
19600 /**
19601  * The Features the channel counterparty provided upon last connection.
19602  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
19603  * many routing-relevant features are present in the init context.
19604  */
19605 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
19606
19607 /**
19608  * The value, in satoshis, that must always be held in the channel for our counterparty. This
19609  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
19610  * claiming at least this value on chain.
19611  *
19612  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
19613  *
19614  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
19615  */
19616 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19617
19618 /**
19619  * The value, in satoshis, that must always be held in the channel for our counterparty. This
19620  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
19621  * claiming at least this value on chain.
19622  *
19623  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
19624  *
19625  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
19626  */
19627 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
19628
19629 /**
19630  * Information on the fees and requirements that the counterparty requires when forwarding
19631  * payments to us through this channel.
19632  *
19633  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19634  */
19635 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19636
19637 /**
19638  * Information on the fees and requirements that the counterparty requires when forwarding
19639  * payments to us through this channel.
19640  *
19641  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19642  */
19643 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
19644
19645 /**
19646  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
19647  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
19648  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
19649  */
19650 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19651
19652 /**
19653  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
19654  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
19655  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
19656  */
19657 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19658
19659 /**
19660  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
19661  */
19662 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19663
19664 /**
19665  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
19666  */
19667 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19668
19669 /**
19670  * Constructs a new ChannelCounterparty given each field
19671  */
19672 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);
19673
19674 /**
19675  * Creates a copy of the ChannelCounterparty
19676  */
19677 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
19678
19679 /**
19680  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
19681  */
19682 void ChannelDetails_free(struct LDKChannelDetails this_obj);
19683
19684 /**
19685  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
19686  * thereafter this is the txid of the funding transaction xor the funding transaction output).
19687  * Note that this means this value is *not* persistent - it can change once during the
19688  * lifetime of the channel.
19689  */
19690 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
19691
19692 /**
19693  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
19694  * thereafter this is the txid of the funding transaction xor the funding transaction output).
19695  * Note that this means this value is *not* persistent - it can change once during the
19696  * lifetime of the channel.
19697  */
19698 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19699
19700 /**
19701  * Parameters which apply to our counterparty. See individual fields for more information.
19702  */
19703 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19704
19705 /**
19706  * Parameters which apply to our counterparty. See individual fields for more information.
19707  */
19708 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
19709
19710 /**
19711  * The Channel's funding transaction output, if we've negotiated the funding transaction with
19712  * our counterparty already.
19713  *
19714  * Note that, if this has been set, `channel_id` will be equivalent to
19715  * `funding_txo.unwrap().to_channel_id()`.
19716  *
19717  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19718  */
19719 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19720
19721 /**
19722  * The Channel's funding transaction output, if we've negotiated the funding transaction with
19723  * our counterparty already.
19724  *
19725  * Note that, if this has been set, `channel_id` will be equivalent to
19726  * `funding_txo.unwrap().to_channel_id()`.
19727  *
19728  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19729  */
19730 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19731
19732 /**
19733  * The features which this channel operates with. See individual features for more info.
19734  *
19735  * `None` until negotiation completes and the channel type is finalized.
19736  *
19737  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19738  */
19739 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19740
19741 /**
19742  * The features which this channel operates with. See individual features for more info.
19743  *
19744  * `None` until negotiation completes and the channel type is finalized.
19745  *
19746  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19747  */
19748 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
19749
19750 /**
19751  * The position of the funding transaction in the chain. None if the funding transaction has
19752  * not yet been confirmed and the channel fully opened.
19753  *
19754  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
19755  * payments instead of this. See [`get_inbound_payment_scid`].
19756  *
19757  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
19758  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
19759  *
19760  * [`inbound_scid_alias`]: Self::inbound_scid_alias
19761  * [`outbound_scid_alias`]: Self::outbound_scid_alias
19762  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
19763  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
19764  * [`confirmations_required`]: Self::confirmations_required
19765  */
19766 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19767
19768 /**
19769  * The position of the funding transaction in the chain. None if the funding transaction has
19770  * not yet been confirmed and the channel fully opened.
19771  *
19772  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
19773  * payments instead of this. See [`get_inbound_payment_scid`].
19774  *
19775  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
19776  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
19777  *
19778  * [`inbound_scid_alias`]: Self::inbound_scid_alias
19779  * [`outbound_scid_alias`]: Self::outbound_scid_alias
19780  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
19781  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
19782  * [`confirmations_required`]: Self::confirmations_required
19783  */
19784 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19785
19786 /**
19787  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
19788  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
19789  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
19790  * `Some(0)`).
19791  *
19792  * This will be `None` as long as the channel is not available for routing outbound payments.
19793  *
19794  * [`short_channel_id`]: Self::short_channel_id
19795  * [`confirmations_required`]: Self::confirmations_required
19796  */
19797 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19798
19799 /**
19800  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
19801  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
19802  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
19803  * `Some(0)`).
19804  *
19805  * This will be `None` as long as the channel is not available for routing outbound payments.
19806  *
19807  * [`short_channel_id`]: Self::short_channel_id
19808  * [`confirmations_required`]: Self::confirmations_required
19809  */
19810 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19811
19812 /**
19813  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
19814  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
19815  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
19816  * when they see a payment to be routed to us.
19817  *
19818  * Our counterparty may choose to rotate this value at any time, though will always recognize
19819  * previous values for inbound payment forwarding.
19820  *
19821  * [`short_channel_id`]: Self::short_channel_id
19822  */
19823 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19824
19825 /**
19826  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
19827  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
19828  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
19829  * when they see a payment to be routed to us.
19830  *
19831  * Our counterparty may choose to rotate this value at any time, though will always recognize
19832  * previous values for inbound payment forwarding.
19833  *
19834  * [`short_channel_id`]: Self::short_channel_id
19835  */
19836 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19837
19838 /**
19839  * The value, in satoshis, of this channel as appears in the funding output
19840  */
19841 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19842
19843 /**
19844  * The value, in satoshis, of this channel as appears in the funding output
19845  */
19846 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19847
19848 /**
19849  * The value, in satoshis, that must always be held in the channel for us. This value ensures
19850  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
19851  * this value on chain.
19852  *
19853  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
19854  *
19855  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19856  *
19857  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
19858  */
19859 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19860
19861 /**
19862  * The value, in satoshis, that must always be held in the channel for us. This value ensures
19863  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
19864  * this value on chain.
19865  *
19866  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
19867  *
19868  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19869  *
19870  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
19871  */
19872 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19873
19874 /**
19875  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
19876  */
19877 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19878
19879 /**
19880  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
19881  */
19882 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19883
19884 /**
19885  * Our total balance.  This is the amount we would get if we close the channel.
19886  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
19887  * amount is not likely to be recoverable on close.
19888  *
19889  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
19890  * balance is not available for inclusion in new outbound HTLCs). This further does not include
19891  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
19892  * This does not consider any on-chain fees.
19893  *
19894  * See also [`ChannelDetails::outbound_capacity_msat`]
19895  */
19896 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19897
19898 /**
19899  * Our total balance.  This is the amount we would get if we close the channel.
19900  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
19901  * amount is not likely to be recoverable on close.
19902  *
19903  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
19904  * balance is not available for inclusion in new outbound HTLCs). This further does not include
19905  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
19906  * This does not consider any on-chain fees.
19907  *
19908  * See also [`ChannelDetails::outbound_capacity_msat`]
19909  */
19910 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19911
19912 /**
19913  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
19914  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19915  * available for inclusion in new outbound HTLCs). This further does not include any pending
19916  * outgoing HTLCs which are awaiting some other resolution to be sent.
19917  *
19918  * See also [`ChannelDetails::balance_msat`]
19919  *
19920  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19921  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
19922  * should be able to spend nearly this amount.
19923  */
19924 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19925
19926 /**
19927  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
19928  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19929  * available for inclusion in new outbound HTLCs). This further does not include any pending
19930  * outgoing HTLCs which are awaiting some other resolution to be sent.
19931  *
19932  * See also [`ChannelDetails::balance_msat`]
19933  *
19934  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19935  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
19936  * should be able to spend nearly this amount.
19937  */
19938 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19939
19940 /**
19941  * The available outbound capacity for sending a single HTLC to the remote peer. This is
19942  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
19943  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
19944  * to use a limit as close as possible to the HTLC limit we can currently send.
19945  *
19946  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
19947  */
19948 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19949
19950 /**
19951  * The available outbound capacity for sending a single HTLC to the remote peer. This is
19952  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
19953  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
19954  * to use a limit as close as possible to the HTLC limit we can currently send.
19955  *
19956  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
19957  */
19958 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19959
19960 /**
19961  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
19962  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19963  * available for inclusion in new inbound HTLCs).
19964  * Note that there are some corner cases not fully handled here, so the actual available
19965  * inbound capacity may be slightly higher than this.
19966  *
19967  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19968  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
19969  * However, our counterparty should be able to spend nearly this amount.
19970  */
19971 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19972
19973 /**
19974  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
19975  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19976  * available for inclusion in new inbound HTLCs).
19977  * Note that there are some corner cases not fully handled here, so the actual available
19978  * inbound capacity may be slightly higher than this.
19979  *
19980  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19981  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
19982  * However, our counterparty should be able to spend nearly this amount.
19983  */
19984 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19985
19986 /**
19987  * The number of required confirmations on the funding transaction before the funding will be
19988  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
19989  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
19990  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
19991  * [`ChannelHandshakeLimits::max_minimum_depth`].
19992  *
19993  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19994  *
19995  * [`is_outbound`]: ChannelDetails::is_outbound
19996  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
19997  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
19998  */
19999 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20000
20001 /**
20002  * The number of required confirmations on the funding transaction before the funding will be
20003  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
20004  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
20005  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
20006  * [`ChannelHandshakeLimits::max_minimum_depth`].
20007  *
20008  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20009  *
20010  * [`is_outbound`]: ChannelDetails::is_outbound
20011  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
20012  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
20013  */
20014 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
20015
20016 /**
20017  * The number of blocks (after our commitment transaction confirms) that we will need to wait
20018  * until we can claim our funds after we force-close the channel. During this time our
20019  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
20020  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
20021  * time to claim our non-HTLC-encumbered funds.
20022  *
20023  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20024  */
20025 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20026
20027 /**
20028  * The number of blocks (after our commitment transaction confirms) that we will need to wait
20029  * until we can claim our funds after we force-close the channel. During this time our
20030  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
20031  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
20032  * time to claim our non-HTLC-encumbered funds.
20033  *
20034  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20035  */
20036 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
20037
20038 /**
20039  * True if the channel was initiated (and thus funded) by us.
20040  */
20041 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20042
20043 /**
20044  * True if the channel was initiated (and thus funded) by us.
20045  */
20046 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20047
20048 /**
20049  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
20050  * channel is not currently being shut down. `channel_ready` message exchange implies the
20051  * required confirmation count has been reached (and we were connected to the peer at some
20052  * point after the funding transaction received enough confirmations). The required
20053  * confirmation count is provided in [`confirmations_required`].
20054  *
20055  * [`confirmations_required`]: ChannelDetails::confirmations_required
20056  */
20057 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20058
20059 /**
20060  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
20061  * channel is not currently being shut down. `channel_ready` message exchange implies the
20062  * required confirmation count has been reached (and we were connected to the peer at some
20063  * point after the funding transaction received enough confirmations). The required
20064  * confirmation count is provided in [`confirmations_required`].
20065  *
20066  * [`confirmations_required`]: ChannelDetails::confirmations_required
20067  */
20068 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20069
20070 /**
20071  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
20072  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
20073  *
20074  * This is a strict superset of `is_channel_ready`.
20075  */
20076 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20077
20078 /**
20079  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
20080  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
20081  *
20082  * This is a strict superset of `is_channel_ready`.
20083  */
20084 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20085
20086 /**
20087  * True if this channel is (or will be) publicly-announced.
20088  */
20089 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20090
20091 /**
20092  * True if this channel is (or will be) publicly-announced.
20093  */
20094 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20095
20096 /**
20097  * The smallest value HTLC (in msat) we will accept, for this channel. This field
20098  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
20099  */
20100 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20101
20102 /**
20103  * The smallest value HTLC (in msat) we will accept, for this channel. This field
20104  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
20105  */
20106 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20107
20108 /**
20109  * The largest value HTLC (in msat) we currently will accept, for this channel.
20110  */
20111 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20112
20113 /**
20114  * The largest value HTLC (in msat) we currently will accept, for this channel.
20115  */
20116 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20117
20118 /**
20119  * Constructs a new ChannelDetails given each field
20120  */
20121 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);
20122
20123 /**
20124  * Creates a copy of the ChannelDetails
20125  */
20126 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
20127
20128 /**
20129  * Gets the current SCID which should be used to identify this channel for inbound payments.
20130  * This should be used for providing invoice hints or in any other context where our
20131  * counterparty will forward a payment to us.
20132  *
20133  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
20134  * [`ChannelDetails::short_channel_id`]. See those for more information.
20135  */
20136 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
20137
20138 /**
20139  * Gets the current SCID which should be used to identify this channel for outbound payments.
20140  * This should be used in [`Route`]s to describe the first hop or in other contexts where
20141  * we're sending or forwarding a payment outbound over this channel.
20142  *
20143  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
20144  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
20145  */
20146 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
20147
20148 /**
20149  * Frees any resources used by the PaymentSendFailure
20150  */
20151 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
20152
20153 /**
20154  * Creates a copy of the PaymentSendFailure
20155  */
20156 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
20157
20158 /**
20159  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
20160  */
20161 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
20162
20163 /**
20164  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
20165  */
20166 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
20167
20168 /**
20169  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
20170  */
20171 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
20172
20173 /**
20174  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
20175  */
20176 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
20177
20178 /**
20179  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
20180  */
20181 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
20182
20183 /**
20184  * The list of channels to be included in the invoice route hints.
20185  */
20186 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20187
20188 /**
20189  * The list of channels to be included in the invoice route hints.
20190  */
20191 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
20192
20193 /**
20194  * A fake scid used for representing the phantom node's fake channel in generating the invoice
20195  * route hints.
20196  */
20197 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20198
20199 /**
20200  * A fake scid used for representing the phantom node's fake channel in generating the invoice
20201  * route hints.
20202  */
20203 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
20204
20205 /**
20206  * The pubkey of the real backing node that would ultimately receive the payment.
20207  */
20208 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20209
20210 /**
20211  * The pubkey of the real backing node that would ultimately receive the payment.
20212  */
20213 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20214
20215 /**
20216  * Constructs a new PhantomRouteHints given each field
20217  */
20218 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
20219
20220 /**
20221  * Creates a copy of the PhantomRouteHints
20222  */
20223 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
20224
20225 /**
20226  * Constructs a new ChannelManager to hold several channels and route between them.
20227  *
20228  * This is the main \"logic hub\" for all channel-related actions, and implements
20229  * ChannelMessageHandler.
20230  *
20231  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
20232  *
20233  * Users need to notify the new ChannelManager when a new block is connected or
20234  * disconnected using its `block_connected` and `block_disconnected` methods, starting
20235  * from after `params.latest_hash`.
20236  */
20237 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);
20238
20239 /**
20240  * Gets the current configuration applied to all new channels,  as
20241  */
20242 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
20243
20244 /**
20245  * Creates a new outbound channel to the given remote node and with the given value.
20246  *
20247  * `user_channel_id` will be provided back as in
20248  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
20249  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
20250  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
20251  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
20252  * ignored.
20253  *
20254  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
20255  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
20256  *
20257  * Note that we do not check if you are currently connected to the given peer. If no
20258  * connection is available, the outbound `open_channel` message may fail to send, resulting in
20259  * the channel eventually being silently forgotten (dropped on reload).
20260  *
20261  * Returns the new Channel's temporary `channel_id`. This ID will appear as
20262  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
20263  * [`ChannelDetails::channel_id`] until after
20264  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
20265  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
20266  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
20267  *
20268  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
20269  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
20270  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
20271  *
20272  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
20273  */
20274 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);
20275
20276 /**
20277  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
20278  * more information.
20279  */
20280 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
20281
20282 /**
20283  * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`]
20284  * to ensure non-announced channels are used.
20285  *
20286  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
20287  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
20288  * are.
20289  *
20290  * [`find_route`]: crate::routing::router::find_route
20291  */
20292 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
20293
20294 /**
20295  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
20296  * will be accepted on the given channel, and after additional timeout/the closing of all
20297  * pending HTLCs, the channel will be closed on chain.
20298  *
20299  *  * If we are the channel initiator, we will pay between our [`Background`] and
20300  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
20301  *    estimate.
20302  *  * If our counterparty is the channel initiator, we will require a channel closing
20303  *    transaction feerate of at least our [`Background`] feerate or the feerate which
20304  *    would appear on a force-closure transaction, whichever is lower. We will allow our
20305  *    counterparty to pay as much fee as they'd like, however.
20306  *
20307  * May generate a SendShutdown message event on success, which should be relayed.
20308  *
20309  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
20310  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20311  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20312  */
20313 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);
20314
20315 /**
20316  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
20317  * will be accepted on the given channel, and after additional timeout/the closing of all
20318  * pending HTLCs, the channel will be closed on chain.
20319  *
20320  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
20321  * the channel being closed or not:
20322  *  * If we are the channel initiator, we will pay at least this feerate on the closing
20323  *    transaction. The upper-bound is set by
20324  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
20325  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
20326  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
20327  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
20328  *    will appear on a force-closure transaction, whichever is lower).
20329  *
20330  * May generate a SendShutdown message event on success, which should be relayed.
20331  *
20332  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
20333  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20334  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20335  */
20336 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);
20337
20338 /**
20339  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
20340  * the chain and rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
20341  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
20342  * channel.
20343  */
20344 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
20345
20346 /**
20347  * Force close all channels, immediately broadcasting the latest local commitment transaction
20348  * for each to the chain and rejecting new HTLCs on each.
20349  */
20350 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
20351
20352 /**
20353  * Sends a payment along a given route.
20354  *
20355  * Value parameters are provided via the last hop in route, see documentation for RouteHop
20356  * fields for more info.
20357  *
20358  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
20359  * payment), we don't do anything to stop you! We always try to ensure that if the provided
20360  * next hop knows the preimage to payment_hash they can claim an additional amount as
20361  * specified in the last hop in the route! Thus, you should probably do your own
20362  * payment_preimage tracking (which you should already be doing as they represent \"proof of
20363  * payment\") and prevent double-sends yourself.
20364  *
20365  * May generate SendHTLCs message(s) event on success, which should be relayed.
20366  *
20367  * Each path may have a different return value, and PaymentSendValue may return a Vec with
20368  * each entry matching the corresponding-index entry in the route paths, see
20369  * PaymentSendFailure for more info.
20370  *
20371  * In general, a path may raise:
20372  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
20373  *    node public key) is specified.
20374  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
20375  *    (including due to previous monitor update failure or new permanent monitor update
20376  *    failure).
20377  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
20378  *    relevant updates.
20379  *
20380  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
20381  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
20382  * different route unless you intend to pay twice!
20383  *
20384  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
20385  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
20386  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
20387  * must not contain multiple paths as multi-path payments require a recipient-provided
20388  * payment_secret.
20389  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
20390  * bit set (either as required or as available). If multiple paths are present in the Route,
20391  * we assume the invoice had the basic_mpp feature set.
20392  *
20393  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
20394  */
20395 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);
20396
20397 /**
20398  * Retries a payment along the given [`Route`].
20399  *
20400  * Errors returned are a superset of those returned from [`send_payment`], so see
20401  * [`send_payment`] documentation for more details on errors. This method will also error if the
20402  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
20403  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
20404  * further retries have been disabled with [`abandon_payment`].
20405  *
20406  * [`send_payment`]: [`ChannelManager::send_payment`]
20407  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
20408  */
20409 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);
20410
20411 /**
20412  * Signals that no further retries for the given payment will occur.
20413  *
20414  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
20415  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
20416  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
20417  * pending HTLCs for this payment.
20418  *
20419  * Note that calling this method does *not* prevent a payment from succeeding. You must still
20420  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
20421  * determine the ultimate status of a payment.
20422  *
20423  * [`retry_payment`]: Self::retry_payment
20424  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
20425  * [`Event::PaymentSent`]: events::Event::PaymentSent
20426  */
20427 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
20428
20429 /**
20430  * Send a spontaneous payment, which is a payment that does not require the recipient to have
20431  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
20432  * the preimage, it must be a cryptographically secure random value that no intermediate node
20433  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
20434  * never reach the recipient.
20435  *
20436  * See [`send_payment`] documentation for more details on the return value of this function.
20437  *
20438  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
20439  * [`send_payment`] for more information about the risks of duplicate preimage usage.
20440  *
20441  * Note that `route` must have exactly one path.
20442  *
20443  * [`send_payment`]: Self::send_payment
20444  *
20445  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
20446  */
20447 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);
20448
20449 /**
20450  * Call this upon creation of a funding transaction for the given channel.
20451  *
20452  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
20453  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
20454  *
20455  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
20456  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
20457  *
20458  * May panic if the output found in the funding transaction is duplicative with some other
20459  * channel (note that this should be trivially prevented by using unique funding transaction
20460  * keys per-channel).
20461  *
20462  * Do NOT broadcast the funding transaction yourself. When we have safely received our
20463  * counterparty's signature the funding transaction will automatically be broadcast via the
20464  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
20465  *
20466  * Note that this includes RBF or similar transaction replacement strategies - lightning does
20467  * not currently support replacing a funding transaction on an existing channel. Instead,
20468  * create a new channel with a conflicting funding transaction.
20469  *
20470  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
20471  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
20472  */
20473 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);
20474
20475 /**
20476  * Regenerates channel_announcements and generates a signed node_announcement from the given
20477  * arguments, providing them in corresponding events via
20478  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
20479  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
20480  * announcement to ensure that the lightning P2P network is aware of the channels we have and
20481  * our network addresses.
20482  *
20483  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
20484  * node to humans. They carry no in-protocol meaning.
20485  *
20486  * `addresses` represent the set (possibly empty) of socket addresses on which this node
20487  * accepts incoming connections. These will be included in the node_announcement, publicly
20488  * tying these addresses together and to this node. If you wish to preserve user privacy,
20489  * addresses should likely contain only Tor Onion addresses.
20490  *
20491  * Panics if `addresses` is absurdly large (more than 500).
20492  *
20493  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
20494  */
20495 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
20496
20497 /**
20498  * Processes HTLCs which are pending waiting on random forward delay.
20499  *
20500  * Should only really ever be called in response to a PendingHTLCsForwardable event.
20501  * Will likely generate further events.
20502  */
20503 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
20504
20505 /**
20506  * Performs actions which should happen on startup and roughly once per minute thereafter.
20507  *
20508  * This currently includes:
20509  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
20510  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
20511  *    than a minute, informing the network that they should no longer attempt to route over
20512  *    the channel.
20513  *
20514  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
20515  * estimate fetches.
20516  */
20517 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
20518
20519 /**
20520  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
20521  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
20522  * along the path (including in our own channel on which we received it).
20523  *
20524  * Note that in some cases around unclean shutdown, it is possible the payment may have
20525  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
20526  * second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment
20527  * may have already been failed automatically by LDK if it was nearing its expiration time.
20528  *
20529  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
20530  * [`ChannelManager::claim_funds`]), you should still monitor for
20531  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
20532  * startup during which time claims that were in-progress at shutdown may be replayed.
20533  */
20534 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
20535
20536 /**
20537  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
20538  * [`MessageSendEvent`]s needed to claim the payment.
20539  *
20540  * Note that calling this method does *not* guarantee that the payment has been claimed. You
20541  * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
20542  * provided to your [`EventHandler`] when [`process_pending_events`] is next called.
20543  *
20544  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
20545  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
20546  * event matches your expectation. If you fail to do so and call this method, you may provide
20547  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
20548  *
20549  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
20550  * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
20551  * [`process_pending_events`]: EventsProvider::process_pending_events
20552  * [`create_inbound_payment`]: Self::create_inbound_payment
20553  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
20554  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
20555  */
20556 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
20557
20558 /**
20559  * Gets the node_id held by this ChannelManager
20560  */
20561 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
20562
20563 /**
20564  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
20565  *
20566  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
20567  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
20568  * the channel.
20569  *
20570  * The `user_channel_id` parameter will be provided back in
20571  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
20572  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
20573  *
20574  * Note that this method will return an error and reject the channel, if it requires support
20575  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
20576  * used to accept such channels.
20577  *
20578  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
20579  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
20580  */
20581 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);
20582
20583 /**
20584  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
20585  * it as confirmed immediately.
20586  *
20587  * The `user_channel_id` parameter will be provided back in
20588  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
20589  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
20590  *
20591  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
20592  * and (if the counterparty agrees), enables forwarding of payments immediately.
20593  *
20594  * This fully trusts that the counterparty has honestly and correctly constructed the funding
20595  * transaction and blindly assumes that it will eventually confirm.
20596  *
20597  * If it does not confirm before we decide to close the channel, or if the funding transaction
20598  * does not pay to the correct script the correct amount, *you will lose funds*.
20599  *
20600  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
20601  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
20602  */
20603 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);
20604
20605 /**
20606  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
20607  * to pay us.
20608  *
20609  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
20610  * [`PaymentHash`] and [`PaymentPreimage`] for you.
20611  *
20612  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
20613  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
20614  * passed directly to [`claim_funds`].
20615  *
20616  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
20617  *
20618  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
20619  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
20620  *
20621  * # Note
20622  *
20623  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
20624  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
20625  *
20626  * Errors if `min_value_msat` is greater than total bitcoin supply.
20627  *
20628  * [`claim_funds`]: Self::claim_funds
20629  * [`PaymentReceived`]: events::Event::PaymentReceived
20630  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
20631  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
20632  */
20633 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);
20634
20635 /**
20636  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
20637  * serialized state with LDK node(s) running 0.0.103 and earlier.
20638  *
20639  * May panic if `invoice_expiry_delta_secs` is greater than one year.
20640  *
20641  * # Note
20642  * This method is deprecated and will be removed soon.
20643  *
20644  * [`create_inbound_payment`]: Self::create_inbound_payment
20645  */
20646 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);
20647
20648 /**
20649  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
20650  * stored external to LDK.
20651  *
20652  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
20653  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
20654  * the `min_value_msat` provided here, if one is provided.
20655  *
20656  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
20657  * note that LDK will not stop you from registering duplicate payment hashes for inbound
20658  * payments.
20659  *
20660  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
20661  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
20662  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
20663  * sender \"proof-of-payment\" unless they have paid the required amount.
20664  *
20665  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
20666  * in excess of the current time. This should roughly match the expiry time set in the invoice.
20667  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
20668  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
20669  * invoices when no timeout is set.
20670  *
20671  * Note that we use block header time to time-out pending inbound payments (with some margin
20672  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
20673  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
20674  * If you need exact expiry semantics, you should enforce them upon receipt of
20675  * [`PaymentReceived`].
20676  *
20677  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
20678  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
20679  *
20680  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
20681  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
20682  *
20683  * # Note
20684  *
20685  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
20686  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
20687  *
20688  * Errors if `min_value_msat` is greater than total bitcoin supply.
20689  *
20690  * [`create_inbound_payment`]: Self::create_inbound_payment
20691  * [`PaymentReceived`]: events::Event::PaymentReceived
20692  */
20693 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);
20694
20695 /**
20696  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
20697  * serialized state with LDK node(s) running 0.0.103 and earlier.
20698  *
20699  * May panic if `invoice_expiry_delta_secs` is greater than one year.
20700  *
20701  * # Note
20702  * This method is deprecated and will be removed soon.
20703  *
20704  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
20705  */
20706 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);
20707
20708 /**
20709  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
20710  * previously returned from [`create_inbound_payment`].
20711  *
20712  * [`create_inbound_payment`]: Self::create_inbound_payment
20713  */
20714 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);
20715
20716 /**
20717  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
20718  * are used when constructing the phantom invoice's route hints.
20719  *
20720  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20721  */
20722 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
20723
20724 /**
20725  * Gets route hints for use in receiving [phantom node payments].
20726  *
20727  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20728  */
20729 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
20730
20731 /**
20732  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
20733  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
20734  */
20735 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
20736
20737 /**
20738  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
20739  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
20740  */
20741 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
20742
20743 /**
20744  * Constructs a new Listen which calls the relevant methods on this_arg.
20745  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
20746  */
20747 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
20748
20749 /**
20750  * Constructs a new Confirm which calls the relevant methods on this_arg.
20751  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
20752  */
20753 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
20754
20755 /**
20756  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
20757  * indicating whether persistence is necessary. Only one listener on
20758  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
20759  * up.
20760  *
20761  * Note that this method is not available with the `no-std` feature.
20762  */
20763 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
20764
20765 /**
20766  * Blocks until ChannelManager needs to be persisted. Only one listener on
20767  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
20768  * up.
20769  */
20770 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
20771
20772 /**
20773  * Gets the latest best block which was connected either via the [`chain::Listen`] or
20774  * [`chain::Confirm`] interfaces.
20775  */
20776 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
20777
20778 /**
20779  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
20780  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
20781  */
20782 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
20783
20784 /**
20785  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
20786  */
20787 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
20788
20789 /**
20790  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
20791  */
20792 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
20793
20794 /**
20795  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
20796  */
20797 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
20798
20799 /**
20800  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
20801  */
20802 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
20803
20804 /**
20805  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
20806  */
20807 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
20808
20809 /**
20810  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
20811  */
20812 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
20813
20814 /**
20815  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
20816  */
20817 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
20818
20819 /**
20820  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
20821  */
20822 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
20823
20824 /**
20825  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
20826  */
20827 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
20828
20829 /**
20830  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
20831  */
20832 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
20833
20834 /**
20835  * The keys provider which will give us relevant keys. Some keys will be loaded during
20836  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
20837  * signing data.
20838  */
20839 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20840
20841 /**
20842  * The keys provider which will give us relevant keys. Some keys will be loaded during
20843  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
20844  * signing data.
20845  */
20846 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
20847
20848 /**
20849  * The fee_estimator for use in the ChannelManager in the future.
20850  *
20851  * No calls to the FeeEstimator will be made during deserialization.
20852  */
20853 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20854
20855 /**
20856  * The fee_estimator for use in the ChannelManager in the future.
20857  *
20858  * No calls to the FeeEstimator will be made during deserialization.
20859  */
20860 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
20861
20862 /**
20863  * The chain::Watch for use in the ChannelManager in the future.
20864  *
20865  * No calls to the chain::Watch will be made during deserialization. It is assumed that
20866  * you have deserialized ChannelMonitors separately and will add them to your
20867  * chain::Watch after deserializing this ChannelManager.
20868  */
20869 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20870
20871 /**
20872  * The chain::Watch for use in the ChannelManager in the future.
20873  *
20874  * No calls to the chain::Watch will be made during deserialization. It is assumed that
20875  * you have deserialized ChannelMonitors separately and will add them to your
20876  * chain::Watch after deserializing this ChannelManager.
20877  */
20878 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
20879
20880 /**
20881  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
20882  * used to broadcast the latest local commitment transactions of channels which must be
20883  * force-closed during deserialization.
20884  */
20885 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20886
20887 /**
20888  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
20889  * used to broadcast the latest local commitment transactions of channels which must be
20890  * force-closed during deserialization.
20891  */
20892 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
20893
20894 /**
20895  * The Logger for use in the ChannelManager and which may be used to log information during
20896  * deserialization.
20897  */
20898 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20899
20900 /**
20901  * The Logger for use in the ChannelManager and which may be used to log information during
20902  * deserialization.
20903  */
20904 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
20905
20906 /**
20907  * Default settings used for new channels. Any existing channels will continue to use the
20908  * runtime settings which were stored when the ChannelManager was serialized.
20909  */
20910 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20911
20912 /**
20913  * Default settings used for new channels. Any existing channels will continue to use the
20914  * runtime settings which were stored when the ChannelManager was serialized.
20915  */
20916 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
20917
20918 /**
20919  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
20920  * HashMap for you. This is primarily useful for C bindings where it is not practical to
20921  * populate a HashMap directly from C.
20922  */
20923 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);
20924
20925 /**
20926  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
20927  */
20928 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
20929
20930 /**
20931  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
20932  */
20933 void ExpandedKey_free(struct LDKExpandedKey this_obj);
20934
20935 /**
20936  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
20937  *
20938  * It is recommended to cache this value and not regenerate it for each new inbound payment.
20939  */
20940 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
20941
20942 /**
20943  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
20944  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
20945  * a `ChannelManager`.
20946  *
20947  * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
20948  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
20949  * regenerate it for each new inbound payment.
20950  *
20951  * `current_time` is a Unix timestamp representing the current time.
20952  *
20953  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20954  */
20955 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);
20956
20957 /**
20958  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
20959  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
20960  * without a `ChannelManager`.
20961  *
20962  * See [`create`] for information on the `keys` and `current_time` parameters.
20963  *
20964  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20965  */
20966 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);
20967
20968 /**
20969  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
20970  */
20971 void DecodeError_free(struct LDKDecodeError this_obj);
20972
20973 /**
20974  * Creates a copy of the DecodeError
20975  */
20976 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
20977
20978 /**
20979  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
20980  */
20981 void Init_free(struct LDKInit this_obj);
20982
20983 /**
20984  * The relevant features which the sender supports
20985  */
20986 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
20987
20988 /**
20989  * The relevant features which the sender supports
20990  */
20991 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
20992
20993 /**
20994  * The receipient's network address. This adds the option to report a remote IP address
20995  * back to a connecting peer using the init message. A node can decide to use that information
20996  * to discover a potential update to its public IPv4 address (NAT) and use
20997  * that for a node_announcement update message containing the new address.
20998  */
20999 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
21000
21001 /**
21002  * The receipient's network address. This adds the option to report a remote IP address
21003  * back to a connecting peer using the init message. A node can decide to use that information
21004  * to discover a potential update to its public IPv4 address (NAT) and use
21005  * that for a node_announcement update message containing the new address.
21006  */
21007 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
21008
21009 /**
21010  * Constructs a new Init given each field
21011  */
21012 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
21013
21014 /**
21015  * Creates a copy of the Init
21016  */
21017 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
21018
21019 /**
21020  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
21021  */
21022 void ErrorMessage_free(struct LDKErrorMessage this_obj);
21023
21024 /**
21025  * The channel ID involved in the error.
21026  *
21027  * All-0s indicates a general error unrelated to a specific channel, after which all channels
21028  * with the sending peer should be closed.
21029  */
21030 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
21031
21032 /**
21033  * The channel ID involved in the error.
21034  *
21035  * All-0s indicates a general error unrelated to a specific channel, after which all channels
21036  * with the sending peer should be closed.
21037  */
21038 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21039
21040 /**
21041  * A possibly human-readable error description.
21042  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21043  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21044  * the terminal emulator or the logging subsystem.
21045  */
21046 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
21047
21048 /**
21049  * A possibly human-readable error description.
21050  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21051  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21052  * the terminal emulator or the logging subsystem.
21053  */
21054 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
21055
21056 /**
21057  * Constructs a new ErrorMessage given each field
21058  */
21059 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
21060
21061 /**
21062  * Creates a copy of the ErrorMessage
21063  */
21064 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
21065
21066 /**
21067  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
21068  */
21069 void WarningMessage_free(struct LDKWarningMessage this_obj);
21070
21071 /**
21072  * The channel ID involved in the warning.
21073  *
21074  * All-0s indicates a warning unrelated to a specific channel.
21075  */
21076 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
21077
21078 /**
21079  * The channel ID involved in the warning.
21080  *
21081  * All-0s indicates a warning unrelated to a specific channel.
21082  */
21083 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21084
21085 /**
21086  * A possibly human-readable warning description.
21087  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21088  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21089  * the terminal emulator or the logging subsystem.
21090  */
21091 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
21092
21093 /**
21094  * A possibly human-readable warning description.
21095  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21096  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21097  * the terminal emulator or the logging subsystem.
21098  */
21099 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
21100
21101 /**
21102  * Constructs a new WarningMessage given each field
21103  */
21104 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
21105
21106 /**
21107  * Creates a copy of the WarningMessage
21108  */
21109 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
21110
21111 /**
21112  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
21113  */
21114 void Ping_free(struct LDKPing this_obj);
21115
21116 /**
21117  * The desired response length
21118  */
21119 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
21120
21121 /**
21122  * The desired response length
21123  */
21124 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
21125
21126 /**
21127  * The ping packet size.
21128  * This field is not sent on the wire. byteslen zeros are sent.
21129  */
21130 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
21131
21132 /**
21133  * The ping packet size.
21134  * This field is not sent on the wire. byteslen zeros are sent.
21135  */
21136 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
21137
21138 /**
21139  * Constructs a new Ping given each field
21140  */
21141 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
21142
21143 /**
21144  * Creates a copy of the Ping
21145  */
21146 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
21147
21148 /**
21149  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
21150  */
21151 void Pong_free(struct LDKPong this_obj);
21152
21153 /**
21154  * The pong packet size.
21155  * This field is not sent on the wire. byteslen zeros are sent.
21156  */
21157 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
21158
21159 /**
21160  * The pong packet size.
21161  * This field is not sent on the wire. byteslen zeros are sent.
21162  */
21163 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
21164
21165 /**
21166  * Constructs a new Pong given each field
21167  */
21168 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
21169
21170 /**
21171  * Creates a copy of the Pong
21172  */
21173 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
21174
21175 /**
21176  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
21177  */
21178 void OpenChannel_free(struct LDKOpenChannel this_obj);
21179
21180 /**
21181  * The genesis hash of the blockchain where the channel is to be opened
21182  */
21183 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
21184
21185 /**
21186  * The genesis hash of the blockchain where the channel is to be opened
21187  */
21188 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21189
21190 /**
21191  * A temporary channel ID, until the funding outpoint is announced
21192  */
21193 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
21194
21195 /**
21196  * A temporary channel ID, until the funding outpoint is announced
21197  */
21198 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21199
21200 /**
21201  * The channel value
21202  */
21203 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21204
21205 /**
21206  * The channel value
21207  */
21208 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21209
21210 /**
21211  * The amount to push to the counterparty as part of the open, in milli-satoshi
21212  */
21213 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21214
21215 /**
21216  * The amount to push to the counterparty as part of the open, in milli-satoshi
21217  */
21218 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21219
21220 /**
21221  * The threshold below which outputs on transactions broadcast by sender will be omitted
21222  */
21223 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21224
21225 /**
21226  * The threshold below which outputs on transactions broadcast by sender will be omitted
21227  */
21228 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21229
21230 /**
21231  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21232  */
21233 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21234
21235 /**
21236  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21237  */
21238 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21239
21240 /**
21241  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21242  */
21243 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21244
21245 /**
21246  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21247  */
21248 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21249
21250 /**
21251  * The minimum HTLC size incoming to sender, in milli-satoshi
21252  */
21253 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21254
21255 /**
21256  * The minimum HTLC size incoming to sender, in milli-satoshi
21257  */
21258 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21259
21260 /**
21261  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
21262  */
21263 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21264
21265 /**
21266  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
21267  */
21268 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
21269
21270 /**
21271  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21272  */
21273 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21274
21275 /**
21276  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21277  */
21278 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
21279
21280 /**
21281  * The maximum number of inbound HTLCs towards sender
21282  */
21283 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21284
21285 /**
21286  * The maximum number of inbound HTLCs towards sender
21287  */
21288 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
21289
21290 /**
21291  * The sender's key controlling the funding transaction
21292  */
21293 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21294
21295 /**
21296  * The sender's key controlling the funding transaction
21297  */
21298 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21299
21300 /**
21301  * Used to derive a revocation key for transactions broadcast by counterparty
21302  */
21303 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21304
21305 /**
21306  * Used to derive a revocation key for transactions broadcast by counterparty
21307  */
21308 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21309
21310 /**
21311  * A payment key to sender for transactions broadcast by counterparty
21312  */
21313 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21314
21315 /**
21316  * A payment key to sender for transactions broadcast by counterparty
21317  */
21318 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21319
21320 /**
21321  * Used to derive a payment key to sender for transactions broadcast by sender
21322  */
21323 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21324
21325 /**
21326  * Used to derive a payment key to sender for transactions broadcast by sender
21327  */
21328 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21329
21330 /**
21331  * Used to derive an HTLC payment key to sender
21332  */
21333 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21334
21335 /**
21336  * Used to derive an HTLC payment key to sender
21337  */
21338 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21339
21340 /**
21341  * The first to-be-broadcast-by-sender transaction's per commitment point
21342  */
21343 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21344
21345 /**
21346  * The first to-be-broadcast-by-sender transaction's per commitment point
21347  */
21348 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21349
21350 /**
21351  * Channel flags
21352  */
21353 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21354
21355 /**
21356  * Channel flags
21357  */
21358 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
21359
21360 /**
21361  * The channel type that this channel will represent. If none is set, we derive the channel
21362  * type from the intersection of our feature bits with our counterparty's feature bits from
21363  * the Init message.
21364  *
21365  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21366  */
21367 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21368
21369 /**
21370  * The channel type that this channel will represent. If none is set, we derive the channel
21371  * type from the intersection of our feature bits with our counterparty's feature bits from
21372  * the Init message.
21373  *
21374  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21375  */
21376 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
21377
21378 /**
21379  * Creates a copy of the OpenChannel
21380  */
21381 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
21382
21383 /**
21384  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
21385  */
21386 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
21387
21388 /**
21389  * A temporary channel ID, until the funding outpoint is announced
21390  */
21391 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
21392
21393 /**
21394  * A temporary channel ID, until the funding outpoint is announced
21395  */
21396 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21397
21398 /**
21399  * The threshold below which outputs on transactions broadcast by sender will be omitted
21400  */
21401 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21402
21403 /**
21404  * The threshold below which outputs on transactions broadcast by sender will be omitted
21405  */
21406 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21407
21408 /**
21409  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21410  */
21411 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21412
21413 /**
21414  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21415  */
21416 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21417
21418 /**
21419  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21420  */
21421 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21422
21423 /**
21424  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21425  */
21426 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21427
21428 /**
21429  * The minimum HTLC size incoming to sender, in milli-satoshi
21430  */
21431 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21432
21433 /**
21434  * The minimum HTLC size incoming to sender, in milli-satoshi
21435  */
21436 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21437
21438 /**
21439  * Minimum depth of the funding transaction before the channel is considered open
21440  */
21441 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21442
21443 /**
21444  * Minimum depth of the funding transaction before the channel is considered open
21445  */
21446 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
21447
21448 /**
21449  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21450  */
21451 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21452
21453 /**
21454  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21455  */
21456 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
21457
21458 /**
21459  * The maximum number of inbound HTLCs towards sender
21460  */
21461 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21462
21463 /**
21464  * The maximum number of inbound HTLCs towards sender
21465  */
21466 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
21467
21468 /**
21469  * The sender's key controlling the funding transaction
21470  */
21471 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21472
21473 /**
21474  * The sender's key controlling the funding transaction
21475  */
21476 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21477
21478 /**
21479  * Used to derive a revocation key for transactions broadcast by counterparty
21480  */
21481 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21482
21483 /**
21484  * Used to derive a revocation key for transactions broadcast by counterparty
21485  */
21486 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21487
21488 /**
21489  * A payment key to sender for transactions broadcast by counterparty
21490  */
21491 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21492
21493 /**
21494  * A payment key to sender for transactions broadcast by counterparty
21495  */
21496 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21497
21498 /**
21499  * Used to derive a payment key to sender for transactions broadcast by sender
21500  */
21501 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21502
21503 /**
21504  * Used to derive a payment key to sender for transactions broadcast by sender
21505  */
21506 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21507
21508 /**
21509  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
21510  */
21511 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21512
21513 /**
21514  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
21515  */
21516 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21517
21518 /**
21519  * The first to-be-broadcast-by-sender transaction's per commitment point
21520  */
21521 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21522
21523 /**
21524  * The first to-be-broadcast-by-sender transaction's per commitment point
21525  */
21526 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21527
21528 /**
21529  * The channel type that this channel will represent. If none is set, we derive the channel
21530  * type from the intersection of our feature bits with our counterparty's feature bits from
21531  * the Init message.
21532  *
21533  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
21534  *
21535  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21536  */
21537 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21538
21539 /**
21540  * The channel type that this channel will represent. If none is set, we derive the channel
21541  * type from the intersection of our feature bits with our counterparty's feature bits from
21542  * the Init message.
21543  *
21544  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
21545  *
21546  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21547  */
21548 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
21549
21550 /**
21551  * Creates a copy of the AcceptChannel
21552  */
21553 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
21554
21555 /**
21556  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
21557  */
21558 void FundingCreated_free(struct LDKFundingCreated this_obj);
21559
21560 /**
21561  * A temporary channel ID, until the funding is established
21562  */
21563 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
21564
21565 /**
21566  * A temporary channel ID, until the funding is established
21567  */
21568 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21569
21570 /**
21571  * The funding transaction ID
21572  */
21573 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
21574
21575 /**
21576  * The funding transaction ID
21577  */
21578 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21579
21580 /**
21581  * The specific output index funding this channel
21582  */
21583 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
21584
21585 /**
21586  * The specific output index funding this channel
21587  */
21588 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
21589
21590 /**
21591  * The signature of the channel initiator (funder) on the initial commitment transaction
21592  */
21593 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
21594
21595 /**
21596  * The signature of the channel initiator (funder) on the initial commitment transaction
21597  */
21598 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
21599
21600 /**
21601  * Constructs a new FundingCreated given each field
21602  */
21603 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);
21604
21605 /**
21606  * Creates a copy of the FundingCreated
21607  */
21608 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
21609
21610 /**
21611  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
21612  */
21613 void FundingSigned_free(struct LDKFundingSigned this_obj);
21614
21615 /**
21616  * The channel ID
21617  */
21618 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
21619
21620 /**
21621  * The channel ID
21622  */
21623 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21624
21625 /**
21626  * The signature of the channel acceptor (fundee) on the initial commitment transaction
21627  */
21628 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
21629
21630 /**
21631  * The signature of the channel acceptor (fundee) on the initial commitment transaction
21632  */
21633 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
21634
21635 /**
21636  * Constructs a new FundingSigned given each field
21637  */
21638 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
21639
21640 /**
21641  * Creates a copy of the FundingSigned
21642  */
21643 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
21644
21645 /**
21646  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
21647  */
21648 void ChannelReady_free(struct LDKChannelReady this_obj);
21649
21650 /**
21651  * The channel ID
21652  */
21653 const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
21654
21655 /**
21656  * The channel ID
21657  */
21658 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21659
21660 /**
21661  * The per-commitment point of the second commitment transaction
21662  */
21663 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
21664
21665 /**
21666  * The per-commitment point of the second commitment transaction
21667  */
21668 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21669
21670 /**
21671  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
21672  * to be forwarded over this SCID and forward them to this messages' recipient.
21673  */
21674 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
21675
21676 /**
21677  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
21678  * to be forwarded over this SCID and forward them to this messages' recipient.
21679  */
21680 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21681
21682 /**
21683  * Constructs a new ChannelReady given each field
21684  */
21685 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);
21686
21687 /**
21688  * Creates a copy of the ChannelReady
21689  */
21690 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
21691
21692 /**
21693  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
21694  */
21695 void Shutdown_free(struct LDKShutdown this_obj);
21696
21697 /**
21698  * The channel ID
21699  */
21700 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
21701
21702 /**
21703  * The channel ID
21704  */
21705 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21706
21707 /**
21708  * The destination of this peer's funds on closing.
21709  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
21710  */
21711 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
21712
21713 /**
21714  * The destination of this peer's funds on closing.
21715  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
21716  */
21717 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
21718
21719 /**
21720  * Constructs a new Shutdown given each field
21721  */
21722 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
21723
21724 /**
21725  * Creates a copy of the Shutdown
21726  */
21727 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
21728
21729 /**
21730  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
21731  */
21732 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
21733
21734 /**
21735  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
21736  * transaction.
21737  */
21738 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
21739
21740 /**
21741  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
21742  * transaction.
21743  */
21744 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
21745
21746 /**
21747  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
21748  * transaction.
21749  */
21750 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
21751
21752 /**
21753  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
21754  * transaction.
21755  */
21756 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
21757
21758 /**
21759  * Constructs a new ClosingSignedFeeRange given each field
21760  */
21761 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
21762
21763 /**
21764  * Creates a copy of the ClosingSignedFeeRange
21765  */
21766 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
21767
21768 /**
21769  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
21770  */
21771 void ClosingSigned_free(struct LDKClosingSigned this_obj);
21772
21773 /**
21774  * The channel ID
21775  */
21776 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
21777
21778 /**
21779  * The channel ID
21780  */
21781 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21782
21783 /**
21784  * The proposed total fee for the closing transaction
21785  */
21786 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
21787
21788 /**
21789  * The proposed total fee for the closing transaction
21790  */
21791 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
21792
21793 /**
21794  * A signature on the closing transaction
21795  */
21796 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
21797
21798 /**
21799  * A signature on the closing transaction
21800  */
21801 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
21802
21803 /**
21804  * The minimum and maximum fees which the sender is willing to accept, provided only by new
21805  * nodes.
21806  *
21807  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21808  */
21809 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
21810
21811 /**
21812  * The minimum and maximum fees which the sender is willing to accept, provided only by new
21813  * nodes.
21814  *
21815  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21816  */
21817 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
21818
21819 /**
21820  * Constructs a new ClosingSigned given each field
21821  */
21822 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);
21823
21824 /**
21825  * Creates a copy of the ClosingSigned
21826  */
21827 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
21828
21829 /**
21830  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
21831  */
21832 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
21833
21834 /**
21835  * The channel ID
21836  */
21837 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
21838
21839 /**
21840  * The channel ID
21841  */
21842 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21843
21844 /**
21845  * The HTLC ID
21846  */
21847 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
21848
21849 /**
21850  * The HTLC ID
21851  */
21852 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
21853
21854 /**
21855  * The HTLC value in milli-satoshi
21856  */
21857 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
21858
21859 /**
21860  * The HTLC value in milli-satoshi
21861  */
21862 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
21863
21864 /**
21865  * The payment hash, the pre-image of which controls HTLC redemption
21866  */
21867 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
21868
21869 /**
21870  * The payment hash, the pre-image of which controls HTLC redemption
21871  */
21872 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21873
21874 /**
21875  * The expiry height of the HTLC
21876  */
21877 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
21878
21879 /**
21880  * The expiry height of the HTLC
21881  */
21882 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
21883
21884 /**
21885  * Creates a copy of the UpdateAddHTLC
21886  */
21887 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
21888
21889 /**
21890  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
21891  */
21892 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
21893
21894 /**
21895  * The channel ID
21896  */
21897 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
21898
21899 /**
21900  * The channel ID
21901  */
21902 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21903
21904 /**
21905  * The HTLC ID
21906  */
21907 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
21908
21909 /**
21910  * The HTLC ID
21911  */
21912 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
21913
21914 /**
21915  * The pre-image of the payment hash, allowing HTLC redemption
21916  */
21917 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
21918
21919 /**
21920  * The pre-image of the payment hash, allowing HTLC redemption
21921  */
21922 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21923
21924 /**
21925  * Constructs a new UpdateFulfillHTLC given each field
21926  */
21927 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
21928
21929 /**
21930  * Creates a copy of the UpdateFulfillHTLC
21931  */
21932 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
21933
21934 /**
21935  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
21936  */
21937 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
21938
21939 /**
21940  * The channel ID
21941  */
21942 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
21943
21944 /**
21945  * The channel ID
21946  */
21947 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21948
21949 /**
21950  * The HTLC ID
21951  */
21952 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
21953
21954 /**
21955  * The HTLC ID
21956  */
21957 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
21958
21959 /**
21960  * Creates a copy of the UpdateFailHTLC
21961  */
21962 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
21963
21964 /**
21965  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
21966  */
21967 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
21968
21969 /**
21970  * The channel ID
21971  */
21972 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
21973
21974 /**
21975  * The channel ID
21976  */
21977 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21978
21979 /**
21980  * The HTLC ID
21981  */
21982 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
21983
21984 /**
21985  * The HTLC ID
21986  */
21987 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
21988
21989 /**
21990  * The failure code
21991  */
21992 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
21993
21994 /**
21995  * The failure code
21996  */
21997 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
21998
21999 /**
22000  * Creates a copy of the UpdateFailMalformedHTLC
22001  */
22002 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
22003
22004 /**
22005  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
22006  */
22007 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
22008
22009 /**
22010  * The channel ID
22011  */
22012 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
22013
22014 /**
22015  * The channel ID
22016  */
22017 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22018
22019 /**
22020  * A signature on the commitment transaction
22021  */
22022 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
22023
22024 /**
22025  * A signature on the commitment transaction
22026  */
22027 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
22028
22029 /**
22030  * Signatures on the HTLC transactions
22031  */
22032 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
22033
22034 /**
22035  * Constructs a new CommitmentSigned given each field
22036  */
22037 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
22038
22039 /**
22040  * Creates a copy of the CommitmentSigned
22041  */
22042 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
22043
22044 /**
22045  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
22046  */
22047 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
22048
22049 /**
22050  * The channel ID
22051  */
22052 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
22053
22054 /**
22055  * The channel ID
22056  */
22057 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22058
22059 /**
22060  * The secret corresponding to the per-commitment point
22061  */
22062 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
22063
22064 /**
22065  * The secret corresponding to the per-commitment point
22066  */
22067 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22068
22069 /**
22070  * The next sender-broadcast commitment transaction's per-commitment point
22071  */
22072 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
22073
22074 /**
22075  * The next sender-broadcast commitment transaction's per-commitment point
22076  */
22077 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22078
22079 /**
22080  * Constructs a new RevokeAndACK given each field
22081  */
22082 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);
22083
22084 /**
22085  * Creates a copy of the RevokeAndACK
22086  */
22087 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
22088
22089 /**
22090  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
22091  */
22092 void UpdateFee_free(struct LDKUpdateFee this_obj);
22093
22094 /**
22095  * The channel ID
22096  */
22097 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
22098
22099 /**
22100  * The channel ID
22101  */
22102 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22103
22104 /**
22105  * Fee rate per 1000-weight of the transaction
22106  */
22107 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
22108
22109 /**
22110  * Fee rate per 1000-weight of the transaction
22111  */
22112 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
22113
22114 /**
22115  * Constructs a new UpdateFee given each field
22116  */
22117 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
22118
22119 /**
22120  * Creates a copy of the UpdateFee
22121  */
22122 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
22123
22124 /**
22125  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
22126  */
22127 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
22128
22129 /**
22130  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
22131  * belonging to the recipient
22132  */
22133 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
22134
22135 /**
22136  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
22137  * belonging to the recipient
22138  */
22139 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22140
22141 /**
22142  * The sender's per-commitment point for their current commitment transaction
22143  */
22144 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
22145
22146 /**
22147  * The sender's per-commitment point for their current commitment transaction
22148  */
22149 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22150
22151 /**
22152  * Constructs a new DataLossProtect given each field
22153  */
22154 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
22155
22156 /**
22157  * Creates a copy of the DataLossProtect
22158  */
22159 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
22160
22161 /**
22162  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
22163  */
22164 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
22165
22166 /**
22167  * The channel ID
22168  */
22169 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
22170
22171 /**
22172  * The channel ID
22173  */
22174 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22175
22176 /**
22177  * The next commitment number for the sender
22178  */
22179 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
22180
22181 /**
22182  * The next commitment number for the sender
22183  */
22184 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
22185
22186 /**
22187  * The next commitment number for the recipient
22188  */
22189 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
22190
22191 /**
22192  * The next commitment number for the recipient
22193  */
22194 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
22195
22196 /**
22197  * Creates a copy of the ChannelReestablish
22198  */
22199 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
22200
22201 /**
22202  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
22203  */
22204 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
22205
22206 /**
22207  * The channel ID
22208  */
22209 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
22210
22211 /**
22212  * The channel ID
22213  */
22214 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22215
22216 /**
22217  * The short channel ID
22218  */
22219 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22220
22221 /**
22222  * The short channel ID
22223  */
22224 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
22225
22226 /**
22227  * A signature by the node key
22228  */
22229 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22230
22231 /**
22232  * A signature by the node key
22233  */
22234 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
22235
22236 /**
22237  * A signature by the funding key
22238  */
22239 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22240
22241 /**
22242  * A signature by the funding key
22243  */
22244 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
22245
22246 /**
22247  * Constructs a new AnnouncementSignatures given each field
22248  */
22249 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);
22250
22251 /**
22252  * Creates a copy of the AnnouncementSignatures
22253  */
22254 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
22255
22256 /**
22257  * Frees any resources used by the NetAddress
22258  */
22259 void NetAddress_free(struct LDKNetAddress this_ptr);
22260
22261 /**
22262  * Creates a copy of the NetAddress
22263  */
22264 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
22265
22266 /**
22267  * Utility method to constructs a new IPv4-variant NetAddress
22268  */
22269 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
22270
22271 /**
22272  * Utility method to constructs a new IPv6-variant NetAddress
22273  */
22274 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
22275
22276 /**
22277  * Utility method to constructs a new OnionV2-variant NetAddress
22278  */
22279 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
22280
22281 /**
22282  * Utility method to constructs a new OnionV3-variant NetAddress
22283  */
22284 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
22285
22286 /**
22287  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
22288  */
22289 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
22290
22291 /**
22292  * Read a NetAddress from a byte array, created by NetAddress_write
22293  */
22294 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
22295
22296 /**
22297  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
22298  */
22299 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
22300
22301 /**
22302  * The advertised features
22303  */
22304 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22305
22306 /**
22307  * The advertised features
22308  */
22309 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
22310
22311 /**
22312  * A strictly monotonic announcement counter, with gaps allowed
22313  */
22314 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22315
22316 /**
22317  * A strictly monotonic announcement counter, with gaps allowed
22318  */
22319 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
22320
22321 /**
22322  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
22323  * to this node).
22324  */
22325 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22326
22327 /**
22328  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
22329  * to this node).
22330  */
22331 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22332
22333 /**
22334  * An RGB color for UI purposes
22335  */
22336 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
22337
22338 /**
22339  * An RGB color for UI purposes
22340  */
22341 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
22342
22343 /**
22344  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
22345  * of uniqueness.
22346  */
22347 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
22348
22349 /**
22350  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
22351  * of uniqueness.
22352  */
22353 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22354
22355 /**
22356  * List of addresses on which this node is reachable
22357  */
22358 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
22359
22360 /**
22361  * Creates a copy of the UnsignedNodeAnnouncement
22362  */
22363 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
22364
22365 /**
22366  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
22367  */
22368 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
22369
22370 /**
22371  * The signature by the node key
22372  */
22373 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
22374
22375 /**
22376  * The signature by the node key
22377  */
22378 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22379
22380 /**
22381  * The actual content of the announcement
22382  */
22383 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
22384
22385 /**
22386  * The actual content of the announcement
22387  */
22388 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
22389
22390 /**
22391  * Constructs a new NodeAnnouncement given each field
22392  */
22393 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
22394
22395 /**
22396  * Creates a copy of the NodeAnnouncement
22397  */
22398 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
22399
22400 /**
22401  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
22402  */
22403 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
22404
22405 /**
22406  * The advertised channel features
22407  */
22408 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22409
22410 /**
22411  * The advertised channel features
22412  */
22413 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
22414
22415 /**
22416  * The genesis hash of the blockchain where the channel is to be opened
22417  */
22418 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
22419
22420 /**
22421  * The genesis hash of the blockchain where the channel is to be opened
22422  */
22423 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22424
22425 /**
22426  * The short channel ID
22427  */
22428 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22429
22430 /**
22431  * The short channel ID
22432  */
22433 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
22434
22435 /**
22436  * One of the two node_ids which are endpoints of this channel
22437  */
22438 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22439
22440 /**
22441  * One of the two node_ids which are endpoints of this channel
22442  */
22443 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22444
22445 /**
22446  * The other of the two node_ids which are endpoints of this channel
22447  */
22448 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22449
22450 /**
22451  * The other of the two node_ids which are endpoints of this channel
22452  */
22453 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22454
22455 /**
22456  * The funding key for the first node
22457  */
22458 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22459
22460 /**
22461  * The funding key for the first node
22462  */
22463 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22464
22465 /**
22466  * The funding key for the second node
22467  */
22468 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22469
22470 /**
22471  * The funding key for the second node
22472  */
22473 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22474
22475 /**
22476  * Creates a copy of the UnsignedChannelAnnouncement
22477  */
22478 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
22479
22480 /**
22481  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
22482  */
22483 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
22484
22485 /**
22486  * Authentication of the announcement by the first public node
22487  */
22488 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22489
22490 /**
22491  * Authentication of the announcement by the first public node
22492  */
22493 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22494
22495 /**
22496  * Authentication of the announcement by the second public node
22497  */
22498 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22499
22500 /**
22501  * Authentication of the announcement by the second public node
22502  */
22503 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22504
22505 /**
22506  * Proof of funding UTXO ownership by the first public node
22507  */
22508 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22509
22510 /**
22511  * Proof of funding UTXO ownership by the first public node
22512  */
22513 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22514
22515 /**
22516  * Proof of funding UTXO ownership by the second public node
22517  */
22518 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22519
22520 /**
22521  * Proof of funding UTXO ownership by the second public node
22522  */
22523 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22524
22525 /**
22526  * The actual announcement
22527  */
22528 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22529
22530 /**
22531  * The actual announcement
22532  */
22533 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
22534
22535 /**
22536  * Constructs a new ChannelAnnouncement given each field
22537  */
22538 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);
22539
22540 /**
22541  * Creates a copy of the ChannelAnnouncement
22542  */
22543 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
22544
22545 /**
22546  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
22547  */
22548 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
22549
22550 /**
22551  * The genesis hash of the blockchain where the channel is to be opened
22552  */
22553 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
22554
22555 /**
22556  * The genesis hash of the blockchain where the channel is to be opened
22557  */
22558 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22559
22560 /**
22561  * The short channel ID
22562  */
22563 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22564
22565 /**
22566  * The short channel ID
22567  */
22568 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
22569
22570 /**
22571  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
22572  */
22573 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22574
22575 /**
22576  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
22577  */
22578 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
22579
22580 /**
22581  * Channel flags
22582  */
22583 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22584
22585 /**
22586  * Channel flags
22587  */
22588 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
22589
22590 /**
22591  * The number of blocks such that if:
22592  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
22593  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
22594  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
22595  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
22596  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
22597  * forwarding. Note that the HTLC sender is the one who originally sets this value when
22598  * constructing the route.
22599  */
22600 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22601
22602 /**
22603  * The number of blocks such that if:
22604  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
22605  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
22606  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
22607  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
22608  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
22609  * forwarding. Note that the HTLC sender is the one who originally sets this value when
22610  * constructing the route.
22611  */
22612 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
22613
22614 /**
22615  * The minimum HTLC size incoming to sender, in milli-satoshi
22616  */
22617 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22618
22619 /**
22620  * The minimum HTLC size incoming to sender, in milli-satoshi
22621  */
22622 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
22623
22624 /**
22625  * The base HTLC fee charged by sender, in milli-satoshi
22626  */
22627 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22628
22629 /**
22630  * The base HTLC fee charged by sender, in milli-satoshi
22631  */
22632 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
22633
22634 /**
22635  * The amount to fee multiplier, in micro-satoshi
22636  */
22637 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22638
22639 /**
22640  * The amount to fee multiplier, in micro-satoshi
22641  */
22642 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
22643
22644 /**
22645  * Excess data which was signed as a part of the message which we do not (yet) understand how
22646  * to decode. This is stored to ensure forward-compatibility as new fields are added to the
22647  * lightning gossip
22648  */
22649 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
22650
22651 /**
22652  * Creates a copy of the UnsignedChannelUpdate
22653  */
22654 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
22655
22656 /**
22657  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
22658  */
22659 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
22660
22661 /**
22662  * A signature of the channel update
22663  */
22664 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
22665
22666 /**
22667  * A signature of the channel update
22668  */
22669 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
22670
22671 /**
22672  * The actual channel update
22673  */
22674 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
22675
22676 /**
22677  * The actual channel update
22678  */
22679 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
22680
22681 /**
22682  * Constructs a new ChannelUpdate given each field
22683  */
22684 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
22685
22686 /**
22687  * Creates a copy of the ChannelUpdate
22688  */
22689 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
22690
22691 /**
22692  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
22693  */
22694 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
22695
22696 /**
22697  * The genesis hash of the blockchain being queried
22698  */
22699 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
22700
22701 /**
22702  * The genesis hash of the blockchain being queried
22703  */
22704 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22705
22706 /**
22707  * The height of the first block for the channel UTXOs being queried
22708  */
22709 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
22710
22711 /**
22712  * The height of the first block for the channel UTXOs being queried
22713  */
22714 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22715
22716 /**
22717  * The number of blocks to include in the query results
22718  */
22719 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
22720
22721 /**
22722  * The number of blocks to include in the query results
22723  */
22724 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22725
22726 /**
22727  * Constructs a new QueryChannelRange given each field
22728  */
22729 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
22730
22731 /**
22732  * Creates a copy of the QueryChannelRange
22733  */
22734 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
22735
22736 /**
22737  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
22738  */
22739 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
22740
22741 /**
22742  * The genesis hash of the blockchain being queried
22743  */
22744 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
22745
22746 /**
22747  * The genesis hash of the blockchain being queried
22748  */
22749 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22750
22751 /**
22752  * The height of the first block in the range of the reply
22753  */
22754 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22755
22756 /**
22757  * The height of the first block in the range of the reply
22758  */
22759 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22760
22761 /**
22762  * The number of blocks included in the range of the reply
22763  */
22764 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22765
22766 /**
22767  * The number of blocks included in the range of the reply
22768  */
22769 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22770
22771 /**
22772  * True when this is the final reply for a query
22773  */
22774 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22775
22776 /**
22777  * True when this is the final reply for a query
22778  */
22779 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
22780
22781 /**
22782  * The short_channel_ids in the channel range
22783  */
22784 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
22785
22786 /**
22787  * Constructs a new ReplyChannelRange given each field
22788  */
22789 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);
22790
22791 /**
22792  * Creates a copy of the ReplyChannelRange
22793  */
22794 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
22795
22796 /**
22797  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
22798  */
22799 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
22800
22801 /**
22802  * The genesis hash of the blockchain being queried
22803  */
22804 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
22805
22806 /**
22807  * The genesis hash of the blockchain being queried
22808  */
22809 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22810
22811 /**
22812  * The short_channel_ids that are being queried
22813  */
22814 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
22815
22816 /**
22817  * Constructs a new QueryShortChannelIds given each field
22818  */
22819 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
22820
22821 /**
22822  * Creates a copy of the QueryShortChannelIds
22823  */
22824 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
22825
22826 /**
22827  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
22828  */
22829 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
22830
22831 /**
22832  * The genesis hash of the blockchain that was queried
22833  */
22834 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
22835
22836 /**
22837  * The genesis hash of the blockchain that was queried
22838  */
22839 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22840
22841 /**
22842  * Indicates if the query recipient maintains up-to-date channel
22843  * information for the chain_hash
22844  */
22845 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
22846
22847 /**
22848  * Indicates if the query recipient maintains up-to-date channel
22849  * information for the chain_hash
22850  */
22851 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
22852
22853 /**
22854  * Constructs a new ReplyShortChannelIdsEnd given each field
22855  */
22856 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
22857
22858 /**
22859  * Creates a copy of the ReplyShortChannelIdsEnd
22860  */
22861 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
22862
22863 /**
22864  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
22865  */
22866 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
22867
22868 /**
22869  * The genesis hash of the blockchain for channel and node information
22870  */
22871 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
22872
22873 /**
22874  * The genesis hash of the blockchain for channel and node information
22875  */
22876 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22877
22878 /**
22879  * The starting unix timestamp
22880  */
22881 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
22882
22883 /**
22884  * The starting unix timestamp
22885  */
22886 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
22887
22888 /**
22889  * The range of information in seconds
22890  */
22891 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
22892
22893 /**
22894  * The range of information in seconds
22895  */
22896 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
22897
22898 /**
22899  * Constructs a new GossipTimestampFilter given each field
22900  */
22901 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
22902
22903 /**
22904  * Creates a copy of the GossipTimestampFilter
22905  */
22906 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
22907
22908 /**
22909  * Frees any resources used by the ErrorAction
22910  */
22911 void ErrorAction_free(struct LDKErrorAction this_ptr);
22912
22913 /**
22914  * Creates a copy of the ErrorAction
22915  */
22916 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
22917
22918 /**
22919  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
22920  */
22921 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
22922
22923 /**
22924  * Utility method to constructs a new IgnoreError-variant ErrorAction
22925  */
22926 struct LDKErrorAction ErrorAction_ignore_error(void);
22927
22928 /**
22929  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
22930  */
22931 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
22932
22933 /**
22934  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
22935  */
22936 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
22937
22938 /**
22939  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
22940  */
22941 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
22942
22943 /**
22944  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
22945  */
22946 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
22947
22948 /**
22949  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
22950  */
22951 void LightningError_free(struct LDKLightningError this_obj);
22952
22953 /**
22954  * A human-readable message describing the error
22955  */
22956 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
22957
22958 /**
22959  * A human-readable message describing the error
22960  */
22961 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
22962
22963 /**
22964  * The action which should be taken against the offending peer.
22965  */
22966 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
22967
22968 /**
22969  * The action which should be taken against the offending peer.
22970  */
22971 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
22972
22973 /**
22974  * Constructs a new LightningError given each field
22975  */
22976 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
22977
22978 /**
22979  * Creates a copy of the LightningError
22980  */
22981 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
22982
22983 /**
22984  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
22985  */
22986 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
22987
22988 /**
22989  * update_add_htlc messages which should be sent
22990  */
22991 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22992
22993 /**
22994  * update_add_htlc messages which should be sent
22995  */
22996 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
22997
22998 /**
22999  * update_fulfill_htlc messages which should be sent
23000  */
23001 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23002
23003 /**
23004  * update_fulfill_htlc messages which should be sent
23005  */
23006 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
23007
23008 /**
23009  * update_fail_htlc messages which should be sent
23010  */
23011 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23012
23013 /**
23014  * update_fail_htlc messages which should be sent
23015  */
23016 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
23017
23018 /**
23019  * update_fail_malformed_htlc messages which should be sent
23020  */
23021 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23022
23023 /**
23024  * update_fail_malformed_htlc messages which should be sent
23025  */
23026 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
23027
23028 /**
23029  * An update_fee message which should be sent
23030  *
23031  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23032  */
23033 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23034
23035 /**
23036  * An update_fee message which should be sent
23037  *
23038  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23039  */
23040 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
23041
23042 /**
23043  * Finally, the commitment_signed message which should be sent
23044  */
23045 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23046
23047 /**
23048  * Finally, the commitment_signed message which should be sent
23049  */
23050 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
23051
23052 /**
23053  * Constructs a new CommitmentUpdate given each field
23054  */
23055 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);
23056
23057 /**
23058  * Creates a copy of the CommitmentUpdate
23059  */
23060 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
23061
23062 /**
23063  * Calls the free function if one is set
23064  */
23065 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
23066
23067 /**
23068  * Calls the free function if one is set
23069  */
23070 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
23071
23072 /**
23073  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
23074  */
23075 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
23076
23077 /**
23078  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
23079  */
23080 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
23081
23082 /**
23083  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
23084  */
23085 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
23086
23087 /**
23088  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
23089  */
23090 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
23091
23092 /**
23093  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
23094  */
23095 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
23096
23097 /**
23098  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
23099  */
23100 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
23101
23102 /**
23103  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
23104  */
23105 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
23106
23107 /**
23108  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
23109  */
23110 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
23111
23112 /**
23113  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
23114  */
23115 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
23116
23117 /**
23118  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
23119  */
23120 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
23121
23122 /**
23123  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
23124  */
23125 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
23126
23127 /**
23128  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
23129  */
23130 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
23131
23132 /**
23133  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
23134  */
23135 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
23136
23137 /**
23138  * Read a FundingCreated from a byte array, created by FundingCreated_write
23139  */
23140 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
23141
23142 /**
23143  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
23144  */
23145 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
23146
23147 /**
23148  * Read a FundingSigned from a byte array, created by FundingSigned_write
23149  */
23150 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
23151
23152 /**
23153  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
23154  */
23155 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
23156
23157 /**
23158  * Read a ChannelReady from a byte array, created by ChannelReady_write
23159  */
23160 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
23161
23162 /**
23163  * Serialize the Init object into a byte array which can be read by Init_read
23164  */
23165 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
23166
23167 /**
23168  * Read a Init from a byte array, created by Init_write
23169  */
23170 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
23171
23172 /**
23173  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
23174  */
23175 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
23176
23177 /**
23178  * Read a OpenChannel from a byte array, created by OpenChannel_write
23179  */
23180 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
23181
23182 /**
23183  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
23184  */
23185 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
23186
23187 /**
23188  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
23189  */
23190 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
23191
23192 /**
23193  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
23194  */
23195 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
23196
23197 /**
23198  * Read a Shutdown from a byte array, created by Shutdown_write
23199  */
23200 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
23201
23202 /**
23203  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
23204  */
23205 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
23206
23207 /**
23208  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
23209  */
23210 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
23211
23212 /**
23213  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
23214  */
23215 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
23216
23217 /**
23218  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
23219  */
23220 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
23221
23222 /**
23223  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
23224  */
23225 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
23226
23227 /**
23228  * Read a UpdateFee from a byte array, created by UpdateFee_write
23229  */
23230 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
23231
23232 /**
23233  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
23234  */
23235 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
23236
23237 /**
23238  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
23239  */
23240 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
23241
23242 /**
23243  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
23244  */
23245 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
23246
23247 /**
23248  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
23249  */
23250 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
23251
23252 /**
23253  * Serialize the Ping object into a byte array which can be read by Ping_read
23254  */
23255 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
23256
23257 /**
23258  * Read a Ping from a byte array, created by Ping_write
23259  */
23260 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
23261
23262 /**
23263  * Serialize the Pong object into a byte array which can be read by Pong_read
23264  */
23265 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
23266
23267 /**
23268  * Read a Pong from a byte array, created by Pong_write
23269  */
23270 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
23271
23272 /**
23273  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
23274  */
23275 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
23276
23277 /**
23278  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
23279  */
23280 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
23281
23282 /**
23283  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
23284  */
23285 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
23286
23287 /**
23288  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
23289  */
23290 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
23291
23292 /**
23293  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
23294  */
23295 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
23296
23297 /**
23298  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
23299  */
23300 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
23301
23302 /**
23303  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
23304  */
23305 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
23306
23307 /**
23308  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
23309  */
23310 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
23311
23312 /**
23313  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
23314  */
23315 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
23316
23317 /**
23318  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
23319  */
23320 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
23321
23322 /**
23323  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
23324  */
23325 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
23326
23327 /**
23328  * Read a WarningMessage from a byte array, created by WarningMessage_write
23329  */
23330 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
23331
23332 /**
23333  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
23334  */
23335 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
23336
23337 /**
23338  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
23339  */
23340 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
23341
23342 /**
23343  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
23344  */
23345 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
23346
23347 /**
23348  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
23349  */
23350 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
23351
23352 /**
23353  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
23354  */
23355 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
23356
23357 /**
23358  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
23359  */
23360 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
23361
23362 /**
23363  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
23364  */
23365 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
23366
23367 /**
23368  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
23369  */
23370 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
23371
23372 /**
23373  *\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
23374  */
23375 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
23376
23377 /**
23378  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
23379  */
23380 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
23381
23382 /**
23383  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
23384  */
23385 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
23386
23387 /**
23388  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
23389  */
23390 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
23391
23392 /**
23393  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
23394  */
23395 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
23396
23397 /**
23398  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
23399  */
23400 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
23401
23402 /**
23403  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
23404  */
23405 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
23406
23407 /**
23408  * Calls the free function if one is set
23409  */
23410 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
23411
23412 /**
23413  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
23414  */
23415 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
23416
23417 /**
23418  * Constructs a new IgnoringMessageHandler given each field
23419  */
23420 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
23421
23422 /**
23423  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
23424  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
23425  */
23426 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23427
23428 /**
23429  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
23430  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
23431  */
23432 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23433
23434 /**
23435  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
23436  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
23437  */
23438 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23439
23440 /**
23441  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
23442  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
23443  */
23444 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23445
23446 /**
23447  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
23448  */
23449 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
23450
23451 /**
23452  * Constructs a new ErroringMessageHandler
23453  */
23454 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
23455
23456 /**
23457  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
23458  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
23459  */
23460 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
23461
23462 /**
23463  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
23464  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
23465  */
23466 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
23467
23468 /**
23469  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
23470  */
23471 void MessageHandler_free(struct LDKMessageHandler this_obj);
23472
23473 /**
23474  * A message handler which handles messages specific to channels. Usually this is just a
23475  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
23476  *
23477  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23478  */
23479 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
23480
23481 /**
23482  * A message handler which handles messages specific to channels. Usually this is just a
23483  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
23484  *
23485  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23486  */
23487 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
23488
23489 /**
23490  * A message handler which handles messages updating our knowledge of the network channel
23491  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
23492  *
23493  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
23494  */
23495 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
23496
23497 /**
23498  * A message handler which handles messages updating our knowledge of the network channel
23499  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
23500  *
23501  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
23502  */
23503 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
23504
23505 /**
23506  * Constructs a new MessageHandler given each field
23507  */
23508 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
23509
23510 /**
23511  * Creates a copy of a SocketDescriptor
23512  */
23513 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
23514
23515 /**
23516  * Calls the free function if one is set
23517  */
23518 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
23519
23520 /**
23521  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
23522  */
23523 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
23524
23525 /**
23526  * Used to indicate that we probably can't make any future connections to this peer (e.g.
23527  * because we required features that our peer was missing, or vice versa).
23528  *
23529  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
23530  * any channels with this peer or check for new versions of LDK.
23531  *
23532  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23533  */
23534 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
23535
23536 /**
23537  * Used to indicate that we probably can't make any future connections to this peer (e.g.
23538  * because we required features that our peer was missing, or vice versa).
23539  *
23540  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
23541  * any channels with this peer or check for new versions of LDK.
23542  *
23543  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23544  */
23545 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
23546
23547 /**
23548  * Constructs a new PeerHandleError given each field
23549  */
23550 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
23551
23552 /**
23553  * Creates a copy of the PeerHandleError
23554  */
23555 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
23556
23557 /**
23558  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
23559  */
23560 void PeerManager_free(struct LDKPeerManager this_obj);
23561
23562 /**
23563  * Constructs a new PeerManager with the given message handlers and node_id secret key
23564  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
23565  * cryptographically secure random bytes.
23566  */
23567 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);
23568
23569 /**
23570  * Get the list of node ids for peers which have completed the initial handshake.
23571  *
23572  * For outbound connections, this will be the same as the their_node_id parameter passed in to
23573  * new_outbound_connection, however entries will only appear once the initial handshake has
23574  * completed and we are sure the remote peer has the private key for the given node_id.
23575  */
23576 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
23577
23578 /**
23579  * Indicates a new outbound connection has been established to a node with the given node_id
23580  * and an optional remote network address.
23581  *
23582  * The remote network address adds the option to report a remote IP address back to a connecting
23583  * peer using the init message.
23584  * The user should pass the remote network address of the host they are connected to.
23585  *
23586  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
23587  * descriptor but must disconnect the connection immediately.
23588  *
23589  * Returns a small number of bytes to send to the remote node (currently always 50).
23590  *
23591  * Panics if descriptor is duplicative with some other descriptor which has not yet been
23592  * [`socket_disconnected()`].
23593  *
23594  * [`socket_disconnected()`]: PeerManager::socket_disconnected
23595  */
23596 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);
23597
23598 /**
23599  * Indicates a new inbound connection has been established to a node with an optional remote
23600  * network address.
23601  *
23602  * The remote network address adds the option to report a remote IP address back to a connecting
23603  * peer using the init message.
23604  * The user should pass the remote network address of the host they are connected to.
23605  *
23606  * May refuse the connection by returning an Err, but will never write bytes to the remote end
23607  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
23608  * call socket_disconnected for the new descriptor but must disconnect the connection
23609  * immediately.
23610  *
23611  * Panics if descriptor is duplicative with some other descriptor which has not yet been
23612  * [`socket_disconnected()`].
23613  *
23614  * [`socket_disconnected()`]: PeerManager::socket_disconnected
23615  */
23616 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);
23617
23618 /**
23619  * Indicates that there is room to write data to the given socket descriptor.
23620  *
23621  * May return an Err to indicate that the connection should be closed.
23622  *
23623  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
23624  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
23625  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
23626  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
23627  * sufficient!
23628  *
23629  * [`send_data`]: SocketDescriptor::send_data
23630  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
23631  */
23632 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
23633
23634 /**
23635  * Indicates that data was read from the given socket descriptor.
23636  *
23637  * May return an Err to indicate that the connection should be closed.
23638  *
23639  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
23640  * Thus, however, you should call [`process_events`] after any `read_event` to generate
23641  * [`send_data`] calls to handle responses.
23642  *
23643  * If `Ok(true)` is returned, further read_events should not be triggered until a
23644  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
23645  * send buffer).
23646  *
23647  * [`send_data`]: SocketDescriptor::send_data
23648  * [`process_events`]: PeerManager::process_events
23649  */
23650 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);
23651
23652 /**
23653  * Checks for any events generated by our handlers and processes them. Includes sending most
23654  * response messages as well as messages generated by calls to handler functions directly (eg
23655  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
23656  *
23657  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
23658  * issues!
23659  *
23660  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
23661  * or one of the other clients provided in our language bindings.
23662  *
23663  * Note that if there are any other calls to this function waiting on lock(s) this may return
23664  * without doing any work. All available events that need handling will be handled before the
23665  * other calls return.
23666  *
23667  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
23668  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
23669  * [`send_data`]: SocketDescriptor::send_data
23670  */
23671 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
23672
23673 /**
23674  * Indicates that the given socket descriptor's connection is now closed.
23675  */
23676 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
23677
23678 /**
23679  * Disconnect a peer given its node id.
23680  *
23681  * Set `no_connection_possible` to true to prevent any further connection with this peer,
23682  * force-closing any channels we have with it.
23683  *
23684  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
23685  * peer. Thus, be very careful about reentrancy issues.
23686  *
23687  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
23688  */
23689 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
23690
23691 /**
23692  * Disconnects all currently-connected peers. This is useful on platforms where there may be
23693  * an indication that TCP sockets have stalled even if we weren't around to time them out
23694  * using regular ping/pongs.
23695  */
23696 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
23697
23698 /**
23699  * Send pings to each peer and disconnect those which did not respond to the last round of
23700  * pings.
23701  *
23702  * This may be called on any timescale you want, however, roughly once every ten seconds is
23703  * preferred. The call rate determines both how often we send a ping to our peers and how much
23704  * time they have to respond before we disconnect them.
23705  *
23706  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
23707  * issues!
23708  *
23709  * [`send_data`]: SocketDescriptor::send_data
23710  */
23711 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
23712
23713 /**
23714  * Gets the weight for an HTLC-Success transaction.
23715  */
23716 uint64_t htlc_success_tx_weight(bool opt_anchors);
23717
23718 /**
23719  * Gets the weight for an HTLC-Timeout transaction.
23720  */
23721 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
23722
23723 /**
23724  * Build the commitment secret from the seed and the commitment number
23725  */
23726 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
23727
23728 /**
23729  * Build a closing transaction
23730  */
23731 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);
23732
23733 /**
23734  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
23735  */
23736 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
23737
23738 /**
23739  * Creates a copy of the CounterpartyCommitmentSecrets
23740  */
23741 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
23742
23743 /**
23744  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
23745  */
23746 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
23747
23748 /**
23749  * Returns the minimum index of all stored secrets. Note that indexes start
23750  * at 1 << 48 and get decremented by one for each new secret.
23751  */
23752 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
23753
23754 /**
23755  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
23756  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
23757  */
23758 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
23759
23760 /**
23761  * Returns the secret at `idx`.
23762  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
23763  *
23764  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23765  */
23766 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
23767
23768 /**
23769  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
23770  */
23771 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
23772
23773 /**
23774  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
23775  */
23776 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
23777
23778 /**
23779  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
23780  * from the base secret and the per_commitment_point.
23781  *
23782  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23783  * generated (ie our own).
23784  */
23785 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
23786
23787 /**
23788  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
23789  * from the base point and the per_commitment_key. This is the public equivalent of
23790  * derive_private_key - using only public keys to derive a public key instead of private keys.
23791  *
23792  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23793  * generated (ie our own).
23794  */
23795 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
23796
23797 /**
23798  * Derives a per-commitment-transaction revocation key from its constituent parts.
23799  *
23800  * Only the cheating participant owns a valid witness to propagate a revoked
23801  * commitment transaction, thus per_commitment_secret always come from cheater
23802  * and revocation_base_secret always come from punisher, which is the broadcaster
23803  * of the transaction spending with this key knowledge.
23804  *
23805  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23806  * generated (ie our own).
23807  */
23808 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
23809
23810 /**
23811  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
23812  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
23813  * public key instead of private keys.
23814  *
23815  * Only the cheating participant owns a valid witness to propagate a revoked
23816  * commitment transaction, thus per_commitment_point always come from cheater
23817  * and revocation_base_point always come from punisher, which is the broadcaster
23818  * of the transaction spending with this key knowledge.
23819  *
23820  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23821  * generated (ie our own).
23822  */
23823 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
23824
23825 /**
23826  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
23827  */
23828 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
23829
23830 /**
23831  * The broadcaster's per-commitment public key which was used to derive the other keys.
23832  */
23833 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23834
23835 /**
23836  * The broadcaster's per-commitment public key which was used to derive the other keys.
23837  */
23838 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23839
23840 /**
23841  * The revocation key which is used to allow the broadcaster of the commitment
23842  * transaction to provide their counterparty the ability to punish them if they broadcast
23843  * an old state.
23844  */
23845 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23846
23847 /**
23848  * The revocation key which is used to allow the broadcaster of the commitment
23849  * transaction to provide their counterparty the ability to punish them if they broadcast
23850  * an old state.
23851  */
23852 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23853
23854 /**
23855  * Broadcaster's HTLC Key
23856  */
23857 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23858
23859 /**
23860  * Broadcaster's HTLC Key
23861  */
23862 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23863
23864 /**
23865  * Countersignatory's HTLC Key
23866  */
23867 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23868
23869 /**
23870  * Countersignatory's HTLC Key
23871  */
23872 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23873
23874 /**
23875  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
23876  */
23877 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23878
23879 /**
23880  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
23881  */
23882 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23883
23884 /**
23885  * Constructs a new TxCreationKeys given each field
23886  */
23887 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);
23888
23889 /**
23890  * Creates a copy of the TxCreationKeys
23891  */
23892 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
23893
23894 /**
23895  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
23896  */
23897 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
23898
23899 /**
23900  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
23901  */
23902 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
23903
23904 /**
23905  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
23906  */
23907 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
23908
23909 /**
23910  * The public key which is used to sign all commitment transactions, as it appears in the
23911  * on-chain channel lock-in 2-of-2 multisig output.
23912  */
23913 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23914
23915 /**
23916  * The public key which is used to sign all commitment transactions, as it appears in the
23917  * on-chain channel lock-in 2-of-2 multisig output.
23918  */
23919 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23920
23921 /**
23922  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
23923  * revocation keys. This is combined with the per-commitment-secret generated by the
23924  * counterparty to create a secret which the counterparty can reveal to revoke previous
23925  * states.
23926  */
23927 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23928
23929 /**
23930  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
23931  * revocation keys. This is combined with the per-commitment-secret generated by the
23932  * counterparty to create a secret which the counterparty can reveal to revoke previous
23933  * states.
23934  */
23935 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23936
23937 /**
23938  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
23939  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
23940  * static across every commitment transaction.
23941  */
23942 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23943
23944 /**
23945  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
23946  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
23947  * static across every commitment transaction.
23948  */
23949 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23950
23951 /**
23952  * The base point which is used (with derive_public_key) to derive a per-commitment payment
23953  * public key which receives non-HTLC-encumbered funds which are only available for spending
23954  * after some delay (or can be claimed via the revocation path).
23955  */
23956 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23957
23958 /**
23959  * The base point which is used (with derive_public_key) to derive a per-commitment payment
23960  * public key which receives non-HTLC-encumbered funds which are only available for spending
23961  * after some delay (or can be claimed via the revocation path).
23962  */
23963 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23964
23965 /**
23966  * The base point which is used (with derive_public_key) to derive a per-commitment public key
23967  * which is used to encumber HTLC-in-flight outputs.
23968  */
23969 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23970
23971 /**
23972  * The base point which is used (with derive_public_key) to derive a per-commitment public key
23973  * which is used to encumber HTLC-in-flight outputs.
23974  */
23975 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23976
23977 /**
23978  * Constructs a new ChannelPublicKeys given each field
23979  */
23980 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);
23981
23982 /**
23983  * Creates a copy of the ChannelPublicKeys
23984  */
23985 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
23986
23987 /**
23988  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
23989  */
23990 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
23991
23992 /**
23993  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
23994  */
23995 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
23996
23997 /**
23998  * Create per-state keys from channel base points and the per-commitment point.
23999  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
24000  */
24001 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);
24002
24003 /**
24004  * Generate per-state keys from channel static keys.
24005  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
24006  */
24007 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);
24008
24009 /**
24010  * A script either spendable by the revocation
24011  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
24012  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
24013  */
24014 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
24015
24016 /**
24017  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
24018  */
24019 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
24020
24021 /**
24022  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
24023  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
24024  * need to compare this value to whether the commitment transaction in question is that of
24025  * the counterparty or our own.
24026  */
24027 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24028
24029 /**
24030  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
24031  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
24032  * need to compare this value to whether the commitment transaction in question is that of
24033  * the counterparty or our own.
24034  */
24035 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
24036
24037 /**
24038  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
24039  * this divided by 1000.
24040  */
24041 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24042
24043 /**
24044  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
24045  * this divided by 1000.
24046  */
24047 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
24048
24049 /**
24050  * The CLTV lock-time at which this HTLC expires.
24051  */
24052 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24053
24054 /**
24055  * The CLTV lock-time at which this HTLC expires.
24056  */
24057 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
24058
24059 /**
24060  * The hash of the preimage which unlocks this HTLC.
24061  */
24062 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
24063
24064 /**
24065  * The hash of the preimage which unlocks this HTLC.
24066  */
24067 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24068
24069 /**
24070  * The position within the commitment transactions' outputs. This may be None if the value is
24071  * below the dust limit (in which case no output appears in the commitment transaction and the
24072  * value is spent to additional transaction fees).
24073  */
24074 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24075
24076 /**
24077  * The position within the commitment transactions' outputs. This may be None if the value is
24078  * below the dust limit (in which case no output appears in the commitment transaction and the
24079  * value is spent to additional transaction fees).
24080  */
24081 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
24082
24083 /**
24084  * Constructs a new HTLCOutputInCommitment given each field
24085  */
24086 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);
24087
24088 /**
24089  * Creates a copy of the HTLCOutputInCommitment
24090  */
24091 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
24092
24093 /**
24094  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
24095  */
24096 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
24097
24098 /**
24099  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
24100  */
24101 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
24102
24103 /**
24104  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
24105  * does not need to have its previous_output_index filled.
24106  */
24107 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
24108
24109 /**
24110  * Gets the redeemscript for a funding output from the two funding public keys.
24111  * Note that the order of funding public keys does not matter.
24112  */
24113 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
24114
24115 /**
24116  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
24117  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
24118  * transaction which needs signing, and can be used to construct an HTLC transaction which is
24119  * broadcastable given a counterparty HTLC signature.
24120  *
24121  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
24122  * commitment transaction).
24123  */
24124 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);
24125
24126 /**
24127  * Gets the witnessScript for an anchor output from the funding public key.
24128  * The witness in the spending input must be:
24129  * <BIP 143 funding_signature>
24130  * After 16 blocks of confirmation, an alternative satisfying witness could be:
24131  * <>
24132  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
24133  */
24134 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
24135
24136 /**
24137  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24138  */
24139 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
24140
24141 /**
24142  * Holder public keys
24143  */
24144 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24145
24146 /**
24147  * Holder public keys
24148  */
24149 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
24150
24151 /**
24152  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
24153  */
24154 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24155
24156 /**
24157  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
24158  */
24159 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
24160
24161 /**
24162  * Whether the holder is the initiator of this channel.
24163  * This is an input to the commitment number obscure factor computation.
24164  */
24165 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24166
24167 /**
24168  * Whether the holder is the initiator of this channel.
24169  * This is an input to the commitment number obscure factor computation.
24170  */
24171 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
24172
24173 /**
24174  * The late-bound counterparty channel transaction parameters.
24175  * These parameters are populated at the point in the protocol where the counterparty provides them.
24176  *
24177  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24178  */
24179 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24180
24181 /**
24182  * The late-bound counterparty channel transaction parameters.
24183  * These parameters are populated at the point in the protocol where the counterparty provides them.
24184  *
24185  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24186  */
24187 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
24188
24189 /**
24190  * The late-bound funding outpoint
24191  *
24192  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24193  */
24194 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24195
24196 /**
24197  * The late-bound funding outpoint
24198  *
24199  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24200  */
24201 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
24202
24203 /**
24204  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
24205  */
24206 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24207
24208 /**
24209  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
24210  */
24211 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
24212
24213 /**
24214  * Constructs a new ChannelTransactionParameters given each field
24215  */
24216 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);
24217
24218 /**
24219  * Creates a copy of the ChannelTransactionParameters
24220  */
24221 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
24222
24223 /**
24224  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24225  */
24226 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
24227
24228 /**
24229  * Counter-party public keys
24230  */
24231 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
24232
24233 /**
24234  * Counter-party public keys
24235  */
24236 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
24237
24238 /**
24239  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
24240  */
24241 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
24242
24243 /**
24244  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
24245  */
24246 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
24247
24248 /**
24249  * Constructs a new CounterpartyChannelTransactionParameters given each field
24250  */
24251 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
24252
24253 /**
24254  * Creates a copy of the CounterpartyChannelTransactionParameters
24255  */
24256 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
24257
24258 /**
24259  * Whether the late bound parameters are populated.
24260  */
24261 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24262
24263 /**
24264  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
24265  * given that the holder is the broadcaster.
24266  *
24267  * self.is_populated() must be true before calling this function.
24268  */
24269 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24270
24271 /**
24272  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
24273  * given that the counterparty is the broadcaster.
24274  *
24275  * self.is_populated() must be true before calling this function.
24276  */
24277 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24278
24279 /**
24280  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
24281  */
24282 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
24283
24284 /**
24285  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
24286  */
24287 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
24288
24289 /**
24290  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
24291  */
24292 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
24293
24294 /**
24295  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
24296  */
24297 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
24298
24299 /**
24300  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24301  */
24302 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
24303
24304 /**
24305  * Get the channel pubkeys for the broadcaster
24306  */
24307 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24308
24309 /**
24310  * Get the channel pubkeys for the countersignatory
24311  */
24312 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24313
24314 /**
24315  * Get the contest delay applicable to the transactions.
24316  * Note that the contest delay was selected by the countersignatory.
24317  */
24318 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24319
24320 /**
24321  * Whether the channel is outbound from the broadcaster.
24322  *
24323  * The boolean representing the side that initiated the channel is
24324  * an input to the commitment number obscure factor computation.
24325  */
24326 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24327
24328 /**
24329  * The funding outpoint
24330  */
24331 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24332
24333 /**
24334  * Whether to use anchors for this channel
24335  */
24336 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24337
24338 /**
24339  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
24340  */
24341 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
24342
24343 /**
24344  * Our counterparty's signature for the transaction
24345  */
24346 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
24347
24348 /**
24349  * Our counterparty's signature for the transaction
24350  */
24351 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
24352
24353 /**
24354  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
24355  */
24356 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
24357
24358 /**
24359  * Creates a copy of the HolderCommitmentTransaction
24360  */
24361 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
24362
24363 /**
24364  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
24365  */
24366 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
24367
24368 /**
24369  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
24370  */
24371 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
24372
24373 /**
24374  * Create a new holder transaction with the given counterparty signatures.
24375  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
24376  */
24377 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);
24378
24379 /**
24380  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
24381  */
24382 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
24383
24384 /**
24385  * The commitment transaction
24386  */
24387 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
24388
24389 /**
24390  * The commitment transaction
24391  */
24392 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
24393
24394 /**
24395  * The txid for the commitment transaction.
24396  *
24397  * This is provided as a performance optimization, instead of calling transaction.txid()
24398  * multiple times.
24399  */
24400 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
24401
24402 /**
24403  * The txid for the commitment transaction.
24404  *
24405  * This is provided as a performance optimization, instead of calling transaction.txid()
24406  * multiple times.
24407  */
24408 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24409
24410 /**
24411  * Constructs a new BuiltCommitmentTransaction given each field
24412  */
24413 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
24414
24415 /**
24416  * Creates a copy of the BuiltCommitmentTransaction
24417  */
24418 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
24419
24420 /**
24421  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
24422  */
24423 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
24424
24425 /**
24426  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
24427  */
24428 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
24429
24430 /**
24431  * Get the SIGHASH_ALL sighash value of the transaction.
24432  *
24433  * This can be used to verify a signature.
24434  */
24435 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);
24436
24437 /**
24438  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
24439  * because we are about to broadcast a holder transaction.
24440  */
24441 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);
24442
24443 /**
24444  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
24445  */
24446 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
24447
24448 /**
24449  * Creates a copy of the ClosingTransaction
24450  */
24451 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
24452
24453 /**
24454  * Checks if two ClosingTransactions contain equal inner contents.
24455  */
24456 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
24457
24458 /**
24459  * Construct an object of the class
24460  */
24461 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);
24462
24463 /**
24464  * Trust our pre-built transaction.
24465  *
24466  * Applies a wrapper which allows access to the transaction.
24467  *
24468  * This should only be used if you fully trust the builder of this object. It should not
24469  * be used by an external signer - instead use the verify function.
24470  */
24471 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24472
24473 /**
24474  * Verify our pre-built transaction.
24475  *
24476  * Applies a wrapper which allows access to the transaction.
24477  *
24478  * An external validating signer must call this method before signing
24479  * or using the built transaction.
24480  */
24481 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
24482
24483 /**
24484  * The value to be sent to the holder, or zero if the output will be omitted
24485  */
24486 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24487
24488 /**
24489  * The value to be sent to the counterparty, or zero if the output will be omitted
24490  */
24491 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24492
24493 /**
24494  * The destination of the holder's output
24495  */
24496 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24497
24498 /**
24499  * The destination of the counterparty's output
24500  */
24501 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24502
24503 /**
24504  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
24505  */
24506 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
24507
24508 /**
24509  * The pre-built Bitcoin commitment transaction
24510  */
24511 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
24512
24513 /**
24514  * Get the SIGHASH_ALL sighash value of the transaction.
24515  *
24516  * This can be used to verify a signature.
24517  */
24518 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);
24519
24520 /**
24521  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
24522  * because we are about to broadcast a holder transaction.
24523  */
24524 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);
24525
24526 /**
24527  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
24528  */
24529 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
24530
24531 /**
24532  * Creates a copy of the CommitmentTransaction
24533  */
24534 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
24535
24536 /**
24537  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
24538  */
24539 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
24540
24541 /**
24542  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
24543  */
24544 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
24545
24546 /**
24547  * The backwards-counting commitment number
24548  */
24549 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24550
24551 /**
24552  * The value to be sent to the broadcaster
24553  */
24554 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24555
24556 /**
24557  * The value to be sent to the counterparty
24558  */
24559 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24560
24561 /**
24562  * The feerate paid per 1000-weight-unit in this commitment transaction.
24563  */
24564 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24565
24566 /**
24567  * Trust our pre-built transaction and derived transaction creation public keys.
24568  *
24569  * Applies a wrapper which allows access to these fields.
24570  *
24571  * This should only be used if you fully trust the builder of this object.  It should not
24572  * be used by an external signer - instead use the verify function.
24573  */
24574 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24575
24576 /**
24577  * Verify our pre-built transaction and derived transaction creation public keys.
24578  *
24579  * Applies a wrapper which allows access to these fields.
24580  *
24581  * An external validating signer must call this method before signing
24582  * or using the built transaction.
24583  */
24584 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);
24585
24586 /**
24587  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
24588  */
24589 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
24590
24591 /**
24592  * The transaction ID of the built Bitcoin transaction
24593  */
24594 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24595
24596 /**
24597  * The pre-built Bitcoin commitment transaction
24598  */
24599 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24600
24601 /**
24602  * The pre-calculated transaction creation public keys.
24603  */
24604 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24605
24606 /**
24607  * Should anchors be used.
24608  */
24609 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24610
24611 /**
24612  * Get a signature for each HTLC which was included in the commitment transaction (ie for
24613  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
24614  *
24615  * The returned Vec has one entry for each HTLC, and in the same order.
24616  *
24617  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
24618  */
24619 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);
24620
24621 /**
24622  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
24623  * shared secret first. This prevents on-chain observers from discovering how many commitment
24624  * transactions occurred in a channel before it was closed.
24625  *
24626  * This function gets the shared secret from relevant channel public keys and can be used to
24627  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
24628  */
24629 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
24630
24631 /**
24632  * Checks if two InitFeaturess contain equal inner contents.
24633  * This ignores pointers and is_owned flags and looks at the values in fields.
24634  * Two objects with NULL inner values will be considered "equal" here.
24635  */
24636 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
24637
24638 /**
24639  * Checks if two NodeFeaturess contain equal inner contents.
24640  * This ignores pointers and is_owned flags and looks at the values in fields.
24641  * Two objects with NULL inner values will be considered "equal" here.
24642  */
24643 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
24644
24645 /**
24646  * Checks if two ChannelFeaturess contain equal inner contents.
24647  * This ignores pointers and is_owned flags and looks at the values in fields.
24648  * Two objects with NULL inner values will be considered "equal" here.
24649  */
24650 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
24651
24652 /**
24653  * Checks if two InvoiceFeaturess contain equal inner contents.
24654  * This ignores pointers and is_owned flags and looks at the values in fields.
24655  * Two objects with NULL inner values will be considered "equal" here.
24656  */
24657 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
24658
24659 /**
24660  * Checks if two ChannelTypeFeaturess contain equal inner contents.
24661  * This ignores pointers and is_owned flags and looks at the values in fields.
24662  * Two objects with NULL inner values will be considered "equal" here.
24663  */
24664 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
24665
24666 /**
24667  * Creates a copy of the InitFeatures
24668  */
24669 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
24670
24671 /**
24672  * Creates a copy of the NodeFeatures
24673  */
24674 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
24675
24676 /**
24677  * Creates a copy of the ChannelFeatures
24678  */
24679 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
24680
24681 /**
24682  * Creates a copy of the InvoiceFeatures
24683  */
24684 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
24685
24686 /**
24687  * Creates a copy of the ChannelTypeFeatures
24688  */
24689 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
24690
24691 /**
24692  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
24693  */
24694 void InitFeatures_free(struct LDKInitFeatures this_obj);
24695
24696 /**
24697  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
24698  */
24699 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
24700
24701 /**
24702  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
24703  */
24704 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
24705
24706 /**
24707  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
24708  */
24709 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
24710
24711 /**
24712  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
24713  */
24714 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
24715
24716 /**
24717  * Create a blank Features with no features set
24718  */
24719 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
24720
24721 /**
24722  * Creates a Features with the bits set which are known by the implementation
24723  */
24724 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
24725
24726 /**
24727  * Returns true if this `Features` object contains unknown feature flags which are set as
24728  * \"required\".
24729  */
24730 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24731
24732 /**
24733  * Create a blank Features with no features set
24734  */
24735 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
24736
24737 /**
24738  * Creates a Features with the bits set which are known by the implementation
24739  */
24740 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
24741
24742 /**
24743  * Returns true if this `Features` object contains unknown feature flags which are set as
24744  * \"required\".
24745  */
24746 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24747
24748 /**
24749  * Create a blank Features with no features set
24750  */
24751 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
24752
24753 /**
24754  * Creates a Features with the bits set which are known by the implementation
24755  */
24756 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
24757
24758 /**
24759  * Returns true if this `Features` object contains unknown feature flags which are set as
24760  * \"required\".
24761  */
24762 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
24763
24764 /**
24765  * Create a blank Features with no features set
24766  */
24767 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
24768
24769 /**
24770  * Creates a Features with the bits set which are known by the implementation
24771  */
24772 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
24773
24774 /**
24775  * Returns true if this `Features` object contains unknown feature flags which are set as
24776  * \"required\".
24777  */
24778 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24779
24780 /**
24781  * Create a blank Features with no features set
24782  */
24783 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
24784
24785 /**
24786  * Creates a Features with the bits set which are known by the implementation
24787  */
24788 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
24789
24790 /**
24791  * Returns true if this `Features` object contains unknown feature flags which are set as
24792  * \"required\".
24793  */
24794 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24795
24796 /**
24797  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
24798  */
24799 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
24800
24801 /**
24802  * Read a InitFeatures from a byte array, created by InitFeatures_write
24803  */
24804 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
24805
24806 /**
24807  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
24808  */
24809 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
24810
24811 /**
24812  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
24813  */
24814 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
24815
24816 /**
24817  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
24818  */
24819 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
24820
24821 /**
24822  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
24823  */
24824 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
24825
24826 /**
24827  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
24828  */
24829 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
24830
24831 /**
24832  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
24833  */
24834 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
24835
24836 /**
24837  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
24838  */
24839 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
24840
24841 /**
24842  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
24843  */
24844 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
24845
24846 /**
24847  * Set this feature as optional.
24848  */
24849 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24850
24851 /**
24852  * Set this feature as required.
24853  */
24854 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24855
24856 /**
24857  * Checks if this feature is supported.
24858  */
24859 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24860
24861 /**
24862  * Set this feature as optional.
24863  */
24864 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24865
24866 /**
24867  * Set this feature as required.
24868  */
24869 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24870
24871 /**
24872  * Checks if this feature is supported.
24873  */
24874 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24875
24876 /**
24877  * Checks if this feature is required.
24878  */
24879 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24880
24881 /**
24882  * Checks if this feature is required.
24883  */
24884 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24885
24886 /**
24887  * Set this feature as optional.
24888  */
24889 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24890
24891 /**
24892  * Set this feature as required.
24893  */
24894 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24895
24896 /**
24897  * Checks if this feature is supported.
24898  */
24899 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24900
24901 /**
24902  * Set this feature as optional.
24903  */
24904 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24905
24906 /**
24907  * Set this feature as required.
24908  */
24909 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24910
24911 /**
24912  * Checks if this feature is supported.
24913  */
24914 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24915
24916 /**
24917  * Set this feature as optional.
24918  */
24919 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24920
24921 /**
24922  * Set this feature as required.
24923  */
24924 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24925
24926 /**
24927  * Checks if this feature is supported.
24928  */
24929 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24930
24931 /**
24932  * Checks if this feature is required.
24933  */
24934 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24935
24936 /**
24937  * Checks if this feature is required.
24938  */
24939 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24940
24941 /**
24942  * Set this feature as optional.
24943  */
24944 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24945
24946 /**
24947  * Set this feature as required.
24948  */
24949 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24950
24951 /**
24952  * Checks if this feature is supported.
24953  */
24954 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24955
24956 /**
24957  * Set this feature as optional.
24958  */
24959 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24960
24961 /**
24962  * Set this feature as required.
24963  */
24964 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24965
24966 /**
24967  * Checks if this feature is supported.
24968  */
24969 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24970
24971 /**
24972  * Checks if this feature is required.
24973  */
24974 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24975
24976 /**
24977  * Checks if this feature is required.
24978  */
24979 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24980
24981 /**
24982  * Set this feature as optional.
24983  */
24984 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24985
24986 /**
24987  * Set this feature as required.
24988  */
24989 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24990
24991 /**
24992  * Checks if this feature is supported.
24993  */
24994 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24995
24996 /**
24997  * Set this feature as optional.
24998  */
24999 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25000
25001 /**
25002  * Set this feature as required.
25003  */
25004 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25005
25006 /**
25007  * Checks if this feature is supported.
25008  */
25009 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25010
25011 /**
25012  * Set this feature as optional.
25013  */
25014 void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25015
25016 /**
25017  * Set this feature as required.
25018  */
25019 void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25020
25021 /**
25022  * Checks if this feature is supported.
25023  */
25024 MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25025
25026 /**
25027  * Checks if this feature is required.
25028  */
25029 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25030
25031 /**
25032  * Checks if this feature is required.
25033  */
25034 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25035
25036 /**
25037  * Checks if this feature is required.
25038  */
25039 MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25040
25041 /**
25042  * Set this feature as optional.
25043  */
25044 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25045
25046 /**
25047  * Set this feature as required.
25048  */
25049 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25050
25051 /**
25052  * Checks if this feature is supported.
25053  */
25054 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25055
25056 /**
25057  * Set this feature as optional.
25058  */
25059 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25060
25061 /**
25062  * Set this feature as required.
25063  */
25064 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25065
25066 /**
25067  * Checks if this feature is supported.
25068  */
25069 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25070
25071 /**
25072  * Set this feature as optional.
25073  */
25074 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25075
25076 /**
25077  * Set this feature as required.
25078  */
25079 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25080
25081 /**
25082  * Checks if this feature is supported.
25083  */
25084 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25085
25086 /**
25087  * Checks if this feature is required.
25088  */
25089 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25090
25091 /**
25092  * Checks if this feature is required.
25093  */
25094 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25095
25096 /**
25097  * Checks if this feature is required.
25098  */
25099 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25100
25101 /**
25102  * Set this feature as optional.
25103  */
25104 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25105
25106 /**
25107  * Set this feature as required.
25108  */
25109 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25110
25111 /**
25112  * Checks if this feature is supported.
25113  */
25114 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25115
25116 /**
25117  * Set this feature as optional.
25118  */
25119 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25120
25121 /**
25122  * Set this feature as required.
25123  */
25124 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25125
25126 /**
25127  * Checks if this feature is supported.
25128  */
25129 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25130
25131 /**
25132  * Set this feature as optional.
25133  */
25134 void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25135
25136 /**
25137  * Set this feature as required.
25138  */
25139 void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25140
25141 /**
25142  * Checks if this feature is supported.
25143  */
25144 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25145
25146 /**
25147  * Checks if this feature is required.
25148  */
25149 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25150
25151 /**
25152  * Checks if this feature is required.
25153  */
25154 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25155
25156 /**
25157  * Checks if this feature is required.
25158  */
25159 MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25160
25161 /**
25162  * Set this feature as optional.
25163  */
25164 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25165
25166 /**
25167  * Set this feature as required.
25168  */
25169 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25170
25171 /**
25172  * Checks if this feature is supported.
25173  */
25174 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25175
25176 /**
25177  * Set this feature as optional.
25178  */
25179 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25180
25181 /**
25182  * Set this feature as required.
25183  */
25184 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25185
25186 /**
25187  * Checks if this feature is supported.
25188  */
25189 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25190
25191 /**
25192  * Set this feature as optional.
25193  */
25194 void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25195
25196 /**
25197  * Set this feature as required.
25198  */
25199 void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25200
25201 /**
25202  * Checks if this feature is supported.
25203  */
25204 MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25205
25206 /**
25207  * Checks if this feature is required.
25208  */
25209 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25210
25211 /**
25212  * Checks if this feature is required.
25213  */
25214 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25215
25216 /**
25217  * Checks if this feature is required.
25218  */
25219 MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25220
25221 /**
25222  * Set this feature as optional.
25223  */
25224 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25225
25226 /**
25227  * Set this feature as required.
25228  */
25229 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25230
25231 /**
25232  * Checks if this feature is supported.
25233  */
25234 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25235
25236 /**
25237  * Set this feature as optional.
25238  */
25239 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25240
25241 /**
25242  * Set this feature as required.
25243  */
25244 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25245
25246 /**
25247  * Checks if this feature is supported.
25248  */
25249 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25250
25251 /**
25252  * Checks if this feature is required.
25253  */
25254 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25255
25256 /**
25257  * Checks if this feature is required.
25258  */
25259 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25260
25261 /**
25262  * Set this feature as optional.
25263  */
25264 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25265
25266 /**
25267  * Set this feature as required.
25268  */
25269 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25270
25271 /**
25272  * Checks if this feature is supported.
25273  */
25274 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25275
25276 /**
25277  * Set this feature as optional.
25278  */
25279 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25280
25281 /**
25282  * Set this feature as required.
25283  */
25284 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25285
25286 /**
25287  * Checks if this feature is supported.
25288  */
25289 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25290
25291 /**
25292  * Checks if this feature is required.
25293  */
25294 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25295
25296 /**
25297  * Checks if this feature is required.
25298  */
25299 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25300
25301 /**
25302  * Set this feature as optional.
25303  */
25304 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25305
25306 /**
25307  * Set this feature as required.
25308  */
25309 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25310
25311 /**
25312  * Checks if this feature is supported.
25313  */
25314 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25315
25316 /**
25317  * Set this feature as optional.
25318  */
25319 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25320
25321 /**
25322  * Set this feature as required.
25323  */
25324 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25325
25326 /**
25327  * Checks if this feature is supported.
25328  */
25329 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25330
25331 /**
25332  * Checks if this feature is required.
25333  */
25334 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25335
25336 /**
25337  * Checks if this feature is required.
25338  */
25339 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25340
25341 /**
25342  * Set this feature as optional.
25343  */
25344 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25345
25346 /**
25347  * Set this feature as required.
25348  */
25349 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25350
25351 /**
25352  * Checks if this feature is supported.
25353  */
25354 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25355
25356 /**
25357  * Set this feature as optional.
25358  */
25359 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25360
25361 /**
25362  * Set this feature as required.
25363  */
25364 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25365
25366 /**
25367  * Checks if this feature is supported.
25368  */
25369 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25370
25371 /**
25372  * Set this feature as optional.
25373  */
25374 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25375
25376 /**
25377  * Set this feature as required.
25378  */
25379 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25380
25381 /**
25382  * Checks if this feature is supported.
25383  */
25384 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25385
25386 /**
25387  * Checks if this feature is required.
25388  */
25389 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25390
25391 /**
25392  * Checks if this feature is required.
25393  */
25394 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25395
25396 /**
25397  * Checks if this feature is required.
25398  */
25399 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25400
25401 /**
25402  * Set this feature as optional.
25403  */
25404 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25405
25406 /**
25407  * Set this feature as required.
25408  */
25409 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25410
25411 /**
25412  * Checks if this feature is supported.
25413  */
25414 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25415
25416 /**
25417  * Set this feature as optional.
25418  */
25419 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25420
25421 /**
25422  * Set this feature as required.
25423  */
25424 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25425
25426 /**
25427  * Checks if this feature is supported.
25428  */
25429 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25430
25431 /**
25432  * Set this feature as optional.
25433  */
25434 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25435
25436 /**
25437  * Set this feature as required.
25438  */
25439 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25440
25441 /**
25442  * Checks if this feature is supported.
25443  */
25444 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25445
25446 /**
25447  * Checks if this feature is required.
25448  */
25449 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25450
25451 /**
25452  * Checks if this feature is required.
25453  */
25454 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25455
25456 /**
25457  * Checks if this feature is required.
25458  */
25459 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25460
25461 /**
25462  * Set this feature as optional.
25463  */
25464 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25465
25466 /**
25467  * Set this feature as required.
25468  */
25469 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25470
25471 /**
25472  * Checks if this feature is supported.
25473  */
25474 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25475
25476 /**
25477  * Checks if this feature is required.
25478  */
25479 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25480
25481 /**
25482  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
25483  */
25484 void ShutdownScript_free(struct LDKShutdownScript this_obj);
25485
25486 /**
25487  * Creates a copy of the ShutdownScript
25488  */
25489 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
25490
25491 /**
25492  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
25493  */
25494 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
25495
25496 /**
25497  * The script that did not meet the requirements from [BOLT #2].
25498  *
25499  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
25500  */
25501 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
25502
25503 /**
25504  * The script that did not meet the requirements from [BOLT #2].
25505  *
25506  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
25507  */
25508 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
25509
25510 /**
25511  * Constructs a new InvalidShutdownScript given each field
25512  */
25513 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
25514
25515 /**
25516  * Creates a copy of the InvalidShutdownScript
25517  */
25518 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
25519
25520 /**
25521  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
25522  */
25523 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
25524
25525 /**
25526  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
25527  */
25528 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
25529
25530 /**
25531  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
25532  */
25533 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
25534
25535 /**
25536  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
25537  */
25538 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
25539
25540 /**
25541  * Generates a witness script pubkey from the given segwit version and program.
25542  *
25543  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
25544  * [`ShutdownScript::new_p2wsh`] instead.
25545  *
25546  * # Errors
25547  *
25548  * This function may return an error if `program` is invalid for the segwit `version`.
25549  */
25550 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
25551
25552 /**
25553  * Converts the shutdown script into the underlying [`Script`].
25554  */
25555 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
25556
25557 /**
25558  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
25559  *
25560  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25561  */
25562 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
25563
25564 /**
25565  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
25566  *
25567  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
25568  */
25569 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
25570
25571 /**
25572  * Calls the free function if one is set
25573  */
25574 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
25575
25576 /**
25577  * Calls the free function if one is set
25578  */
25579 void Type_free(struct LDKType this_ptr);
25580
25581 /**
25582  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
25583  */
25584 void NodeId_free(struct LDKNodeId this_obj);
25585
25586 /**
25587  * Creates a copy of the NodeId
25588  */
25589 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
25590
25591 /**
25592  * Create a new NodeId from a public key
25593  */
25594 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
25595
25596 /**
25597  * Get the public key slice from this NodeId
25598  */
25599 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
25600
25601 /**
25602  * Checks if two NodeIds contain equal inner contents.
25603  */
25604 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
25605
25606 /**
25607  * Serialize the NodeId object into a byte array which can be read by NodeId_read
25608  */
25609 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
25610
25611 /**
25612  * Read a NodeId from a byte array, created by NodeId_write
25613  */
25614 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
25615
25616 /**
25617  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
25618  */
25619 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
25620
25621 /**
25622  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
25623  */
25624 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
25625
25626 /**
25627  * Frees any resources used by the NetworkUpdate
25628  */
25629 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
25630
25631 /**
25632  * Creates a copy of the NetworkUpdate
25633  */
25634 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
25635
25636 /**
25637  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
25638  */
25639 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
25640
25641 /**
25642  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
25643  */
25644 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
25645
25646 /**
25647  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
25648  */
25649 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
25650
25651 /**
25652  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
25653  */
25654 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
25655
25656 /**
25657  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
25658  */
25659 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
25660
25661 /**
25662  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
25663  */
25664 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
25665
25666 /**
25667  * Creates a new tracker of the actual state of the network of channels and nodes,
25668  * assuming an existing Network Graph.
25669  * Chain monitor is used to make sure announced channels exist on-chain,
25670  * channel data is correct, and that the announcement is signed with
25671  * channel owners' keys.
25672  */
25673 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
25674
25675 /**
25676  * Adds a provider used to check new announcements. Does not affect
25677  * existing announcements unless they are updated.
25678  * Add, update or remove the provider would replace the current one.
25679  */
25680 void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
25681
25682 /**
25683  * Constructs a new EventHandler which calls the relevant methods on this_arg.
25684  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
25685  */
25686 struct LDKEventHandler NetworkGraph_as_EventHandler(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
25687
25688 /**
25689  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
25690  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
25691  */
25692 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
25693
25694 /**
25695  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
25696  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
25697  */
25698 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
25699
25700 /**
25701  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
25702  */
25703 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
25704
25705 /**
25706  * When the last update to the channel direction was issued.
25707  * Value is opaque, as set in the announcement.
25708  */
25709 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25710
25711 /**
25712  * When the last update to the channel direction was issued.
25713  * Value is opaque, as set in the announcement.
25714  */
25715 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
25716
25717 /**
25718  * Whether the channel can be currently used for payments (in this one direction).
25719  */
25720 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25721
25722 /**
25723  * Whether the channel can be currently used for payments (in this one direction).
25724  */
25725 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
25726
25727 /**
25728  * The difference in CLTV values that you must have when routing through this channel.
25729  */
25730 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25731
25732 /**
25733  * The difference in CLTV values that you must have when routing through this channel.
25734  */
25735 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
25736
25737 /**
25738  * The minimum value, which must be relayed to the next hop via the channel
25739  */
25740 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25741
25742 /**
25743  * The minimum value, which must be relayed to the next hop via the channel
25744  */
25745 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
25746
25747 /**
25748  * The maximum value which may be relayed to the next hop via the channel.
25749  */
25750 struct LDKCOption_u64Z ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25751
25752 /**
25753  * The maximum value which may be relayed to the next hop via the channel.
25754  */
25755 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25756
25757 /**
25758  * Fees charged when the channel is used for routing
25759  */
25760 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25761
25762 /**
25763  * Fees charged when the channel is used for routing
25764  */
25765 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
25766
25767 /**
25768  * Most recent update for the channel received from the network
25769  * Mostly redundant with the data we store in fields explicitly.
25770  * Everything else is useful only for sending out for initial routing sync.
25771  * Not stored if contains excess data to prevent DoS.
25772  *
25773  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25774  */
25775 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25776
25777 /**
25778  * Most recent update for the channel received from the network
25779  * Mostly redundant with the data we store in fields explicitly.
25780  * Everything else is useful only for sending out for initial routing sync.
25781  * Not stored if contains excess data to prevent DoS.
25782  *
25783  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25784  */
25785 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
25786
25787 /**
25788  * Constructs a new ChannelUpdateInfo given each field
25789  */
25790 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);
25791
25792 /**
25793  * Creates a copy of the ChannelUpdateInfo
25794  */
25795 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
25796
25797 /**
25798  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
25799  */
25800 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
25801
25802 /**
25803  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
25804  */
25805 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
25806
25807 /**
25808  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
25809  */
25810 void ChannelInfo_free(struct LDKChannelInfo this_obj);
25811
25812 /**
25813  * Protocol features of a channel communicated during its announcement
25814  */
25815 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25816
25817 /**
25818  * Protocol features of a channel communicated during its announcement
25819  */
25820 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
25821
25822 /**
25823  * Source node of the first direction of a channel
25824  */
25825 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25826
25827 /**
25828  * Source node of the first direction of a channel
25829  */
25830 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
25831
25832 /**
25833  * Details about the first direction of a channel
25834  *
25835  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25836  */
25837 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25838
25839 /**
25840  * Details about the first direction of a channel
25841  *
25842  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25843  */
25844 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
25845
25846 /**
25847  * Source node of the second direction of a channel
25848  */
25849 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25850
25851 /**
25852  * Source node of the second direction of a channel
25853  */
25854 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
25855
25856 /**
25857  * Details about the second direction of a channel
25858  *
25859  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25860  */
25861 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25862
25863 /**
25864  * Details about the second direction of a channel
25865  *
25866  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25867  */
25868 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
25869
25870 /**
25871  * The channel capacity as seen on-chain, if chain lookup is available.
25872  */
25873 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25874
25875 /**
25876  * The channel capacity as seen on-chain, if chain lookup is available.
25877  */
25878 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25879
25880 /**
25881  * An initial announcement of the channel
25882  * Mostly redundant with the data we store in fields explicitly.
25883  * Everything else is useful only for sending out for initial routing sync.
25884  * Not stored if contains excess data to prevent DoS.
25885  *
25886  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25887  */
25888 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25889
25890 /**
25891  * An initial announcement of the channel
25892  * Mostly redundant with the data we store in fields explicitly.
25893  * Everything else is useful only for sending out for initial routing sync.
25894  * Not stored if contains excess data to prevent DoS.
25895  *
25896  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25897  */
25898 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
25899
25900 /**
25901  * Creates a copy of the ChannelInfo
25902  */
25903 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
25904
25905 /**
25906  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
25907  *
25908  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25909  */
25910 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
25911
25912 /**
25913  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
25914  */
25915 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
25916
25917 /**
25918  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
25919  */
25920 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
25921
25922 /**
25923  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
25924  */
25925 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
25926
25927 /**
25928  * Creates a copy of the DirectedChannelInfo
25929  */
25930 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
25931
25932 /**
25933  * Returns information for the channel.
25934  */
25935 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25936
25937 /**
25938  * Returns information for the direction.
25939  *
25940  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25941  */
25942 MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25943
25944 /**
25945  * Returns the maximum HTLC amount allowed over the channel in the direction.
25946  */
25947 MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25948
25949 /**
25950  * Returns the [`EffectiveCapacity`] of the channel in the direction.
25951  *
25952  * This is either the total capacity from the funding transaction, if known, or the
25953  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
25954  * otherwise.
25955  */
25956 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25957
25958 /**
25959  * Frees any resources used by the EffectiveCapacity
25960  */
25961 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
25962
25963 /**
25964  * Creates a copy of the EffectiveCapacity
25965  */
25966 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
25967
25968 /**
25969  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
25970  */
25971 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
25972
25973 /**
25974  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
25975  */
25976 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
25977
25978 /**
25979  * Utility method to constructs a new Total-variant EffectiveCapacity
25980  */
25981 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat);
25982
25983 /**
25984  * Utility method to constructs a new Infinite-variant EffectiveCapacity
25985  */
25986 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
25987
25988 /**
25989  * Utility method to constructs a new Unknown-variant EffectiveCapacity
25990  */
25991 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
25992
25993 /**
25994  * Returns the effective capacity denominated in millisatoshi.
25995  */
25996 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
25997
25998 /**
25999  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
26000  */
26001 void RoutingFees_free(struct LDKRoutingFees this_obj);
26002
26003 /**
26004  * Flat routing fee in satoshis
26005  */
26006 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
26007
26008 /**
26009  * Flat routing fee in satoshis
26010  */
26011 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
26012
26013 /**
26014  * Liquidity-based routing fee in millionths of a routed amount.
26015  * In other words, 10000 is 1%.
26016  */
26017 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
26018
26019 /**
26020  * Liquidity-based routing fee in millionths of a routed amount.
26021  * In other words, 10000 is 1%.
26022  */
26023 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
26024
26025 /**
26026  * Constructs a new RoutingFees given each field
26027  */
26028 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
26029
26030 /**
26031  * Checks if two RoutingFeess contain equal inner contents.
26032  * This ignores pointers and is_owned flags and looks at the values in fields.
26033  * Two objects with NULL inner values will be considered "equal" here.
26034  */
26035 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
26036
26037 /**
26038  * Creates a copy of the RoutingFees
26039  */
26040 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
26041
26042 /**
26043  * Checks if two RoutingFeess contain equal inner contents.
26044  */
26045 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
26046
26047 /**
26048  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
26049  */
26050 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
26051
26052 /**
26053  * Read a RoutingFees from a byte array, created by RoutingFees_write
26054  */
26055 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
26056
26057 /**
26058  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
26059  */
26060 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
26061
26062 /**
26063  * Protocol features the node announced support for
26064  */
26065 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26066
26067 /**
26068  * Protocol features the node announced support for
26069  */
26070 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
26071
26072 /**
26073  * When the last known update to the node state was issued.
26074  * Value is opaque, as set in the announcement.
26075  */
26076 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26077
26078 /**
26079  * When the last known update to the node state was issued.
26080  * Value is opaque, as set in the announcement.
26081  */
26082 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
26083
26084 /**
26085  * Color assigned to the node
26086  */
26087 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
26088
26089 /**
26090  * Color assigned to the node
26091  */
26092 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
26093
26094 /**
26095  * Moniker assigned to the node.
26096  * May be invalid or malicious (eg control chars),
26097  * should not be exposed to the user.
26098  */
26099 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
26100
26101 /**
26102  * Moniker assigned to the node.
26103  * May be invalid or malicious (eg control chars),
26104  * should not be exposed to the user.
26105  */
26106 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26107
26108 /**
26109  * Internet-level addresses via which one can connect to the node
26110  */
26111 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
26112
26113 /**
26114  * An initial announcement of the node
26115  * Mostly redundant with the data we store in fields explicitly.
26116  * Everything else is useful only for sending out for initial routing sync.
26117  * Not stored if contains excess data to prevent DoS.
26118  *
26119  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26120  */
26121 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26122
26123 /**
26124  * An initial announcement of the node
26125  * Mostly redundant with the data we store in fields explicitly.
26126  * Everything else is useful only for sending out for initial routing sync.
26127  * Not stored if contains excess data to prevent DoS.
26128  *
26129  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26130  */
26131 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
26132
26133 /**
26134  * Constructs a new NodeAnnouncementInfo given each field
26135  */
26136 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
26137
26138 /**
26139  * Creates a copy of the NodeAnnouncementInfo
26140  */
26141 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
26142
26143 /**
26144  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
26145  */
26146 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
26147
26148 /**
26149  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
26150  */
26151 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
26152
26153 /**
26154  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
26155  */
26156 void NodeInfo_free(struct LDKNodeInfo this_obj);
26157
26158 /**
26159  * All valid channels a node has announced
26160  */
26161 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
26162
26163 /**
26164  * Lowest fees enabling routing via any of the enabled, known channels to a node.
26165  * The two fields (flat and proportional fee) are independent,
26166  * meaning they don't have to refer to the same channel.
26167  *
26168  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26169  */
26170 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
26171
26172 /**
26173  * Lowest fees enabling routing via any of the enabled, known channels to a node.
26174  * The two fields (flat and proportional fee) are independent,
26175  * meaning they don't have to refer to the same channel.
26176  *
26177  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26178  */
26179 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
26180
26181 /**
26182  * More information about a node from node_announcement.
26183  * Optional because we store a Node entry after learning about it from
26184  * a channel announcement, but before receiving a node announcement.
26185  *
26186  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26187  */
26188 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
26189
26190 /**
26191  * More information about a node from node_announcement.
26192  * Optional because we store a Node entry after learning about it from
26193  * a channel announcement, but before receiving a node announcement.
26194  *
26195  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26196  */
26197 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
26198
26199 /**
26200  * Constructs a new NodeInfo given each field
26201  */
26202 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
26203
26204 /**
26205  * Creates a copy of the NodeInfo
26206  */
26207 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
26208
26209 /**
26210  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
26211  */
26212 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
26213
26214 /**
26215  * Read a NodeInfo from a byte array, created by NodeInfo_write
26216  */
26217 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
26218
26219 /**
26220  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
26221  */
26222 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
26223
26224 /**
26225  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
26226  */
26227 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
26228
26229 /**
26230  * Creates a new, empty, network graph.
26231  */
26232 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger);
26233
26234 /**
26235  * Returns a read-only view of the network graph.
26236  */
26237 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26238
26239 /**
26240  * The unix timestamp provided by the most recent rapid gossip sync.
26241  * It will be set by the rapid sync process after every sync completion.
26242  */
26243 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26244
26245 /**
26246  * Update the unix timestamp provided by the most recent rapid gossip sync.
26247  * This should be done automatically by the rapid sync process after every sync completion.
26248  */
26249 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
26250
26251 /**
26252  * For an already known node (from channel announcements), update its stored properties from a
26253  * given node announcement.
26254  *
26255  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26256  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26257  * routing messages from a source using a protocol other than the lightning P2P protocol.
26258  */
26259 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
26260
26261 /**
26262  * For an already known node (from channel announcements), update its stored properties from a
26263  * given node announcement without verifying the associated signatures. Because we aren't
26264  * given the associated signatures here we cannot relay the node announcement to any of our
26265  * peers.
26266  */
26267 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);
26268
26269 /**
26270  * Store or update channel info from a channel announcement.
26271  *
26272  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26273  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26274  * routing messages from a source using a protocol other than the lightning P2P protocol.
26275  *
26276  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
26277  * the corresponding UTXO exists on chain and is correctly-formatted.
26278  */
26279 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);
26280
26281 /**
26282  * Store or update channel info from a channel announcement without verifying the associated
26283  * signatures. Because we aren't given the associated signatures here we cannot relay the
26284  * channel announcement to any of our peers.
26285  *
26286  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
26287  * the corresponding UTXO exists on chain and is correctly-formatted.
26288  */
26289 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);
26290
26291 /**
26292  * Update channel from partial announcement data received via rapid gossip sync
26293  *
26294  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
26295  * rapid gossip sync server)
26296  *
26297  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
26298  */
26299 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);
26300
26301 /**
26302  * Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
26303  * If permanent, removes a channel from the local storage.
26304  * May cause the removal of nodes too, if this was their last channel.
26305  * If not permanent, makes channels unavailable for routing.
26306  */
26307 void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
26308
26309 /**
26310  * Marks a node in the graph as failed.
26311  */
26312 void NetworkGraph_node_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
26313
26314 /**
26315  * Removes information about channels that we haven't heard any updates about in some time.
26316  * This can be used regularly to prune the network graph of channels that likely no longer
26317  * exist.
26318  *
26319  * While there is no formal requirement that nodes regularly re-broadcast their channel
26320  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
26321  * pruning occur for updates which are at least two weeks old, which we implement here.
26322  *
26323  * Note that for users of the `lightning-background-processor` crate this method may be
26324  * automatically called regularly for you.
26325  *
26326  * This method is only available with the `std` feature. See
26327  * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
26328  */
26329 void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26330
26331 /**
26332  * Removes information about channels that we haven't heard any updates about in some time.
26333  * This can be used regularly to prune the network graph of channels that likely no longer
26334  * exist.
26335  *
26336  * While there is no formal requirement that nodes regularly re-broadcast their channel
26337  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
26338  * pruning occur for updates which are at least two weeks old, which we implement here.
26339  *
26340  * This function takes the current unix time as an argument. For users with the `std` feature
26341  * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
26342  */
26343 void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
26344
26345 /**
26346  * For an already known (from announcement) channel, update info about one of the directions
26347  * of the channel.
26348  *
26349  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26350  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26351  * routing messages from a source using a protocol other than the lightning P2P protocol.
26352  *
26353  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
26354  * materially in the future will be rejected.
26355  */
26356 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
26357
26358 /**
26359  * For an already known (from announcement) channel, update info about one of the directions
26360  * of the channel without verifying the associated signatures. Because we aren't given the
26361  * associated signatures here we cannot relay the channel update to any of our peers.
26362  *
26363  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
26364  * materially in the future will be rejected.
26365  */
26366 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
26367
26368 /**
26369  * Get network addresses by node id.
26370  * Returns None if the requested node is completely unknown,
26371  * or if node announcement for the node was never received.
26372  */
26373 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
26374
26375 /**
26376  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
26377  */
26378 void RouteHop_free(struct LDKRouteHop this_obj);
26379
26380 /**
26381  * The node_id of the node at this hop.
26382  */
26383 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26384
26385 /**
26386  * The node_id of the node at this hop.
26387  */
26388 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26389
26390 /**
26391  * The node_announcement features of the node at this hop. For the last hop, these may be
26392  * amended to match the features present in the invoice this node generated.
26393  */
26394 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26395
26396 /**
26397  * The node_announcement features of the node at this hop. For the last hop, these may be
26398  * amended to match the features present in the invoice this node generated.
26399  */
26400 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
26401
26402 /**
26403  * The channel that should be used from the previous hop to reach this node.
26404  */
26405 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26406
26407 /**
26408  * The channel that should be used from the previous hop to reach this node.
26409  */
26410 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
26411
26412 /**
26413  * The channel_announcement features of the channel that should be used from the previous hop
26414  * to reach this node.
26415  */
26416 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26417
26418 /**
26419  * The channel_announcement features of the channel that should be used from the previous hop
26420  * to reach this node.
26421  */
26422 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
26423
26424 /**
26425  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
26426  * For the last hop, this should be the full value of the payment (might be more than
26427  * requested if we had to match htlc_minimum_msat).
26428  */
26429 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26430
26431 /**
26432  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
26433  * For the last hop, this should be the full value of the payment (might be more than
26434  * requested if we had to match htlc_minimum_msat).
26435  */
26436 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
26437
26438 /**
26439  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
26440  * expected at the destination, in excess of the current block height.
26441  */
26442 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26443
26444 /**
26445  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
26446  * expected at the destination, in excess of the current block height.
26447  */
26448 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
26449
26450 /**
26451  * Constructs a new RouteHop given each field
26452  */
26453 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);
26454
26455 /**
26456  * Creates a copy of the RouteHop
26457  */
26458 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
26459
26460 /**
26461  * Checks if two RouteHops contain equal inner contents.
26462  */
26463 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
26464
26465 /**
26466  * Checks if two RouteHops contain equal inner contents.
26467  * This ignores pointers and is_owned flags and looks at the values in fields.
26468  * Two objects with NULL inner values will be considered "equal" here.
26469  */
26470 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
26471
26472 /**
26473  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
26474  */
26475 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
26476
26477 /**
26478  * Read a RouteHop from a byte array, created by RouteHop_write
26479  */
26480 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
26481
26482 /**
26483  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
26484  */
26485 void Route_free(struct LDKRoute this_obj);
26486
26487 /**
26488  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
26489  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
26490  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
26491  * least length one. While the maximum length of any given path is variable, keeping the length
26492  * of any path less or equal to 19 should currently ensure it is viable.
26493  */
26494 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
26495
26496 /**
26497  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
26498  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
26499  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
26500  * least length one. While the maximum length of any given path is variable, keeping the length
26501  * of any path less or equal to 19 should currently ensure it is viable.
26502  */
26503 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
26504
26505 /**
26506  * The `payment_params` parameter passed to [`find_route`].
26507  * This is used by `ChannelManager` to track information which may be required for retries,
26508  * provided back to you via [`Event::PaymentPathFailed`].
26509  *
26510  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
26511  *
26512  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26513  */
26514 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
26515
26516 /**
26517  * The `payment_params` parameter passed to [`find_route`].
26518  * This is used by `ChannelManager` to track information which may be required for retries,
26519  * provided back to you via [`Event::PaymentPathFailed`].
26520  *
26521  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
26522  *
26523  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26524  */
26525 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
26526
26527 /**
26528  * Constructs a new Route given each field
26529  */
26530 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
26531
26532 /**
26533  * Creates a copy of the Route
26534  */
26535 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
26536
26537 /**
26538  * Checks if two Routes contain equal inner contents.
26539  */
26540 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
26541
26542 /**
26543  * Checks if two Routes contain equal inner contents.
26544  * This ignores pointers and is_owned flags and looks at the values in fields.
26545  * Two objects with NULL inner values will be considered "equal" here.
26546  */
26547 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
26548
26549 /**
26550  * Returns the total amount of fees paid on this [`Route`].
26551  *
26552  * This doesn't include any extra payment made to the recipient, which can happen in excess of
26553  * the amount passed to [`find_route`]'s `params.final_value_msat`.
26554  */
26555 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
26556
26557 /**
26558  * Returns the total amount paid on this [`Route`], excluding the fees.
26559  */
26560 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
26561
26562 /**
26563  * Serialize the Route object into a byte array which can be read by Route_read
26564  */
26565 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
26566
26567 /**
26568  * Read a Route from a byte array, created by Route_write
26569  */
26570 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
26571
26572 /**
26573  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
26574  */
26575 void RouteParameters_free(struct LDKRouteParameters this_obj);
26576
26577 /**
26578  * The parameters of the failed payment path.
26579  */
26580 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
26581
26582 /**
26583  * The parameters of the failed payment path.
26584  */
26585 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
26586
26587 /**
26588  * The amount in msats sent on the failed payment path.
26589  */
26590 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
26591
26592 /**
26593  * The amount in msats sent on the failed payment path.
26594  */
26595 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
26596
26597 /**
26598  * The CLTV on the final hop of the failed payment path.
26599  */
26600 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
26601
26602 /**
26603  * The CLTV on the final hop of the failed payment path.
26604  */
26605 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
26606
26607 /**
26608  * Constructs a new RouteParameters given each field
26609  */
26610 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);
26611
26612 /**
26613  * Creates a copy of the RouteParameters
26614  */
26615 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
26616
26617 /**
26618  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
26619  */
26620 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
26621
26622 /**
26623  * Read a RouteParameters from a byte array, created by RouteParameters_write
26624  */
26625 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
26626
26627 /**
26628  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
26629  */
26630 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
26631
26632 /**
26633  * The node id of the payee.
26634  */
26635 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26636
26637 /**
26638  * The node id of the payee.
26639  */
26640 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26641
26642 /**
26643  * Features supported by the payee.
26644  *
26645  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
26646  * does not contain any features.
26647  *
26648  * [`for_keysend`]: Self::for_keysend
26649  *
26650  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26651  */
26652 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26653
26654 /**
26655  * Features supported by the payee.
26656  *
26657  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
26658  * does not contain any features.
26659  *
26660  * [`for_keysend`]: Self::for_keysend
26661  *
26662  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26663  */
26664 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
26665
26666 /**
26667  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
26668  */
26669 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26670
26671 /**
26672  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
26673  */
26674 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
26675
26676 /**
26677  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
26678  */
26679 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26680
26681 /**
26682  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
26683  */
26684 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26685
26686 /**
26687  * The maximum total CLTV delta we accept for the route.
26688  */
26689 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26690
26691 /**
26692  * The maximum total CLTV delta we accept for the route.
26693  */
26694 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
26695
26696 /**
26697  * Constructs a new PaymentParameters given each field
26698  */
26699 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);
26700
26701 /**
26702  * Creates a copy of the PaymentParameters
26703  */
26704 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
26705
26706 /**
26707  * Checks if two PaymentParameterss contain equal inner contents.
26708  */
26709 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
26710
26711 /**
26712  * Checks if two PaymentParameterss 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 PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
26717
26718 /**
26719  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
26720  */
26721 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
26722
26723 /**
26724  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
26725  */
26726 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
26727
26728 /**
26729  * Creates a payee with the node id of the given `pubkey`.
26730  */
26731 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
26732
26733 /**
26734  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
26735  */
26736 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
26737
26738 /**
26739  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
26740  */
26741 void RouteHint_free(struct LDKRouteHint this_obj);
26742
26743 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
26744
26745 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
26746
26747 /**
26748  * Constructs a new RouteHint given each field
26749  */
26750 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
26751
26752 /**
26753  * Creates a copy of the RouteHint
26754  */
26755 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
26756
26757 /**
26758  * Checks if two RouteHints contain equal inner contents.
26759  */
26760 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
26761
26762 /**
26763  * Checks if two RouteHints contain equal inner contents.
26764  * This ignores pointers and is_owned flags and looks at the values in fields.
26765  * Two objects with NULL inner values will be considered "equal" here.
26766  */
26767 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
26768
26769 /**
26770  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
26771  */
26772 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
26773
26774 /**
26775  * Read a RouteHint from a byte array, created by RouteHint_write
26776  */
26777 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
26778
26779 /**
26780  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
26781  */
26782 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
26783
26784 /**
26785  * The node_id of the non-target end of the route
26786  */
26787 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26788
26789 /**
26790  * The node_id of the non-target end of the route
26791  */
26792 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26793
26794 /**
26795  * The short_channel_id of this channel
26796  */
26797 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26798
26799 /**
26800  * The short_channel_id of this channel
26801  */
26802 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
26803
26804 /**
26805  * The fees which must be paid to use this channel
26806  */
26807 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26808
26809 /**
26810  * The fees which must be paid to use this channel
26811  */
26812 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
26813
26814 /**
26815  * The difference in CLTV values between this node and the next node.
26816  */
26817 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26818
26819 /**
26820  * The difference in CLTV values between this node and the next node.
26821  */
26822 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
26823
26824 /**
26825  * The minimum value, in msat, which must be relayed to the next hop.
26826  */
26827 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26828
26829 /**
26830  * The minimum value, in msat, which must be relayed to the next hop.
26831  */
26832 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26833
26834 /**
26835  * The maximum value in msat available for routing with a single HTLC.
26836  */
26837 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26838
26839 /**
26840  * The maximum value in msat available for routing with a single HTLC.
26841  */
26842 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26843
26844 /**
26845  * Constructs a new RouteHintHop given each field
26846  */
26847 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);
26848
26849 /**
26850  * Creates a copy of the RouteHintHop
26851  */
26852 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
26853
26854 /**
26855  * Checks if two RouteHintHops contain equal inner contents.
26856  */
26857 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
26858
26859 /**
26860  * Checks if two RouteHintHops contain equal inner contents.
26861  * This ignores pointers and is_owned flags and looks at the values in fields.
26862  * Two objects with NULL inner values will be considered "equal" here.
26863  */
26864 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
26865
26866 /**
26867  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
26868  */
26869 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
26870
26871 /**
26872  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
26873  */
26874 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
26875
26876 /**
26877  * Finds a route from us (payer) to the given target node (payee).
26878  *
26879  * If the payee provided features in their invoice, they should be provided via `params.payee`.
26880  * Without this, MPP will only be used if the payee's features are available in the network graph.
26881  *
26882  * Private routing paths between a public node and the target may be included in `params.payee`.
26883  *
26884  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
26885  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
26886  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
26887  *
26888  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
26889  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
26890  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
26891  *
26892  * # Note
26893  *
26894  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
26895  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
26896  * function.
26897  *
26898  * # Panics
26899  *
26900  * Panics if first_hops contains channels without short_channel_ids;
26901  * [`ChannelManager::list_usable_channels`] will never include such channels.
26902  *
26903  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
26904  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
26905  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
26906  *
26907  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
26908  */
26909 struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKReadOnlyNetworkGraph *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]);
26910
26911 /**
26912  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
26913  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
26914  *
26915  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
26916  */
26917 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 LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]);
26918
26919 /**
26920  * Calls the free function if one is set
26921  */
26922 void Score_free(struct LDKScore this_ptr);
26923
26924 /**
26925  * Calls the free function if one is set
26926  */
26927 void LockableScore_free(struct LDKLockableScore this_ptr);
26928
26929 /**
26930  * Calls the free function if one is set
26931  */
26932 void WriteableScore_free(struct LDKWriteableScore this_ptr);
26933
26934 /**
26935  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
26936  */
26937 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
26938
26939 /**
26940  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
26941  */
26942 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
26943
26944 /**
26945  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
26946  */
26947 void ChannelUsage_free(struct LDKChannelUsage this_obj);
26948
26949 /**
26950  * The amount to send through the channel, denominated in millisatoshis.
26951  */
26952 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
26953
26954 /**
26955  * The amount to send through the channel, denominated in millisatoshis.
26956  */
26957 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
26958
26959 /**
26960  * Total amount, denominated in millisatoshis, already allocated to send through the channel
26961  * as part of a multi-path payment.
26962  */
26963 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
26964
26965 /**
26966  * Total amount, denominated in millisatoshis, already allocated to send through the channel
26967  * as part of a multi-path payment.
26968  */
26969 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
26970
26971 /**
26972  * The effective capacity of the channel.
26973  */
26974 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
26975
26976 /**
26977  * The effective capacity of the channel.
26978  */
26979 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
26980
26981 /**
26982  * Constructs a new ChannelUsage given each field
26983  */
26984 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
26985
26986 /**
26987  * Creates a copy of the ChannelUsage
26988  */
26989 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
26990
26991 /**
26992  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
26993  */
26994 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
26995
26996 /**
26997  * Creates a copy of the FixedPenaltyScorer
26998  */
26999 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
27000
27001 /**
27002  * Creates a new scorer using `penalty_msat`.
27003  */
27004 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
27005
27006 /**
27007  * Constructs a new Score which calls the relevant methods on this_arg.
27008  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
27009  */
27010 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
27011
27012 /**
27013  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
27014  */
27015 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
27016
27017 /**
27018  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
27019  */
27020 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
27021
27022 /**
27023  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
27024  */
27025 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
27026
27027 /**
27028  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
27029  */
27030 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
27031
27032 /**
27033  * A fixed penalty in msats to apply to each channel.
27034  *
27035  * Default value: 500 msat
27036  */
27037 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27038
27039 /**
27040  * A fixed penalty in msats to apply to each channel.
27041  *
27042  * Default value: 500 msat
27043  */
27044 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27045
27046 /**
27047  * A multiplier used in conjunction with the negative `log10` of the channel's success
27048  * probability for a payment to determine the liquidity penalty.
27049  *
27050  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
27051  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
27052  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
27053  * lower bounding the success probability to `0.01`) when the amount falls within the
27054  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
27055  * result in a `u64::max_value` penalty, however.
27056  *
27057  * Default value: 40,000 msat
27058  *
27059  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
27060  */
27061 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27062
27063 /**
27064  * A multiplier used in conjunction with the negative `log10` of the channel's success
27065  * probability for a payment to determine the liquidity penalty.
27066  *
27067  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
27068  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
27069  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
27070  * lower bounding the success probability to `0.01`) when the amount falls within the
27071  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
27072  * result in a `u64::max_value` penalty, however.
27073  *
27074  * Default value: 40,000 msat
27075  *
27076  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
27077  */
27078 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27079
27080 /**
27081  * The time required to elapse before any knowledge learned about channel liquidity balances is
27082  * cut in half.
27083  *
27084  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
27085  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
27086  * the certainty of the channel liquidity balance.
27087  *
27088  * Default value: 1 hour
27089  *
27090  * # Note
27091  *
27092  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
27093  * liquidity knowledge will never decay except when the bounds cross.
27094  */
27095 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27096
27097 /**
27098  * The time required to elapse before any knowledge learned about channel liquidity balances is
27099  * cut in half.
27100  *
27101  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
27102  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
27103  * the certainty of the channel liquidity balance.
27104  *
27105  * Default value: 1 hour
27106  *
27107  * # Note
27108  *
27109  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
27110  * liquidity knowledge will never decay except when the bounds cross.
27111  */
27112 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27113
27114 /**
27115  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
27116  * channel's success probability for the payment to determine the amount penalty.
27117  *
27118  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
27119  * fees plus penalty) for large payments. The penalty is computed as the product of this
27120  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
27121  * success probability.
27122  *
27123  * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
27124  *
27125  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
27126  * the amount will result in a penalty of the multiplier. And, as the success probability
27127  * decreases, the negative `log10` weighting will increase dramatically. For higher success
27128  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
27129  * fall below `1`.
27130  *
27131  * Default value: 256 msat
27132  */
27133 uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27134
27135 /**
27136  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
27137  * channel's success probability for the payment to determine the amount penalty.
27138  *
27139  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
27140  * fees plus penalty) for large payments. The penalty is computed as the product of this
27141  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
27142  * success probability.
27143  *
27144  * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
27145  *
27146  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
27147  * the amount will result in a penalty of the multiplier. And, as the success probability
27148  * decreases, the negative `log10` weighting will increase dramatically. For higher success
27149  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
27150  * fall below `1`.
27151  *
27152  * Default value: 256 msat
27153  */
27154 void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27155
27156 /**
27157  * Constructs a new ProbabilisticScoringParameters given each field
27158  */
27159 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg, uint64_t amount_penalty_multiplier_msat_arg);
27160
27161 /**
27162  * Creates a copy of the ProbabilisticScoringParameters
27163  */
27164 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
27165
27166 /**
27167  * Creates a new scorer using the given scoring parameters for sending payments from a node
27168  * through a network graph.
27169  */
27170 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
27171
27172 /**
27173  * Dump the contents of this scorer into the configured logger.
27174  *
27175  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
27176  * which may be a substantial amount of log output.
27177  */
27178 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
27179
27180 /**
27181  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
27182  */
27183 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
27184
27185 /**
27186  * Constructs a new Score which calls the relevant methods on this_arg.
27187  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
27188  */
27189 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
27190
27191 /**
27192  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
27193  */
27194 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
27195
27196 /**
27197  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
27198  */
27199 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
27200
27201 /**
27202  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
27203  */
27204 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
27205
27206 /**
27207  * Initialize a new FilesystemPersister and set the path to the individual channels'
27208  * files.
27209  */
27210 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
27211
27212 /**
27213  * Get the directory which was provided when this persister was initialized.
27214  */
27215 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
27216
27217 /**
27218  * Read `ChannelMonitor`s from disk.
27219  */
27220 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
27221
27222 /**
27223  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
27224  */
27225 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
27226
27227 /**
27228  * Frees any resources used by the GossipSync
27229  */
27230 void GossipSync_free(struct LDKGossipSync this_ptr);
27231
27232 /**
27233  * Utility method to constructs a new P2P-variant GossipSync
27234  */
27235 struct LDKGossipSync GossipSync_p2_p(struct LDKP2PGossipSync a);
27236
27237 /**
27238  * Utility method to constructs a new Rapid-variant GossipSync
27239  */
27240 struct LDKGossipSync GossipSync_rapid(struct LDKRapidGossipSync a);
27241
27242 /**
27243  * Utility method to constructs a new None-variant GossipSync
27244  */
27245 struct LDKGossipSync GossipSync_none(void);
27246
27247 /**
27248  * Start a background thread that takes care of responsibilities enumerated in the [top-level
27249  * documentation].
27250  *
27251  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
27252  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
27253  * either [`join`] or [`stop`].
27254  *
27255  * # Data Persistence
27256  *
27257  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
27258  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
27259  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
27260  * provided implementation.
27261  *
27262  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
27263  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
27264  * See the `lightning-persister` crate for LDK's provided implementation.
27265  *
27266  * Typically, users should either implement [`Persister::persist_manager`] to never return an
27267  * error or call [`join`] and handle any error that may arise. For the latter case,
27268  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
27269  *
27270  * # Event Handling
27271  *
27272  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
27273  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
27274  * functionality implemented by other handlers.
27275  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
27276  *
27277  * # Rapid Gossip Sync
27278  *
27279  * If rapid gossip sync is meant to run at startup, pass a [`RapidGossipSync`] to `gossip_sync`
27280  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
27281  * until the [`RapidGossipSync`] instance completes its first sync.
27282  *
27283  * [top-level documentation]: BackgroundProcessor
27284  * [`join`]: Self::join
27285  * [`stop`]: Self::stop
27286  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
27287  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
27288  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
27289  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
27290  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
27291  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
27292  */
27293 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 LDKCOption_WriteableScoreZ scorer);
27294
27295 /**
27296  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
27297  * [`ChannelManager`].
27298  *
27299  * # Panics
27300  *
27301  * This function panics if the background thread has panicked such as while persisting or
27302  * handling events.
27303  *
27304  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
27305  */
27306 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
27307
27308 /**
27309  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
27310  * [`ChannelManager`].
27311  *
27312  * # Panics
27313  *
27314  * This function panics if the background thread has panicked such as while persisting or
27315  * handling events.
27316  *
27317  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
27318  */
27319 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
27320
27321 /**
27322  * Frees any resources used by the ParseError
27323  */
27324 void ParseError_free(struct LDKParseError this_ptr);
27325
27326 /**
27327  * Creates a copy of the ParseError
27328  */
27329 struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
27330
27331 /**
27332  * Utility method to constructs a new Bech32Error-variant ParseError
27333  */
27334 struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
27335
27336 /**
27337  * Utility method to constructs a new ParseAmountError-variant ParseError
27338  */
27339 struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
27340
27341 /**
27342  * Utility method to constructs a new MalformedSignature-variant ParseError
27343  */
27344 struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
27345
27346 /**
27347  * Utility method to constructs a new BadPrefix-variant ParseError
27348  */
27349 struct LDKParseError ParseError_bad_prefix(void);
27350
27351 /**
27352  * Utility method to constructs a new UnknownCurrency-variant ParseError
27353  */
27354 struct LDKParseError ParseError_unknown_currency(void);
27355
27356 /**
27357  * Utility method to constructs a new UnknownSiPrefix-variant ParseError
27358  */
27359 struct LDKParseError ParseError_unknown_si_prefix(void);
27360
27361 /**
27362  * Utility method to constructs a new MalformedHRP-variant ParseError
27363  */
27364 struct LDKParseError ParseError_malformed_hrp(void);
27365
27366 /**
27367  * Utility method to constructs a new TooShortDataPart-variant ParseError
27368  */
27369 struct LDKParseError ParseError_too_short_data_part(void);
27370
27371 /**
27372  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
27373  */
27374 struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
27375
27376 /**
27377  * Utility method to constructs a new DescriptionDecodeError-variant ParseError
27378  */
27379 struct LDKParseError ParseError_description_decode_error(struct LDKError a);
27380
27381 /**
27382  * Utility method to constructs a new PaddingError-variant ParseError
27383  */
27384 struct LDKParseError ParseError_padding_error(void);
27385
27386 /**
27387  * Utility method to constructs a new IntegerOverflowError-variant ParseError
27388  */
27389 struct LDKParseError ParseError_integer_overflow_error(void);
27390
27391 /**
27392  * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
27393  */
27394 struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
27395
27396 /**
27397  * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
27398  */
27399 struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
27400
27401 /**
27402  * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
27403  */
27404 struct LDKParseError ParseError_invalid_script_hash_length(void);
27405
27406 /**
27407  * Utility method to constructs a new InvalidRecoveryId-variant ParseError
27408  */
27409 struct LDKParseError ParseError_invalid_recovery_id(void);
27410
27411 /**
27412  * Utility method to constructs a new InvalidSliceLength-variant ParseError
27413  */
27414 struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
27415
27416 /**
27417  * Utility method to constructs a new Skip-variant ParseError
27418  */
27419 struct LDKParseError ParseError_skip(void);
27420
27421 /**
27422  * Frees any resources used by the ParseOrSemanticError
27423  */
27424 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
27425
27426 /**
27427  * Creates a copy of the ParseOrSemanticError
27428  */
27429 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
27430
27431 /**
27432  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
27433  */
27434 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
27435
27436 /**
27437  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
27438  */
27439 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
27440
27441 /**
27442  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
27443  */
27444 void Invoice_free(struct LDKInvoice this_obj);
27445
27446 /**
27447  * Checks if two Invoices contain equal inner contents.
27448  * This ignores pointers and is_owned flags and looks at the values in fields.
27449  * Two objects with NULL inner values will be considered "equal" here.
27450  */
27451 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
27452
27453 /**
27454  * Creates a copy of the Invoice
27455  */
27456 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
27457
27458 /**
27459  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
27460  */
27461 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
27462
27463 /**
27464  * Checks if two SignedRawInvoices contain equal inner contents.
27465  * This ignores pointers and is_owned flags and looks at the values in fields.
27466  * Two objects with NULL inner values will be considered "equal" here.
27467  */
27468 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
27469
27470 /**
27471  * Creates a copy of the SignedRawInvoice
27472  */
27473 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
27474
27475 /**
27476  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
27477  */
27478 void RawInvoice_free(struct LDKRawInvoice this_obj);
27479
27480 /**
27481  * data part
27482  */
27483 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
27484
27485 /**
27486  * data part
27487  */
27488 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
27489
27490 /**
27491  * Checks if two RawInvoices contain equal inner contents.
27492  * This ignores pointers and is_owned flags and looks at the values in fields.
27493  * Two objects with NULL inner values will be considered "equal" here.
27494  */
27495 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
27496
27497 /**
27498  * Creates a copy of the RawInvoice
27499  */
27500 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
27501
27502 /**
27503  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
27504  */
27505 void RawDataPart_free(struct LDKRawDataPart this_obj);
27506
27507 /**
27508  * generation time of the invoice
27509  */
27510 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
27511
27512 /**
27513  * generation time of the invoice
27514  */
27515 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
27516
27517 /**
27518  * Checks if two RawDataParts contain equal inner contents.
27519  * This ignores pointers and is_owned flags and looks at the values in fields.
27520  * Two objects with NULL inner values will be considered "equal" here.
27521  */
27522 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
27523
27524 /**
27525  * Creates a copy of the RawDataPart
27526  */
27527 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
27528
27529 /**
27530  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
27531  */
27532 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
27533
27534 /**
27535  * Checks if two PositiveTimestamps contain equal inner contents.
27536  * This ignores pointers and is_owned flags and looks at the values in fields.
27537  * Two objects with NULL inner values will be considered "equal" here.
27538  */
27539 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
27540
27541 /**
27542  * Creates a copy of the PositiveTimestamp
27543  */
27544 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
27545
27546 /**
27547  * Creates a copy of the SiPrefix
27548  */
27549 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
27550
27551 /**
27552  * Utility method to constructs a new Milli-variant SiPrefix
27553  */
27554 enum LDKSiPrefix SiPrefix_milli(void);
27555
27556 /**
27557  * Utility method to constructs a new Micro-variant SiPrefix
27558  */
27559 enum LDKSiPrefix SiPrefix_micro(void);
27560
27561 /**
27562  * Utility method to constructs a new Nano-variant SiPrefix
27563  */
27564 enum LDKSiPrefix SiPrefix_nano(void);
27565
27566 /**
27567  * Utility method to constructs a new Pico-variant SiPrefix
27568  */
27569 enum LDKSiPrefix SiPrefix_pico(void);
27570
27571 /**
27572  * Checks if two SiPrefixs contain equal inner contents.
27573  * This ignores pointers and is_owned flags and looks at the values in fields.
27574  */
27575 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
27576
27577 /**
27578  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
27579  * This is effectively 10^12 * the prefix multiplier
27580  */
27581 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
27582
27583 /**
27584  * Creates a copy of the Currency
27585  */
27586 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
27587
27588 /**
27589  * Utility method to constructs a new Bitcoin-variant Currency
27590  */
27591 enum LDKCurrency Currency_bitcoin(void);
27592
27593 /**
27594  * Utility method to constructs a new BitcoinTestnet-variant Currency
27595  */
27596 enum LDKCurrency Currency_bitcoin_testnet(void);
27597
27598 /**
27599  * Utility method to constructs a new Regtest-variant Currency
27600  */
27601 enum LDKCurrency Currency_regtest(void);
27602
27603 /**
27604  * Utility method to constructs a new Simnet-variant Currency
27605  */
27606 enum LDKCurrency Currency_simnet(void);
27607
27608 /**
27609  * Utility method to constructs a new Signet-variant Currency
27610  */
27611 enum LDKCurrency Currency_signet(void);
27612
27613 /**
27614  * Checks if two Currencys contain equal inner contents.
27615  */
27616 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
27617
27618 /**
27619  * Checks if two Currencys contain equal inner contents.
27620  * This ignores pointers and is_owned flags and looks at the values in fields.
27621  */
27622 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
27623
27624 /**
27625  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
27626  */
27627 void Sha256_free(struct LDKSha256 this_obj);
27628
27629 /**
27630  * Creates a copy of the Sha256
27631  */
27632 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
27633
27634 /**
27635  * Checks if two Sha256s contain equal inner contents.
27636  */
27637 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
27638
27639 /**
27640  * Checks if two Sha256s contain equal inner contents.
27641  * This ignores pointers and is_owned flags and looks at the values in fields.
27642  * Two objects with NULL inner values will be considered "equal" here.
27643  */
27644 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
27645
27646 /**
27647  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
27648  */
27649 void Description_free(struct LDKDescription this_obj);
27650
27651 /**
27652  * Creates a copy of the Description
27653  */
27654 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
27655
27656 /**
27657  * Checks if two Descriptions contain equal inner contents.
27658  */
27659 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
27660
27661 /**
27662  * Checks if two Descriptions contain equal inner contents.
27663  * This ignores pointers and is_owned flags and looks at the values in fields.
27664  * Two objects with NULL inner values will be considered "equal" here.
27665  */
27666 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
27667
27668 /**
27669  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
27670  */
27671 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
27672
27673 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
27674
27675 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27676
27677 /**
27678  * Constructs a new PayeePubKey given each field
27679  */
27680 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
27681
27682 /**
27683  * Creates a copy of the PayeePubKey
27684  */
27685 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
27686
27687 /**
27688  * Checks if two PayeePubKeys contain equal inner contents.
27689  */
27690 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
27691
27692 /**
27693  * Checks if two PayeePubKeys contain equal inner contents.
27694  * This ignores pointers and is_owned flags and looks at the values in fields.
27695  * Two objects with NULL inner values will be considered "equal" here.
27696  */
27697 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
27698
27699 /**
27700  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
27701  */
27702 void ExpiryTime_free(struct LDKExpiryTime this_obj);
27703
27704 /**
27705  * Creates a copy of the ExpiryTime
27706  */
27707 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
27708
27709 /**
27710  * Checks if two ExpiryTimes contain equal inner contents.
27711  */
27712 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
27713
27714 /**
27715  * Checks if two ExpiryTimes contain equal inner contents.
27716  * This ignores pointers and is_owned flags and looks at the values in fields.
27717  * Two objects with NULL inner values will be considered "equal" here.
27718  */
27719 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
27720
27721 /**
27722  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
27723  */
27724 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
27725
27726 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
27727
27728 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
27729
27730 /**
27731  * Constructs a new MinFinalCltvExpiry given each field
27732  */
27733 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
27734
27735 /**
27736  * Creates a copy of the MinFinalCltvExpiry
27737  */
27738 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
27739
27740 /**
27741  * Checks if two MinFinalCltvExpirys contain equal inner contents.
27742  */
27743 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
27744
27745 /**
27746  * Checks if two MinFinalCltvExpirys contain equal inner contents.
27747  * This ignores pointers and is_owned flags and looks at the values in fields.
27748  * Two objects with NULL inner values will be considered "equal" here.
27749  */
27750 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
27751
27752 /**
27753  * Frees any resources used by the Fallback
27754  */
27755 void Fallback_free(struct LDKFallback this_ptr);
27756
27757 /**
27758  * Creates a copy of the Fallback
27759  */
27760 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
27761
27762 /**
27763  * Utility method to constructs a new SegWitProgram-variant Fallback
27764  */
27765 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
27766
27767 /**
27768  * Utility method to constructs a new PubKeyHash-variant Fallback
27769  */
27770 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
27771
27772 /**
27773  * Utility method to constructs a new ScriptHash-variant Fallback
27774  */
27775 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
27776
27777 /**
27778  * Checks if two Fallbacks contain equal inner contents.
27779  */
27780 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
27781
27782 /**
27783  * Checks if two Fallbacks contain equal inner contents.
27784  * This ignores pointers and is_owned flags and looks at the values in fields.
27785  */
27786 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
27787
27788 /**
27789  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
27790  */
27791 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
27792
27793 /**
27794  * Creates a copy of the InvoiceSignature
27795  */
27796 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
27797
27798 /**
27799  * Checks if two InvoiceSignatures contain equal inner contents.
27800  * This ignores pointers and is_owned flags and looks at the values in fields.
27801  * Two objects with NULL inner values will be considered "equal" here.
27802  */
27803 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
27804
27805 /**
27806  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
27807  */
27808 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
27809
27810 /**
27811  * Creates a copy of the PrivateRoute
27812  */
27813 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
27814
27815 /**
27816  * Checks if two PrivateRoutes contain equal inner contents.
27817  */
27818 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
27819
27820 /**
27821  * Checks if two PrivateRoutes contain equal inner contents.
27822  * This ignores pointers and is_owned flags and looks at the values in fields.
27823  * Two objects with NULL inner values will be considered "equal" here.
27824  */
27825 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
27826
27827 /**
27828  * Disassembles the `SignedRawInvoice` into its three parts:
27829  *  1. raw invoice
27830  *  2. hash of the raw invoice
27831  *  3. signature
27832  */
27833 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
27834
27835 /**
27836  * The `RawInvoice` which was signed.
27837  */
27838 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27839
27840 /**
27841  * The hash of the `RawInvoice` that was signed.
27842  */
27843 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
27844
27845 /**
27846  * InvoiceSignature for the invoice.
27847  */
27848 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27849
27850 /**
27851  * Recovers the public key used for signing the invoice from the recoverable signature.
27852  */
27853 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27854
27855 /**
27856  * Checks if the signature is valid for the included payee public key or if none exists if it's
27857  * valid for the recovered signature (which should always be true?).
27858  */
27859 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27860
27861 /**
27862  * Calculate the hash of the encoded `RawInvoice`
27863  */
27864 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27865
27866 /**
27867  *
27868  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27869  */
27870 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27871
27872 /**
27873  *
27874  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27875  */
27876 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27877
27878 /**
27879  *
27880  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27881  */
27882 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27883
27884 /**
27885  *
27886  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27887  */
27888 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27889
27890 /**
27891  *
27892  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27893  */
27894 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27895
27896 /**
27897  *
27898  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27899  */
27900 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27901
27902 /**
27903  *
27904  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27905  */
27906 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27907
27908 /**
27909  *
27910  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27911  */
27912 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27913
27914 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27915
27916 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27917
27918 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27919
27920 /**
27921  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
27922  *
27923  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
27924  */
27925 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
27926
27927 /**
27928  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
27929  * the range `0..=MAX_TIMESTAMP`.
27930  *
27931  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
27932  */
27933 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
27934
27935 /**
27936  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
27937  * `0..=MAX_TIMESTAMP`.
27938  *
27939  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
27940  */
27941 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
27942
27943 /**
27944  * Returns the Unix timestamp representing the stored time
27945  */
27946 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
27947
27948 /**
27949  * Returns the duration of the stored time since the Unix epoch
27950  */
27951 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
27952
27953 /**
27954  * Returns the [`SystemTime`] representing the stored time
27955  */
27956 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
27957
27958 /**
27959  * Transform the `Invoice` into it's unchecked version
27960  */
27961 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
27962
27963 /**
27964  * Check that the invoice is signed correctly and that key recovery works
27965  */
27966 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
27967
27968 /**
27969  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
27970  * ```
27971  * use lightning_invoice::*;
27972  *
27973  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
27974  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
27975  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
27976  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
27977  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
27978  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
27979  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
27980  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
27981  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
27982  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
27983  * j5r6drg6k6zcqj0fcwg\";
27984  *
27985  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
27986  *
27987  * assert!(Invoice::from_signed(signed).is_ok());
27988  * ```
27989  */
27990 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
27991
27992 /**
27993  * Returns the `Invoice`'s timestamp (should equal its creation time)
27994  */
27995 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
27996
27997 /**
27998  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
27999  */
28000 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
28001
28002 /**
28003  * Returns the hash to which we will receive the preimage on completion of the payment
28004  */
28005 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
28006
28007 /**
28008  * Get the payee's public key if one was included in the invoice
28009  *
28010  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28011  */
28012 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
28013
28014 /**
28015  * Get the payment secret if one was included in the invoice
28016  */
28017 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
28018
28019 /**
28020  * Get the invoice features if they were included in the invoice
28021  *
28022  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28023  */
28024 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
28025
28026 /**
28027  * Recover the payee's public key (only to be used if none was included in the invoice)
28028  */
28029 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
28030
28031 /**
28032  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
28033  */
28034 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
28035
28036 /**
28037  * Returns whether the invoice has expired.
28038  */
28039 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
28040
28041 /**
28042  * Returns whether the expiry time would pass at the given point in time.
28043  * `at_time` is the timestamp as a duration since the Unix epoch.
28044  */
28045 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
28046
28047 /**
28048  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
28049  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
28050  */
28051 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
28052
28053 /**
28054  * Returns a list of all routes included in the invoice
28055  */
28056 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
28057
28058 /**
28059  * Returns a list of all routes included in the invoice as the underlying hints
28060  */
28061 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
28062
28063 /**
28064  * Returns the currency for which the invoice was issued
28065  */
28066 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
28067
28068 /**
28069  * Returns the amount if specified in the invoice as millisatoshis.
28070  */
28071 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
28072
28073 /**
28074  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
28075  * returns `CreationError::DescriptionTooLong` otherwise
28076  *
28077  * Please note that single characters may use more than one byte due to UTF8 encoding.
28078  */
28079 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
28080
28081 /**
28082  * Returns the underlying description `String`
28083  */
28084 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
28085
28086 /**
28087  * Construct an `ExpiryTime` from seconds.
28088  */
28089 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
28090
28091 /**
28092  * Construct an `ExpiryTime` from a `Duration`.
28093  */
28094 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
28095
28096 /**
28097  * Returns the expiry time in seconds
28098  */
28099 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
28100
28101 /**
28102  * Returns a reference to the underlying `Duration` (=expiry time)
28103  */
28104 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
28105
28106 /**
28107  * Creates a new (partial) route from a list of hops
28108  */
28109 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
28110
28111 /**
28112  * Returns the underlying list of hops
28113  */
28114 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
28115
28116 /**
28117  * Creates a copy of the CreationError
28118  */
28119 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
28120
28121 /**
28122  * Utility method to constructs a new DescriptionTooLong-variant CreationError
28123  */
28124 enum LDKCreationError CreationError_description_too_long(void);
28125
28126 /**
28127  * Utility method to constructs a new RouteTooLong-variant CreationError
28128  */
28129 enum LDKCreationError CreationError_route_too_long(void);
28130
28131 /**
28132  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
28133  */
28134 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
28135
28136 /**
28137  * Utility method to constructs a new InvalidAmount-variant CreationError
28138  */
28139 enum LDKCreationError CreationError_invalid_amount(void);
28140
28141 /**
28142  * Utility method to constructs a new MissingRouteHints-variant CreationError
28143  */
28144 enum LDKCreationError CreationError_missing_route_hints(void);
28145
28146 /**
28147  * Checks if two CreationErrors contain equal inner contents.
28148  * This ignores pointers and is_owned flags and looks at the values in fields.
28149  */
28150 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
28151
28152 /**
28153  * Get the string representation of a CreationError object
28154  */
28155 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
28156
28157 /**
28158  * Creates a copy of the SemanticError
28159  */
28160 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
28161
28162 /**
28163  * Utility method to constructs a new NoPaymentHash-variant SemanticError
28164  */
28165 enum LDKSemanticError SemanticError_no_payment_hash(void);
28166
28167 /**
28168  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
28169  */
28170 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
28171
28172 /**
28173  * Utility method to constructs a new NoDescription-variant SemanticError
28174  */
28175 enum LDKSemanticError SemanticError_no_description(void);
28176
28177 /**
28178  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
28179  */
28180 enum LDKSemanticError SemanticError_multiple_descriptions(void);
28181
28182 /**
28183  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
28184  */
28185 enum LDKSemanticError SemanticError_no_payment_secret(void);
28186
28187 /**
28188  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
28189  */
28190 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
28191
28192 /**
28193  * Utility method to constructs a new InvalidFeatures-variant SemanticError
28194  */
28195 enum LDKSemanticError SemanticError_invalid_features(void);
28196
28197 /**
28198  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
28199  */
28200 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
28201
28202 /**
28203  * Utility method to constructs a new InvalidSignature-variant SemanticError
28204  */
28205 enum LDKSemanticError SemanticError_invalid_signature(void);
28206
28207 /**
28208  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
28209  */
28210 enum LDKSemanticError SemanticError_imprecise_amount(void);
28211
28212 /**
28213  * Checks if two SemanticErrors contain equal inner contents.
28214  * This ignores pointers and is_owned flags and looks at the values in fields.
28215  */
28216 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
28217
28218 /**
28219  * Get the string representation of a SemanticError object
28220  */
28221 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
28222
28223 /**
28224  * Frees any resources used by the SignOrCreationError
28225  */
28226 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
28227
28228 /**
28229  * Creates a copy of the SignOrCreationError
28230  */
28231 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
28232
28233 /**
28234  * Utility method to constructs a new SignError-variant SignOrCreationError
28235  */
28236 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
28237
28238 /**
28239  * Utility method to constructs a new CreationError-variant SignOrCreationError
28240  */
28241 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
28242
28243 /**
28244  * Checks if two SignOrCreationErrors contain equal inner contents.
28245  * This ignores pointers and is_owned flags and looks at the values in fields.
28246  */
28247 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
28248
28249 /**
28250  * Get the string representation of a SignOrCreationError object
28251  */
28252 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
28253
28254 /**
28255  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
28256  */
28257 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
28258
28259 /**
28260  * Calls the free function if one is set
28261  */
28262 void Payer_free(struct LDKPayer this_ptr);
28263
28264 /**
28265  * Calls the free function if one is set
28266  */
28267 void Router_free(struct LDKRouter this_ptr);
28268
28269 /**
28270  * Frees any resources used by the Retry
28271  */
28272 void Retry_free(struct LDKRetry this_ptr);
28273
28274 /**
28275  * Creates a copy of the Retry
28276  */
28277 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
28278
28279 /**
28280  * Utility method to constructs a new Attempts-variant Retry
28281  */
28282 struct LDKRetry Retry_attempts(uintptr_t a);
28283
28284 /**
28285  * Utility method to constructs a new Timeout-variant Retry
28286  */
28287 struct LDKRetry Retry_timeout(uint64_t a);
28288
28289 /**
28290  * Checks if two Retrys contain equal inner contents.
28291  * This ignores pointers and is_owned flags and looks at the values in fields.
28292  */
28293 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
28294
28295 /**
28296  * Checks if two Retrys contain equal inner contents.
28297  */
28298 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
28299
28300 /**
28301  * Frees any resources used by the PaymentError
28302  */
28303 void PaymentError_free(struct LDKPaymentError this_ptr);
28304
28305 /**
28306  * Creates a copy of the PaymentError
28307  */
28308 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
28309
28310 /**
28311  * Utility method to constructs a new Invoice-variant PaymentError
28312  */
28313 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
28314
28315 /**
28316  * Utility method to constructs a new Routing-variant PaymentError
28317  */
28318 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
28319
28320 /**
28321  * Utility method to constructs a new Sending-variant PaymentError
28322  */
28323 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
28324
28325 /**
28326  * Creates an invoice payer that retries failed payment paths.
28327  *
28328  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
28329  * `retry` has been exceeded for a given [`Invoice`].
28330  */
28331 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);
28332
28333 /**
28334  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
28335  *
28336  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
28337  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
28338  * for you.
28339  */
28340 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
28341
28342 /**
28343  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
28344  * case a retry is needed.
28345  *
28346  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
28347  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
28348  * for you.
28349  */
28350 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);
28351
28352 /**
28353  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
28354  * case a retry is needed.
28355  *
28356  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
28357  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
28358  */
28359 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);
28360
28361 /**
28362  * Removes the payment cached by the given payment hash.
28363  *
28364  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
28365  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
28366  */
28367 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
28368
28369 /**
28370  * Constructs a new EventHandler which calls the relevant methods on this_arg.
28371  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
28372  */
28373 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
28374
28375 /**
28376  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
28377  * See [`PhantomKeysManager`] for more information on phantom node payments.
28378  *
28379  * `phantom_route_hints` parameter:
28380  * * Contains channel info for all nodes participating in the phantom invoice
28381  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
28382  *   participating node
28383  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
28384  *   updated when a channel becomes disabled or closes
28385  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
28386  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
28387  *   down
28388  *
28389  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
28390  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
28391  * If `None` is provided for `payment_hash`, then one will be created.
28392  *
28393  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28394  * in excess of the current time.
28395  *
28396  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
28397  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
28398  * requirement).
28399  *
28400  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
28401  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
28402  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
28403  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
28404  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
28405  *
28406  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
28407  */
28408 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);
28409
28410 /**
28411  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
28412  * See [`PhantomKeysManager`] for more information on phantom node payments.
28413  *
28414  * `phantom_route_hints` parameter:
28415  * * Contains channel info for all nodes participating in the phantom invoice
28416  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
28417  *   participating node
28418  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
28419  *   updated when a channel becomes disabled or closes
28420  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
28421  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
28422  *   down
28423  *
28424  * `description_hash` is a SHA-256 hash of the description text
28425  *
28426  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
28427  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
28428  * If `None` is provided for `payment_hash`, then one will be created.
28429  *
28430  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28431  * in excess of the current time.
28432  *
28433  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
28434  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
28435  * requirement).
28436  *
28437  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
28438  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
28439  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
28440  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
28441  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
28442  *
28443  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
28444  */
28445 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);
28446
28447 /**
28448  * Utility to construct an invoice. Generally, unless you want to do something like a custom
28449  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
28450  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
28451  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
28452  * that the payment secret is valid when the invoice is paid.
28453  *
28454  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28455  * in excess of the current time.
28456  */
28457 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);
28458
28459 /**
28460  * Utility to construct an invoice. Generally, unless you want to do something like a custom
28461  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
28462  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
28463  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
28464  * that the payment secret is valid when the invoice is paid.
28465  * Use this variant if you want to pass the `description_hash` to the invoice.
28466  *
28467  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28468  * in excess of the current time.
28469  */
28470 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);
28471
28472 /**
28473  * See [`create_invoice_from_channelmanager_with_description_hash`]
28474  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
28475  * available and the current time is supplied by the caller.
28476  */
28477 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);
28478
28479 /**
28480  * See [`create_invoice_from_channelmanager`]
28481  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
28482  * available and the current time is supplied by the caller.
28483  */
28484 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);
28485
28486 /**
28487  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
28488  */
28489 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
28490
28491 /**
28492  * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source
28493  * `random_seed_bytes`.
28494  */
28495 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes);
28496
28497 /**
28498  * Constructs a new Router which calls the relevant methods on this_arg.
28499  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
28500  */
28501 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
28502
28503 /**
28504  * Constructs a new Payer which calls the relevant methods on this_arg.
28505  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
28506  */
28507 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
28508
28509 /**
28510  * Read a SiPrefix object from a string
28511  */
28512 struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
28513
28514 /**
28515  * Read a Invoice object from a string
28516  */
28517 struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
28518
28519 /**
28520  * Read a SignedRawInvoice object from a string
28521  */
28522 struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
28523
28524 /**
28525  * Get the string representation of a ParseError object
28526  */
28527 struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
28528
28529 /**
28530  * Get the string representation of a ParseOrSemanticError object
28531  */
28532 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
28533
28534 /**
28535  * Get the string representation of a Invoice object
28536  */
28537 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
28538
28539 /**
28540  * Get the string representation of a SignedRawInvoice object
28541  */
28542 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
28543
28544 /**
28545  * Get the string representation of a Currency object
28546  */
28547 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
28548
28549 /**
28550  * Get the string representation of a SiPrefix object
28551  */
28552 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
28553
28554 /**
28555  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
28556  */
28557 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
28558
28559 /**
28560  * Instantiate a new [`RapidGossipSync`] instance
28561  */
28562 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph);
28563
28564 /**
28565  * Sync gossip data from a file
28566  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
28567  *
28568  * `network_graph`: The network graph to apply the updates to
28569  *
28570  * `sync_path`: Path to the file where the gossip update data is located
28571  *
28572  */
28573 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path);
28574
28575 /**
28576  * Returns whether a rapid gossip sync has completed at least once
28577  */
28578 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
28579
28580 /**
28581  * Frees any resources used by the GraphSyncError
28582  */
28583 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
28584
28585 /**
28586  * Creates a copy of the GraphSyncError
28587  */
28588 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
28589
28590 /**
28591  * Utility method to constructs a new DecodeError-variant GraphSyncError
28592  */
28593 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
28594
28595 /**
28596  * Utility method to constructs a new LightningError-variant GraphSyncError
28597  */
28598 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
28599
28600 /**
28601  * Update network graph from binary data.
28602  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
28603  *
28604  * `network_graph`: network graph to be updated
28605  *
28606  * `update_data`: `&[u8]` binary stream that comprises the update data
28607  */
28608 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
28609
28610 #endif /* LDK_C_BINDINGS_H */
28611
28612 #include "ldk_ver.h"