Update auto-generated bindings to match latest 0.0.108-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  * The contents of CResult_NoneErrorZ
1564  */
1565 typedef union LDKCResult_NoneErrorZPtr {
1566    /**
1567     * Note that this value is always NULL, as there are no contents in the OK variant
1568     */
1569    void *result;
1570    /**
1571     * A pointer to the contents in the error state.
1572     * Reading from this pointer when `result_ok` is set is undefined.
1573     */
1574    enum LDKIOError *err;
1575 } LDKCResult_NoneErrorZPtr;
1576
1577 /**
1578  * A CResult_NoneErrorZ represents the result of a fallible operation,
1579  * containing a () on success and a crate::c_types::IOError on failure.
1580  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1581  */
1582 typedef struct LDKCResult_NoneErrorZ {
1583    /**
1584     * The contents of this CResult_NoneErrorZ, accessible via either
1585     * `err` or `result` depending on the state of `result_ok`.
1586     */
1587    union LDKCResult_NoneErrorZPtr contents;
1588    /**
1589     * Whether this CResult_NoneErrorZ represents a success state.
1590     */
1591    bool result_ok;
1592 } LDKCResult_NoneErrorZ;
1593
1594
1595
1596 /**
1597  * A hop in a route
1598  */
1599 typedef struct MUST_USE_STRUCT LDKRouteHop {
1600    /**
1601     * A pointer to the opaque Rust object.
1602     * Nearly everywhere, inner must be non-null, however in places where
1603     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1604     */
1605    LDKnativeRouteHop *inner;
1606    /**
1607     * Indicates that this is the only struct which contains the same pointer.
1608     * Rust functions which take ownership of an object provided via an argument require
1609     * this to be true and invalidate the object pointed to by inner.
1610     */
1611    bool is_owned;
1612 } LDKRouteHop;
1613
1614 /**
1615  * The contents of CResult_RouteHopDecodeErrorZ
1616  */
1617 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1618    /**
1619     * A pointer to the contents in the success state.
1620     * Reading from this pointer when `result_ok` is not set is undefined.
1621     */
1622    struct LDKRouteHop *result;
1623    /**
1624     * A pointer to the contents in the error state.
1625     * Reading from this pointer when `result_ok` is set is undefined.
1626     */
1627    struct LDKDecodeError *err;
1628 } LDKCResult_RouteHopDecodeErrorZPtr;
1629
1630 /**
1631  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1632  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1633  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1634  */
1635 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1636    /**
1637     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1638     * `err` or `result` depending on the state of `result_ok`.
1639     */
1640    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1641    /**
1642     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1643     */
1644    bool result_ok;
1645 } LDKCResult_RouteHopDecodeErrorZ;
1646
1647 /**
1648  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1649  * This corresponds to std::vector in C++
1650  */
1651 typedef struct LDKCVec_RouteHopZ {
1652    /**
1653     * The elements in the array.
1654     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1655     */
1656    struct LDKRouteHop *data;
1657    /**
1658     * The number of elements pointed to by `data`.
1659     */
1660    uintptr_t datalen;
1661 } LDKCVec_RouteHopZ;
1662
1663 /**
1664  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1665  * This corresponds to std::vector in C++
1666  */
1667 typedef struct LDKCVec_CVec_RouteHopZZ {
1668    /**
1669     * The elements in the array.
1670     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1671     */
1672    struct LDKCVec_RouteHopZ *data;
1673    /**
1674     * The number of elements pointed to by `data`.
1675     */
1676    uintptr_t datalen;
1677 } LDKCVec_CVec_RouteHopZZ;
1678
1679
1680
1681 /**
1682  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1683  * it can take multiple paths. Each path is composed of one or more hops through the network.
1684  */
1685 typedef struct MUST_USE_STRUCT LDKRoute {
1686    /**
1687     * A pointer to the opaque Rust object.
1688     * Nearly everywhere, inner must be non-null, however in places where
1689     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1690     */
1691    LDKnativeRoute *inner;
1692    /**
1693     * Indicates that this is the only struct which contains the same pointer.
1694     * Rust functions which take ownership of an object provided via an argument require
1695     * this to be true and invalidate the object pointed to by inner.
1696     */
1697    bool is_owned;
1698 } LDKRoute;
1699
1700 /**
1701  * The contents of CResult_RouteDecodeErrorZ
1702  */
1703 typedef union LDKCResult_RouteDecodeErrorZPtr {
1704    /**
1705     * A pointer to the contents in the success state.
1706     * Reading from this pointer when `result_ok` is not set is undefined.
1707     */
1708    struct LDKRoute *result;
1709    /**
1710     * A pointer to the contents in the error state.
1711     * Reading from this pointer when `result_ok` is set is undefined.
1712     */
1713    struct LDKDecodeError *err;
1714 } LDKCResult_RouteDecodeErrorZPtr;
1715
1716 /**
1717  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1718  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1719  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1720  */
1721 typedef struct LDKCResult_RouteDecodeErrorZ {
1722    /**
1723     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1724     * `err` or `result` depending on the state of `result_ok`.
1725     */
1726    union LDKCResult_RouteDecodeErrorZPtr contents;
1727    /**
1728     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1729     */
1730    bool result_ok;
1731 } LDKCResult_RouteDecodeErrorZ;
1732
1733
1734
1735 /**
1736  * Parameters needed to find a [`Route`].
1737  *
1738  * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
1739  * [`Event::PaymentPathFailed`] for retrying a failed payment path.
1740  *
1741  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
1742  */
1743 typedef struct MUST_USE_STRUCT LDKRouteParameters {
1744    /**
1745     * A pointer to the opaque Rust object.
1746     * Nearly everywhere, inner must be non-null, however in places where
1747     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1748     */
1749    LDKnativeRouteParameters *inner;
1750    /**
1751     * Indicates that this is the only struct which contains the same pointer.
1752     * Rust functions which take ownership of an object provided via an argument require
1753     * this to be true and invalidate the object pointed to by inner.
1754     */
1755    bool is_owned;
1756 } LDKRouteParameters;
1757
1758 /**
1759  * The contents of CResult_RouteParametersDecodeErrorZ
1760  */
1761 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
1762    /**
1763     * A pointer to the contents in the success state.
1764     * Reading from this pointer when `result_ok` is not set is undefined.
1765     */
1766    struct LDKRouteParameters *result;
1767    /**
1768     * A pointer to the contents in the error state.
1769     * Reading from this pointer when `result_ok` is set is undefined.
1770     */
1771    struct LDKDecodeError *err;
1772 } LDKCResult_RouteParametersDecodeErrorZPtr;
1773
1774 /**
1775  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1776  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1777  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1778  */
1779 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
1780    /**
1781     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1782     * `err` or `result` depending on the state of `result_ok`.
1783     */
1784    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
1785    /**
1786     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1787     */
1788    bool result_ok;
1789 } LDKCResult_RouteParametersDecodeErrorZ;
1790
1791
1792
1793 /**
1794  * A list of hops along a payment path terminating with a channel to the recipient.
1795  */
1796 typedef struct MUST_USE_STRUCT LDKRouteHint {
1797    /**
1798     * A pointer to the opaque Rust object.
1799     * Nearly everywhere, inner must be non-null, however in places where
1800     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1801     */
1802    LDKnativeRouteHint *inner;
1803    /**
1804     * Indicates that this is the only struct which contains the same pointer.
1805     * Rust functions which take ownership of an object provided via an argument require
1806     * this to be true and invalidate the object pointed to by inner.
1807     */
1808    bool is_owned;
1809 } LDKRouteHint;
1810
1811 /**
1812  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1813  * This corresponds to std::vector in C++
1814  */
1815 typedef struct LDKCVec_RouteHintZ {
1816    /**
1817     * The elements in the array.
1818     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1819     */
1820    struct LDKRouteHint *data;
1821    /**
1822     * The number of elements pointed to by `data`.
1823     */
1824    uintptr_t datalen;
1825 } LDKCVec_RouteHintZ;
1826
1827 /**
1828  * An enum which can either contain a u64 or not
1829  */
1830 typedef enum LDKCOption_u64Z_Tag {
1831    /**
1832     * When we're in this state, this COption_u64Z contains a u64
1833     */
1834    LDKCOption_u64Z_Some,
1835    /**
1836     * When we're in this state, this COption_u64Z contains nothing
1837     */
1838    LDKCOption_u64Z_None,
1839    /**
1840     * Must be last for serialization purposes
1841     */
1842    LDKCOption_u64Z_Sentinel,
1843 } LDKCOption_u64Z_Tag;
1844
1845 typedef struct LDKCOption_u64Z {
1846    LDKCOption_u64Z_Tag tag;
1847    union {
1848       struct {
1849          uint64_t some;
1850       };
1851    };
1852 } LDKCOption_u64Z;
1853
1854
1855
1856 /**
1857  * The recipient of a payment.
1858  */
1859 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
1860    /**
1861     * A pointer to the opaque Rust object.
1862     * Nearly everywhere, inner must be non-null, however in places where
1863     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1864     */
1865    LDKnativePaymentParameters *inner;
1866    /**
1867     * Indicates that this is the only struct which contains the same pointer.
1868     * Rust functions which take ownership of an object provided via an argument require
1869     * this to be true and invalidate the object pointed to by inner.
1870     */
1871    bool is_owned;
1872 } LDKPaymentParameters;
1873
1874 /**
1875  * The contents of CResult_PaymentParametersDecodeErrorZ
1876  */
1877 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
1878    /**
1879     * A pointer to the contents in the success state.
1880     * Reading from this pointer when `result_ok` is not set is undefined.
1881     */
1882    struct LDKPaymentParameters *result;
1883    /**
1884     * A pointer to the contents in the error state.
1885     * Reading from this pointer when `result_ok` is set is undefined.
1886     */
1887    struct LDKDecodeError *err;
1888 } LDKCResult_PaymentParametersDecodeErrorZPtr;
1889
1890 /**
1891  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
1892  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1893  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1894  */
1895 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
1896    /**
1897     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
1898     * `err` or `result` depending on the state of `result_ok`.
1899     */
1900    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
1901    /**
1902     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
1903     */
1904    bool result_ok;
1905 } LDKCResult_PaymentParametersDecodeErrorZ;
1906
1907
1908
1909 /**
1910  * A channel descriptor for a hop along a payment path.
1911  */
1912 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1913    /**
1914     * A pointer to the opaque Rust object.
1915     * Nearly everywhere, inner must be non-null, however in places where
1916     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1917     */
1918    LDKnativeRouteHintHop *inner;
1919    /**
1920     * Indicates that this is the only struct which contains the same pointer.
1921     * Rust functions which take ownership of an object provided via an argument require
1922     * this to be true and invalidate the object pointed to by inner.
1923     */
1924    bool is_owned;
1925 } LDKRouteHintHop;
1926
1927 /**
1928  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1929  * This corresponds to std::vector in C++
1930  */
1931 typedef struct LDKCVec_RouteHintHopZ {
1932    /**
1933     * The elements in the array.
1934     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1935     */
1936    struct LDKRouteHintHop *data;
1937    /**
1938     * The number of elements pointed to by `data`.
1939     */
1940    uintptr_t datalen;
1941 } LDKCVec_RouteHintHopZ;
1942
1943 /**
1944  * The contents of CResult_RouteHintDecodeErrorZ
1945  */
1946 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
1947    /**
1948     * A pointer to the contents in the success state.
1949     * Reading from this pointer when `result_ok` is not set is undefined.
1950     */
1951    struct LDKRouteHint *result;
1952    /**
1953     * A pointer to the contents in the error state.
1954     * Reading from this pointer when `result_ok` is set is undefined.
1955     */
1956    struct LDKDecodeError *err;
1957 } LDKCResult_RouteHintDecodeErrorZPtr;
1958
1959 /**
1960  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
1961  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
1962  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1963  */
1964 typedef struct LDKCResult_RouteHintDecodeErrorZ {
1965    /**
1966     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
1967     * `err` or `result` depending on the state of `result_ok`.
1968     */
1969    union LDKCResult_RouteHintDecodeErrorZPtr contents;
1970    /**
1971     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
1972     */
1973    bool result_ok;
1974 } LDKCResult_RouteHintDecodeErrorZ;
1975
1976 /**
1977  * The contents of CResult_RouteHintHopDecodeErrorZ
1978  */
1979 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
1980    /**
1981     * A pointer to the contents in the success state.
1982     * Reading from this pointer when `result_ok` is not set is undefined.
1983     */
1984    struct LDKRouteHintHop *result;
1985    /**
1986     * A pointer to the contents in the error state.
1987     * Reading from this pointer when `result_ok` is set is undefined.
1988     */
1989    struct LDKDecodeError *err;
1990 } LDKCResult_RouteHintHopDecodeErrorZPtr;
1991
1992 /**
1993  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
1994  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1995  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1996  */
1997 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
1998    /**
1999     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2000     * `err` or `result` depending on the state of `result_ok`.
2001     */
2002    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
2003    /**
2004     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2005     */
2006    bool result_ok;
2007 } LDKCResult_RouteHintHopDecodeErrorZ;
2008
2009
2010
2011 /**
2012  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2013  */
2014 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2015    /**
2016     * A pointer to the opaque Rust object.
2017     * Nearly everywhere, inner must be non-null, however in places where
2018     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2019     */
2020    LDKnativeChannelDetails *inner;
2021    /**
2022     * Indicates that this is the only struct which contains the same pointer.
2023     * Rust functions which take ownership of an object provided via an argument require
2024     * this to be true and invalidate the object pointed to by inner.
2025     */
2026    bool is_owned;
2027 } LDKChannelDetails;
2028
2029 /**
2030  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2031  * This corresponds to std::vector in C++
2032  */
2033 typedef struct LDKCVec_ChannelDetailsZ {
2034    /**
2035     * The elements in the array.
2036     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2037     */
2038    struct LDKChannelDetails *data;
2039    /**
2040     * The number of elements pointed to by `data`.
2041     */
2042    uintptr_t datalen;
2043 } LDKCVec_ChannelDetailsZ;
2044
2045
2046
2047 /**
2048  * An Err type for failure to process messages.
2049  */
2050 typedef struct MUST_USE_STRUCT LDKLightningError {
2051    /**
2052     * A pointer to the opaque Rust object.
2053     * Nearly everywhere, inner must be non-null, however in places where
2054     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2055     */
2056    LDKnativeLightningError *inner;
2057    /**
2058     * Indicates that this is the only struct which contains the same pointer.
2059     * Rust functions which take ownership of an object provided via an argument require
2060     * this to be true and invalidate the object pointed to by inner.
2061     */
2062    bool is_owned;
2063 } LDKLightningError;
2064
2065 /**
2066  * The contents of CResult_RouteLightningErrorZ
2067  */
2068 typedef union LDKCResult_RouteLightningErrorZPtr {
2069    /**
2070     * A pointer to the contents in the success state.
2071     * Reading from this pointer when `result_ok` is not set is undefined.
2072     */
2073    struct LDKRoute *result;
2074    /**
2075     * A pointer to the contents in the error state.
2076     * Reading from this pointer when `result_ok` is set is undefined.
2077     */
2078    struct LDKLightningError *err;
2079 } LDKCResult_RouteLightningErrorZPtr;
2080
2081 /**
2082  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2083  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2084  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2085  */
2086 typedef struct LDKCResult_RouteLightningErrorZ {
2087    /**
2088     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2089     * `err` or `result` depending on the state of `result_ok`.
2090     */
2091    union LDKCResult_RouteLightningErrorZPtr contents;
2092    /**
2093     * Whether this CResult_RouteLightningErrorZ represents a success state.
2094     */
2095    bool result_ok;
2096 } LDKCResult_RouteLightningErrorZ;
2097
2098 /**
2099  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2100  * This corresponds to std::vector in C++
2101  */
2102 typedef struct LDKCVec_PublicKeyZ {
2103    /**
2104     * The elements in the array.
2105     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2106     */
2107    struct LDKPublicKey *data;
2108    /**
2109     * The number of elements pointed to by `data`.
2110     */
2111    uintptr_t datalen;
2112 } LDKCVec_PublicKeyZ;
2113
2114 /**
2115  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
2116  * look up the corresponding function in rust-lightning's docs.
2117  */
2118 typedef struct LDKThirtyTwoBytes {
2119    /**
2120     * The thirty-two bytes
2121     */
2122    uint8_t data[32];
2123 } LDKThirtyTwoBytes;
2124
2125 /**
2126  * Some information provided on receipt of payment depends on whether the payment received is a
2127  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2128  */
2129 typedef enum LDKPaymentPurpose_Tag {
2130    /**
2131     * Information for receiving a payment that we generated an invoice for.
2132     */
2133    LDKPaymentPurpose_InvoicePayment,
2134    /**
2135     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2136     * (the payee) providing a preimage.
2137     */
2138    LDKPaymentPurpose_SpontaneousPayment,
2139    /**
2140     * Must be last for serialization purposes
2141     */
2142    LDKPaymentPurpose_Sentinel,
2143 } LDKPaymentPurpose_Tag;
2144
2145 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2146    /**
2147     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2148     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2149     * [`ChannelManager::claim_funds`].
2150     *
2151     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2152     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2153     *
2154     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2155     */
2156    struct LDKThirtyTwoBytes payment_preimage;
2157    /**
2158     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2159     * number of deanonymization attacks during the routing process.
2160     * It is provided here for your reference, however its accuracy is enforced directly by
2161     * [`ChannelManager`] using the values you previously provided to
2162     * [`ChannelManager::create_inbound_payment`] or
2163     * [`ChannelManager::create_inbound_payment_for_hash`].
2164     *
2165     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2166     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2167     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2168     */
2169    struct LDKThirtyTwoBytes payment_secret;
2170 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2171
2172 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2173    LDKPaymentPurpose_Tag tag;
2174    union {
2175       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2176       struct {
2177          struct LDKThirtyTwoBytes spontaneous_payment;
2178       };
2179    };
2180 } LDKPaymentPurpose;
2181
2182 /**
2183  * The contents of CResult_PaymentPurposeDecodeErrorZ
2184  */
2185 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
2186    /**
2187     * A pointer to the contents in the success state.
2188     * Reading from this pointer when `result_ok` is not set is undefined.
2189     */
2190    struct LDKPaymentPurpose *result;
2191    /**
2192     * A pointer to the contents in the error state.
2193     * Reading from this pointer when `result_ok` is set is undefined.
2194     */
2195    struct LDKDecodeError *err;
2196 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
2197
2198 /**
2199  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2200  * containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2201  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2202  */
2203 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
2204    /**
2205     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2206     * `err` or `result` depending on the state of `result_ok`.
2207     */
2208    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
2209    /**
2210     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2211     */
2212    bool result_ok;
2213 } LDKCResult_PaymentPurposeDecodeErrorZ;
2214
2215 /**
2216  * The reason the channel was closed. See individual variants more details.
2217  */
2218 typedef enum LDKClosureReason_Tag {
2219    /**
2220     * Closure generated from receiving a peer error message.
2221     *
2222     * Our counterparty may have broadcasted their latest commitment state, and we have
2223     * as well.
2224     */
2225    LDKClosureReason_CounterpartyForceClosed,
2226    /**
2227     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2228     *
2229     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2230     */
2231    LDKClosureReason_HolderForceClosed,
2232    /**
2233     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2234     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2235     */
2236    LDKClosureReason_CooperativeClosure,
2237    /**
2238     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2239     * commitment transaction came from our counterparty, but it may also have come from
2240     * a copy of our own `ChannelMonitor`.
2241     */
2242    LDKClosureReason_CommitmentTxConfirmed,
2243    /**
2244     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2245     */
2246    LDKClosureReason_FundingTimedOut,
2247    /**
2248     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2249     */
2250    LDKClosureReason_ProcessingError,
2251    /**
2252     * The peer disconnected prior to funding completing. In this case the spec mandates that we
2253     * forget the channel entirely - we can attempt again if the peer reconnects.
2254     *
2255     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
2256     * peer because of mutual incompatibility between us and our channel counterparty.
2257     */
2258    LDKClosureReason_DisconnectedPeer,
2259    /**
2260     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
2261     * the ChannelManager deserialized.
2262     */
2263    LDKClosureReason_OutdatedChannelManager,
2264    /**
2265     * Must be last for serialization purposes
2266     */
2267    LDKClosureReason_Sentinel,
2268 } LDKClosureReason_Tag;
2269
2270 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2271    /**
2272     * The error which the peer sent us.
2273     *
2274     * The string should be sanitized before it is used (e.g emitted to logs
2275     * or printed to stdout). Otherwise, a well crafted error message may exploit
2276     * a security vulnerability in the terminal emulator or the logging subsystem.
2277     */
2278    struct LDKStr peer_msg;
2279 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2280
2281 typedef struct LDKClosureReason_LDKProcessingError_Body {
2282    /**
2283     * A developer-readable error message which we generated.
2284     */
2285    struct LDKStr err;
2286 } LDKClosureReason_LDKProcessingError_Body;
2287
2288 typedef struct MUST_USE_STRUCT LDKClosureReason {
2289    LDKClosureReason_Tag tag;
2290    union {
2291       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2292       LDKClosureReason_LDKProcessingError_Body processing_error;
2293    };
2294 } LDKClosureReason;
2295
2296 /**
2297  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2298  */
2299 typedef enum LDKCOption_ClosureReasonZ_Tag {
2300    /**
2301     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2302     */
2303    LDKCOption_ClosureReasonZ_Some,
2304    /**
2305     * When we're in this state, this COption_ClosureReasonZ contains nothing
2306     */
2307    LDKCOption_ClosureReasonZ_None,
2308    /**
2309     * Must be last for serialization purposes
2310     */
2311    LDKCOption_ClosureReasonZ_Sentinel,
2312 } LDKCOption_ClosureReasonZ_Tag;
2313
2314 typedef struct LDKCOption_ClosureReasonZ {
2315    LDKCOption_ClosureReasonZ_Tag tag;
2316    union {
2317       struct {
2318          struct LDKClosureReason some;
2319       };
2320    };
2321 } LDKCOption_ClosureReasonZ;
2322
2323 /**
2324  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2325  */
2326 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2327    /**
2328     * A pointer to the contents in the success state.
2329     * Reading from this pointer when `result_ok` is not set is undefined.
2330     */
2331    struct LDKCOption_ClosureReasonZ *result;
2332    /**
2333     * A pointer to the contents in the error state.
2334     * Reading from this pointer when `result_ok` is set is undefined.
2335     */
2336    struct LDKDecodeError *err;
2337 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2338
2339 /**
2340  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2341  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2342  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2343  */
2344 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2345    /**
2346     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2347     * `err` or `result` depending on the state of `result_ok`.
2348     */
2349    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2350    /**
2351     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2352     */
2353    bool result_ok;
2354 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2355
2356
2357
2358 /**
2359  * A channel_update message to be sent or received from a peer
2360  */
2361 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2362    /**
2363     * A pointer to the opaque Rust object.
2364     * Nearly everywhere, inner must be non-null, however in places where
2365     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2366     */
2367    LDKnativeChannelUpdate *inner;
2368    /**
2369     * Indicates that this is the only struct which contains the same pointer.
2370     * Rust functions which take ownership of an object provided via an argument require
2371     * this to be true and invalidate the object pointed to by inner.
2372     */
2373    bool is_owned;
2374 } LDKChannelUpdate;
2375
2376 /**
2377  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2378  * return packet by a node along the route. See [BOLT #4] for details.
2379  *
2380  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
2381  */
2382 typedef enum LDKNetworkUpdate_Tag {
2383    /**
2384     * An error indicating a `channel_update` messages should be applied via
2385     * [`NetworkGraph::update_channel`].
2386     */
2387    LDKNetworkUpdate_ChannelUpdateMessage,
2388    /**
2389     * An error indicating that a channel failed to route a payment, which should be applied via
2390     * [`NetworkGraph::channel_failed`].
2391     */
2392    LDKNetworkUpdate_ChannelFailure,
2393    /**
2394     * An error indicating that a node failed to route a payment, which should be applied via
2395     * [`NetworkGraph::node_failed`].
2396     */
2397    LDKNetworkUpdate_NodeFailure,
2398    /**
2399     * Must be last for serialization purposes
2400     */
2401    LDKNetworkUpdate_Sentinel,
2402 } LDKNetworkUpdate_Tag;
2403
2404 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2405    /**
2406     * The update to apply via [`NetworkGraph::update_channel`].
2407     */
2408    struct LDKChannelUpdate msg;
2409 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2410
2411 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
2412    /**
2413     * The short channel id of the closed channel.
2414     */
2415    uint64_t short_channel_id;
2416    /**
2417     * Whether the channel should be permanently removed or temporarily disabled until a new
2418     * `channel_update` message is received.
2419     */
2420    bool is_permanent;
2421 } LDKNetworkUpdate_LDKChannelFailure_Body;
2422
2423 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2424    /**
2425     * The node id of the failed node.
2426     */
2427    struct LDKPublicKey node_id;
2428    /**
2429     * Whether the node should be permanently removed from consideration or can be restored
2430     * when a new `channel_update` message is received.
2431     */
2432    bool is_permanent;
2433 } LDKNetworkUpdate_LDKNodeFailure_Body;
2434
2435 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2436    LDKNetworkUpdate_Tag tag;
2437    union {
2438       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2439       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
2440       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2441    };
2442 } LDKNetworkUpdate;
2443
2444 /**
2445  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
2446  */
2447 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2448    /**
2449     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
2450     */
2451    LDKCOption_NetworkUpdateZ_Some,
2452    /**
2453     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2454     */
2455    LDKCOption_NetworkUpdateZ_None,
2456    /**
2457     * Must be last for serialization purposes
2458     */
2459    LDKCOption_NetworkUpdateZ_Sentinel,
2460 } LDKCOption_NetworkUpdateZ_Tag;
2461
2462 typedef struct LDKCOption_NetworkUpdateZ {
2463    LDKCOption_NetworkUpdateZ_Tag tag;
2464    union {
2465       struct {
2466          struct LDKNetworkUpdate some;
2467       };
2468    };
2469 } LDKCOption_NetworkUpdateZ;
2470
2471
2472
2473 /**
2474  * A reference to a transaction output.
2475  *
2476  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2477  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2478  */
2479 typedef struct MUST_USE_STRUCT LDKOutPoint {
2480    /**
2481     * A pointer to the opaque Rust object.
2482     * Nearly everywhere, inner must be non-null, however in places where
2483     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2484     */
2485    LDKnativeOutPoint *inner;
2486    /**
2487     * Indicates that this is the only struct which contains the same pointer.
2488     * Rust functions which take ownership of an object provided via an argument require
2489     * this to be true and invalidate the object pointed to by inner.
2490     */
2491    bool is_owned;
2492 } LDKOutPoint;
2493
2494
2495
2496 /**
2497  * Information about a spendable output to a P2WSH script. See
2498  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2499  */
2500 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2501    /**
2502     * A pointer to the opaque Rust object.
2503     * Nearly everywhere, inner must be non-null, however in places where
2504     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2505     */
2506    LDKnativeDelayedPaymentOutputDescriptor *inner;
2507    /**
2508     * Indicates that this is the only struct which contains the same pointer.
2509     * Rust functions which take ownership of an object provided via an argument require
2510     * this to be true and invalidate the object pointed to by inner.
2511     */
2512    bool is_owned;
2513 } LDKDelayedPaymentOutputDescriptor;
2514
2515
2516
2517 /**
2518  * Information about a spendable output to our \"payment key\". See
2519  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2520  */
2521 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2522    /**
2523     * A pointer to the opaque Rust object.
2524     * Nearly everywhere, inner must be non-null, however in places where
2525     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2526     */
2527    LDKnativeStaticPaymentOutputDescriptor *inner;
2528    /**
2529     * Indicates that this is the only struct which contains the same pointer.
2530     * Rust functions which take ownership of an object provided via an argument require
2531     * this to be true and invalidate the object pointed to by inner.
2532     */
2533    bool is_owned;
2534 } LDKStaticPaymentOutputDescriptor;
2535
2536 /**
2537  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2538  * claim at any point in the future) an event is generated which you must track and be able to
2539  * spend on-chain. The information needed to do this is provided in this enum, including the
2540  * outpoint describing which txid and output index is available, the full output which exists at
2541  * that txid/index, and any keys or other information required to sign.
2542  */
2543 typedef enum LDKSpendableOutputDescriptor_Tag {
2544    /**
2545     * An output to a script which was provided via KeysInterface directly, either from
2546     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2547     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2548     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2549     * on-chain using the payment preimage or after it has timed out.
2550     */
2551    LDKSpendableOutputDescriptor_StaticOutput,
2552    /**
2553     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2554     *
2555     * The witness in the spending input should be:
2556     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2557     *
2558     * Note that the nSequence field in the spending input must be set to to_self_delay
2559     * (which means the transaction is not broadcastable until at least to_self_delay
2560     * blocks after the outpoint confirms).
2561     *
2562     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2563     * it is an output from an old state which we broadcast (which should never happen).
2564     *
2565     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2566     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2567     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2568     * chan_utils::derive_private_key. The public key can be generated without the secret key
2569     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2570     * Sign::pubkeys().
2571     *
2572     * To derive the revocation_pubkey provided here (which is used in the witness
2573     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2574     * call to Sign::ready_channel) and the provided per_commitment point
2575     * to chan_utils::derive_public_revocation_key.
2576     *
2577     * The witness script which is hashed and included in the output script_pubkey may be
2578     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2579     * (derived as above), and the to_self_delay contained here to
2580     * chan_utils::get_revokeable_redeemscript.
2581     */
2582    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2583    /**
2584     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2585     * corresponds to the public key in Sign::pubkeys().payment_point).
2586     * The witness in the spending input, is, thus, simply:
2587     * <BIP 143 signature> <payment key>
2588     *
2589     * These are generally the result of our counterparty having broadcast the current state,
2590     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2591     */
2592    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2593    /**
2594     * Must be last for serialization purposes
2595     */
2596    LDKSpendableOutputDescriptor_Sentinel,
2597 } LDKSpendableOutputDescriptor_Tag;
2598
2599 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2600    /**
2601     * The outpoint which is spendable
2602     */
2603    struct LDKOutPoint outpoint;
2604    /**
2605     * The output which is referenced by the given outpoint.
2606     */
2607    struct LDKTxOut output;
2608 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2609
2610 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2611    LDKSpendableOutputDescriptor_Tag tag;
2612    union {
2613       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2614       struct {
2615          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2616       };
2617       struct {
2618          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2619       };
2620    };
2621 } LDKSpendableOutputDescriptor;
2622
2623 /**
2624  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2625  * This corresponds to std::vector in C++
2626  */
2627 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2628    /**
2629     * The elements in the array.
2630     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2631     */
2632    struct LDKSpendableOutputDescriptor *data;
2633    /**
2634     * The number of elements pointed to by `data`.
2635     */
2636    uintptr_t datalen;
2637 } LDKCVec_SpendableOutputDescriptorZ;
2638
2639
2640
2641 /**
2642  * Features used within the channel_type field in an OpenChannel message.
2643  *
2644  * A channel is always of some known \"type\", describing the transaction formats used and the exact
2645  * semantics of our interaction with our peer.
2646  *
2647  * Note that because a channel is a specific type which is proposed by the opener and accepted by
2648  * the counterparty, only required features are allowed here.
2649  *
2650  * This is serialized differently from other feature types - it is not prefixed by a length, and
2651  * thus must only appear inside a TLV where its length is known in advance.
2652  */
2653 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
2654    /**
2655     * A pointer to the opaque Rust object.
2656     * Nearly everywhere, inner must be non-null, however in places where
2657     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2658     */
2659    LDKnativeChannelTypeFeatures *inner;
2660    /**
2661     * Indicates that this is the only struct which contains the same pointer.
2662     * Rust functions which take ownership of an object provided via an argument require
2663     * this to be true and invalidate the object pointed to by inner.
2664     */
2665    bool is_owned;
2666 } LDKChannelTypeFeatures;
2667
2668 /**
2669  * An Event which you should probably take some action in response to.
2670  *
2671  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2672  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2673  * written as it makes no sense to respond to it after reconnecting to peers).
2674  */
2675 typedef enum LDKEvent_Tag {
2676    /**
2677     * Used to indicate that the client should generate a funding transaction with the given
2678     * parameters and then call [`ChannelManager::funding_transaction_generated`].
2679     * Generated in [`ChannelManager`] message handling.
2680     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2681     * counterparty can steal your funds!
2682     *
2683     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2684     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2685     */
2686    LDKEvent_FundingGenerationReady,
2687    /**
2688     * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
2689     * feed it to [`ChannelManager::claim_funds`] to get it....
2690     *
2691     * Note that if the preimage is not known, you should call
2692     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
2693     * network congestion.
2694     * If you fail to call either [`ChannelManager::claim_funds`] or
2695     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
2696     * automatically failed.
2697     *
2698     * # Note
2699     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2700     * `PaymentReceived` events may be generated for the same payment.
2701     *
2702     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2703     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
2704     */
2705    LDKEvent_PaymentReceived,
2706    /**
2707     * Indicates a payment has been claimed and we've received money!
2708     *
2709     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
2710     * to an [`Event::PaymentReceived`]. However, if we previously crashed during a
2711     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
2712     * [`Event::PaymentReceived`] event.
2713     *
2714     * # Note
2715     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2716     * `PaymentReceived` events may be generated for the same payment. If you then call
2717     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
2718     * multiple `PaymentClaimed` events.
2719     *
2720     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2721     */
2722    LDKEvent_PaymentClaimed,
2723    /**
2724     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
2725     * and we got back the payment preimage for it).
2726     *
2727     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
2728     * event. In this situation, you SHOULD treat this payment as having succeeded.
2729     */
2730    LDKEvent_PaymentSent,
2731    /**
2732     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
2733     * provide failure information for each MPP part in the payment.
2734     *
2735     * This event is provided once there are no further pending HTLCs for the payment and the
2736     * payment is no longer retryable, either due to a several-block timeout or because
2737     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
2738     *
2739     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2740     */
2741    LDKEvent_PaymentFailed,
2742    /**
2743     * Indicates that a path for an outbound payment was successful.
2744     *
2745     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
2746     * [`Event::PaymentSent`] for obtaining the payment preimage.
2747     */
2748    LDKEvent_PaymentPathSuccessful,
2749    /**
2750     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
2751     * something. You may wish to retry with a different route.
2752     *
2753     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
2754     * [`Event::PaymentFailed`] and [`all_paths_failed`].
2755     *
2756     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
2757     */
2758    LDKEvent_PaymentPathFailed,
2759    /**
2760     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
2761     * a time in the future.
2762     *
2763     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
2764     */
2765    LDKEvent_PendingHTLCsForwardable,
2766    /**
2767     * Used to indicate that an output which you should know how to spend was confirmed on chain
2768     * and is now spendable.
2769     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2770     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2771     * somewhere and spend them when you create on-chain transactions.
2772     */
2773    LDKEvent_SpendableOutputs,
2774    /**
2775     * This event is generated when a payment has been successfully forwarded through us and a
2776     * forwarding fee earned.
2777     */
2778    LDKEvent_PaymentForwarded,
2779    /**
2780     * Used to indicate that a previously opened channel with the given `channel_id` is in the
2781     * process of closure.
2782     */
2783    LDKEvent_ChannelClosed,
2784    /**
2785     * Used to indicate to the user that they can abandon the funding transaction and recycle the
2786     * inputs for another purpose.
2787     */
2788    LDKEvent_DiscardFunding,
2789    /**
2790     * Indicates a request to open a new channel by a peer.
2791     *
2792     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
2793     * request, call [`ChannelManager::force_close_channel`].
2794     *
2795     * The event is only triggered when a new open channel request is received and the
2796     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
2797     *
2798     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
2799     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
2800     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
2801     */
2802    LDKEvent_OpenChannelRequest,
2803    /**
2804     * Must be last for serialization purposes
2805     */
2806    LDKEvent_Sentinel,
2807 } LDKEvent_Tag;
2808
2809 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2810    /**
2811     * The random channel_id we picked which you'll need to pass into
2812     * [`ChannelManager::funding_transaction_generated`].
2813     *
2814     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2815     */
2816    struct LDKThirtyTwoBytes temporary_channel_id;
2817    /**
2818     * The counterparty's node_id, which you'll need to pass back into
2819     * [`ChannelManager::funding_transaction_generated`].
2820     *
2821     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2822     */
2823    struct LDKPublicKey counterparty_node_id;
2824    /**
2825     * The value, in satoshis, that the output should have.
2826     */
2827    uint64_t channel_value_satoshis;
2828    /**
2829     * The script which should be used in the transaction output.
2830     */
2831    struct LDKCVec_u8Z output_script;
2832    /**
2833     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
2834     * an inbound channel.
2835     *
2836     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
2837     */
2838    uint64_t user_channel_id;
2839 } LDKEvent_LDKFundingGenerationReady_Body;
2840
2841 typedef struct LDKEvent_LDKPaymentReceived_Body {
2842    /**
2843     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
2844     * not stop you from registering duplicate payment hashes for inbound payments.
2845     */
2846    struct LDKThirtyTwoBytes payment_hash;
2847    /**
2848     * The value, in thousandths of a satoshi, that this payment is for.
2849     */
2850    uint64_t amount_msat;
2851    /**
2852     * Information for claiming this received payment, based on whether the purpose of the
2853     * payment is to pay an invoice or to send a spontaneous payment.
2854     */
2855    struct LDKPaymentPurpose purpose;
2856 } LDKEvent_LDKPaymentReceived_Body;
2857
2858 typedef struct LDKEvent_LDKPaymentClaimed_Body {
2859    /**
2860     * The payment hash of the claimed payment. Note that LDK will not stop you from
2861     * registering duplicate payment hashes for inbound payments.
2862     */
2863    struct LDKThirtyTwoBytes payment_hash;
2864    /**
2865     * The value, in thousandths of a satoshi, that this payment is for.
2866     */
2867    uint64_t amount_msat;
2868    /**
2869     * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
2870     * spontaneous payment.
2871     */
2872    struct LDKPaymentPurpose purpose;
2873 } LDKEvent_LDKPaymentClaimed_Body;
2874
2875 typedef struct LDKEvent_LDKPaymentSent_Body {
2876    /**
2877     * The id returned by [`ChannelManager::send_payment`] and used with
2878     * [`ChannelManager::retry_payment`].
2879     *
2880     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2881     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2882     *
2883     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2884     */
2885    struct LDKThirtyTwoBytes payment_id;
2886    /**
2887     * The preimage to the hash given to ChannelManager::send_payment.
2888     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
2889     * store it somehow!
2890     */
2891    struct LDKThirtyTwoBytes payment_preimage;
2892    /**
2893     * The hash that was given to [`ChannelManager::send_payment`].
2894     *
2895     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2896     */
2897    struct LDKThirtyTwoBytes payment_hash;
2898    /**
2899     * The total fee which was spent at intermediate hops in this payment, across all paths.
2900     *
2901     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
2902     * overpayment to the recipient node.
2903     *
2904     * If the recipient or an intermediate node misbehaves and gives us free money, this may
2905     * overstate the amount paid, though this is unlikely.
2906     *
2907     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
2908     */
2909    struct LDKCOption_u64Z fee_paid_msat;
2910 } LDKEvent_LDKPaymentSent_Body;
2911
2912 typedef struct LDKEvent_LDKPaymentFailed_Body {
2913    /**
2914     * The id returned by [`ChannelManager::send_payment`] and used with
2915     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
2916     *
2917     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2918     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2919     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2920     */
2921    struct LDKThirtyTwoBytes payment_id;
2922    /**
2923     * The hash that was given to [`ChannelManager::send_payment`].
2924     *
2925     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2926     */
2927    struct LDKThirtyTwoBytes payment_hash;
2928 } LDKEvent_LDKPaymentFailed_Body;
2929
2930 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
2931    /**
2932     * The id returned by [`ChannelManager::send_payment`] and used with
2933     * [`ChannelManager::retry_payment`].
2934     *
2935     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2936     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2937     */
2938    struct LDKThirtyTwoBytes payment_id;
2939    /**
2940     * The hash that was given to [`ChannelManager::send_payment`].
2941     *
2942     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2943     *
2944     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2945     */
2946    struct LDKThirtyTwoBytes payment_hash;
2947    /**
2948     * The payment path that was successful.
2949     *
2950     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
2951     */
2952    struct LDKCVec_RouteHopZ path;
2953 } LDKEvent_LDKPaymentPathSuccessful_Body;
2954
2955 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
2956    /**
2957     * The id returned by [`ChannelManager::send_payment`] and used with
2958     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
2959     *
2960     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2961     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
2962     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2963     *
2964     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2965     */
2966    struct LDKThirtyTwoBytes payment_id;
2967    /**
2968     * The hash that was given to [`ChannelManager::send_payment`].
2969     *
2970     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
2971     */
2972    struct LDKThirtyTwoBytes payment_hash;
2973    /**
2974     * Indicates the payment was rejected for some reason by the recipient. This implies that
2975     * the payment has failed, not just the route in question. If this is not set, you may
2976     * retry the payment via a different route.
2977     */
2978    bool rejected_by_dest;
2979    /**
2980     * Any failure information conveyed via the Onion return packet by a node along the failed
2981     * payment route.
2982     *
2983     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
2984     * account the update.
2985     *
2986     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
2987     */
2988    struct LDKCOption_NetworkUpdateZ network_update;
2989    /**
2990     * For both single-path and multi-path payments, this is set if all paths of the payment have
2991     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
2992     * larger MPP payment were still in flight when this event was generated.
2993     *
2994     * Note that if you are retrying individual MPP parts, using this value to determine if a
2995     * payment has fully failed is race-y. Because multiple failures can happen prior to events
2996     * being processed, you may retry in response to a first failure, with a second failure
2997     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
2998     * you will see `all_paths_failed` set even though the retry of the first failure still
2999     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3000     *
3001     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3002     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3003     *
3004     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3005     *
3006     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3007     */
3008    bool all_paths_failed;
3009    /**
3010     * The payment path that failed.
3011     */
3012    struct LDKCVec_RouteHopZ path;
3013    /**
3014     * The channel responsible for the failed payment path.
3015     *
3016     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3017     * may not refer to a channel in the public network graph. These aliases may also collide
3018     * with channels in the public network graph.
3019     *
3020     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3021     * retried. May be `None` for older [`Event`] serializations.
3022     */
3023    struct LDKCOption_u64Z short_channel_id;
3024    /**
3025     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3026     *
3027     * See [`find_route`] for details.
3028     *
3029     * [`Route`]: crate::routing::router::Route
3030     * [`find_route`]: crate::routing::router::find_route
3031     *
3032     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3033     */
3034    struct LDKRouteParameters retry;
3035 } LDKEvent_LDKPaymentPathFailed_Body;
3036
3037 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3038    /**
3039     * The minimum amount of time that should be waited prior to calling
3040     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3041     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3042     * now + 5*time_forwardable).
3043     */
3044    uint64_t time_forwardable;
3045 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3046
3047 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3048    /**
3049     * The outputs which you should store as spendable by you.
3050     */
3051    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3052 } LDKEvent_LDKSpendableOutputs_Body;
3053
3054 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3055    /**
3056     * The incoming channel between the previous node and us. This is only `None` for events
3057     * generated or serialized by versions prior to 0.0.107.
3058     *
3059     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3060     */
3061    struct LDKThirtyTwoBytes prev_channel_id;
3062    /**
3063     * The outgoing channel between the next node and us. This is only `None` for events
3064     * generated or serialized by versions prior to 0.0.107.
3065     *
3066     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3067     */
3068    struct LDKThirtyTwoBytes next_channel_id;
3069    /**
3070     * The fee, in milli-satoshis, which was earned as a result of the payment.
3071     *
3072     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3073     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3074     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3075     * claimed the full value in millisatoshis from the source. In this case,
3076     * `claim_from_onchain_tx` will be set.
3077     *
3078     * If the channel which sent us the payment has been force-closed, we will claim the funds
3079     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3080     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3081     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3082     * `None`.
3083     */
3084    struct LDKCOption_u64Z fee_earned_msat;
3085    /**
3086     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3087     * transaction.
3088     */
3089    bool claim_from_onchain_tx;
3090 } LDKEvent_LDKPaymentForwarded_Body;
3091
3092 typedef struct LDKEvent_LDKChannelClosed_Body {
3093    /**
3094     * The channel_id of the channel which has been closed. Note that on-chain transactions
3095     * resolving the channel are likely still awaiting confirmation.
3096     */
3097    struct LDKThirtyTwoBytes channel_id;
3098    /**
3099     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
3100     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
3101     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
3102     * `user_channel_id` will be 0 for an inbound channel.
3103     * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
3104     *
3105     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3106     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3107     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3108     */
3109    uint64_t user_channel_id;
3110    /**
3111     * The reason the channel was closed.
3112     */
3113    struct LDKClosureReason reason;
3114 } LDKEvent_LDKChannelClosed_Body;
3115
3116 typedef struct LDKEvent_LDKDiscardFunding_Body {
3117    /**
3118     * The channel_id of the channel which has been closed.
3119     */
3120    struct LDKThirtyTwoBytes channel_id;
3121    /**
3122     * The full transaction received from the user
3123     */
3124    struct LDKTransaction transaction;
3125 } LDKEvent_LDKDiscardFunding_Body;
3126
3127 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3128    /**
3129     * The temporary channel ID of the channel requested to be opened.
3130     *
3131     * When responding to the request, the `temporary_channel_id` should be passed
3132     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
3133     * or through [`ChannelManager::force_close_channel`] to reject.
3134     *
3135     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3136     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
3137     */
3138    struct LDKThirtyTwoBytes temporary_channel_id;
3139    /**
3140     * The node_id of the counterparty requesting to open the channel.
3141     *
3142     * When responding to the request, the `counterparty_node_id` should be passed
3143     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
3144     * accept the request, or through [`ChannelManager::force_close_channel`] to reject the
3145     * request.
3146     *
3147     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3148     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel
3149     */
3150    struct LDKPublicKey counterparty_node_id;
3151    /**
3152     * The channel value of the requested channel.
3153     */
3154    uint64_t funding_satoshis;
3155    /**
3156     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3157     */
3158    uint64_t push_msat;
3159    /**
3160     * The features that this channel will operate with. If you reject the channel, a
3161     * well-behaved counterparty may automatically re-attempt the channel with a new set of
3162     * feature flags.
3163     *
3164     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
3165     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3166     * 0.0.106.
3167     *
3168     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
3169     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3170     * 0.0.107. Channels setting this type also need to get manually accepted via
3171     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
3172     * or will be rejected otherwise.
3173     *
3174     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3175     */
3176    struct LDKChannelTypeFeatures channel_type;
3177 } LDKEvent_LDKOpenChannelRequest_Body;
3178
3179 typedef struct MUST_USE_STRUCT LDKEvent {
3180    LDKEvent_Tag tag;
3181    union {
3182       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3183       LDKEvent_LDKPaymentReceived_Body payment_received;
3184       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
3185       LDKEvent_LDKPaymentSent_Body payment_sent;
3186       LDKEvent_LDKPaymentFailed_Body payment_failed;
3187       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3188       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3189       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3190       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3191       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3192       LDKEvent_LDKChannelClosed_Body channel_closed;
3193       LDKEvent_LDKDiscardFunding_Body discard_funding;
3194       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
3195    };
3196 } LDKEvent;
3197
3198 /**
3199  * An enum which can either contain a crate::lightning::util::events::Event or not
3200  */
3201 typedef enum LDKCOption_EventZ_Tag {
3202    /**
3203     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3204     */
3205    LDKCOption_EventZ_Some,
3206    /**
3207     * When we're in this state, this COption_EventZ contains nothing
3208     */
3209    LDKCOption_EventZ_None,
3210    /**
3211     * Must be last for serialization purposes
3212     */
3213    LDKCOption_EventZ_Sentinel,
3214 } LDKCOption_EventZ_Tag;
3215
3216 typedef struct LDKCOption_EventZ {
3217    LDKCOption_EventZ_Tag tag;
3218    union {
3219       struct {
3220          struct LDKEvent some;
3221       };
3222    };
3223 } LDKCOption_EventZ;
3224
3225 /**
3226  * The contents of CResult_COption_EventZDecodeErrorZ
3227  */
3228 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
3229    /**
3230     * A pointer to the contents in the success state.
3231     * Reading from this pointer when `result_ok` is not set is undefined.
3232     */
3233    struct LDKCOption_EventZ *result;
3234    /**
3235     * A pointer to the contents in the error state.
3236     * Reading from this pointer when `result_ok` is set is undefined.
3237     */
3238    struct LDKDecodeError *err;
3239 } LDKCResult_COption_EventZDecodeErrorZPtr;
3240
3241 /**
3242  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3243  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3244  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3245  */
3246 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3247    /**
3248     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3249     * `err` or `result` depending on the state of `result_ok`.
3250     */
3251    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3252    /**
3253     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3254     */
3255    bool result_ok;
3256 } LDKCResult_COption_EventZDecodeErrorZ;
3257
3258
3259
3260 /**
3261  * An accept_channel message to be sent or received from a peer
3262  */
3263 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3264    /**
3265     * A pointer to the opaque Rust object.
3266     * Nearly everywhere, inner must be non-null, however in places where
3267     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3268     */
3269    LDKnativeAcceptChannel *inner;
3270    /**
3271     * Indicates that this is the only struct which contains the same pointer.
3272     * Rust functions which take ownership of an object provided via an argument require
3273     * this to be true and invalidate the object pointed to by inner.
3274     */
3275    bool is_owned;
3276 } LDKAcceptChannel;
3277
3278
3279
3280 /**
3281  * An open_channel message to be sent or received from a peer
3282  */
3283 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3284    /**
3285     * A pointer to the opaque Rust object.
3286     * Nearly everywhere, inner must be non-null, however in places where
3287     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3288     */
3289    LDKnativeOpenChannel *inner;
3290    /**
3291     * Indicates that this is the only struct which contains the same pointer.
3292     * Rust functions which take ownership of an object provided via an argument require
3293     * this to be true and invalidate the object pointed to by inner.
3294     */
3295    bool is_owned;
3296 } LDKOpenChannel;
3297
3298
3299
3300 /**
3301  * A funding_created message to be sent or received from a peer
3302  */
3303 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3304    /**
3305     * A pointer to the opaque Rust object.
3306     * Nearly everywhere, inner must be non-null, however in places where
3307     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3308     */
3309    LDKnativeFundingCreated *inner;
3310    /**
3311     * Indicates that this is the only struct which contains the same pointer.
3312     * Rust functions which take ownership of an object provided via an argument require
3313     * this to be true and invalidate the object pointed to by inner.
3314     */
3315    bool is_owned;
3316 } LDKFundingCreated;
3317
3318
3319
3320 /**
3321  * A funding_signed message to be sent or received from a peer
3322  */
3323 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3324    /**
3325     * A pointer to the opaque Rust object.
3326     * Nearly everywhere, inner must be non-null, however in places where
3327     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3328     */
3329    LDKnativeFundingSigned *inner;
3330    /**
3331     * Indicates that this is the only struct which contains the same pointer.
3332     * Rust functions which take ownership of an object provided via an argument require
3333     * this to be true and invalidate the object pointed to by inner.
3334     */
3335    bool is_owned;
3336 } LDKFundingSigned;
3337
3338
3339
3340 /**
3341  * A channel_ready message to be sent or received from a peer
3342  */
3343 typedef struct MUST_USE_STRUCT LDKChannelReady {
3344    /**
3345     * A pointer to the opaque Rust object.
3346     * Nearly everywhere, inner must be non-null, however in places where
3347     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3348     */
3349    LDKnativeChannelReady *inner;
3350    /**
3351     * Indicates that this is the only struct which contains the same pointer.
3352     * Rust functions which take ownership of an object provided via an argument require
3353     * this to be true and invalidate the object pointed to by inner.
3354     */
3355    bool is_owned;
3356 } LDKChannelReady;
3357
3358
3359
3360 /**
3361  * An announcement_signatures message to be sent or received from a peer
3362  */
3363 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3364    /**
3365     * A pointer to the opaque Rust object.
3366     * Nearly everywhere, inner must be non-null, however in places where
3367     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3368     */
3369    LDKnativeAnnouncementSignatures *inner;
3370    /**
3371     * Indicates that this is the only struct which contains the same pointer.
3372     * Rust functions which take ownership of an object provided via an argument require
3373     * this to be true and invalidate the object pointed to by inner.
3374     */
3375    bool is_owned;
3376 } LDKAnnouncementSignatures;
3377
3378
3379
3380 /**
3381  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3382  * transaction updates if they were pending.
3383  */
3384 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3385    /**
3386     * A pointer to the opaque Rust object.
3387     * Nearly everywhere, inner must be non-null, however in places where
3388     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3389     */
3390    LDKnativeCommitmentUpdate *inner;
3391    /**
3392     * Indicates that this is the only struct which contains the same pointer.
3393     * Rust functions which take ownership of an object provided via an argument require
3394     * this to be true and invalidate the object pointed to by inner.
3395     */
3396    bool is_owned;
3397 } LDKCommitmentUpdate;
3398
3399
3400
3401 /**
3402  * A revoke_and_ack message to be sent or received from a peer
3403  */
3404 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3405    /**
3406     * A pointer to the opaque Rust object.
3407     * Nearly everywhere, inner must be non-null, however in places where
3408     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3409     */
3410    LDKnativeRevokeAndACK *inner;
3411    /**
3412     * Indicates that this is the only struct which contains the same pointer.
3413     * Rust functions which take ownership of an object provided via an argument require
3414     * this to be true and invalidate the object pointed to by inner.
3415     */
3416    bool is_owned;
3417 } LDKRevokeAndACK;
3418
3419
3420
3421 /**
3422  * A closing_signed message to be sent or received from a peer
3423  */
3424 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3425    /**
3426     * A pointer to the opaque Rust object.
3427     * Nearly everywhere, inner must be non-null, however in places where
3428     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3429     */
3430    LDKnativeClosingSigned *inner;
3431    /**
3432     * Indicates that this is the only struct which contains the same pointer.
3433     * Rust functions which take ownership of an object provided via an argument require
3434     * this to be true and invalidate the object pointed to by inner.
3435     */
3436    bool is_owned;
3437 } LDKClosingSigned;
3438
3439
3440
3441 /**
3442  * A shutdown message to be sent or received from a peer
3443  */
3444 typedef struct MUST_USE_STRUCT LDKShutdown {
3445    /**
3446     * A pointer to the opaque Rust object.
3447     * Nearly everywhere, inner must be non-null, however in places where
3448     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3449     */
3450    LDKnativeShutdown *inner;
3451    /**
3452     * Indicates that this is the only struct which contains the same pointer.
3453     * Rust functions which take ownership of an object provided via an argument require
3454     * this to be true and invalidate the object pointed to by inner.
3455     */
3456    bool is_owned;
3457 } LDKShutdown;
3458
3459
3460
3461 /**
3462  * A channel_reestablish message to be sent or received from a peer
3463  */
3464 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3465    /**
3466     * A pointer to the opaque Rust object.
3467     * Nearly everywhere, inner must be non-null, however in places where
3468     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3469     */
3470    LDKnativeChannelReestablish *inner;
3471    /**
3472     * Indicates that this is the only struct which contains the same pointer.
3473     * Rust functions which take ownership of an object provided via an argument require
3474     * this to be true and invalidate the object pointed to by inner.
3475     */
3476    bool is_owned;
3477 } LDKChannelReestablish;
3478
3479
3480
3481 /**
3482  * A channel_announcement message to be sent or received from a peer
3483  */
3484 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3485    /**
3486     * A pointer to the opaque Rust object.
3487     * Nearly everywhere, inner must be non-null, however in places where
3488     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3489     */
3490    LDKnativeChannelAnnouncement *inner;
3491    /**
3492     * Indicates that this is the only struct which contains the same pointer.
3493     * Rust functions which take ownership of an object provided via an argument require
3494     * this to be true and invalidate the object pointed to by inner.
3495     */
3496    bool is_owned;
3497 } LDKChannelAnnouncement;
3498
3499
3500
3501 /**
3502  * A node_announcement message to be sent or received from a peer
3503  */
3504 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3505    /**
3506     * A pointer to the opaque Rust object.
3507     * Nearly everywhere, inner must be non-null, however in places where
3508     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3509     */
3510    LDKnativeNodeAnnouncement *inner;
3511    /**
3512     * Indicates that this is the only struct which contains the same pointer.
3513     * Rust functions which take ownership of an object provided via an argument require
3514     * this to be true and invalidate the object pointed to by inner.
3515     */
3516    bool is_owned;
3517 } LDKNodeAnnouncement;
3518
3519
3520
3521 /**
3522  * An error message to be sent or received from a peer
3523  */
3524 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3525    /**
3526     * A pointer to the opaque Rust object.
3527     * Nearly everywhere, inner must be non-null, however in places where
3528     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3529     */
3530    LDKnativeErrorMessage *inner;
3531    /**
3532     * Indicates that this is the only struct which contains the same pointer.
3533     * Rust functions which take ownership of an object provided via an argument require
3534     * this to be true and invalidate the object pointed to by inner.
3535     */
3536    bool is_owned;
3537 } LDKErrorMessage;
3538
3539
3540
3541 /**
3542  * A warning message to be sent or received from a peer
3543  */
3544 typedef struct MUST_USE_STRUCT LDKWarningMessage {
3545    /**
3546     * A pointer to the opaque Rust object.
3547     * Nearly everywhere, inner must be non-null, however in places where
3548     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3549     */
3550    LDKnativeWarningMessage *inner;
3551    /**
3552     * Indicates that this is the only struct which contains the same pointer.
3553     * Rust functions which take ownership of an object provided via an argument require
3554     * this to be true and invalidate the object pointed to by inner.
3555     */
3556    bool is_owned;
3557 } LDKWarningMessage;
3558
3559 /**
3560  * Used to put an error message in a LightningError
3561  */
3562 typedef enum LDKErrorAction_Tag {
3563    /**
3564     * The peer took some action which made us think they were useless. Disconnect them.
3565     */
3566    LDKErrorAction_DisconnectPeer,
3567    /**
3568     * The peer did something harmless that we weren't able to process, just log and ignore
3569     */
3570    LDKErrorAction_IgnoreError,
3571    /**
3572     * The peer did something harmless that we weren't able to meaningfully process.
3573     * If the error is logged, log it at the given level.
3574     */
3575    LDKErrorAction_IgnoreAndLog,
3576    /**
3577     * The peer provided us with a gossip message which we'd already seen. In most cases this
3578     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
3579     * our own channel announcements.
3580     */
3581    LDKErrorAction_IgnoreDuplicateGossip,
3582    /**
3583     * The peer did something incorrect. Tell them.
3584     */
3585    LDKErrorAction_SendErrorMessage,
3586    /**
3587     * The peer did something incorrect. Tell them without closing any channels.
3588     */
3589    LDKErrorAction_SendWarningMessage,
3590    /**
3591     * Must be last for serialization purposes
3592     */
3593    LDKErrorAction_Sentinel,
3594 } LDKErrorAction_Tag;
3595
3596 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3597    /**
3598     * An error message which we should make an effort to send before we disconnect.
3599     *
3600     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3601     */
3602    struct LDKErrorMessage msg;
3603 } LDKErrorAction_LDKDisconnectPeer_Body;
3604
3605 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3606    /**
3607     * The message to send.
3608     */
3609    struct LDKErrorMessage msg;
3610 } LDKErrorAction_LDKSendErrorMessage_Body;
3611
3612 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
3613    /**
3614     * The message to send.
3615     */
3616    struct LDKWarningMessage msg;
3617    /**
3618     * The peer may have done something harmless that we weren't able to meaningfully process,
3619     * though we should still tell them about it.
3620     * If this event is logged, log it at the given level.
3621     */
3622    enum LDKLevel log_level;
3623 } LDKErrorAction_LDKSendWarningMessage_Body;
3624
3625 typedef struct MUST_USE_STRUCT LDKErrorAction {
3626    LDKErrorAction_Tag tag;
3627    union {
3628       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3629       struct {
3630          enum LDKLevel ignore_and_log;
3631       };
3632       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3633       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
3634    };
3635 } LDKErrorAction;
3636
3637
3638
3639 /**
3640  * A query_channel_range message is used to query a peer for channel
3641  * UTXOs in a range of blocks. The recipient of a query makes a best
3642  * effort to reply to the query using one or more reply_channel_range
3643  * messages.
3644  */
3645 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3646    /**
3647     * A pointer to the opaque Rust object.
3648     * Nearly everywhere, inner must be non-null, however in places where
3649     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3650     */
3651    LDKnativeQueryChannelRange *inner;
3652    /**
3653     * Indicates that this is the only struct which contains the same pointer.
3654     * Rust functions which take ownership of an object provided via an argument require
3655     * this to be true and invalidate the object pointed to by inner.
3656     */
3657    bool is_owned;
3658 } LDKQueryChannelRange;
3659
3660
3661
3662 /**
3663  * A query_short_channel_ids message is used to query a peer for
3664  * routing gossip messages related to one or more short_channel_ids.
3665  * The query recipient will reply with the latest, if available,
3666  * channel_announcement, channel_update and node_announcement messages
3667  * it maintains for the requested short_channel_ids followed by a
3668  * reply_short_channel_ids_end message. The short_channel_ids sent in
3669  * this query are encoded. We only support encoding_type=0 uncompressed
3670  * serialization and do not support encoding_type=1 zlib serialization.
3671  */
3672 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3673    /**
3674     * A pointer to the opaque Rust object.
3675     * Nearly everywhere, inner must be non-null, however in places where
3676     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3677     */
3678    LDKnativeQueryShortChannelIds *inner;
3679    /**
3680     * Indicates that this is the only struct which contains the same pointer.
3681     * Rust functions which take ownership of an object provided via an argument require
3682     * this to be true and invalidate the object pointed to by inner.
3683     */
3684    bool is_owned;
3685 } LDKQueryShortChannelIds;
3686
3687
3688
3689 /**
3690  * A reply_channel_range message is a reply to a query_channel_range
3691  * message. Multiple reply_channel_range messages can be sent in reply
3692  * to a single query_channel_range message. The query recipient makes a
3693  * best effort to respond based on their local network view which may
3694  * not be a perfect view of the network. The short_channel_ids in the
3695  * reply are encoded. We only support encoding_type=0 uncompressed
3696  * serialization and do not support encoding_type=1 zlib serialization.
3697  */
3698 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3699    /**
3700     * A pointer to the opaque Rust object.
3701     * Nearly everywhere, inner must be non-null, however in places where
3702     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3703     */
3704    LDKnativeReplyChannelRange *inner;
3705    /**
3706     * Indicates that this is the only struct which contains the same pointer.
3707     * Rust functions which take ownership of an object provided via an argument require
3708     * this to be true and invalidate the object pointed to by inner.
3709     */
3710    bool is_owned;
3711 } LDKReplyChannelRange;
3712
3713
3714
3715 /**
3716  * A gossip_timestamp_filter message is used by a node to request
3717  * gossip relay for messages in the requested time range when the
3718  * gossip_queries feature has been negotiated.
3719  */
3720 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
3721    /**
3722     * A pointer to the opaque Rust object.
3723     * Nearly everywhere, inner must be non-null, however in places where
3724     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3725     */
3726    LDKnativeGossipTimestampFilter *inner;
3727    /**
3728     * Indicates that this is the only struct which contains the same pointer.
3729     * Rust functions which take ownership of an object provided via an argument require
3730     * this to be true and invalidate the object pointed to by inner.
3731     */
3732    bool is_owned;
3733 } LDKGossipTimestampFilter;
3734
3735 /**
3736  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3737  * broadcast to most peers).
3738  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3739  */
3740 typedef enum LDKMessageSendEvent_Tag {
3741    /**
3742     * Used to indicate that we've accepted a channel open and should send the accept_channel
3743     * message provided to the given peer.
3744     */
3745    LDKMessageSendEvent_SendAcceptChannel,
3746    /**
3747     * Used to indicate that we've initiated a channel open and should send the open_channel
3748     * message provided to the given peer.
3749     */
3750    LDKMessageSendEvent_SendOpenChannel,
3751    /**
3752     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3753     */
3754    LDKMessageSendEvent_SendFundingCreated,
3755    /**
3756     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3757     */
3758    LDKMessageSendEvent_SendFundingSigned,
3759    /**
3760     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
3761     */
3762    LDKMessageSendEvent_SendChannelReady,
3763    /**
3764     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3765     */
3766    LDKMessageSendEvent_SendAnnouncementSignatures,
3767    /**
3768     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3769     * message should be sent to the peer with the given node_id.
3770     */
3771    LDKMessageSendEvent_UpdateHTLCs,
3772    /**
3773     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
3774     */
3775    LDKMessageSendEvent_SendRevokeAndACK,
3776    /**
3777     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
3778     */
3779    LDKMessageSendEvent_SendClosingSigned,
3780    /**
3781     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
3782     */
3783    LDKMessageSendEvent_SendShutdown,
3784    /**
3785     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
3786     */
3787    LDKMessageSendEvent_SendChannelReestablish,
3788    /**
3789     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
3790     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
3791     *
3792     * Note that after doing so, you very likely (unless you did so very recently) want to call
3793     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
3794     * This ensures that any nodes which see our channel_announcement also have a relevant
3795     * node_announcement, including relevant feature flags which may be important for routing
3796     * through or to us.
3797     */
3798    LDKMessageSendEvent_BroadcastChannelAnnouncement,
3799    /**
3800     * Used to indicate that a node_announcement should be broadcast to all peers.
3801     */
3802    LDKMessageSendEvent_BroadcastNodeAnnouncement,
3803    /**
3804     * Used to indicate that a channel_update should be broadcast to all peers.
3805     */
3806    LDKMessageSendEvent_BroadcastChannelUpdate,
3807    /**
3808     * Used to indicate that a channel_update should be sent to a single peer.
3809     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
3810     * private channel and we shouldn't be informing all of our peers of channel parameters.
3811     */
3812    LDKMessageSendEvent_SendChannelUpdate,
3813    /**
3814     * Broadcast an error downstream to be handled
3815     */
3816    LDKMessageSendEvent_HandleError,
3817    /**
3818     * Query a peer for channels with funding transaction UTXOs in a block range.
3819     */
3820    LDKMessageSendEvent_SendChannelRangeQuery,
3821    /**
3822     * Request routing gossip messages from a peer for a list of channels identified by
3823     * their short_channel_ids.
3824     */
3825    LDKMessageSendEvent_SendShortIdsQuery,
3826    /**
3827     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
3828     * emitted during processing of the query.
3829     */
3830    LDKMessageSendEvent_SendReplyChannelRange,
3831    /**
3832     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
3833     * enable receiving gossip messages from the peer.
3834     */
3835    LDKMessageSendEvent_SendGossipTimestampFilter,
3836    /**
3837     * Must be last for serialization purposes
3838     */
3839    LDKMessageSendEvent_Sentinel,
3840 } LDKMessageSendEvent_Tag;
3841
3842 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
3843    /**
3844     * The node_id of the node which should receive this message
3845     */
3846    struct LDKPublicKey node_id;
3847    /**
3848     * The message which should be sent.
3849     */
3850    struct LDKAcceptChannel msg;
3851 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
3852
3853 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
3854    /**
3855     * The node_id of the node which should receive this message
3856     */
3857    struct LDKPublicKey node_id;
3858    /**
3859     * The message which should be sent.
3860     */
3861    struct LDKOpenChannel msg;
3862 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
3863
3864 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
3865    /**
3866     * The node_id of the node which should receive this message
3867     */
3868    struct LDKPublicKey node_id;
3869    /**
3870     * The message which should be sent.
3871     */
3872    struct LDKFundingCreated msg;
3873 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
3874
3875 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
3876    /**
3877     * The node_id of the node which should receive this message
3878     */
3879    struct LDKPublicKey node_id;
3880    /**
3881     * The message which should be sent.
3882     */
3883    struct LDKFundingSigned msg;
3884 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
3885
3886 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
3887    /**
3888     * The node_id of the node which should receive these message(s)
3889     */
3890    struct LDKPublicKey node_id;
3891    /**
3892     * The channel_ready message which should be sent.
3893     */
3894    struct LDKChannelReady msg;
3895 } LDKMessageSendEvent_LDKSendChannelReady_Body;
3896
3897 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
3898    /**
3899     * The node_id of the node which should receive these message(s)
3900     */
3901    struct LDKPublicKey node_id;
3902    /**
3903     * The announcement_signatures message which should be sent.
3904     */
3905    struct LDKAnnouncementSignatures msg;
3906 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
3907
3908 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
3909    /**
3910     * The node_id of the node which should receive these message(s)
3911     */
3912    struct LDKPublicKey node_id;
3913    /**
3914     * The update messages which should be sent. ALL messages in the struct should be sent!
3915     */
3916    struct LDKCommitmentUpdate updates;
3917 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
3918
3919 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
3920    /**
3921     * The node_id of the node which should receive this message
3922     */
3923    struct LDKPublicKey node_id;
3924    /**
3925     * The message which should be sent.
3926     */
3927    struct LDKRevokeAndACK msg;
3928 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
3929
3930 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
3931    /**
3932     * The node_id of the node which should receive this message
3933     */
3934    struct LDKPublicKey node_id;
3935    /**
3936     * The message which should be sent.
3937     */
3938    struct LDKClosingSigned msg;
3939 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
3940
3941 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
3942    /**
3943     * The node_id of the node which should receive this message
3944     */
3945    struct LDKPublicKey node_id;
3946    /**
3947     * The message which should be sent.
3948     */
3949    struct LDKShutdown msg;
3950 } LDKMessageSendEvent_LDKSendShutdown_Body;
3951
3952 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
3953    /**
3954     * The node_id of the node which should receive this message
3955     */
3956    struct LDKPublicKey node_id;
3957    /**
3958     * The message which should be sent.
3959     */
3960    struct LDKChannelReestablish msg;
3961 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
3962
3963 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
3964    /**
3965     * The channel_announcement which should be sent.
3966     */
3967    struct LDKChannelAnnouncement msg;
3968    /**
3969     * The followup channel_update which should be sent.
3970     */
3971    struct LDKChannelUpdate update_msg;
3972 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
3973
3974 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
3975    /**
3976     * The node_announcement which should be sent.
3977     */
3978    struct LDKNodeAnnouncement msg;
3979 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
3980
3981 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
3982    /**
3983     * The channel_update which should be sent.
3984     */
3985    struct LDKChannelUpdate msg;
3986 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
3987
3988 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
3989    /**
3990     * The node_id of the node which should receive this message
3991     */
3992    struct LDKPublicKey node_id;
3993    /**
3994     * The channel_update which should be sent.
3995     */
3996    struct LDKChannelUpdate msg;
3997 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
3998
3999 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4000    /**
4001     * The node_id of the node which should receive this message
4002     */
4003    struct LDKPublicKey node_id;
4004    /**
4005     * The action which should be taken.
4006     */
4007    struct LDKErrorAction action;
4008 } LDKMessageSendEvent_LDKHandleError_Body;
4009
4010 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4011    /**
4012     * The node_id of this message recipient
4013     */
4014    struct LDKPublicKey node_id;
4015    /**
4016     * The query_channel_range which should be sent.
4017     */
4018    struct LDKQueryChannelRange msg;
4019 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4020
4021 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4022    /**
4023     * The node_id of this message recipient
4024     */
4025    struct LDKPublicKey node_id;
4026    /**
4027     * The query_short_channel_ids which should be sent.
4028     */
4029    struct LDKQueryShortChannelIds msg;
4030 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4031
4032 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4033    /**
4034     * The node_id of this message recipient
4035     */
4036    struct LDKPublicKey node_id;
4037    /**
4038     * The reply_channel_range which should be sent.
4039     */
4040    struct LDKReplyChannelRange msg;
4041 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4042
4043 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
4044    /**
4045     * The node_id of this message recipient
4046     */
4047    struct LDKPublicKey node_id;
4048    /**
4049     * The gossip_timestamp_filter which should be sent.
4050     */
4051    struct LDKGossipTimestampFilter msg;
4052 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
4053
4054 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4055    LDKMessageSendEvent_Tag tag;
4056    union {
4057       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4058       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4059       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4060       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4061       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
4062       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4063       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4064       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4065       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4066       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4067       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4068       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4069       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4070       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4071       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4072       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4073       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4074       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4075       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4076       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
4077    };
4078 } LDKMessageSendEvent;
4079
4080 /**
4081  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4082  * This corresponds to std::vector in C++
4083  */
4084 typedef struct LDKCVec_MessageSendEventZ {
4085    /**
4086     * The elements in the array.
4087     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4088     */
4089    struct LDKMessageSendEvent *data;
4090    /**
4091     * The number of elements pointed to by `data`.
4092     */
4093    uintptr_t datalen;
4094 } LDKCVec_MessageSendEventZ;
4095
4096 /**
4097  * The contents of CResult_TxOutAccessErrorZ
4098  */
4099 typedef union LDKCResult_TxOutAccessErrorZPtr {
4100    /**
4101     * A pointer to the contents in the success state.
4102     * Reading from this pointer when `result_ok` is not set is undefined.
4103     */
4104    struct LDKTxOut *result;
4105    /**
4106     * A pointer to the contents in the error state.
4107     * Reading from this pointer when `result_ok` is set is undefined.
4108     */
4109    enum LDKAccessError *err;
4110 } LDKCResult_TxOutAccessErrorZPtr;
4111
4112 /**
4113  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4114  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4115  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4116  */
4117 typedef struct LDKCResult_TxOutAccessErrorZ {
4118    /**
4119     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4120     * `err` or `result` depending on the state of `result_ok`.
4121     */
4122    union LDKCResult_TxOutAccessErrorZPtr contents;
4123    /**
4124     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4125     */
4126    bool result_ok;
4127 } LDKCResult_TxOutAccessErrorZ;
4128
4129 /**
4130  * A tuple of 2 elements. See the individual fields for the types contained.
4131  */
4132 typedef struct LDKC2Tuple_usizeTransactionZ {
4133    /**
4134     * The element at position 0
4135     */
4136    uintptr_t a;
4137    /**
4138     * The element at position 1
4139     */
4140    struct LDKTransaction b;
4141 } LDKC2Tuple_usizeTransactionZ;
4142
4143 /**
4144  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4145  * This corresponds to std::vector in C++
4146  */
4147 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
4148    /**
4149     * The elements in the array.
4150     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4151     */
4152    struct LDKC2Tuple_usizeTransactionZ *data;
4153    /**
4154     * The number of elements pointed to by `data`.
4155     */
4156    uintptr_t datalen;
4157 } LDKCVec_C2Tuple_usizeTransactionZZ;
4158
4159 /**
4160  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4161  * This corresponds to std::vector in C++
4162  */
4163 typedef struct LDKCVec_TxidZ {
4164    /**
4165     * The elements in the array.
4166     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4167     */
4168    struct LDKThirtyTwoBytes *data;
4169    /**
4170     * The number of elements pointed to by `data`.
4171     */
4172    uintptr_t datalen;
4173 } LDKCVec_TxidZ;
4174
4175 /**
4176  * The contents of CResult_NoneChannelMonitorUpdateErrZ
4177  */
4178 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
4179    /**
4180     * Note that this value is always NULL, as there are no contents in the OK variant
4181     */
4182    void *result;
4183    /**
4184     * A pointer to the contents in the error state.
4185     * Reading from this pointer when `result_ok` is set is undefined.
4186     */
4187    enum LDKChannelMonitorUpdateErr *err;
4188 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
4189
4190 /**
4191  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
4192  * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
4193  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4194  */
4195 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
4196    /**
4197     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
4198     * `err` or `result` depending on the state of `result_ok`.
4199     */
4200    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
4201    /**
4202     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
4203     */
4204    bool result_ok;
4205 } LDKCResult_NoneChannelMonitorUpdateErrZ;
4206
4207
4208
4209 /**
4210  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
4211  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
4212  * preimage claim backward will lead to loss of funds.
4213  */
4214 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
4215    /**
4216     * A pointer to the opaque Rust object.
4217     * Nearly everywhere, inner must be non-null, however in places where
4218     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4219     */
4220    LDKnativeHTLCUpdate *inner;
4221    /**
4222     * Indicates that this is the only struct which contains the same pointer.
4223     * Rust functions which take ownership of an object provided via an argument require
4224     * this to be true and invalidate the object pointed to by inner.
4225     */
4226    bool is_owned;
4227 } LDKHTLCUpdate;
4228
4229 /**
4230  * An event to be processed by the ChannelManager.
4231  */
4232 typedef enum LDKMonitorEvent_Tag {
4233    /**
4234     * A monitor event containing an HTLCUpdate.
4235     */
4236    LDKMonitorEvent_HTLCEvent,
4237    /**
4238     * A monitor event that the Channel's commitment transaction was confirmed.
4239     */
4240    LDKMonitorEvent_CommitmentTxConfirmed,
4241    /**
4242     * Indicates a [`ChannelMonitor`] update has completed. See
4243     * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
4244     *
4245     * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
4246     */
4247    LDKMonitorEvent_UpdateCompleted,
4248    /**
4249     * Indicates a [`ChannelMonitor`] update has failed. See
4250     * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
4251     *
4252     * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
4253     */
4254    LDKMonitorEvent_UpdateFailed,
4255    /**
4256     * Must be last for serialization purposes
4257     */
4258    LDKMonitorEvent_Sentinel,
4259 } LDKMonitorEvent_Tag;
4260
4261 typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
4262    /**
4263     * The funding outpoint of the [`ChannelMonitor`] that was updated
4264     */
4265    struct LDKOutPoint funding_txo;
4266    /**
4267     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
4268     * [`ChannelMonitor::get_latest_update_id`].
4269     *
4270     * Note that this should only be set to a given update's ID if all previous updates for the
4271     * same [`ChannelMonitor`] have been applied and persisted.
4272     */
4273    uint64_t monitor_update_id;
4274 } LDKMonitorEvent_LDKUpdateCompleted_Body;
4275
4276 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
4277    LDKMonitorEvent_Tag tag;
4278    union {
4279       struct {
4280          struct LDKHTLCUpdate htlc_event;
4281       };
4282       struct {
4283          struct LDKOutPoint commitment_tx_confirmed;
4284       };
4285       LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
4286       struct {
4287          struct LDKOutPoint update_failed;
4288       };
4289    };
4290 } LDKMonitorEvent;
4291
4292 /**
4293  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4294  * This corresponds to std::vector in C++
4295  */
4296 typedef struct LDKCVec_MonitorEventZ {
4297    /**
4298     * The elements in the array.
4299     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4300     */
4301    struct LDKMonitorEvent *data;
4302    /**
4303     * The number of elements pointed to by `data`.
4304     */
4305    uintptr_t datalen;
4306 } LDKCVec_MonitorEventZ;
4307
4308 /**
4309  * A tuple of 2 elements. See the individual fields for the types contained.
4310  */
4311 typedef struct LDKC2Tuple_OutPointCVec_MonitorEventZZ {
4312    /**
4313     * The element at position 0
4314     */
4315    struct LDKOutPoint a;
4316    /**
4317     * The element at position 1
4318     */
4319    struct LDKCVec_MonitorEventZ b;
4320 } LDKC2Tuple_OutPointCVec_MonitorEventZZ;
4321
4322 /**
4323  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorEventZZs of arbitrary size.
4324  * This corresponds to std::vector in C++
4325  */
4326 typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ {
4327    /**
4328     * The elements in the array.
4329     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4330     */
4331    struct LDKC2Tuple_OutPointCVec_MonitorEventZZ *data;
4332    /**
4333     * The number of elements pointed to by `data`.
4334     */
4335    uintptr_t datalen;
4336 } LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ;
4337
4338 /**
4339  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4340  */
4341 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
4342    /**
4343     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4344     */
4345    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
4346    /**
4347     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4348     */
4349    LDKCOption_C2Tuple_usizeTransactionZZ_None,
4350    /**
4351     * Must be last for serialization purposes
4352     */
4353    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
4354 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
4355
4356 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
4357    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
4358    union {
4359       struct {
4360          struct LDKC2Tuple_usizeTransactionZ some;
4361       };
4362    };
4363 } LDKCOption_C2Tuple_usizeTransactionZZ;
4364
4365
4366
4367 /**
4368  * [`Score`] implementation that uses a fixed penalty.
4369  */
4370 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
4371    /**
4372     * A pointer to the opaque Rust object.
4373     * Nearly everywhere, inner must be non-null, however in places where
4374     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4375     */
4376    LDKnativeFixedPenaltyScorer *inner;
4377    /**
4378     * Indicates that this is the only struct which contains the same pointer.
4379     * Rust functions which take ownership of an object provided via an argument require
4380     * this to be true and invalidate the object pointed to by inner.
4381     */
4382    bool is_owned;
4383 } LDKFixedPenaltyScorer;
4384
4385 /**
4386  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4387  */
4388 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
4389    /**
4390     * A pointer to the contents in the success state.
4391     * Reading from this pointer when `result_ok` is not set is undefined.
4392     */
4393    struct LDKFixedPenaltyScorer *result;
4394    /**
4395     * A pointer to the contents in the error state.
4396     * Reading from this pointer when `result_ok` is set is undefined.
4397     */
4398    struct LDKDecodeError *err;
4399 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
4400
4401 /**
4402  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4403  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4404  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4405  */
4406 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
4407    /**
4408     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4409     * `err` or `result` depending on the state of `result_ok`.
4410     */
4411    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
4412    /**
4413     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4414     */
4415    bool result_ok;
4416 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
4417
4418
4419
4420 /**
4421  * A Record, unit of logging output with Metadata to enable filtering
4422  * Module_path, file, line to inform on log's source
4423  */
4424 typedef struct MUST_USE_STRUCT LDKRecord {
4425    /**
4426     * A pointer to the opaque Rust object.
4427     * Nearly everywhere, inner must be non-null, however in places where
4428     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4429     */
4430    LDKnativeRecord *inner;
4431    /**
4432     * Indicates that this is the only struct which contains the same pointer.
4433     * Rust functions which take ownership of an object provided via an argument require
4434     * this to be true and invalidate the object pointed to by inner.
4435     */
4436    bool is_owned;
4437 } LDKRecord;
4438
4439 /**
4440  * A trait encapsulating the operations required of a logger
4441  */
4442 typedef struct LDKLogger {
4443    /**
4444     * An opaque pointer which is passed to your function implementations as an argument.
4445     * This has no meaning in the LDK, and can be NULL or any other value.
4446     */
4447    void *this_arg;
4448    /**
4449     * Logs the `Record`
4450     */
4451    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
4452    /**
4453     * Frees any resources associated with this object given its this_arg pointer.
4454     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4455     */
4456    void (*free)(void *this_arg);
4457 } LDKLogger;
4458
4459
4460
4461 /**
4462  * Represents the network as nodes and channels between them
4463  */
4464 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4465    /**
4466     * A pointer to the opaque Rust object.
4467     * Nearly everywhere, inner must be non-null, however in places where
4468     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4469     */
4470    LDKnativeNetworkGraph *inner;
4471    /**
4472     * Indicates that this is the only struct which contains the same pointer.
4473     * Rust functions which take ownership of an object provided via an argument require
4474     * this to be true and invalidate the object pointed to by inner.
4475     */
4476    bool is_owned;
4477 } LDKNetworkGraph;
4478
4479
4480
4481 /**
4482  * [`Score`] implementation using channel success probability distributions.
4483  *
4484  * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
4485  * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
4486  * distributions are defined based on knowledge learned from successful and unsuccessful attempts.
4487  * Then the negative `log10` of the success probability is used to determine the cost of routing a
4488  * specific HTLC amount through a channel.
4489  *
4490  * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
4491  * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
4492  * [`ProbabilisticScoringParameters`] for details.
4493  *
4494  * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
4495  * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
4496  * volume are more likely to experience failed payment paths, which would need to be retried.
4497  *
4498  * # Note
4499  *
4500  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4501  * behavior.
4502  *
4503  * [1]: https://arxiv.org/abs/2107.05322
4504  */
4505 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
4506    /**
4507     * A pointer to the opaque Rust object.
4508     * Nearly everywhere, inner must be non-null, however in places where
4509     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4510     */
4511    LDKnativeProbabilisticScorer *inner;
4512    /**
4513     * Indicates that this is the only struct which contains the same pointer.
4514     * Rust functions which take ownership of an object provided via an argument require
4515     * this to be true and invalidate the object pointed to by inner.
4516     */
4517    bool is_owned;
4518 } LDKProbabilisticScorer;
4519
4520 /**
4521  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
4522  */
4523 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
4524    /**
4525     * A pointer to the contents in the success state.
4526     * Reading from this pointer when `result_ok` is not set is undefined.
4527     */
4528    struct LDKProbabilisticScorer *result;
4529    /**
4530     * A pointer to the contents in the error state.
4531     * Reading from this pointer when `result_ok` is set is undefined.
4532     */
4533    struct LDKDecodeError *err;
4534 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
4535
4536 /**
4537  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4538  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4539  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4540  */
4541 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
4542    /**
4543     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4544     * `err` or `result` depending on the state of `result_ok`.
4545     */
4546    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
4547    /**
4548     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4549     */
4550    bool result_ok;
4551 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
4552
4553
4554
4555 /**
4556  * Features used within an `init` message.
4557  */
4558 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4559    /**
4560     * A pointer to the opaque Rust object.
4561     * Nearly everywhere, inner must be non-null, however in places where
4562     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4563     */
4564    LDKnativeInitFeatures *inner;
4565    /**
4566     * Indicates that this is the only struct which contains the same pointer.
4567     * Rust functions which take ownership of an object provided via an argument require
4568     * this to be true and invalidate the object pointed to by inner.
4569     */
4570    bool is_owned;
4571 } LDKInitFeatures;
4572
4573 /**
4574  * The contents of CResult_InitFeaturesDecodeErrorZ
4575  */
4576 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4577    /**
4578     * A pointer to the contents in the success state.
4579     * Reading from this pointer when `result_ok` is not set is undefined.
4580     */
4581    struct LDKInitFeatures *result;
4582    /**
4583     * A pointer to the contents in the error state.
4584     * Reading from this pointer when `result_ok` is set is undefined.
4585     */
4586    struct LDKDecodeError *err;
4587 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4588
4589 /**
4590  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4591  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4592  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4593  */
4594 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4595    /**
4596     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4597     * `err` or `result` depending on the state of `result_ok`.
4598     */
4599    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4600    /**
4601     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4602     */
4603    bool result_ok;
4604 } LDKCResult_InitFeaturesDecodeErrorZ;
4605
4606
4607
4608 /**
4609  * Features used within a `channel_announcement` message.
4610  */
4611 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4612    /**
4613     * A pointer to the opaque Rust object.
4614     * Nearly everywhere, inner must be non-null, however in places where
4615     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4616     */
4617    LDKnativeChannelFeatures *inner;
4618    /**
4619     * Indicates that this is the only struct which contains the same pointer.
4620     * Rust functions which take ownership of an object provided via an argument require
4621     * this to be true and invalidate the object pointed to by inner.
4622     */
4623    bool is_owned;
4624 } LDKChannelFeatures;
4625
4626 /**
4627  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4628  */
4629 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4630    /**
4631     * A pointer to the contents in the success state.
4632     * Reading from this pointer when `result_ok` is not set is undefined.
4633     */
4634    struct LDKChannelFeatures *result;
4635    /**
4636     * A pointer to the contents in the error state.
4637     * Reading from this pointer when `result_ok` is set is undefined.
4638     */
4639    struct LDKDecodeError *err;
4640 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4641
4642 /**
4643  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4644  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4645  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4646  */
4647 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4648    /**
4649     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4650     * `err` or `result` depending on the state of `result_ok`.
4651     */
4652    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4653    /**
4654     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4655     */
4656    bool result_ok;
4657 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4658
4659
4660
4661 /**
4662  * Features used within a `node_announcement` message.
4663  */
4664 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4665    /**
4666     * A pointer to the opaque Rust object.
4667     * Nearly everywhere, inner must be non-null, however in places where
4668     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4669     */
4670    LDKnativeNodeFeatures *inner;
4671    /**
4672     * Indicates that this is the only struct which contains the same pointer.
4673     * Rust functions which take ownership of an object provided via an argument require
4674     * this to be true and invalidate the object pointed to by inner.
4675     */
4676    bool is_owned;
4677 } LDKNodeFeatures;
4678
4679 /**
4680  * The contents of CResult_NodeFeaturesDecodeErrorZ
4681  */
4682 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4683    /**
4684     * A pointer to the contents in the success state.
4685     * Reading from this pointer when `result_ok` is not set is undefined.
4686     */
4687    struct LDKNodeFeatures *result;
4688    /**
4689     * A pointer to the contents in the error state.
4690     * Reading from this pointer when `result_ok` is set is undefined.
4691     */
4692    struct LDKDecodeError *err;
4693 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
4694
4695 /**
4696  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
4697  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4698  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4699  */
4700 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
4701    /**
4702     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
4703     * `err` or `result` depending on the state of `result_ok`.
4704     */
4705    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
4706    /**
4707     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
4708     */
4709    bool result_ok;
4710 } LDKCResult_NodeFeaturesDecodeErrorZ;
4711
4712
4713
4714 /**
4715  * Features used within an invoice.
4716  */
4717 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
4718    /**
4719     * A pointer to the opaque Rust object.
4720     * Nearly everywhere, inner must be non-null, however in places where
4721     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4722     */
4723    LDKnativeInvoiceFeatures *inner;
4724    /**
4725     * Indicates that this is the only struct which contains the same pointer.
4726     * Rust functions which take ownership of an object provided via an argument require
4727     * this to be true and invalidate the object pointed to by inner.
4728     */
4729    bool is_owned;
4730 } LDKInvoiceFeatures;
4731
4732 /**
4733  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
4734  */
4735 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
4736    /**
4737     * A pointer to the contents in the success state.
4738     * Reading from this pointer when `result_ok` is not set is undefined.
4739     */
4740    struct LDKInvoiceFeatures *result;
4741    /**
4742     * A pointer to the contents in the error state.
4743     * Reading from this pointer when `result_ok` is set is undefined.
4744     */
4745    struct LDKDecodeError *err;
4746 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
4747
4748 /**
4749  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
4750  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4751  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4752  */
4753 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
4754    /**
4755     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
4756     * `err` or `result` depending on the state of `result_ok`.
4757     */
4758    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
4759    /**
4760     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
4761     */
4762    bool result_ok;
4763 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
4764
4765 /**
4766  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
4767  */
4768 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
4769    /**
4770     * A pointer to the contents in the success state.
4771     * Reading from this pointer when `result_ok` is not set is undefined.
4772     */
4773    struct LDKChannelTypeFeatures *result;
4774    /**
4775     * A pointer to the contents in the error state.
4776     * Reading from this pointer when `result_ok` is set is undefined.
4777     */
4778    struct LDKDecodeError *err;
4779 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
4780
4781 /**
4782  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
4783  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4784  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4785  */
4786 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
4787    /**
4788     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
4789     * `err` or `result` depending on the state of `result_ok`.
4790     */
4791    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
4792    /**
4793     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
4794     */
4795    bool result_ok;
4796 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
4797
4798
4799
4800 /**
4801  * Represents the compressed public key of a node
4802  */
4803 typedef struct MUST_USE_STRUCT LDKNodeId {
4804    /**
4805     * A pointer to the opaque Rust object.
4806     * Nearly everywhere, inner must be non-null, however in places where
4807     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4808     */
4809    LDKnativeNodeId *inner;
4810    /**
4811     * Indicates that this is the only struct which contains the same pointer.
4812     * Rust functions which take ownership of an object provided via an argument require
4813     * this to be true and invalidate the object pointed to by inner.
4814     */
4815    bool is_owned;
4816 } LDKNodeId;
4817
4818 /**
4819  * The contents of CResult_NodeIdDecodeErrorZ
4820  */
4821 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
4822    /**
4823     * A pointer to the contents in the success state.
4824     * Reading from this pointer when `result_ok` is not set is undefined.
4825     */
4826    struct LDKNodeId *result;
4827    /**
4828     * A pointer to the contents in the error state.
4829     * Reading from this pointer when `result_ok` is set is undefined.
4830     */
4831    struct LDKDecodeError *err;
4832 } LDKCResult_NodeIdDecodeErrorZPtr;
4833
4834 /**
4835  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
4836  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
4837  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4838  */
4839 typedef struct LDKCResult_NodeIdDecodeErrorZ {
4840    /**
4841     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
4842     * `err` or `result` depending on the state of `result_ok`.
4843     */
4844    union LDKCResult_NodeIdDecodeErrorZPtr contents;
4845    /**
4846     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
4847     */
4848    bool result_ok;
4849 } LDKCResult_NodeIdDecodeErrorZ;
4850
4851 /**
4852  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
4853  */
4854 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
4855    /**
4856     * A pointer to the contents in the success state.
4857     * Reading from this pointer when `result_ok` is not set is undefined.
4858     */
4859    struct LDKCOption_NetworkUpdateZ *result;
4860    /**
4861     * A pointer to the contents in the error state.
4862     * Reading from this pointer when `result_ok` is set is undefined.
4863     */
4864    struct LDKDecodeError *err;
4865 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
4866
4867 /**
4868  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
4869  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
4870  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4871  */
4872 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
4873    /**
4874     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
4875     * `err` or `result` depending on the state of `result_ok`.
4876     */
4877    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
4878    /**
4879     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
4880     */
4881    bool result_ok;
4882 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
4883
4884 /**
4885  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
4886  * UTXOs.
4887  */
4888 typedef struct LDKAccess {
4889    /**
4890     * An opaque pointer which is passed to your function implementations as an argument.
4891     * This has no meaning in the LDK, and can be NULL or any other value.
4892     */
4893    void *this_arg;
4894    /**
4895     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
4896     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
4897     * is unknown.
4898     *
4899     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
4900     */
4901    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
4902    /**
4903     * Frees any resources associated with this object given its this_arg pointer.
4904     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4905     */
4906    void (*free)(void *this_arg);
4907 } LDKAccess;
4908
4909 /**
4910  * An enum which can either contain a crate::lightning::chain::Access or not
4911  */
4912 typedef enum LDKCOption_AccessZ_Tag {
4913    /**
4914     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
4915     */
4916    LDKCOption_AccessZ_Some,
4917    /**
4918     * When we're in this state, this COption_AccessZ contains nothing
4919     */
4920    LDKCOption_AccessZ_None,
4921    /**
4922     * Must be last for serialization purposes
4923     */
4924    LDKCOption_AccessZ_Sentinel,
4925 } LDKCOption_AccessZ_Tag;
4926
4927 typedef struct LDKCOption_AccessZ {
4928    LDKCOption_AccessZ_Tag tag;
4929    union {
4930       struct {
4931          struct LDKAccess some;
4932       };
4933    };
4934 } LDKCOption_AccessZ;
4935
4936 /**
4937  * The contents of CResult_boolLightningErrorZ
4938  */
4939 typedef union LDKCResult_boolLightningErrorZPtr {
4940    /**
4941     * A pointer to the contents in the success state.
4942     * Reading from this pointer when `result_ok` is not set is undefined.
4943     */
4944    bool *result;
4945    /**
4946     * A pointer to the contents in the error state.
4947     * Reading from this pointer when `result_ok` is set is undefined.
4948     */
4949    struct LDKLightningError *err;
4950 } LDKCResult_boolLightningErrorZPtr;
4951
4952 /**
4953  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
4954  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
4955  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4956  */
4957 typedef struct LDKCResult_boolLightningErrorZ {
4958    /**
4959     * The contents of this CResult_boolLightningErrorZ, accessible via either
4960     * `err` or `result` depending on the state of `result_ok`.
4961     */
4962    union LDKCResult_boolLightningErrorZPtr contents;
4963    /**
4964     * Whether this CResult_boolLightningErrorZ represents a success state.
4965     */
4966    bool result_ok;
4967 } LDKCResult_boolLightningErrorZ;
4968
4969 /**
4970  * A tuple of 3 elements. See the individual fields for the types contained.
4971  */
4972 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
4973    /**
4974     * The element at position 0
4975     */
4976    struct LDKChannelAnnouncement a;
4977    /**
4978     * The element at position 1
4979     */
4980    struct LDKChannelUpdate b;
4981    /**
4982     * The element at position 2
4983     */
4984    struct LDKChannelUpdate c;
4985 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
4986
4987 /**
4988  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
4989  * This corresponds to std::vector in C++
4990  */
4991 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
4992    /**
4993     * The elements in the array.
4994     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4995     */
4996    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
4997    /**
4998     * The number of elements pointed to by `data`.
4999     */
5000    uintptr_t datalen;
5001 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5002
5003 /**
5004  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5005  * This corresponds to std::vector in C++
5006  */
5007 typedef struct LDKCVec_NodeAnnouncementZ {
5008    /**
5009     * The elements in the array.
5010     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5011     */
5012    struct LDKNodeAnnouncement *data;
5013    /**
5014     * The number of elements pointed to by `data`.
5015     */
5016    uintptr_t datalen;
5017 } LDKCVec_NodeAnnouncementZ;
5018
5019 /**
5020  * The contents of CResult_NoneLightningErrorZ
5021  */
5022 typedef union LDKCResult_NoneLightningErrorZPtr {
5023    /**
5024     * Note that this value is always NULL, as there are no contents in the OK variant
5025     */
5026    void *result;
5027    /**
5028     * A pointer to the contents in the error state.
5029     * Reading from this pointer when `result_ok` is set is undefined.
5030     */
5031    struct LDKLightningError *err;
5032 } LDKCResult_NoneLightningErrorZPtr;
5033
5034 /**
5035  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5036  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5037  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5038  */
5039 typedef struct LDKCResult_NoneLightningErrorZ {
5040    /**
5041     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5042     * `err` or `result` depending on the state of `result_ok`.
5043     */
5044    union LDKCResult_NoneLightningErrorZPtr contents;
5045    /**
5046     * Whether this CResult_NoneLightningErrorZ represents a success state.
5047     */
5048    bool result_ok;
5049 } LDKCResult_NoneLightningErrorZ;
5050
5051
5052
5053 /**
5054  * Details about one direction of a channel as received within a [`ChannelUpdate`].
5055  */
5056 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
5057    /**
5058     * A pointer to the opaque Rust object.
5059     * Nearly everywhere, inner must be non-null, however in places where
5060     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5061     */
5062    LDKnativeChannelUpdateInfo *inner;
5063    /**
5064     * Indicates that this is the only struct which contains the same pointer.
5065     * Rust functions which take ownership of an object provided via an argument require
5066     * this to be true and invalidate the object pointed to by inner.
5067     */
5068    bool is_owned;
5069 } LDKChannelUpdateInfo;
5070
5071 /**
5072  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5073  */
5074 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
5075    /**
5076     * A pointer to the contents in the success state.
5077     * Reading from this pointer when `result_ok` is not set is undefined.
5078     */
5079    struct LDKChannelUpdateInfo *result;
5080    /**
5081     * A pointer to the contents in the error state.
5082     * Reading from this pointer when `result_ok` is set is undefined.
5083     */
5084    struct LDKDecodeError *err;
5085 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
5086
5087 /**
5088  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5089  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5090  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5091  */
5092 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
5093    /**
5094     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5095     * `err` or `result` depending on the state of `result_ok`.
5096     */
5097    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
5098    /**
5099     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5100     */
5101    bool result_ok;
5102 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
5103
5104
5105
5106 /**
5107  * Details about a channel (both directions).
5108  * Received within a channel announcement.
5109  */
5110 typedef struct MUST_USE_STRUCT LDKChannelInfo {
5111    /**
5112     * A pointer to the opaque Rust object.
5113     * Nearly everywhere, inner must be non-null, however in places where
5114     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5115     */
5116    LDKnativeChannelInfo *inner;
5117    /**
5118     * Indicates that this is the only struct which contains the same pointer.
5119     * Rust functions which take ownership of an object provided via an argument require
5120     * this to be true and invalidate the object pointed to by inner.
5121     */
5122    bool is_owned;
5123 } LDKChannelInfo;
5124
5125 /**
5126  * The contents of CResult_ChannelInfoDecodeErrorZ
5127  */
5128 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
5129    /**
5130     * A pointer to the contents in the success state.
5131     * Reading from this pointer when `result_ok` is not set is undefined.
5132     */
5133    struct LDKChannelInfo *result;
5134    /**
5135     * A pointer to the contents in the error state.
5136     * Reading from this pointer when `result_ok` is set is undefined.
5137     */
5138    struct LDKDecodeError *err;
5139 } LDKCResult_ChannelInfoDecodeErrorZPtr;
5140
5141 /**
5142  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5143  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5144  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5145  */
5146 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
5147    /**
5148     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5149     * `err` or `result` depending on the state of `result_ok`.
5150     */
5151    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
5152    /**
5153     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5154     */
5155    bool result_ok;
5156 } LDKCResult_ChannelInfoDecodeErrorZ;
5157
5158
5159
5160 /**
5161  * Fees for routing via a given channel or a node
5162  */
5163 typedef struct MUST_USE_STRUCT LDKRoutingFees {
5164    /**
5165     * A pointer to the opaque Rust object.
5166     * Nearly everywhere, inner must be non-null, however in places where
5167     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5168     */
5169    LDKnativeRoutingFees *inner;
5170    /**
5171     * Indicates that this is the only struct which contains the same pointer.
5172     * Rust functions which take ownership of an object provided via an argument require
5173     * this to be true and invalidate the object pointed to by inner.
5174     */
5175    bool is_owned;
5176 } LDKRoutingFees;
5177
5178 /**
5179  * The contents of CResult_RoutingFeesDecodeErrorZ
5180  */
5181 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
5182    /**
5183     * A pointer to the contents in the success state.
5184     * Reading from this pointer when `result_ok` is not set is undefined.
5185     */
5186    struct LDKRoutingFees *result;
5187    /**
5188     * A pointer to the contents in the error state.
5189     * Reading from this pointer when `result_ok` is set is undefined.
5190     */
5191    struct LDKDecodeError *err;
5192 } LDKCResult_RoutingFeesDecodeErrorZPtr;
5193
5194 /**
5195  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5196  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5197  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5198  */
5199 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
5200    /**
5201     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5202     * `err` or `result` depending on the state of `result_ok`.
5203     */
5204    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
5205    /**
5206     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5207     */
5208    bool result_ok;
5209 } LDKCResult_RoutingFeesDecodeErrorZ;
5210
5211 /**
5212  * A 4-byte byte array.
5213  */
5214 typedef struct LDKFourBytes {
5215    /**
5216     * The four bytes
5217     */
5218    uint8_t data[4];
5219 } LDKFourBytes;
5220
5221 /**
5222  * A 16-byte byte array.
5223  */
5224 typedef struct LDKSixteenBytes {
5225    /**
5226     * The sixteen bytes
5227     */
5228    uint8_t data[16];
5229 } LDKSixteenBytes;
5230
5231 /**
5232  * A 12-byte byte array.
5233  */
5234 typedef struct LDKTwelveBytes {
5235    /**
5236     * The twelve bytes
5237     */
5238    uint8_t data[12];
5239 } LDKTwelveBytes;
5240
5241 /**
5242  * An address which can be used to connect to a remote peer
5243  */
5244 typedef enum LDKNetAddress_Tag {
5245    /**
5246     * An IPv4 address/port on which the peer is listening.
5247     */
5248    LDKNetAddress_IPv4,
5249    /**
5250     * An IPv6 address/port on which the peer is listening.
5251     */
5252    LDKNetAddress_IPv6,
5253    /**
5254     * An old-style Tor onion address/port on which the peer is listening.
5255     *
5256     * This field is deprecated and the Tor network generally no longer supports V2 Onion
5257     * addresses. Thus, the details are not parsed here.
5258     */
5259    LDKNetAddress_OnionV2,
5260    /**
5261     * A new-style Tor onion address/port on which the peer is listening.
5262     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
5263     * wrap as base32 and append \".onion\".
5264     */
5265    LDKNetAddress_OnionV3,
5266    /**
5267     * Must be last for serialization purposes
5268     */
5269    LDKNetAddress_Sentinel,
5270 } LDKNetAddress_Tag;
5271
5272 typedef struct LDKNetAddress_LDKIPv4_Body {
5273    /**
5274     * The 4-byte IPv4 address
5275     */
5276    struct LDKFourBytes addr;
5277    /**
5278     * The port on which the node is listening
5279     */
5280    uint16_t port;
5281 } LDKNetAddress_LDKIPv4_Body;
5282
5283 typedef struct LDKNetAddress_LDKIPv6_Body {
5284    /**
5285     * The 16-byte IPv6 address
5286     */
5287    struct LDKSixteenBytes addr;
5288    /**
5289     * The port on which the node is listening
5290     */
5291    uint16_t port;
5292 } LDKNetAddress_LDKIPv6_Body;
5293
5294 typedef struct LDKNetAddress_LDKOnionV3_Body {
5295    /**
5296     * The ed25519 long-term public key of the peer
5297     */
5298    struct LDKThirtyTwoBytes ed25519_pubkey;
5299    /**
5300     * The checksum of the pubkey and version, as included in the onion address
5301     */
5302    uint16_t checksum;
5303    /**
5304     * The version byte, as defined by the Tor Onion v3 spec.
5305     */
5306    uint8_t version;
5307    /**
5308     * The port on which the node is listening
5309     */
5310    uint16_t port;
5311 } LDKNetAddress_LDKOnionV3_Body;
5312
5313 typedef struct MUST_USE_STRUCT LDKNetAddress {
5314    LDKNetAddress_Tag tag;
5315    union {
5316       LDKNetAddress_LDKIPv4_Body i_pv4;
5317       LDKNetAddress_LDKIPv6_Body i_pv6;
5318       struct {
5319          struct LDKTwelveBytes onion_v2;
5320       };
5321       LDKNetAddress_LDKOnionV3_Body onion_v3;
5322    };
5323 } LDKNetAddress;
5324
5325 /**
5326  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5327  * This corresponds to std::vector in C++
5328  */
5329 typedef struct LDKCVec_NetAddressZ {
5330    /**
5331     * The elements in the array.
5332     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5333     */
5334    struct LDKNetAddress *data;
5335    /**
5336     * The number of elements pointed to by `data`.
5337     */
5338    uintptr_t datalen;
5339 } LDKCVec_NetAddressZ;
5340
5341
5342
5343 /**
5344  * Information received in the latest node_announcement from this node.
5345  */
5346 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
5347    /**
5348     * A pointer to the opaque Rust object.
5349     * Nearly everywhere, inner must be non-null, however in places where
5350     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5351     */
5352    LDKnativeNodeAnnouncementInfo *inner;
5353    /**
5354     * Indicates that this is the only struct which contains the same pointer.
5355     * Rust functions which take ownership of an object provided via an argument require
5356     * this to be true and invalidate the object pointed to by inner.
5357     */
5358    bool is_owned;
5359 } LDKNodeAnnouncementInfo;
5360
5361 /**
5362  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5363  */
5364 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
5365    /**
5366     * A pointer to the contents in the success state.
5367     * Reading from this pointer when `result_ok` is not set is undefined.
5368     */
5369    struct LDKNodeAnnouncementInfo *result;
5370    /**
5371     * A pointer to the contents in the error state.
5372     * Reading from this pointer when `result_ok` is set is undefined.
5373     */
5374    struct LDKDecodeError *err;
5375 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
5376
5377 /**
5378  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5379  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5380  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5381  */
5382 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
5383    /**
5384     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5385     * `err` or `result` depending on the state of `result_ok`.
5386     */
5387    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
5388    /**
5389     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5390     */
5391    bool result_ok;
5392 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
5393
5394 /**
5395  * A dynamically-allocated array of u64s of arbitrary size.
5396  * This corresponds to std::vector in C++
5397  */
5398 typedef struct LDKCVec_u64Z {
5399    /**
5400     * The elements in the array.
5401     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5402     */
5403    uint64_t *data;
5404    /**
5405     * The number of elements pointed to by `data`.
5406     */
5407    uintptr_t datalen;
5408 } LDKCVec_u64Z;
5409
5410
5411
5412 /**
5413  * Details about a node in the network, known from the network announcement.
5414  */
5415 typedef struct MUST_USE_STRUCT LDKNodeInfo {
5416    /**
5417     * A pointer to the opaque Rust object.
5418     * Nearly everywhere, inner must be non-null, however in places where
5419     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5420     */
5421    LDKnativeNodeInfo *inner;
5422    /**
5423     * Indicates that this is the only struct which contains the same pointer.
5424     * Rust functions which take ownership of an object provided via an argument require
5425     * this to be true and invalidate the object pointed to by inner.
5426     */
5427    bool is_owned;
5428 } LDKNodeInfo;
5429
5430 /**
5431  * The contents of CResult_NodeInfoDecodeErrorZ
5432  */
5433 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
5434    /**
5435     * A pointer to the contents in the success state.
5436     * Reading from this pointer when `result_ok` is not set is undefined.
5437     */
5438    struct LDKNodeInfo *result;
5439    /**
5440     * A pointer to the contents in the error state.
5441     * Reading from this pointer when `result_ok` is set is undefined.
5442     */
5443    struct LDKDecodeError *err;
5444 } LDKCResult_NodeInfoDecodeErrorZPtr;
5445
5446 /**
5447  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5448  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5449  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5450  */
5451 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
5452    /**
5453     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5454     * `err` or `result` depending on the state of `result_ok`.
5455     */
5456    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
5457    /**
5458     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5459     */
5460    bool result_ok;
5461 } LDKCResult_NodeInfoDecodeErrorZ;
5462
5463 /**
5464  * The contents of CResult_NetworkGraphDecodeErrorZ
5465  */
5466 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
5467    /**
5468     * A pointer to the contents in the success state.
5469     * Reading from this pointer when `result_ok` is not set is undefined.
5470     */
5471    struct LDKNetworkGraph *result;
5472    /**
5473     * A pointer to the contents in the error state.
5474     * Reading from this pointer when `result_ok` is set is undefined.
5475     */
5476    struct LDKDecodeError *err;
5477 } LDKCResult_NetworkGraphDecodeErrorZPtr;
5478
5479 /**
5480  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5481  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5482  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5483  */
5484 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
5485    /**
5486     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5487     * `err` or `result` depending on the state of `result_ok`.
5488     */
5489    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
5490    /**
5491     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5492     */
5493    bool result_ok;
5494 } LDKCResult_NetworkGraphDecodeErrorZ;
5495
5496 /**
5497  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
5498  */
5499 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
5500    /**
5501     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
5502     */
5503    LDKCOption_CVec_NetAddressZZ_Some,
5504    /**
5505     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
5506     */
5507    LDKCOption_CVec_NetAddressZZ_None,
5508    /**
5509     * Must be last for serialization purposes
5510     */
5511    LDKCOption_CVec_NetAddressZZ_Sentinel,
5512 } LDKCOption_CVec_NetAddressZZ_Tag;
5513
5514 typedef struct LDKCOption_CVec_NetAddressZZ {
5515    LDKCOption_CVec_NetAddressZZ_Tag tag;
5516    union {
5517       struct {
5518          struct LDKCVec_NetAddressZ some;
5519       };
5520    };
5521 } LDKCOption_CVec_NetAddressZZ;
5522
5523 /**
5524  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
5525  */
5526 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5527    /**
5528     * A pointer to the contents in the success state.
5529     * Reading from this pointer when `result_ok` is not set is undefined.
5530     */
5531    struct LDKDelayedPaymentOutputDescriptor *result;
5532    /**
5533     * A pointer to the contents in the error state.
5534     * Reading from this pointer when `result_ok` is set is undefined.
5535     */
5536    struct LDKDecodeError *err;
5537 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
5538
5539 /**
5540  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5541  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5542  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5543  */
5544 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5545    /**
5546     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
5547     * `err` or `result` depending on the state of `result_ok`.
5548     */
5549    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
5550    /**
5551     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
5552     */
5553    bool result_ok;
5554 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
5555
5556 /**
5557  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
5558  */
5559 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5560    /**
5561     * A pointer to the contents in the success state.
5562     * Reading from this pointer when `result_ok` is not set is undefined.
5563     */
5564    struct LDKStaticPaymentOutputDescriptor *result;
5565    /**
5566     * A pointer to the contents in the error state.
5567     * Reading from this pointer when `result_ok` is set is undefined.
5568     */
5569    struct LDKDecodeError *err;
5570 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
5571
5572 /**
5573  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5574  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5575  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5576  */
5577 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5578    /**
5579     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
5580     * `err` or `result` depending on the state of `result_ok`.
5581     */
5582    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
5583    /**
5584     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
5585     */
5586    bool result_ok;
5587 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
5588
5589 /**
5590  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5591  */
5592 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
5593    /**
5594     * A pointer to the contents in the success state.
5595     * Reading from this pointer when `result_ok` is not set is undefined.
5596     */
5597    struct LDKSpendableOutputDescriptor *result;
5598    /**
5599     * A pointer to the contents in the error state.
5600     * Reading from this pointer when `result_ok` is set is undefined.
5601     */
5602    struct LDKDecodeError *err;
5603 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
5604
5605 /**
5606  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5607  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5608  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5609  */
5610 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
5611    /**
5612     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5613     * `err` or `result` depending on the state of `result_ok`.
5614     */
5615    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
5616    /**
5617     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5618     */
5619    bool result_ok;
5620 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
5621
5622 /**
5623  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
5624  * This corresponds to std::vector in C++
5625  */
5626 typedef struct LDKCVec_PaymentPreimageZ {
5627    /**
5628     * The elements in the array.
5629     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5630     */
5631    struct LDKThirtyTwoBytes *data;
5632    /**
5633     * The number of elements pointed to by `data`.
5634     */
5635    uintptr_t datalen;
5636 } LDKCVec_PaymentPreimageZ;
5637
5638 /**
5639  * A tuple of 2 elements. See the individual fields for the types contained.
5640  */
5641 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
5642    /**
5643     * The element at position 0
5644     */
5645    struct LDKSignature a;
5646    /**
5647     * The element at position 1
5648     */
5649    struct LDKCVec_SignatureZ b;
5650 } LDKC2Tuple_SignatureCVec_SignatureZZ;
5651
5652 /**
5653  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
5654  */
5655 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
5656    /**
5657     * A pointer to the contents in the success state.
5658     * Reading from this pointer when `result_ok` is not set is undefined.
5659     */
5660    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
5661    /**
5662     * Note that this value is always NULL, as there are no contents in the Err variant
5663     */
5664    void *err;
5665 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
5666
5667 /**
5668  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
5669  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
5670  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5671  */
5672 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
5673    /**
5674     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
5675     * `err` or `result` depending on the state of `result_ok`.
5676     */
5677    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
5678    /**
5679     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
5680     */
5681    bool result_ok;
5682 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
5683
5684 /**
5685  * The contents of CResult_SignatureNoneZ
5686  */
5687 typedef union LDKCResult_SignatureNoneZPtr {
5688    /**
5689     * A pointer to the contents in the success state.
5690     * Reading from this pointer when `result_ok` is not set is undefined.
5691     */
5692    struct LDKSignature *result;
5693    /**
5694     * Note that this value is always NULL, as there are no contents in the Err variant
5695     */
5696    void *err;
5697 } LDKCResult_SignatureNoneZPtr;
5698
5699 /**
5700  * A CResult_SignatureNoneZ represents the result of a fallible operation,
5701  * containing a crate::c_types::Signature on success and a () on failure.
5702  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5703  */
5704 typedef struct LDKCResult_SignatureNoneZ {
5705    /**
5706     * The contents of this CResult_SignatureNoneZ, accessible via either
5707     * `err` or `result` depending on the state of `result_ok`.
5708     */
5709    union LDKCResult_SignatureNoneZPtr contents;
5710    /**
5711     * Whether this CResult_SignatureNoneZ represents a success state.
5712     */
5713    bool result_ok;
5714 } LDKCResult_SignatureNoneZ;
5715
5716 /**
5717  * A tuple of 2 elements. See the individual fields for the types contained.
5718  */
5719 typedef struct LDKC2Tuple_SignatureSignatureZ {
5720    /**
5721     * The element at position 0
5722     */
5723    struct LDKSignature a;
5724    /**
5725     * The element at position 1
5726     */
5727    struct LDKSignature b;
5728 } LDKC2Tuple_SignatureSignatureZ;
5729
5730 /**
5731  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
5732  */
5733 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
5734    /**
5735     * A pointer to the contents in the success state.
5736     * Reading from this pointer when `result_ok` is not set is undefined.
5737     */
5738    struct LDKC2Tuple_SignatureSignatureZ *result;
5739    /**
5740     * Note that this value is always NULL, as there are no contents in the Err variant
5741     */
5742    void *err;
5743 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
5744
5745 /**
5746  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
5747  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
5748  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5749  */
5750 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
5751    /**
5752     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
5753     * `err` or `result` depending on the state of `result_ok`.
5754     */
5755    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
5756    /**
5757     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
5758     */
5759    bool result_ok;
5760 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
5761
5762 /**
5763  * The contents of CResult_SecretKeyNoneZ
5764  */
5765 typedef union LDKCResult_SecretKeyNoneZPtr {
5766    /**
5767     * A pointer to the contents in the success state.
5768     * Reading from this pointer when `result_ok` is not set is undefined.
5769     */
5770    struct LDKSecretKey *result;
5771    /**
5772     * Note that this value is always NULL, as there are no contents in the Err variant
5773     */
5774    void *err;
5775 } LDKCResult_SecretKeyNoneZPtr;
5776
5777 /**
5778  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
5779  * containing a crate::c_types::SecretKey on success and a () on failure.
5780  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5781  */
5782 typedef struct LDKCResult_SecretKeyNoneZ {
5783    /**
5784     * The contents of this CResult_SecretKeyNoneZ, accessible via either
5785     * `err` or `result` depending on the state of `result_ok`.
5786     */
5787    union LDKCResult_SecretKeyNoneZPtr contents;
5788    /**
5789     * Whether this CResult_SecretKeyNoneZ represents a success state.
5790     */
5791    bool result_ok;
5792 } LDKCResult_SecretKeyNoneZ;
5793
5794
5795
5796 /**
5797  * This class tracks the per-transaction information needed to build a closing transaction and will
5798  * actually build it and sign.
5799  *
5800  * This class can be used inside a signer implementation to generate a signature given the relevant
5801  * secret key.
5802  */
5803 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
5804    /**
5805     * A pointer to the opaque Rust object.
5806     * Nearly everywhere, inner must be non-null, however in places where
5807     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5808     */
5809    LDKnativeClosingTransaction *inner;
5810    /**
5811     * Indicates that this is the only struct which contains the same pointer.
5812     * Rust functions which take ownership of an object provided via an argument require
5813     * this to be true and invalidate the object pointed to by inner.
5814     */
5815    bool is_owned;
5816 } LDKClosingTransaction;
5817
5818
5819
5820 /**
5821  * The unsigned part of a channel_announcement
5822  */
5823 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
5824    /**
5825     * A pointer to the opaque Rust object.
5826     * Nearly everywhere, inner must be non-null, however in places where
5827     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5828     */
5829    LDKnativeUnsignedChannelAnnouncement *inner;
5830    /**
5831     * Indicates that this is the only struct which contains the same pointer.
5832     * Rust functions which take ownership of an object provided via an argument require
5833     * this to be true and invalidate the object pointed to by inner.
5834     */
5835    bool is_owned;
5836 } LDKUnsignedChannelAnnouncement;
5837
5838 /**
5839  * A trait to sign lightning channel transactions as described in BOLT 3.
5840  *
5841  * Signing services could be implemented on a hardware wallet. In this case,
5842  * the current Sign would be a front-end on top of a communication
5843  * channel connected to your secure device and lightning key material wouldn't
5844  * reside on a hot server. Nevertheless, a this deployment would still need
5845  * to trust the ChannelManager to avoid loss of funds as this latest component
5846  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
5847  *
5848  * A more secure iteration would be to use hashlock (or payment points) to pair
5849  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
5850  * at the price of more state and computation on the hardware wallet side. In the future,
5851  * we are looking forward to design such interface.
5852  *
5853  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
5854  * to act, as liveness and breach reply correctness are always going to be hard requirements
5855  * of LN security model, orthogonal of key management issues.
5856  */
5857 typedef struct LDKBaseSign {
5858    /**
5859     * An opaque pointer which is passed to your function implementations as an argument.
5860     * This has no meaning in the LDK, and can be NULL or any other value.
5861     */
5862    void *this_arg;
5863    /**
5864     * Gets the per-commitment point for a specific commitment number
5865     *
5866     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
5867     */
5868    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
5869    /**
5870     * Gets the commitment secret for a specific commitment number as part of the revocation process
5871     *
5872     * An external signer implementation should error here if the commitment was already signed
5873     * and should refuse to sign it in the future.
5874     *
5875     * May be called more than once for the same index.
5876     *
5877     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
5878     */
5879    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
5880    /**
5881     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
5882     *
5883     * This is required in order for the signer to make sure that releasing a commitment
5884     * secret won't leave us without a broadcastable holder transaction.
5885     * Policy checks should be implemented in this function, including checking the amount
5886     * sent to us and checking the HTLCs.
5887     *
5888     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
5889     * A validating signer should ensure that an HTLC output is removed only when the matching
5890     * preimage is provided, or when the value to holder is restored.
5891     *
5892     * NOTE: all the relevant preimages will be provided, but there may also be additional
5893     * irrelevant or duplicate preimages.
5894     */
5895    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
5896    /**
5897     * Gets the holder's channel public keys and basepoints
5898     */
5899    struct LDKChannelPublicKeys pubkeys;
5900    /**
5901     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
5902     * Note that this takes a pointer to this object, not the this_ptr like other methods do
5903     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
5904     */
5905    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
5906    /**
5907     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
5908     * some SpendableOutputDescriptor types. This should be sufficient to identify this
5909     * Sign object uniquely and lookup or re-derive its keys.
5910     */
5911    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
5912    /**
5913     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
5914     *
5915     * Note that if signing fails or is rejected, the channel will be force-closed.
5916     *
5917     * Policy checks should be implemented in this function, including checking the amount
5918     * sent to us and checking the HTLCs.
5919     *
5920     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
5921     * A validating signer should ensure that an HTLC output is removed only when the matching
5922     * preimage is provided, or when the value to holder is restored.
5923     *
5924     * NOTE: all the relevant preimages will be provided, but there may also be additional
5925     * irrelevant or duplicate preimages.
5926     */
5927    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
5928    /**
5929     * Validate the counterparty's revocation.
5930     *
5931     * This is required in order for the signer to make sure that the state has moved
5932     * forward and it is safe to sign the next counterparty commitment.
5933     */
5934    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
5935    /**
5936     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
5937     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
5938     * latest commitment_tx when we initiate a force-close.
5939     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
5940     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
5941     * the latest.
5942     * This may be called multiple times for the same transaction.
5943     *
5944     * An external signer implementation should check that the commitment has not been revoked.
5945     *
5946     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
5947     */
5948    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
5949    /**
5950     * Create a signature for the given input in a transaction spending an HTLC transaction output
5951     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
5952     *
5953     * A justice transaction may claim multiple outputs at the same time if timelocks are
5954     * similar, but only a signature for the input at index `input` should be signed for here.
5955     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
5956     * to an upcoming timelock expiration.
5957     *
5958     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5959     *
5960     * per_commitment_key is revocation secret which was provided by our counterparty when they
5961     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
5962     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
5963     * so).
5964     */
5965    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]);
5966    /**
5967     * Create a signature for the given input in a transaction spending a commitment transaction
5968     * HTLC output when our counterparty broadcasts an old state.
5969     *
5970     * A justice transaction may claim multiple outputs at the same time if timelocks are
5971     * similar, but only a signature for the input at index `input` should be signed for here.
5972     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
5973     * to an upcoming timelock expiration.
5974     *
5975     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5976     *
5977     * per_commitment_key is revocation secret which was provided by our counterparty when they
5978     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
5979     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
5980     * so).
5981     *
5982     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
5983     * (which is committed to in the BIP 143 signatures).
5984     */
5985    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);
5986    /**
5987     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
5988     * transaction, either offered or received.
5989     *
5990     * Such a transaction may claim multiples offered outputs at same time if we know the
5991     * preimage for each when we create it, but only the input at index `input` should be
5992     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
5993     * needed with regards to an upcoming timelock expiration.
5994     *
5995     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
5996     * outputs.
5997     *
5998     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
5999     *
6000     * Per_commitment_point is the dynamic point corresponding to the channel state
6001     * detected onchain. It has been generated by our counterparty and is used to derive
6002     * channel state keys, which are then included in the witness script and committed to in the
6003     * BIP 143 signature.
6004     */
6005    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);
6006    /**
6007     * Create a signature for a (proposed) closing transaction.
6008     *
6009     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
6010     * chosen to forgo their output as dust.
6011     */
6012    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
6013    /**
6014     * Signs a channel announcement message with our funding key and our node secret key (aka
6015     * node_id or network_key), proving it comes from one of the channel participants.
6016     *
6017     * The first returned signature should be from our node secret key, the second from our
6018     * funding key.
6019     *
6020     * Note that if this fails or is rejected, the channel will not be publicly announced and
6021     * our counterparty may (though likely will not) close the channel on us for violating the
6022     * protocol.
6023     */
6024    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
6025    /**
6026     * Set the counterparty static channel data, including basepoints,
6027     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
6028     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
6029     * they MUST NOT be allowed to change to different values once set.
6030     *
6031     * channel_parameters.is_populated() MUST be true.
6032     *
6033     * We bind holder_selected_contest_delay late here for API convenience.
6034     *
6035     * Will be called before any signatures are applied.
6036     */
6037    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
6038    /**
6039     * Frees any resources associated with this object given its this_arg pointer.
6040     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6041     */
6042    void (*free)(void *this_arg);
6043 } LDKBaseSign;
6044
6045 /**
6046  * A cloneable signer.
6047  *
6048  * Although we require signers to be cloneable, it may be useful for developers to be able to use
6049  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
6050  * which implies Sized, into this derived trait.
6051  */
6052 typedef struct LDKSign {
6053    /**
6054     * An opaque pointer which is passed to your function implementations as an argument.
6055     * This has no meaning in the LDK, and can be NULL or any other value.
6056     */
6057    void *this_arg;
6058    /**
6059     * Implementation of BaseSign for this object.
6060     */
6061    struct LDKBaseSign BaseSign;
6062    /**
6063     * Serialize the object into a byte array
6064     */
6065    struct LDKCVec_u8Z (*write)(const void *this_arg);
6066    /**
6067     * Called, if set, after this Sign has been cloned into a duplicate object.
6068     * The new Sign is provided, and should be mutated as needed to perform a
6069     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
6070     */
6071    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
6072    /**
6073     * Frees any resources associated with this object given its this_arg pointer.
6074     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6075     */
6076    void (*free)(void *this_arg);
6077 } LDKSign;
6078
6079 /**
6080  * The contents of CResult_SignDecodeErrorZ
6081  */
6082 typedef union LDKCResult_SignDecodeErrorZPtr {
6083    /**
6084     * A pointer to the contents in the success state.
6085     * Reading from this pointer when `result_ok` is not set is undefined.
6086     */
6087    struct LDKSign *result;
6088    /**
6089     * A pointer to the contents in the error state.
6090     * Reading from this pointer when `result_ok` is set is undefined.
6091     */
6092    struct LDKDecodeError *err;
6093 } LDKCResult_SignDecodeErrorZPtr;
6094
6095 /**
6096  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6097  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6098  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6099  */
6100 typedef struct LDKCResult_SignDecodeErrorZ {
6101    /**
6102     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6103     * `err` or `result` depending on the state of `result_ok`.
6104     */
6105    union LDKCResult_SignDecodeErrorZPtr contents;
6106    /**
6107     * Whether this CResult_SignDecodeErrorZ represents a success state.
6108     */
6109    bool result_ok;
6110 } LDKCResult_SignDecodeErrorZ;
6111
6112 /**
6113  * Integer in the range `0..32`
6114  */
6115 typedef struct LDKu5 {
6116    uint8_t _0;
6117 } LDKu5;
6118
6119 /**
6120  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6121  * This corresponds to std::vector in C++
6122  */
6123 typedef struct LDKCVec_u5Z {
6124    /**
6125     * The elements in the array.
6126     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6127     */
6128    struct LDKu5 *data;
6129    /**
6130     * The number of elements pointed to by `data`.
6131     */
6132    uintptr_t datalen;
6133 } LDKCVec_u5Z;
6134
6135 /**
6136  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
6137  * allows recovering the exact public key which created the signature given the message.
6138  */
6139 typedef struct LDKRecoverableSignature {
6140    /**
6141     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
6142     * recovery.
6143     */
6144    uint8_t serialized_form[68];
6145 } LDKRecoverableSignature;
6146
6147 /**
6148  * The contents of CResult_RecoverableSignatureNoneZ
6149  */
6150 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
6151    /**
6152     * A pointer to the contents in the success state.
6153     * Reading from this pointer when `result_ok` is not set is undefined.
6154     */
6155    struct LDKRecoverableSignature *result;
6156    /**
6157     * Note that this value is always NULL, as there are no contents in the Err variant
6158     */
6159    void *err;
6160 } LDKCResult_RecoverableSignatureNoneZPtr;
6161
6162 /**
6163  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6164  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
6165  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6166  */
6167 typedef struct LDKCResult_RecoverableSignatureNoneZ {
6168    /**
6169     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6170     * `err` or `result` depending on the state of `result_ok`.
6171     */
6172    union LDKCResult_RecoverableSignatureNoneZPtr contents;
6173    /**
6174     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6175     */
6176    bool result_ok;
6177 } LDKCResult_RecoverableSignatureNoneZ;
6178
6179 /**
6180  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6181  * This corresponds to std::vector in C++
6182  */
6183 typedef struct LDKCVec_CVec_u8ZZ {
6184    /**
6185     * The elements in the array.
6186     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6187     */
6188    struct LDKCVec_u8Z *data;
6189    /**
6190     * The number of elements pointed to by `data`.
6191     */
6192    uintptr_t datalen;
6193 } LDKCVec_CVec_u8ZZ;
6194
6195 /**
6196  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6197  */
6198 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6199    /**
6200     * A pointer to the contents in the success state.
6201     * Reading from this pointer when `result_ok` is not set is undefined.
6202     */
6203    struct LDKCVec_CVec_u8ZZ *result;
6204    /**
6205     * Note that this value is always NULL, as there are no contents in the Err variant
6206     */
6207    void *err;
6208 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6209
6210 /**
6211  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6212  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6213  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6214  */
6215 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6216    /**
6217     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6218     * `err` or `result` depending on the state of `result_ok`.
6219     */
6220    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6221    /**
6222     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6223     */
6224    bool result_ok;
6225 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6226
6227
6228
6229 /**
6230  * A simple implementation of Sign that just keeps the private keys in memory.
6231  *
6232  * This implementation performs no policy checks and is insufficient by itself as
6233  * a secure external signer.
6234  */
6235 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
6236    /**
6237     * A pointer to the opaque Rust object.
6238     * Nearly everywhere, inner must be non-null, however in places where
6239     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6240     */
6241    LDKnativeInMemorySigner *inner;
6242    /**
6243     * Indicates that this is the only struct which contains the same pointer.
6244     * Rust functions which take ownership of an object provided via an argument require
6245     * this to be true and invalidate the object pointed to by inner.
6246     */
6247    bool is_owned;
6248 } LDKInMemorySigner;
6249
6250 /**
6251  * The contents of CResult_InMemorySignerDecodeErrorZ
6252  */
6253 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
6254    /**
6255     * A pointer to the contents in the success state.
6256     * Reading from this pointer when `result_ok` is not set is undefined.
6257     */
6258    struct LDKInMemorySigner *result;
6259    /**
6260     * A pointer to the contents in the error state.
6261     * Reading from this pointer when `result_ok` is set is undefined.
6262     */
6263    struct LDKDecodeError *err;
6264 } LDKCResult_InMemorySignerDecodeErrorZPtr;
6265
6266 /**
6267  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6268  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6269  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6270  */
6271 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
6272    /**
6273     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6274     * `err` or `result` depending on the state of `result_ok`.
6275     */
6276    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
6277    /**
6278     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6279     */
6280    bool result_ok;
6281 } LDKCResult_InMemorySignerDecodeErrorZ;
6282
6283 /**
6284  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6285  * This corresponds to std::vector in C++
6286  */
6287 typedef struct LDKCVec_TxOutZ {
6288    /**
6289     * The elements in the array.
6290     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6291     */
6292    struct LDKTxOut *data;
6293    /**
6294     * The number of elements pointed to by `data`.
6295     */
6296    uintptr_t datalen;
6297 } LDKCVec_TxOutZ;
6298
6299 /**
6300  * The contents of CResult_TransactionNoneZ
6301  */
6302 typedef union LDKCResult_TransactionNoneZPtr {
6303    /**
6304     * A pointer to the contents in the success state.
6305     * Reading from this pointer when `result_ok` is not set is undefined.
6306     */
6307    struct LDKTransaction *result;
6308    /**
6309     * Note that this value is always NULL, as there are no contents in the Err variant
6310     */
6311    void *err;
6312 } LDKCResult_TransactionNoneZPtr;
6313
6314 /**
6315  * A CResult_TransactionNoneZ represents the result of a fallible operation,
6316  * containing a crate::c_types::Transaction on success and a () on failure.
6317  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6318  */
6319 typedef struct LDKCResult_TransactionNoneZ {
6320    /**
6321     * The contents of this CResult_TransactionNoneZ, accessible via either
6322     * `err` or `result` depending on the state of `result_ok`.
6323     */
6324    union LDKCResult_TransactionNoneZPtr contents;
6325    /**
6326     * Whether this CResult_TransactionNoneZ represents a success state.
6327     */
6328    bool result_ok;
6329 } LDKCResult_TransactionNoneZ;
6330
6331
6332
6333 /**
6334  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
6335  * on-chain transactions to ensure no loss of funds occurs.
6336  *
6337  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
6338  * information and are actively monitoring the chain.
6339  *
6340  * Pending Events or updated HTLCs which have not yet been read out by
6341  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
6342  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
6343  * gotten are fully handled before re-serializing the new state.
6344  *
6345  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
6346  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6347  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
6348  * returned block hash and the the current chain and then reconnecting blocks to get to the
6349  * best chain) upon deserializing the object!
6350  */
6351 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
6352    /**
6353     * A pointer to the opaque Rust object.
6354     * Nearly everywhere, inner must be non-null, however in places where
6355     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6356     */
6357    LDKnativeChannelMonitor *inner;
6358    /**
6359     * Indicates that this is the only struct which contains the same pointer.
6360     * Rust functions which take ownership of an object provided via an argument require
6361     * this to be true and invalidate the object pointed to by inner.
6362     */
6363    bool is_owned;
6364 } LDKChannelMonitor;
6365
6366 /**
6367  * A tuple of 2 elements. See the individual fields for the types contained.
6368  */
6369 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
6370    /**
6371     * The element at position 0
6372     */
6373    struct LDKThirtyTwoBytes a;
6374    /**
6375     * The element at position 1
6376     */
6377    struct LDKChannelMonitor b;
6378 } LDKC2Tuple_BlockHashChannelMonitorZ;
6379
6380 /**
6381  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
6382  * This corresponds to std::vector in C++
6383  */
6384 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
6385    /**
6386     * The elements in the array.
6387     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6388     */
6389    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
6390    /**
6391     * The number of elements pointed to by `data`.
6392     */
6393    uintptr_t datalen;
6394 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
6395
6396 /**
6397  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
6398  */
6399 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6400    /**
6401     * A pointer to the contents in the success state.
6402     * Reading from this pointer when `result_ok` is not set is undefined.
6403     */
6404    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
6405    /**
6406     * A pointer to the contents in the error state.
6407     * Reading from this pointer when `result_ok` is set is undefined.
6408     */
6409    enum LDKIOError *err;
6410 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
6411
6412 /**
6413  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
6414  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
6415  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6416  */
6417 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6418    /**
6419     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
6420     * `err` or `result` depending on the state of `result_ok`.
6421     */
6422    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
6423    /**
6424     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6425     */
6426    bool result_ok;
6427 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
6428
6429 /**
6430  * An enum which can either contain a u16 or not
6431  */
6432 typedef enum LDKCOption_u16Z_Tag {
6433    /**
6434     * When we're in this state, this COption_u16Z contains a u16
6435     */
6436    LDKCOption_u16Z_Some,
6437    /**
6438     * When we're in this state, this COption_u16Z contains nothing
6439     */
6440    LDKCOption_u16Z_None,
6441    /**
6442     * Must be last for serialization purposes
6443     */
6444    LDKCOption_u16Z_Sentinel,
6445 } LDKCOption_u16Z_Tag;
6446
6447 typedef struct LDKCOption_u16Z {
6448    LDKCOption_u16Z_Tag tag;
6449    union {
6450       struct {
6451          uint16_t some;
6452       };
6453    };
6454 } LDKCOption_u16Z;
6455
6456 /**
6457  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
6458  * too-high values)
6459  */
6460 typedef enum LDKAPIError_Tag {
6461    /**
6462     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
6463     * are documented, but generally indicates some precondition of a function was violated.
6464     */
6465    LDKAPIError_APIMisuseError,
6466    /**
6467     * Due to a high feerate, we were unable to complete the request.
6468     * For example, this may be returned if the feerate implies we cannot open a channel at the
6469     * requested value, but opening a larger channel would succeed.
6470     */
6471    LDKAPIError_FeeRateTooHigh,
6472    /**
6473     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
6474     * too-many-hops, etc).
6475     */
6476    LDKAPIError_RouteError,
6477    /**
6478     * We were unable to complete the request as the Channel required to do so is unable to
6479     * complete the request (or was not found). This can take many forms, including disconnected
6480     * peer, channel at capacity, channel shutting down, etc.
6481     */
6482    LDKAPIError_ChannelUnavailable,
6483    /**
6484     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
6485     * attempted action to fail.
6486     */
6487    LDKAPIError_MonitorUpdateFailed,
6488    /**
6489     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
6490     * with the channel counterparty as negotiated in [`InitFeatures`].
6491     *
6492     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
6493     * a channel or cooperatively close one with this peer (and will have to force-close instead).
6494     *
6495     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
6496     * [`InitFeatures`]: crate::ln::features::InitFeatures
6497     */
6498    LDKAPIError_IncompatibleShutdownScript,
6499    /**
6500     * Must be last for serialization purposes
6501     */
6502    LDKAPIError_Sentinel,
6503 } LDKAPIError_Tag;
6504
6505 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
6506    /**
6507     * A human-readable error message
6508     */
6509    struct LDKStr err;
6510 } LDKAPIError_LDKAPIMisuseError_Body;
6511
6512 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
6513    /**
6514     * A human-readable error message
6515     */
6516    struct LDKStr err;
6517    /**
6518     * The feerate which was too high.
6519     */
6520    uint32_t feerate;
6521 } LDKAPIError_LDKFeeRateTooHigh_Body;
6522
6523 typedef struct LDKAPIError_LDKRouteError_Body {
6524    /**
6525     * A human-readable error message
6526     */
6527    struct LDKStr err;
6528 } LDKAPIError_LDKRouteError_Body;
6529
6530 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
6531    /**
6532     * A human-readable error message
6533     */
6534    struct LDKStr err;
6535 } LDKAPIError_LDKChannelUnavailable_Body;
6536
6537 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
6538    /**
6539     * The incompatible shutdown script.
6540     */
6541    struct LDKShutdownScript script;
6542 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
6543
6544 typedef struct MUST_USE_STRUCT LDKAPIError {
6545    LDKAPIError_Tag tag;
6546    union {
6547       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
6548       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
6549       LDKAPIError_LDKRouteError_Body route_error;
6550       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
6551       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
6552    };
6553 } LDKAPIError;
6554
6555 /**
6556  * The contents of CResult_NoneAPIErrorZ
6557  */
6558 typedef union LDKCResult_NoneAPIErrorZPtr {
6559    /**
6560     * Note that this value is always NULL, as there are no contents in the OK variant
6561     */
6562    void *result;
6563    /**
6564     * A pointer to the contents in the error state.
6565     * Reading from this pointer when `result_ok` is set is undefined.
6566     */
6567    struct LDKAPIError *err;
6568 } LDKCResult_NoneAPIErrorZPtr;
6569
6570 /**
6571  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6572  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
6573  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6574  */
6575 typedef struct LDKCResult_NoneAPIErrorZ {
6576    /**
6577     * The contents of this CResult_NoneAPIErrorZ, accessible via either
6578     * `err` or `result` depending on the state of `result_ok`.
6579     */
6580    union LDKCResult_NoneAPIErrorZPtr contents;
6581    /**
6582     * Whether this CResult_NoneAPIErrorZ represents a success state.
6583     */
6584    bool result_ok;
6585 } LDKCResult_NoneAPIErrorZ;
6586
6587 /**
6588  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6589  * This corresponds to std::vector in C++
6590  */
6591 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
6592    /**
6593     * The elements in the array.
6594     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6595     */
6596    struct LDKCResult_NoneAPIErrorZ *data;
6597    /**
6598     * The number of elements pointed to by `data`.
6599     */
6600    uintptr_t datalen;
6601 } LDKCVec_CResult_NoneAPIErrorZZ;
6602
6603 /**
6604  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6605  * This corresponds to std::vector in C++
6606  */
6607 typedef struct LDKCVec_APIErrorZ {
6608    /**
6609     * The elements in the array.
6610     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6611     */
6612    struct LDKAPIError *data;
6613    /**
6614     * The number of elements pointed to by `data`.
6615     */
6616    uintptr_t datalen;
6617 } LDKCVec_APIErrorZ;
6618
6619 /**
6620  * The contents of CResult__u832APIErrorZ
6621  */
6622 typedef union LDKCResult__u832APIErrorZPtr {
6623    /**
6624     * A pointer to the contents in the success state.
6625     * Reading from this pointer when `result_ok` is not set is undefined.
6626     */
6627    struct LDKThirtyTwoBytes *result;
6628    /**
6629     * A pointer to the contents in the error state.
6630     * Reading from this pointer when `result_ok` is set is undefined.
6631     */
6632    struct LDKAPIError *err;
6633 } LDKCResult__u832APIErrorZPtr;
6634
6635 /**
6636  * A CResult__u832APIErrorZ represents the result of a fallible operation,
6637  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6638  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6639  */
6640 typedef struct LDKCResult__u832APIErrorZ {
6641    /**
6642     * The contents of this CResult__u832APIErrorZ, accessible via either
6643     * `err` or `result` depending on the state of `result_ok`.
6644     */
6645    union LDKCResult__u832APIErrorZPtr contents;
6646    /**
6647     * Whether this CResult__u832APIErrorZ represents a success state.
6648     */
6649    bool result_ok;
6650 } LDKCResult__u832APIErrorZ;
6651
6652 /**
6653  * If a payment fails to send, it can be in one of several states. This enum is returned as the
6654  * Err() type describing which state the payment is in, see the description of individual enum
6655  * states for more.
6656  */
6657 typedef enum LDKPaymentSendFailure_Tag {
6658    /**
6659     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
6660     * send the payment at all. No channel state has been changed or messages sent to peers, and
6661     * once you've changed the parameter at error, you can freely retry the payment in full.
6662     */
6663    LDKPaymentSendFailure_ParameterError,
6664    /**
6665     * A parameter in a single path which was passed to send_payment was invalid, preventing us
6666     * from attempting to send the payment at all. No channel state has been changed or messages
6667     * sent to peers, and once you've changed the parameter at error, you can freely retry the
6668     * payment in full.
6669     *
6670     * The results here are ordered the same as the paths in the route object which was passed to
6671     * send_payment.
6672     */
6673    LDKPaymentSendFailure_PathParameterError,
6674    /**
6675     * All paths which were attempted failed to send, with no channel state change taking place.
6676     * You can freely retry the payment in full (though you probably want to do so over different
6677     * paths than the ones selected).
6678     */
6679    LDKPaymentSendFailure_AllFailedRetrySafe,
6680    /**
6681     * Some paths which were attempted failed to send, though possibly not all. At least some
6682     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
6683     * in over-/re-payment.
6684     *
6685     * The results here are ordered the same as the paths in the route object which was passed to
6686     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
6687     * retried (though there is currently no API with which to do so).
6688     *
6689     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
6690     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
6691     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
6692     * with the latest update_id.
6693     */
6694    LDKPaymentSendFailure_PartialFailure,
6695    /**
6696     * Must be last for serialization purposes
6697     */
6698    LDKPaymentSendFailure_Sentinel,
6699 } LDKPaymentSendFailure_Tag;
6700
6701 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
6702    /**
6703     * The errors themselves, in the same order as the route hops.
6704     */
6705    struct LDKCVec_CResult_NoneAPIErrorZZ results;
6706    /**
6707     * If some paths failed without irrevocably committing to the new HTLC(s), this will
6708     * contain a [`RouteParameters`] object which can be used to calculate a new route that
6709     * will pay all remaining unpaid balance.
6710     *
6711     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
6712     */
6713    struct LDKRouteParameters failed_paths_retry;
6714    /**
6715     * The payment id for the payment, which is now at least partially pending.
6716     */
6717    struct LDKThirtyTwoBytes payment_id;
6718 } LDKPaymentSendFailure_LDKPartialFailure_Body;
6719
6720 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
6721    LDKPaymentSendFailure_Tag tag;
6722    union {
6723       struct {
6724          struct LDKAPIError parameter_error;
6725       };
6726       struct {
6727          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
6728       };
6729       struct {
6730          struct LDKCVec_APIErrorZ all_failed_retry_safe;
6731       };
6732       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
6733    };
6734 } LDKPaymentSendFailure;
6735
6736 /**
6737  * The contents of CResult_PaymentIdPaymentSendFailureZ
6738  */
6739 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
6740    /**
6741     * A pointer to the contents in the success state.
6742     * Reading from this pointer when `result_ok` is not set is undefined.
6743     */
6744    struct LDKThirtyTwoBytes *result;
6745    /**
6746     * A pointer to the contents in the error state.
6747     * Reading from this pointer when `result_ok` is set is undefined.
6748     */
6749    struct LDKPaymentSendFailure *err;
6750 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
6751
6752 /**
6753  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
6754  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6755  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6756  */
6757 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
6758    /**
6759     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
6760     * `err` or `result` depending on the state of `result_ok`.
6761     */
6762    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
6763    /**
6764     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
6765     */
6766    bool result_ok;
6767 } LDKCResult_PaymentIdPaymentSendFailureZ;
6768
6769 /**
6770  * The contents of CResult_NonePaymentSendFailureZ
6771  */
6772 typedef union LDKCResult_NonePaymentSendFailureZPtr {
6773    /**
6774     * Note that this value is always NULL, as there are no contents in the OK variant
6775     */
6776    void *result;
6777    /**
6778     * A pointer to the contents in the error state.
6779     * Reading from this pointer when `result_ok` is set is undefined.
6780     */
6781    struct LDKPaymentSendFailure *err;
6782 } LDKCResult_NonePaymentSendFailureZPtr;
6783
6784 /**
6785  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
6786  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6787  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6788  */
6789 typedef struct LDKCResult_NonePaymentSendFailureZ {
6790    /**
6791     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
6792     * `err` or `result` depending on the state of `result_ok`.
6793     */
6794    union LDKCResult_NonePaymentSendFailureZPtr contents;
6795    /**
6796     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
6797     */
6798    bool result_ok;
6799 } LDKCResult_NonePaymentSendFailureZ;
6800
6801 /**
6802  * A tuple of 2 elements. See the individual fields for the types contained.
6803  */
6804 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
6805    /**
6806     * The element at position 0
6807     */
6808    struct LDKThirtyTwoBytes a;
6809    /**
6810     * The element at position 1
6811     */
6812    struct LDKThirtyTwoBytes b;
6813 } LDKC2Tuple_PaymentHashPaymentIdZ;
6814
6815 /**
6816  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
6817  */
6818 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
6819    /**
6820     * A pointer to the contents in the success state.
6821     * Reading from this pointer when `result_ok` is not set is undefined.
6822     */
6823    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
6824    /**
6825     * A pointer to the contents in the error state.
6826     * Reading from this pointer when `result_ok` is set is undefined.
6827     */
6828    struct LDKPaymentSendFailure *err;
6829 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
6830
6831 /**
6832  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
6833  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
6834  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6835  */
6836 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
6837    /**
6838     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
6839     * `err` or `result` depending on the state of `result_ok`.
6840     */
6841    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
6842    /**
6843     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
6844     */
6845    bool result_ok;
6846 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
6847
6848 /**
6849  * A tuple of 2 elements. See the individual fields for the types contained.
6850  */
6851 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
6852    /**
6853     * The element at position 0
6854     */
6855    struct LDKThirtyTwoBytes a;
6856    /**
6857     * The element at position 1
6858     */
6859    struct LDKThirtyTwoBytes b;
6860 } LDKC2Tuple_PaymentHashPaymentSecretZ;
6861
6862 /**
6863  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
6864  */
6865 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
6866    /**
6867     * A pointer to the contents in the success state.
6868     * Reading from this pointer when `result_ok` is not set is undefined.
6869     */
6870    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
6871    /**
6872     * Note that this value is always NULL, as there are no contents in the Err variant
6873     */
6874    void *err;
6875 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
6876
6877 /**
6878  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
6879  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
6880  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6881  */
6882 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
6883    /**
6884     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
6885     * `err` or `result` depending on the state of `result_ok`.
6886     */
6887    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
6888    /**
6889     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
6890     */
6891    bool result_ok;
6892 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
6893
6894 /**
6895  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
6896  */
6897 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
6898    /**
6899     * A pointer to the contents in the success state.
6900     * Reading from this pointer when `result_ok` is not set is undefined.
6901     */
6902    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
6903    /**
6904     * A pointer to the contents in the error state.
6905     * Reading from this pointer when `result_ok` is set is undefined.
6906     */
6907    struct LDKAPIError *err;
6908 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
6909
6910 /**
6911  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
6912  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
6913  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6914  */
6915 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
6916    /**
6917     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
6918     * `err` or `result` depending on the state of `result_ok`.
6919     */
6920    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
6921    /**
6922     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
6923     */
6924    bool result_ok;
6925 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
6926
6927 /**
6928  * The contents of CResult_PaymentSecretNoneZ
6929  */
6930 typedef union LDKCResult_PaymentSecretNoneZPtr {
6931    /**
6932     * A pointer to the contents in the success state.
6933     * Reading from this pointer when `result_ok` is not set is undefined.
6934     */
6935    struct LDKThirtyTwoBytes *result;
6936    /**
6937     * Note that this value is always NULL, as there are no contents in the Err variant
6938     */
6939    void *err;
6940 } LDKCResult_PaymentSecretNoneZPtr;
6941
6942 /**
6943  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
6944  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
6945  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6946  */
6947 typedef struct LDKCResult_PaymentSecretNoneZ {
6948    /**
6949     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
6950     * `err` or `result` depending on the state of `result_ok`.
6951     */
6952    union LDKCResult_PaymentSecretNoneZPtr contents;
6953    /**
6954     * Whether this CResult_PaymentSecretNoneZ represents a success state.
6955     */
6956    bool result_ok;
6957 } LDKCResult_PaymentSecretNoneZ;
6958
6959 /**
6960  * The contents of CResult_PaymentSecretAPIErrorZ
6961  */
6962 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
6963    /**
6964     * A pointer to the contents in the success state.
6965     * Reading from this pointer when `result_ok` is not set is undefined.
6966     */
6967    struct LDKThirtyTwoBytes *result;
6968    /**
6969     * A pointer to the contents in the error state.
6970     * Reading from this pointer when `result_ok` is set is undefined.
6971     */
6972    struct LDKAPIError *err;
6973 } LDKCResult_PaymentSecretAPIErrorZPtr;
6974
6975 /**
6976  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
6977  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
6978  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6979  */
6980 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
6981    /**
6982     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
6983     * `err` or `result` depending on the state of `result_ok`.
6984     */
6985    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
6986    /**
6987     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
6988     */
6989    bool result_ok;
6990 } LDKCResult_PaymentSecretAPIErrorZ;
6991
6992 /**
6993  * The contents of CResult_PaymentPreimageAPIErrorZ
6994  */
6995 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
6996    /**
6997     * A pointer to the contents in the success state.
6998     * Reading from this pointer when `result_ok` is not set is undefined.
6999     */
7000    struct LDKThirtyTwoBytes *result;
7001    /**
7002     * A pointer to the contents in the error state.
7003     * Reading from this pointer when `result_ok` is set is undefined.
7004     */
7005    struct LDKAPIError *err;
7006 } LDKCResult_PaymentPreimageAPIErrorZPtr;
7007
7008 /**
7009  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7010  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7011  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7012  */
7013 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
7014    /**
7015     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7016     * `err` or `result` depending on the state of `result_ok`.
7017     */
7018    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
7019    /**
7020     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7021     */
7022    bool result_ok;
7023 } LDKCResult_PaymentPreimageAPIErrorZ;
7024
7025
7026
7027 /**
7028  * Information needed for constructing an invoice route hint for this channel.
7029  */
7030 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
7031    /**
7032     * A pointer to the opaque Rust object.
7033     * Nearly everywhere, inner must be non-null, however in places where
7034     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7035     */
7036    LDKnativeCounterpartyForwardingInfo *inner;
7037    /**
7038     * Indicates that this is the only struct which contains the same pointer.
7039     * Rust functions which take ownership of an object provided via an argument require
7040     * this to be true and invalidate the object pointed to by inner.
7041     */
7042    bool is_owned;
7043 } LDKCounterpartyForwardingInfo;
7044
7045 /**
7046  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7047  */
7048 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7049    /**
7050     * A pointer to the contents in the success state.
7051     * Reading from this pointer when `result_ok` is not set is undefined.
7052     */
7053    struct LDKCounterpartyForwardingInfo *result;
7054    /**
7055     * A pointer to the contents in the error state.
7056     * Reading from this pointer when `result_ok` is set is undefined.
7057     */
7058    struct LDKDecodeError *err;
7059 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
7060
7061 /**
7062  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7063  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7064  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7065  */
7066 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
7067    /**
7068     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7069     * `err` or `result` depending on the state of `result_ok`.
7070     */
7071    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
7072    /**
7073     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7074     */
7075    bool result_ok;
7076 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
7077
7078
7079
7080 /**
7081  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
7082  * to better separate parameters.
7083  */
7084 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
7085    /**
7086     * A pointer to the opaque Rust object.
7087     * Nearly everywhere, inner must be non-null, however in places where
7088     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7089     */
7090    LDKnativeChannelCounterparty *inner;
7091    /**
7092     * Indicates that this is the only struct which contains the same pointer.
7093     * Rust functions which take ownership of an object provided via an argument require
7094     * this to be true and invalidate the object pointed to by inner.
7095     */
7096    bool is_owned;
7097 } LDKChannelCounterparty;
7098
7099 /**
7100  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
7101  */
7102 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
7103    /**
7104     * A pointer to the contents in the success state.
7105     * Reading from this pointer when `result_ok` is not set is undefined.
7106     */
7107    struct LDKChannelCounterparty *result;
7108    /**
7109     * A pointer to the contents in the error state.
7110     * Reading from this pointer when `result_ok` is set is undefined.
7111     */
7112    struct LDKDecodeError *err;
7113 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
7114
7115 /**
7116  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7117  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7118  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7119  */
7120 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
7121    /**
7122     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7123     * `err` or `result` depending on the state of `result_ok`.
7124     */
7125    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
7126    /**
7127     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7128     */
7129    bool result_ok;
7130 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
7131
7132 /**
7133  * The contents of CResult_ChannelDetailsDecodeErrorZ
7134  */
7135 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
7136    /**
7137     * A pointer to the contents in the success state.
7138     * Reading from this pointer when `result_ok` is not set is undefined.
7139     */
7140    struct LDKChannelDetails *result;
7141    /**
7142     * A pointer to the contents in the error state.
7143     * Reading from this pointer when `result_ok` is set is undefined.
7144     */
7145    struct LDKDecodeError *err;
7146 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
7147
7148 /**
7149  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7150  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7151  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7152  */
7153 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
7154    /**
7155     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7156     * `err` or `result` depending on the state of `result_ok`.
7157     */
7158    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
7159    /**
7160     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7161     */
7162    bool result_ok;
7163 } LDKCResult_ChannelDetailsDecodeErrorZ;
7164
7165
7166
7167 /**
7168  * Route hints used in constructing invoices for [phantom node payents].
7169  *
7170  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
7171  */
7172 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
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    LDKnativePhantomRouteHints *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 } LDKPhantomRouteHints;
7186
7187 /**
7188  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
7189  */
7190 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
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 LDKPhantomRouteHints *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_PhantomRouteHintsDecodeErrorZPtr;
7202
7203 /**
7204  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7205  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints 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_PhantomRouteHintsDecodeErrorZ {
7209    /**
7210     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7211     * `err` or `result` depending on the state of `result_ok`.
7212     */
7213    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
7214    /**
7215     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7216     */
7217    bool result_ok;
7218 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
7219
7220 /**
7221  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7222  * This corresponds to std::vector in C++
7223  */
7224 typedef struct LDKCVec_ChannelMonitorZ {
7225    /**
7226     * The elements in the array.
7227     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7228     */
7229    struct LDKChannelMonitor *data;
7230    /**
7231     * The number of elements pointed to by `data`.
7232     */
7233    uintptr_t datalen;
7234 } LDKCVec_ChannelMonitorZ;
7235
7236
7237
7238 /**
7239  * An update generated by the underlying Channel itself which contains some new information the
7240  * ChannelMonitor should be made aware of.
7241  */
7242 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
7243    /**
7244     * A pointer to the opaque Rust object.
7245     * Nearly everywhere, inner must be non-null, however in places where
7246     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7247     */
7248    LDKnativeChannelMonitorUpdate *inner;
7249    /**
7250     * Indicates that this is the only struct which contains the same pointer.
7251     * Rust functions which take ownership of an object provided via an argument require
7252     * this to be true and invalidate the object pointed to by inner.
7253     */
7254    bool is_owned;
7255 } LDKChannelMonitorUpdate;
7256
7257 /**
7258  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
7259  * blocks are connected and disconnected.
7260  *
7261  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
7262  * responsible for maintaining a set of monitors such that they can be updated accordingly as
7263  * channel state changes and HTLCs are resolved. See method documentation for specific
7264  * requirements.
7265  *
7266  * Implementations **must** ensure that updates are successfully applied and persisted upon method
7267  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
7268  * without taking any further action such as persisting the current state.
7269  *
7270  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
7271  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
7272  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
7273  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
7274  * multiple instances.
7275  *
7276  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
7277  */
7278 typedef struct LDKWatch {
7279    /**
7280     * An opaque pointer which is passed to your function implementations as an argument.
7281     * This has no meaning in the LDK, and can be NULL or any other value.
7282     */
7283    void *this_arg;
7284    /**
7285     * Watches a channel identified by `funding_txo` using `monitor`.
7286     *
7287     * Implementations are responsible for watching the chain for the funding transaction along
7288     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
7289     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
7290     *
7291     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
7292     * the given `funding_txo` has previously been registered via `watch_channel`.
7293     *
7294     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
7295     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
7296     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
7297     */
7298    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
7299    /**
7300     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
7301     *
7302     * Implementations must call [`update_monitor`] with the given update. See
7303     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
7304     *
7305     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
7306     */
7307    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
7308    /**
7309     * Returns any monitor events since the last call. Subsequent calls must only return new
7310     * events.
7311     *
7312     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
7313     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
7314     * to disk.
7315     *
7316     * For details on asynchronous [`ChannelMonitor`] updating and returning
7317     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
7318     */
7319    struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ (*release_pending_monitor_events)(const void *this_arg);
7320    /**
7321     * Frees any resources associated with this object given its this_arg pointer.
7322     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7323     */
7324    void (*free)(void *this_arg);
7325 } LDKWatch;
7326
7327 /**
7328  * An interface to send a transaction to the Bitcoin network.
7329  */
7330 typedef struct LDKBroadcasterInterface {
7331    /**
7332     * An opaque pointer which is passed to your function implementations as an argument.
7333     * This has no meaning in the LDK, and can be NULL or any other value.
7334     */
7335    void *this_arg;
7336    /**
7337     * Sends a transaction out to (hopefully) be mined.
7338     */
7339    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
7340    /**
7341     * Frees any resources associated with this object given its this_arg pointer.
7342     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7343     */
7344    void (*free)(void *this_arg);
7345 } LDKBroadcasterInterface;
7346
7347 /**
7348  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
7349  * own the memory pointed to by data.
7350  */
7351 typedef struct LDKu8slice {
7352    /**
7353     * A pointer to the byte buffer
7354     */
7355    const uint8_t *data;
7356    /**
7357     * The number of bytes pointed to by `data`.
7358     */
7359    uintptr_t datalen;
7360 } LDKu8slice;
7361
7362 /**
7363  * A trait to describe an object which can get user secrets and key material.
7364  */
7365 typedef struct LDKKeysInterface {
7366    /**
7367     * An opaque pointer which is passed to your function implementations as an argument.
7368     * This has no meaning in the LDK, and can be NULL or any other value.
7369     */
7370    void *this_arg;
7371    /**
7372     * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`].
7373     *
7374     * This method must return the same value each time it is called with a given `Recipient`
7375     * parameter.
7376     */
7377    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
7378    /**
7379     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
7380     *
7381     * This method should return a different value each time it is called, to avoid linking
7382     * on-chain funds across channels as controlled to the same user.
7383     */
7384    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
7385    /**
7386     * Get a script pubkey which we will send funds to when closing a channel.
7387     *
7388     * This method should return a different value each time it is called, to avoid linking
7389     * on-chain funds across channels as controlled to the same user.
7390     */
7391    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
7392    /**
7393     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
7394     * restarted with some stale data!
7395     *
7396     * This method must return a different value each time it is called.
7397     */
7398    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
7399    /**
7400     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
7401     * onion packets and for temporary channel IDs. There is no requirement that these be
7402     * persisted anywhere, though they must be unique across restarts.
7403     *
7404     * This method must return a different value each time it is called.
7405     */
7406    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
7407    /**
7408     * Reads a `Signer` for this `KeysInterface` from the given input stream.
7409     * This is only called during deserialization of other objects which contain
7410     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
7411     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
7412     * contain no versioning scheme. You may wish to include your own version prefix and ensure
7413     * you've read all of the provided bytes to ensure no corruption occurred.
7414     */
7415    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
7416    /**
7417     * Sign an invoice.
7418     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
7419     * this trait to parse the invoice and make sure they're signing what they expect, rather than
7420     * blindly signing the hash.
7421     * The hrp is ascii bytes, while the invoice data is base32.
7422     *
7423     * The secret key used to sign the invoice is dependent on the [`Recipient`].
7424     */
7425    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
7426    /**
7427     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
7428     *
7429     * If the implementor of this trait supports [phantom node payments], then every node that is
7430     * intended to be included in the phantom invoice route hints must return the same value from
7431     * this method.
7432     *
7433     * This method must return the same value each time it is called.
7434     *
7435     * [phantom node payments]: PhantomKeysManager
7436     */
7437    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
7438    /**
7439     * Frees any resources associated with this object given its this_arg pointer.
7440     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7441     */
7442    void (*free)(void *this_arg);
7443 } LDKKeysInterface;
7444
7445 /**
7446  * A trait which should be implemented to provide feerate information on a number of time
7447  * horizons.
7448  *
7449  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
7450  * called from inside the library in response to chain events, P2P events, or timer events).
7451  */
7452 typedef struct LDKFeeEstimator {
7453    /**
7454     * An opaque pointer which is passed to your function implementations as an argument.
7455     * This has no meaning in the LDK, and can be NULL or any other value.
7456     */
7457    void *this_arg;
7458    /**
7459     * Gets estimated satoshis of fee required per 1000 Weight-Units.
7460     *
7461     * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
7462     * round-downs don't put us below 1 satoshi-per-byte).
7463     *
7464     * This method can be implemented with the following unit conversions:
7465     *  * max(satoshis-per-byte * 250, 253)
7466     *  * max(satoshis-per-kbyte / 4, 253)
7467     */
7468    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
7469    /**
7470     * Frees any resources associated with this object given its this_arg pointer.
7471     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7472     */
7473    void (*free)(void *this_arg);
7474 } LDKFeeEstimator;
7475
7476
7477
7478 /**
7479  * Manager which keeps track of a number of channels and sends messages to the appropriate
7480  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
7481  *
7482  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
7483  * to individual Channels.
7484  *
7485  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
7486  * all peers during write/read (though does not modify this instance, only the instance being
7487  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
7488  * called funding_transaction_generated for outbound channels).
7489  *
7490  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
7491  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
7492  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
7493  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
7494  * the serialization process). If the deserialized version is out-of-date compared to the
7495  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
7496  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
7497  *
7498  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
7499  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7500  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
7501  * block_connected() to step towards your best block) upon deserialization before using the
7502  * object!
7503  *
7504  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
7505  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
7506  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
7507  * offline for a full minute. In order to track this, you must call
7508  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
7509  *
7510  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
7511  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
7512  * essentially you should default to using a SimpleRefChannelManager, and use a
7513  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
7514  * you're using lightning-net-tokio.
7515  */
7516 typedef struct MUST_USE_STRUCT LDKChannelManager {
7517    /**
7518     * A pointer to the opaque Rust object.
7519     * Nearly everywhere, inner must be non-null, however in places where
7520     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7521     */
7522    LDKnativeChannelManager *inner;
7523    /**
7524     * Indicates that this is the only struct which contains the same pointer.
7525     * Rust functions which take ownership of an object provided via an argument require
7526     * this to be true and invalidate the object pointed to by inner.
7527     */
7528    bool is_owned;
7529 } LDKChannelManager;
7530
7531 /**
7532  * A tuple of 2 elements. See the individual fields for the types contained.
7533  */
7534 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
7535    /**
7536     * The element at position 0
7537     */
7538    struct LDKThirtyTwoBytes a;
7539    /**
7540     * The element at position 1
7541     */
7542    struct LDKChannelManager b;
7543 } LDKC2Tuple_BlockHashChannelManagerZ;
7544
7545 /**
7546  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7547  */
7548 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7549    /**
7550     * A pointer to the contents in the success state.
7551     * Reading from this pointer when `result_ok` is not set is undefined.
7552     */
7553    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
7554    /**
7555     * A pointer to the contents in the error state.
7556     * Reading from this pointer when `result_ok` is set is undefined.
7557     */
7558    struct LDKDecodeError *err;
7559 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
7560
7561 /**
7562  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7563  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7564  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7565  */
7566 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7567    /**
7568     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7569     * `err` or `result` depending on the state of `result_ok`.
7570     */
7571    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
7572    /**
7573     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7574     */
7575    bool result_ok;
7576 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
7577
7578
7579
7580 /**
7581  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
7582  * with our counterparty.
7583  */
7584 typedef struct MUST_USE_STRUCT LDKChannelConfig {
7585    /**
7586     * A pointer to the opaque Rust object.
7587     * Nearly everywhere, inner must be non-null, however in places where
7588     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7589     */
7590    LDKnativeChannelConfig *inner;
7591    /**
7592     * Indicates that this is the only struct which contains the same pointer.
7593     * Rust functions which take ownership of an object provided via an argument require
7594     * this to be true and invalidate the object pointed to by inner.
7595     */
7596    bool is_owned;
7597 } LDKChannelConfig;
7598
7599 /**
7600  * The contents of CResult_ChannelConfigDecodeErrorZ
7601  */
7602 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
7603    /**
7604     * A pointer to the contents in the success state.
7605     * Reading from this pointer when `result_ok` is not set is undefined.
7606     */
7607    struct LDKChannelConfig *result;
7608    /**
7609     * A pointer to the contents in the error state.
7610     * Reading from this pointer when `result_ok` is set is undefined.
7611     */
7612    struct LDKDecodeError *err;
7613 } LDKCResult_ChannelConfigDecodeErrorZPtr;
7614
7615 /**
7616  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
7617  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
7618  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7619  */
7620 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
7621    /**
7622     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
7623     * `err` or `result` depending on the state of `result_ok`.
7624     */
7625    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
7626    /**
7627     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
7628     */
7629    bool result_ok;
7630 } LDKCResult_ChannelConfigDecodeErrorZ;
7631
7632 /**
7633  * The contents of CResult_OutPointDecodeErrorZ
7634  */
7635 typedef union LDKCResult_OutPointDecodeErrorZPtr {
7636    /**
7637     * A pointer to the contents in the success state.
7638     * Reading from this pointer when `result_ok` is not set is undefined.
7639     */
7640    struct LDKOutPoint *result;
7641    /**
7642     * A pointer to the contents in the error state.
7643     * Reading from this pointer when `result_ok` is set is undefined.
7644     */
7645    struct LDKDecodeError *err;
7646 } LDKCResult_OutPointDecodeErrorZPtr;
7647
7648 /**
7649  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
7650  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
7651  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7652  */
7653 typedef struct LDKCResult_OutPointDecodeErrorZ {
7654    /**
7655     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
7656     * `err` or `result` depending on the state of `result_ok`.
7657     */
7658    union LDKCResult_OutPointDecodeErrorZPtr contents;
7659    /**
7660     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
7661     */
7662    bool result_ok;
7663 } LDKCResult_OutPointDecodeErrorZ;
7664
7665 /**
7666  * Defines a type identifier for sending messages over the wire.
7667  *
7668  * Messages implementing this trait specify a type and must be [`Writeable`].
7669  */
7670 typedef struct LDKType {
7671    /**
7672     * An opaque pointer which is passed to your function implementations as an argument.
7673     * This has no meaning in the LDK, and can be NULL or any other value.
7674     */
7675    void *this_arg;
7676    /**
7677     * Returns the type identifying the message payload.
7678     */
7679    uint16_t (*type_id)(const void *this_arg);
7680    /**
7681     * Return a human-readable "debug" string describing this object
7682     */
7683    struct LDKStr (*debug_str)(const void *this_arg);
7684    /**
7685     * Serialize the object into a byte array
7686     */
7687    struct LDKCVec_u8Z (*write)(const void *this_arg);
7688    /**
7689     * Frees any resources associated with this object given its this_arg pointer.
7690     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7691     */
7692    void (*free)(void *this_arg);
7693 } LDKType;
7694
7695 /**
7696  * An enum which can either contain a crate::lightning::ln::wire::Type or not
7697  */
7698 typedef enum LDKCOption_TypeZ_Tag {
7699    /**
7700     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
7701     */
7702    LDKCOption_TypeZ_Some,
7703    /**
7704     * When we're in this state, this COption_TypeZ contains nothing
7705     */
7706    LDKCOption_TypeZ_None,
7707    /**
7708     * Must be last for serialization purposes
7709     */
7710    LDKCOption_TypeZ_Sentinel,
7711 } LDKCOption_TypeZ_Tag;
7712
7713 typedef struct LDKCOption_TypeZ {
7714    LDKCOption_TypeZ_Tag tag;
7715    union {
7716       struct {
7717          struct LDKType some;
7718       };
7719    };
7720 } LDKCOption_TypeZ;
7721
7722 /**
7723  * The contents of CResult_COption_TypeZDecodeErrorZ
7724  */
7725 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
7726    /**
7727     * A pointer to the contents in the success state.
7728     * Reading from this pointer when `result_ok` is not set is undefined.
7729     */
7730    struct LDKCOption_TypeZ *result;
7731    /**
7732     * A pointer to the contents in the error state.
7733     * Reading from this pointer when `result_ok` is set is undefined.
7734     */
7735    struct LDKDecodeError *err;
7736 } LDKCResult_COption_TypeZDecodeErrorZPtr;
7737
7738 /**
7739  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
7740  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7741  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7742  */
7743 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
7744    /**
7745     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
7746     * `err` or `result` depending on the state of `result_ok`.
7747     */
7748    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
7749    /**
7750     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
7751     */
7752    bool result_ok;
7753 } LDKCResult_COption_TypeZDecodeErrorZ;
7754
7755 /**
7756  * An error that may occur when making a payment.
7757  */
7758 typedef enum LDKPaymentError_Tag {
7759    /**
7760     * An error resulting from the provided [`Invoice`] or payment hash.
7761     */
7762    LDKPaymentError_Invoice,
7763    /**
7764     * An error occurring when finding a route.
7765     */
7766    LDKPaymentError_Routing,
7767    /**
7768     * An error occurring when sending a payment.
7769     */
7770    LDKPaymentError_Sending,
7771    /**
7772     * Must be last for serialization purposes
7773     */
7774    LDKPaymentError_Sentinel,
7775 } LDKPaymentError_Tag;
7776
7777 typedef struct MUST_USE_STRUCT LDKPaymentError {
7778    LDKPaymentError_Tag tag;
7779    union {
7780       struct {
7781          struct LDKStr invoice;
7782       };
7783       struct {
7784          struct LDKLightningError routing;
7785       };
7786       struct {
7787          struct LDKPaymentSendFailure sending;
7788       };
7789    };
7790 } LDKPaymentError;
7791
7792 /**
7793  * The contents of CResult_PaymentIdPaymentErrorZ
7794  */
7795 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
7796    /**
7797     * A pointer to the contents in the success state.
7798     * Reading from this pointer when `result_ok` is not set is undefined.
7799     */
7800    struct LDKThirtyTwoBytes *result;
7801    /**
7802     * A pointer to the contents in the error state.
7803     * Reading from this pointer when `result_ok` is set is undefined.
7804     */
7805    struct LDKPaymentError *err;
7806 } LDKCResult_PaymentIdPaymentErrorZPtr;
7807
7808 /**
7809  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
7810  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
7811  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7812  */
7813 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
7814    /**
7815     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
7816     * `err` or `result` depending on the state of `result_ok`.
7817     */
7818    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
7819    /**
7820     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
7821     */
7822    bool result_ok;
7823 } LDKCResult_PaymentIdPaymentErrorZ;
7824
7825 /**
7826  * Sub-errors which don't have specific information in them use this type.
7827  */
7828 typedef struct LDKError {
7829    /**
7830     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
7831     */
7832    uint8_t _dummy;
7833 } LDKError;
7834
7835 /**
7836  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
7837  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
7838  */
7839 typedef enum LDKParseError_Tag {
7840    LDKParseError_Bech32Error,
7841    LDKParseError_ParseAmountError,
7842    LDKParseError_MalformedSignature,
7843    LDKParseError_BadPrefix,
7844    LDKParseError_UnknownCurrency,
7845    LDKParseError_UnknownSiPrefix,
7846    LDKParseError_MalformedHRP,
7847    LDKParseError_TooShortDataPart,
7848    LDKParseError_UnexpectedEndOfTaggedFields,
7849    LDKParseError_DescriptionDecodeError,
7850    LDKParseError_PaddingError,
7851    LDKParseError_IntegerOverflowError,
7852    LDKParseError_InvalidSegWitProgramLength,
7853    LDKParseError_InvalidPubKeyHashLength,
7854    LDKParseError_InvalidScriptHashLength,
7855    LDKParseError_InvalidRecoveryId,
7856    LDKParseError_InvalidSliceLength,
7857    /**
7858     * Not an error, but used internally to signal that a part of the invoice should be ignored
7859     * according to BOLT11
7860     */
7861    LDKParseError_Skip,
7862    /**
7863     * Must be last for serialization purposes
7864     */
7865    LDKParseError_Sentinel,
7866 } LDKParseError_Tag;
7867
7868 typedef struct MUST_USE_STRUCT LDKParseError {
7869    LDKParseError_Tag tag;
7870    union {
7871       struct {
7872          struct LDKBech32Error bech32_error;
7873       };
7874       struct {
7875          struct LDKError parse_amount_error;
7876       };
7877       struct {
7878          enum LDKSecp256k1Error malformed_signature;
7879       };
7880       struct {
7881          struct LDKError description_decode_error;
7882       };
7883       struct {
7884          struct LDKStr invalid_slice_length;
7885       };
7886    };
7887 } LDKParseError;
7888
7889 /**
7890  * The contents of CResult_SiPrefixParseErrorZ
7891  */
7892 typedef union LDKCResult_SiPrefixParseErrorZPtr {
7893    /**
7894     * A pointer to the contents in the success state.
7895     * Reading from this pointer when `result_ok` is not set is undefined.
7896     */
7897    enum LDKSiPrefix *result;
7898    /**
7899     * A pointer to the contents in the error state.
7900     * Reading from this pointer when `result_ok` is set is undefined.
7901     */
7902    struct LDKParseError *err;
7903 } LDKCResult_SiPrefixParseErrorZPtr;
7904
7905 /**
7906  * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
7907  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
7908  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7909  */
7910 typedef struct LDKCResult_SiPrefixParseErrorZ {
7911    /**
7912     * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
7913     * `err` or `result` depending on the state of `result_ok`.
7914     */
7915    union LDKCResult_SiPrefixParseErrorZPtr contents;
7916    /**
7917     * Whether this CResult_SiPrefixParseErrorZ represents a success state.
7918     */
7919    bool result_ok;
7920 } LDKCResult_SiPrefixParseErrorZ;
7921
7922
7923
7924 /**
7925  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
7926  *
7927  * There are three ways to construct an `Invoice`:
7928  *  1. using `InvoiceBuilder`
7929  *  2. using `Invoice::from_signed(SignedRawInvoice)`
7930  *  3. using `str::parse::<Invoice>(&str)`
7931  */
7932 typedef struct MUST_USE_STRUCT LDKInvoice {
7933    /**
7934     * A pointer to the opaque Rust object.
7935     * Nearly everywhere, inner must be non-null, however in places where
7936     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7937     */
7938    LDKnativeInvoice *inner;
7939    /**
7940     * Indicates that this is the only struct which contains the same pointer.
7941     * Rust functions which take ownership of an object provided via an argument require
7942     * this to be true and invalidate the object pointed to by inner.
7943     */
7944    bool is_owned;
7945 } LDKInvoice;
7946
7947 /**
7948  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
7949  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
7950  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
7951  */
7952 typedef enum LDKParseOrSemanticError_Tag {
7953    /**
7954     * The invoice couldn't be decoded
7955     */
7956    LDKParseOrSemanticError_ParseError,
7957    /**
7958     * The invoice could be decoded but violates the BOLT11 standard
7959     */
7960    LDKParseOrSemanticError_SemanticError,
7961    /**
7962     * Must be last for serialization purposes
7963     */
7964    LDKParseOrSemanticError_Sentinel,
7965 } LDKParseOrSemanticError_Tag;
7966
7967 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
7968    LDKParseOrSemanticError_Tag tag;
7969    union {
7970       struct {
7971          struct LDKParseError parse_error;
7972       };
7973       struct {
7974          enum LDKSemanticError semantic_error;
7975       };
7976    };
7977 } LDKParseOrSemanticError;
7978
7979 /**
7980  * The contents of CResult_InvoiceParseOrSemanticErrorZ
7981  */
7982 typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
7983    /**
7984     * A pointer to the contents in the success state.
7985     * Reading from this pointer when `result_ok` is not set is undefined.
7986     */
7987    struct LDKInvoice *result;
7988    /**
7989     * A pointer to the contents in the error state.
7990     * Reading from this pointer when `result_ok` is set is undefined.
7991     */
7992    struct LDKParseOrSemanticError *err;
7993 } LDKCResult_InvoiceParseOrSemanticErrorZPtr;
7994
7995 /**
7996  * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
7997  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
7998  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7999  */
8000 typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
8001    /**
8002     * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
8003     * `err` or `result` depending on the state of `result_ok`.
8004     */
8005    union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
8006    /**
8007     * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
8008     */
8009    bool result_ok;
8010 } LDKCResult_InvoiceParseOrSemanticErrorZ;
8011
8012
8013
8014 /**
8015  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
8016  * invalid.
8017  *
8018  * # Invariants
8019  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
8020  */
8021 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
8022    /**
8023     * A pointer to the opaque Rust object.
8024     * Nearly everywhere, inner must be non-null, however in places where
8025     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8026     */
8027    LDKnativeSignedRawInvoice *inner;
8028    /**
8029     * Indicates that this is the only struct which contains the same pointer.
8030     * Rust functions which take ownership of an object provided via an argument require
8031     * this to be true and invalidate the object pointed to by inner.
8032     */
8033    bool is_owned;
8034 } LDKSignedRawInvoice;
8035
8036 /**
8037  * The contents of CResult_SignedRawInvoiceParseErrorZ
8038  */
8039 typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
8040    /**
8041     * A pointer to the contents in the success state.
8042     * Reading from this pointer when `result_ok` is not set is undefined.
8043     */
8044    struct LDKSignedRawInvoice *result;
8045    /**
8046     * A pointer to the contents in the error state.
8047     * Reading from this pointer when `result_ok` is set is undefined.
8048     */
8049    struct LDKParseError *err;
8050 } LDKCResult_SignedRawInvoiceParseErrorZPtr;
8051
8052 /**
8053  * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
8054  * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
8055  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8056  */
8057 typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
8058    /**
8059     * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
8060     * `err` or `result` depending on the state of `result_ok`.
8061     */
8062    union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
8063    /**
8064     * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
8065     */
8066    bool result_ok;
8067 } LDKCResult_SignedRawInvoiceParseErrorZ;
8068
8069
8070
8071 /**
8072  * Represents an syntactically correct Invoice for a payment on the lightning network,
8073  * but without the signature information.
8074  * De- and encoding should not lead to information loss but may lead to different hashes.
8075  *
8076  * For methods without docs see the corresponding methods in `Invoice`.
8077  */
8078 typedef struct MUST_USE_STRUCT LDKRawInvoice {
8079    /**
8080     * A pointer to the opaque Rust object.
8081     * Nearly everywhere, inner must be non-null, however in places where
8082     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8083     */
8084    LDKnativeRawInvoice *inner;
8085    /**
8086     * Indicates that this is the only struct which contains the same pointer.
8087     * Rust functions which take ownership of an object provided via an argument require
8088     * this to be true and invalidate the object pointed to by inner.
8089     */
8090    bool is_owned;
8091 } LDKRawInvoice;
8092
8093
8094
8095 /**
8096  * Recoverable signature
8097  */
8098 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
8099    /**
8100     * A pointer to the opaque Rust object.
8101     * Nearly everywhere, inner must be non-null, however in places where
8102     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8103     */
8104    LDKnativeInvoiceSignature *inner;
8105    /**
8106     * Indicates that this is the only struct which contains the same pointer.
8107     * Rust functions which take ownership of an object provided via an argument require
8108     * this to be true and invalidate the object pointed to by inner.
8109     */
8110    bool is_owned;
8111 } LDKInvoiceSignature;
8112
8113 /**
8114  * A tuple of 3 elements. See the individual fields for the types contained.
8115  */
8116 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
8117    /**
8118     * The element at position 0
8119     */
8120    struct LDKRawInvoice a;
8121    /**
8122     * The element at position 1
8123     */
8124    struct LDKThirtyTwoBytes b;
8125    /**
8126     * The element at position 2
8127     */
8128    struct LDKInvoiceSignature c;
8129 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
8130
8131
8132
8133 /**
8134  * Payee public key
8135  */
8136 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
8137    /**
8138     * A pointer to the opaque Rust object.
8139     * Nearly everywhere, inner must be non-null, however in places where
8140     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8141     */
8142    LDKnativePayeePubKey *inner;
8143    /**
8144     * Indicates that this is the only struct which contains the same pointer.
8145     * Rust functions which take ownership of an object provided via an argument require
8146     * this to be true and invalidate the object pointed to by inner.
8147     */
8148    bool is_owned;
8149 } LDKPayeePubKey;
8150
8151 /**
8152  * The contents of CResult_PayeePubKeyErrorZ
8153  */
8154 typedef union LDKCResult_PayeePubKeyErrorZPtr {
8155    /**
8156     * A pointer to the contents in the success state.
8157     * Reading from this pointer when `result_ok` is not set is undefined.
8158     */
8159    struct LDKPayeePubKey *result;
8160    /**
8161     * A pointer to the contents in the error state.
8162     * Reading from this pointer when `result_ok` is set is undefined.
8163     */
8164    enum LDKSecp256k1Error *err;
8165 } LDKCResult_PayeePubKeyErrorZPtr;
8166
8167 /**
8168  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8169  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8170  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8171  */
8172 typedef struct LDKCResult_PayeePubKeyErrorZ {
8173    /**
8174     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8175     * `err` or `result` depending on the state of `result_ok`.
8176     */
8177    union LDKCResult_PayeePubKeyErrorZPtr contents;
8178    /**
8179     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
8180     */
8181    bool result_ok;
8182 } LDKCResult_PayeePubKeyErrorZ;
8183
8184
8185
8186 /**
8187  * Private routing information
8188  *
8189  * # Invariants
8190  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
8191  *
8192  */
8193 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
8194    /**
8195     * A pointer to the opaque Rust object.
8196     * Nearly everywhere, inner must be non-null, however in places where
8197     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8198     */
8199    LDKnativePrivateRoute *inner;
8200    /**
8201     * Indicates that this is the only struct which contains the same pointer.
8202     * Rust functions which take ownership of an object provided via an argument require
8203     * this to be true and invalidate the object pointed to by inner.
8204     */
8205    bool is_owned;
8206 } LDKPrivateRoute;
8207
8208 /**
8209  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8210  * This corresponds to std::vector in C++
8211  */
8212 typedef struct LDKCVec_PrivateRouteZ {
8213    /**
8214     * The elements in the array.
8215     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8216     */
8217    struct LDKPrivateRoute *data;
8218    /**
8219     * The number of elements pointed to by `data`.
8220     */
8221    uintptr_t datalen;
8222 } LDKCVec_PrivateRouteZ;
8223
8224
8225
8226 /**
8227  * A timestamp that refers to a date after 1 January 1970.
8228  *
8229  * # Invariants
8230  *
8231  * The Unix timestamp representing the stored time has to be positive and no greater than
8232  * [`MAX_TIMESTAMP`].
8233  */
8234 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
8235    /**
8236     * A pointer to the opaque Rust object.
8237     * Nearly everywhere, inner must be non-null, however in places where
8238     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8239     */
8240    LDKnativePositiveTimestamp *inner;
8241    /**
8242     * Indicates that this is the only struct which contains the same pointer.
8243     * Rust functions which take ownership of an object provided via an argument require
8244     * this to be true and invalidate the object pointed to by inner.
8245     */
8246    bool is_owned;
8247 } LDKPositiveTimestamp;
8248
8249 /**
8250  * The contents of CResult_PositiveTimestampCreationErrorZ
8251  */
8252 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
8253    /**
8254     * A pointer to the contents in the success state.
8255     * Reading from this pointer when `result_ok` is not set is undefined.
8256     */
8257    struct LDKPositiveTimestamp *result;
8258    /**
8259     * A pointer to the contents in the error state.
8260     * Reading from this pointer when `result_ok` is set is undefined.
8261     */
8262    enum LDKCreationError *err;
8263 } LDKCResult_PositiveTimestampCreationErrorZPtr;
8264
8265 /**
8266  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8267  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8268  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8269  */
8270 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
8271    /**
8272     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8273     * `err` or `result` depending on the state of `result_ok`.
8274     */
8275    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
8276    /**
8277     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8278     */
8279    bool result_ok;
8280 } LDKCResult_PositiveTimestampCreationErrorZ;
8281
8282 /**
8283  * The contents of CResult_NoneSemanticErrorZ
8284  */
8285 typedef union LDKCResult_NoneSemanticErrorZPtr {
8286    /**
8287     * Note that this value is always NULL, as there are no contents in the OK variant
8288     */
8289    void *result;
8290    /**
8291     * A pointer to the contents in the error state.
8292     * Reading from this pointer when `result_ok` is set is undefined.
8293     */
8294    enum LDKSemanticError *err;
8295 } LDKCResult_NoneSemanticErrorZPtr;
8296
8297 /**
8298  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8299  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8300  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8301  */
8302 typedef struct LDKCResult_NoneSemanticErrorZ {
8303    /**
8304     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
8305     * `err` or `result` depending on the state of `result_ok`.
8306     */
8307    union LDKCResult_NoneSemanticErrorZPtr contents;
8308    /**
8309     * Whether this CResult_NoneSemanticErrorZ represents a success state.
8310     */
8311    bool result_ok;
8312 } LDKCResult_NoneSemanticErrorZ;
8313
8314 /**
8315  * The contents of CResult_InvoiceSemanticErrorZ
8316  */
8317 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
8318    /**
8319     * A pointer to the contents in the success state.
8320     * Reading from this pointer when `result_ok` is not set is undefined.
8321     */
8322    struct LDKInvoice *result;
8323    /**
8324     * A pointer to the contents in the error state.
8325     * Reading from this pointer when `result_ok` is set is undefined.
8326     */
8327    enum LDKSemanticError *err;
8328 } LDKCResult_InvoiceSemanticErrorZPtr;
8329
8330 /**
8331  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8332  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8333  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8334  */
8335 typedef struct LDKCResult_InvoiceSemanticErrorZ {
8336    /**
8337     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8338     * `err` or `result` depending on the state of `result_ok`.
8339     */
8340    union LDKCResult_InvoiceSemanticErrorZPtr contents;
8341    /**
8342     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8343     */
8344    bool result_ok;
8345 } LDKCResult_InvoiceSemanticErrorZ;
8346
8347
8348
8349 /**
8350  * Description string
8351  *
8352  * # Invariants
8353  * The description can be at most 639 __bytes__ long
8354  */
8355 typedef struct MUST_USE_STRUCT LDKDescription {
8356    /**
8357     * A pointer to the opaque Rust object.
8358     * Nearly everywhere, inner must be non-null, however in places where
8359     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8360     */
8361    LDKnativeDescription *inner;
8362    /**
8363     * Indicates that this is the only struct which contains the same pointer.
8364     * Rust functions which take ownership of an object provided via an argument require
8365     * this to be true and invalidate the object pointed to by inner.
8366     */
8367    bool is_owned;
8368 } LDKDescription;
8369
8370 /**
8371  * The contents of CResult_DescriptionCreationErrorZ
8372  */
8373 typedef union LDKCResult_DescriptionCreationErrorZPtr {
8374    /**
8375     * A pointer to the contents in the success state.
8376     * Reading from this pointer when `result_ok` is not set is undefined.
8377     */
8378    struct LDKDescription *result;
8379    /**
8380     * A pointer to the contents in the error state.
8381     * Reading from this pointer when `result_ok` is set is undefined.
8382     */
8383    enum LDKCreationError *err;
8384 } LDKCResult_DescriptionCreationErrorZPtr;
8385
8386 /**
8387  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8388  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8389  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8390  */
8391 typedef struct LDKCResult_DescriptionCreationErrorZ {
8392    /**
8393     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8394     * `err` or `result` depending on the state of `result_ok`.
8395     */
8396    union LDKCResult_DescriptionCreationErrorZPtr contents;
8397    /**
8398     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
8399     */
8400    bool result_ok;
8401 } LDKCResult_DescriptionCreationErrorZ;
8402
8403 /**
8404  * The contents of CResult_PrivateRouteCreationErrorZ
8405  */
8406 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
8407    /**
8408     * A pointer to the contents in the success state.
8409     * Reading from this pointer when `result_ok` is not set is undefined.
8410     */
8411    struct LDKPrivateRoute *result;
8412    /**
8413     * A pointer to the contents in the error state.
8414     * Reading from this pointer when `result_ok` is set is undefined.
8415     */
8416    enum LDKCreationError *err;
8417 } LDKCResult_PrivateRouteCreationErrorZPtr;
8418
8419 /**
8420  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8421  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8422  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8423  */
8424 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
8425    /**
8426     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8427     * `err` or `result` depending on the state of `result_ok`.
8428     */
8429    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
8430    /**
8431     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8432     */
8433    bool result_ok;
8434 } LDKCResult_PrivateRouteCreationErrorZ;
8435
8436 /**
8437  * The contents of CResult_StringErrorZ
8438  */
8439 typedef union LDKCResult_StringErrorZPtr {
8440    /**
8441     * A pointer to the contents in the success state.
8442     * Reading from this pointer when `result_ok` is not set is undefined.
8443     */
8444    struct LDKStr *result;
8445    /**
8446     * A pointer to the contents in the error state.
8447     * Reading from this pointer when `result_ok` is set is undefined.
8448     */
8449    enum LDKSecp256k1Error *err;
8450 } LDKCResult_StringErrorZPtr;
8451
8452 /**
8453  * A CResult_StringErrorZ represents the result of a fallible operation,
8454  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
8455  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8456  */
8457 typedef struct LDKCResult_StringErrorZ {
8458    /**
8459     * The contents of this CResult_StringErrorZ, accessible via either
8460     * `err` or `result` depending on the state of `result_ok`.
8461     */
8462    union LDKCResult_StringErrorZPtr contents;
8463    /**
8464     * Whether this CResult_StringErrorZ represents a success state.
8465     */
8466    bool result_ok;
8467 } LDKCResult_StringErrorZ;
8468
8469 /**
8470  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
8471  */
8472 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
8473    /**
8474     * A pointer to the contents in the success state.
8475     * Reading from this pointer when `result_ok` is not set is undefined.
8476     */
8477    struct LDKChannelMonitorUpdate *result;
8478    /**
8479     * A pointer to the contents in the error state.
8480     * Reading from this pointer when `result_ok` is set is undefined.
8481     */
8482    struct LDKDecodeError *err;
8483 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
8484
8485 /**
8486  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
8487  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8488  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8489  */
8490 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
8491    /**
8492     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
8493     * `err` or `result` depending on the state of `result_ok`.
8494     */
8495    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
8496    /**
8497     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
8498     */
8499    bool result_ok;
8500 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
8501
8502 /**
8503  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
8504  */
8505 typedef enum LDKCOption_MonitorEventZ_Tag {
8506    /**
8507     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
8508     */
8509    LDKCOption_MonitorEventZ_Some,
8510    /**
8511     * When we're in this state, this COption_MonitorEventZ contains nothing
8512     */
8513    LDKCOption_MonitorEventZ_None,
8514    /**
8515     * Must be last for serialization purposes
8516     */
8517    LDKCOption_MonitorEventZ_Sentinel,
8518 } LDKCOption_MonitorEventZ_Tag;
8519
8520 typedef struct LDKCOption_MonitorEventZ {
8521    LDKCOption_MonitorEventZ_Tag tag;
8522    union {
8523       struct {
8524          struct LDKMonitorEvent some;
8525       };
8526    };
8527 } LDKCOption_MonitorEventZ;
8528
8529 /**
8530  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
8531  */
8532 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
8533    /**
8534     * A pointer to the contents in the success state.
8535     * Reading from this pointer when `result_ok` is not set is undefined.
8536     */
8537    struct LDKCOption_MonitorEventZ *result;
8538    /**
8539     * A pointer to the contents in the error state.
8540     * Reading from this pointer when `result_ok` is set is undefined.
8541     */
8542    struct LDKDecodeError *err;
8543 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
8544
8545 /**
8546  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
8547  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8548  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8549  */
8550 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
8551    /**
8552     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
8553     * `err` or `result` depending on the state of `result_ok`.
8554     */
8555    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
8556    /**
8557     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
8558     */
8559    bool result_ok;
8560 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
8561
8562 /**
8563  * The contents of CResult_HTLCUpdateDecodeErrorZ
8564  */
8565 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
8566    /**
8567     * A pointer to the contents in the success state.
8568     * Reading from this pointer when `result_ok` is not set is undefined.
8569     */
8570    struct LDKHTLCUpdate *result;
8571    /**
8572     * A pointer to the contents in the error state.
8573     * Reading from this pointer when `result_ok` is set is undefined.
8574     */
8575    struct LDKDecodeError *err;
8576 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
8577
8578 /**
8579  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
8580  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8581  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8582  */
8583 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
8584    /**
8585     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
8586     * `err` or `result` depending on the state of `result_ok`.
8587     */
8588    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
8589    /**
8590     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
8591     */
8592    bool result_ok;
8593 } LDKCResult_HTLCUpdateDecodeErrorZ;
8594
8595 /**
8596  * A tuple of 2 elements. See the individual fields for the types contained.
8597  */
8598 typedef struct LDKC2Tuple_OutPointScriptZ {
8599    /**
8600     * The element at position 0
8601     */
8602    struct LDKOutPoint a;
8603    /**
8604     * The element at position 1
8605     */
8606    struct LDKCVec_u8Z b;
8607 } LDKC2Tuple_OutPointScriptZ;
8608
8609 /**
8610  * A tuple of 2 elements. See the individual fields for the types contained.
8611  */
8612 typedef struct LDKC2Tuple_u32ScriptZ {
8613    /**
8614     * The element at position 0
8615     */
8616    uint32_t a;
8617    /**
8618     * The element at position 1
8619     */
8620    struct LDKCVec_u8Z b;
8621 } LDKC2Tuple_u32ScriptZ;
8622
8623 /**
8624  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
8625  * This corresponds to std::vector in C++
8626  */
8627 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
8628    /**
8629     * The elements in the array.
8630     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8631     */
8632    struct LDKC2Tuple_u32ScriptZ *data;
8633    /**
8634     * The number of elements pointed to by `data`.
8635     */
8636    uintptr_t datalen;
8637 } LDKCVec_C2Tuple_u32ScriptZZ;
8638
8639 /**
8640  * A tuple of 2 elements. See the individual fields for the types contained.
8641  */
8642 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
8643    /**
8644     * The element at position 0
8645     */
8646    struct LDKThirtyTwoBytes a;
8647    /**
8648     * The element at position 1
8649     */
8650    struct LDKCVec_C2Tuple_u32ScriptZZ b;
8651 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
8652
8653 /**
8654  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
8655  * This corresponds to std::vector in C++
8656  */
8657 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
8658    /**
8659     * The elements in the array.
8660     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8661     */
8662    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
8663    /**
8664     * The number of elements pointed to by `data`.
8665     */
8666    uintptr_t datalen;
8667 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
8668
8669 /**
8670  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
8671  * This corresponds to std::vector in C++
8672  */
8673 typedef struct LDKCVec_EventZ {
8674    /**
8675     * The elements in the array.
8676     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8677     */
8678    struct LDKEvent *data;
8679    /**
8680     * The number of elements pointed to by `data`.
8681     */
8682    uintptr_t datalen;
8683 } LDKCVec_EventZ;
8684
8685 /**
8686  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
8687  * This corresponds to std::vector in C++
8688  */
8689 typedef struct LDKCVec_TransactionZ {
8690    /**
8691     * The elements in the array.
8692     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8693     */
8694    struct LDKTransaction *data;
8695    /**
8696     * The number of elements pointed to by `data`.
8697     */
8698    uintptr_t datalen;
8699 } LDKCVec_TransactionZ;
8700
8701 /**
8702  * A tuple of 2 elements. See the individual fields for the types contained.
8703  */
8704 typedef struct LDKC2Tuple_u32TxOutZ {
8705    /**
8706     * The element at position 0
8707     */
8708    uint32_t a;
8709    /**
8710     * The element at position 1
8711     */
8712    struct LDKTxOut b;
8713 } LDKC2Tuple_u32TxOutZ;
8714
8715 /**
8716  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
8717  * This corresponds to std::vector in C++
8718  */
8719 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
8720    /**
8721     * The elements in the array.
8722     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8723     */
8724    struct LDKC2Tuple_u32TxOutZ *data;
8725    /**
8726     * The number of elements pointed to by `data`.
8727     */
8728    uintptr_t datalen;
8729 } LDKCVec_C2Tuple_u32TxOutZZ;
8730
8731 /**
8732  * A tuple of 2 elements. See the individual fields for the types contained.
8733  */
8734 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
8735    /**
8736     * The element at position 0
8737     */
8738    struct LDKThirtyTwoBytes a;
8739    /**
8740     * The element at position 1
8741     */
8742    struct LDKCVec_C2Tuple_u32TxOutZZ b;
8743 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
8744
8745 /**
8746  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
8747  * This corresponds to std::vector in C++
8748  */
8749 typedef struct LDKCVec_TransactionOutputsZ {
8750    /**
8751     * The elements in the array.
8752     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8753     */
8754    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
8755    /**
8756     * The number of elements pointed to by `data`.
8757     */
8758    uintptr_t datalen;
8759 } LDKCVec_TransactionOutputsZ;
8760
8761 /**
8762  * Details about the balance(s) available for spending once the channel appears on chain.
8763  *
8764  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
8765  * be provided.
8766  */
8767 typedef enum LDKBalance_Tag {
8768    /**
8769     * The channel is not yet closed (or the commitment or closing transaction has not yet
8770     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
8771     * force-closed now.
8772     */
8773    LDKBalance_ClaimableOnChannelClose,
8774    /**
8775     * The channel has been closed, and the given balance is ours but awaiting confirmations until
8776     * we consider it spendable.
8777     */
8778    LDKBalance_ClaimableAwaitingConfirmations,
8779    /**
8780     * The channel has been closed, and the given balance should be ours but awaiting spending
8781     * transaction confirmation. If the spending transaction does not confirm in time, it is
8782     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
8783     *
8784     * Once the spending transaction confirms, before it has reached enough confirmations to be
8785     * considered safe from chain reorganizations, the balance will instead be provided via
8786     * [`Balance::ClaimableAwaitingConfirmations`].
8787     */
8788    LDKBalance_ContentiousClaimable,
8789    /**
8790     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
8791     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
8792     * likely to be claimed by our counterparty before we do.
8793     */
8794    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
8795    /**
8796     * Must be last for serialization purposes
8797     */
8798    LDKBalance_Sentinel,
8799 } LDKBalance_Tag;
8800
8801 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
8802    /**
8803     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8804     * required to do so.
8805     */
8806    uint64_t claimable_amount_satoshis;
8807 } LDKBalance_LDKClaimableOnChannelClose_Body;
8808
8809 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
8810    /**
8811     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
8812     * were spent in broadcasting the transaction.
8813     */
8814    uint64_t claimable_amount_satoshis;
8815    /**
8816     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
8817     * amount.
8818     */
8819    uint32_t confirmation_height;
8820 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
8821
8822 typedef struct LDKBalance_LDKContentiousClaimable_Body {
8823    /**
8824     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8825     * required to do so.
8826     */
8827    uint64_t claimable_amount_satoshis;
8828    /**
8829     * The height at which the counterparty may be able to claim the balance if we have not
8830     * done so.
8831     */
8832    uint32_t timeout_height;
8833 } LDKBalance_LDKContentiousClaimable_Body;
8834
8835 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
8836    /**
8837     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
8838     * required to do so.
8839     */
8840    uint64_t claimable_amount_satoshis;
8841    /**
8842     * The height at which we will be able to claim the balance if our counterparty has not
8843     * done so.
8844     */
8845    uint32_t claimable_height;
8846 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
8847
8848 typedef struct MUST_USE_STRUCT LDKBalance {
8849    LDKBalance_Tag tag;
8850    union {
8851       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
8852       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
8853       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
8854       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
8855    };
8856 } LDKBalance;
8857
8858 /**
8859  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
8860  * This corresponds to std::vector in C++
8861  */
8862 typedef struct LDKCVec_BalanceZ {
8863    /**
8864     * The elements in the array.
8865     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8866     */
8867    struct LDKBalance *data;
8868    /**
8869     * The number of elements pointed to by `data`.
8870     */
8871    uintptr_t datalen;
8872 } LDKCVec_BalanceZ;
8873
8874 /**
8875  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
8876  */
8877 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
8878    /**
8879     * A pointer to the contents in the success state.
8880     * Reading from this pointer when `result_ok` is not set is undefined.
8881     */
8882    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
8883    /**
8884     * A pointer to the contents in the error state.
8885     * Reading from this pointer when `result_ok` is set is undefined.
8886     */
8887    struct LDKDecodeError *err;
8888 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
8889
8890 /**
8891  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
8892  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8893  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8894  */
8895 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
8896    /**
8897     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
8898     * `err` or `result` depending on the state of `result_ok`.
8899     */
8900    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
8901    /**
8902     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
8903     */
8904    bool result_ok;
8905 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
8906
8907 /**
8908  * A tuple of 2 elements. See the individual fields for the types contained.
8909  */
8910 typedef struct LDKC2Tuple_PublicKeyTypeZ {
8911    /**
8912     * The element at position 0
8913     */
8914    struct LDKPublicKey a;
8915    /**
8916     * The element at position 1
8917     */
8918    struct LDKType b;
8919 } LDKC2Tuple_PublicKeyTypeZ;
8920
8921 /**
8922  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
8923  * This corresponds to std::vector in C++
8924  */
8925 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
8926    /**
8927     * The elements in the array.
8928     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8929     */
8930    struct LDKC2Tuple_PublicKeyTypeZ *data;
8931    /**
8932     * The number of elements pointed to by `data`.
8933     */
8934    uintptr_t datalen;
8935 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
8936
8937 /**
8938  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
8939  */
8940 typedef enum LDKCOption_NetAddressZ_Tag {
8941    /**
8942     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
8943     */
8944    LDKCOption_NetAddressZ_Some,
8945    /**
8946     * When we're in this state, this COption_NetAddressZ contains nothing
8947     */
8948    LDKCOption_NetAddressZ_None,
8949    /**
8950     * Must be last for serialization purposes
8951     */
8952    LDKCOption_NetAddressZ_Sentinel,
8953 } LDKCOption_NetAddressZ_Tag;
8954
8955 typedef struct LDKCOption_NetAddressZ {
8956    LDKCOption_NetAddressZ_Tag tag;
8957    union {
8958       struct {
8959          struct LDKNetAddress some;
8960       };
8961    };
8962 } LDKCOption_NetAddressZ;
8963
8964
8965
8966 /**
8967  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
8968  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
8969  * descriptor.
8970  */
8971 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
8972    /**
8973     * A pointer to the opaque Rust object.
8974     * Nearly everywhere, inner must be non-null, however in places where
8975     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8976     */
8977    LDKnativePeerHandleError *inner;
8978    /**
8979     * Indicates that this is the only struct which contains the same pointer.
8980     * Rust functions which take ownership of an object provided via an argument require
8981     * this to be true and invalidate the object pointed to by inner.
8982     */
8983    bool is_owned;
8984 } LDKPeerHandleError;
8985
8986 /**
8987  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
8988  */
8989 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
8990    /**
8991     * A pointer to the contents in the success state.
8992     * Reading from this pointer when `result_ok` is not set is undefined.
8993     */
8994    struct LDKCVec_u8Z *result;
8995    /**
8996     * A pointer to the contents in the error state.
8997     * Reading from this pointer when `result_ok` is set is undefined.
8998     */
8999    struct LDKPeerHandleError *err;
9000 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
9001
9002 /**
9003  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9004  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9005  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9006  */
9007 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
9008    /**
9009     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9010     * `err` or `result` depending on the state of `result_ok`.
9011     */
9012    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
9013    /**
9014     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9015     */
9016    bool result_ok;
9017 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
9018
9019 /**
9020  * The contents of CResult_NonePeerHandleErrorZ
9021  */
9022 typedef union LDKCResult_NonePeerHandleErrorZPtr {
9023    /**
9024     * Note that this value is always NULL, as there are no contents in the OK variant
9025     */
9026    void *result;
9027    /**
9028     * A pointer to the contents in the error state.
9029     * Reading from this pointer when `result_ok` is set is undefined.
9030     */
9031    struct LDKPeerHandleError *err;
9032 } LDKCResult_NonePeerHandleErrorZPtr;
9033
9034 /**
9035  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9036  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9037  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9038  */
9039 typedef struct LDKCResult_NonePeerHandleErrorZ {
9040    /**
9041     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9042     * `err` or `result` depending on the state of `result_ok`.
9043     */
9044    union LDKCResult_NonePeerHandleErrorZPtr contents;
9045    /**
9046     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
9047     */
9048    bool result_ok;
9049 } LDKCResult_NonePeerHandleErrorZ;
9050
9051 /**
9052  * The contents of CResult_boolPeerHandleErrorZ
9053  */
9054 typedef union LDKCResult_boolPeerHandleErrorZPtr {
9055    /**
9056     * A pointer to the contents in the success state.
9057     * Reading from this pointer when `result_ok` is not set is undefined.
9058     */
9059    bool *result;
9060    /**
9061     * A pointer to the contents in the error state.
9062     * Reading from this pointer when `result_ok` is set is undefined.
9063     */
9064    struct LDKPeerHandleError *err;
9065 } LDKCResult_boolPeerHandleErrorZPtr;
9066
9067 /**
9068  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9069  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9070  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9071  */
9072 typedef struct LDKCResult_boolPeerHandleErrorZ {
9073    /**
9074     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9075     * `err` or `result` depending on the state of `result_ok`.
9076     */
9077    union LDKCResult_boolPeerHandleErrorZPtr contents;
9078    /**
9079     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
9080     */
9081    bool result_ok;
9082 } LDKCResult_boolPeerHandleErrorZ;
9083
9084 /**
9085  * All-encompassing standard error type that processing can return
9086  */
9087 typedef enum LDKGraphSyncError_Tag {
9088    /**
9089     * Error trying to read the update data, typically due to an erroneous data length indication
9090     * that is greater than the actual amount of data provided
9091     */
9092    LDKGraphSyncError_DecodeError,
9093    /**
9094     * Error applying the patch to the network graph, usually the result of updates that are too
9095     * old or missing prerequisite data to the application of updates out of order
9096     */
9097    LDKGraphSyncError_LightningError,
9098    /**
9099     * Must be last for serialization purposes
9100     */
9101    LDKGraphSyncError_Sentinel,
9102 } LDKGraphSyncError_Tag;
9103
9104 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
9105    LDKGraphSyncError_Tag tag;
9106    union {
9107       struct {
9108          struct LDKDecodeError decode_error;
9109       };
9110       struct {
9111          struct LDKLightningError lightning_error;
9112       };
9113    };
9114 } LDKGraphSyncError;
9115
9116 /**
9117  * The contents of CResult_u32GraphSyncErrorZ
9118  */
9119 typedef union LDKCResult_u32GraphSyncErrorZPtr {
9120    /**
9121     * A pointer to the contents in the success state.
9122     * Reading from this pointer when `result_ok` is not set is undefined.
9123     */
9124    uint32_t *result;
9125    /**
9126     * A pointer to the contents in the error state.
9127     * Reading from this pointer when `result_ok` is set is undefined.
9128     */
9129    struct LDKGraphSyncError *err;
9130 } LDKCResult_u32GraphSyncErrorZPtr;
9131
9132 /**
9133  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
9134  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
9135  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9136  */
9137 typedef struct LDKCResult_u32GraphSyncErrorZ {
9138    /**
9139     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
9140     * `err` or `result` depending on the state of `result_ok`.
9141     */
9142    union LDKCResult_u32GraphSyncErrorZPtr contents;
9143    /**
9144     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
9145     */
9146    bool result_ok;
9147 } LDKCResult_u32GraphSyncErrorZ;
9148
9149 /**
9150  * The contents of CResult_NetAddressDecodeErrorZ
9151  */
9152 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
9153    /**
9154     * A pointer to the contents in the success state.
9155     * Reading from this pointer when `result_ok` is not set is undefined.
9156     */
9157    struct LDKNetAddress *result;
9158    /**
9159     * A pointer to the contents in the error state.
9160     * Reading from this pointer when `result_ok` is set is undefined.
9161     */
9162    struct LDKDecodeError *err;
9163 } LDKCResult_NetAddressDecodeErrorZPtr;
9164
9165 /**
9166  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9167  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9168  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9169  */
9170 typedef struct LDKCResult_NetAddressDecodeErrorZ {
9171    /**
9172     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9173     * `err` or `result` depending on the state of `result_ok`.
9174     */
9175    union LDKCResult_NetAddressDecodeErrorZPtr contents;
9176    /**
9177     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9178     */
9179    bool result_ok;
9180 } LDKCResult_NetAddressDecodeErrorZ;
9181
9182
9183
9184 /**
9185  * An update_add_htlc message to be sent or received from a peer
9186  */
9187 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
9188    /**
9189     * A pointer to the opaque Rust object.
9190     * Nearly everywhere, inner must be non-null, however in places where
9191     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9192     */
9193    LDKnativeUpdateAddHTLC *inner;
9194    /**
9195     * Indicates that this is the only struct which contains the same pointer.
9196     * Rust functions which take ownership of an object provided via an argument require
9197     * this to be true and invalidate the object pointed to by inner.
9198     */
9199    bool is_owned;
9200 } LDKUpdateAddHTLC;
9201
9202 /**
9203  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9204  * This corresponds to std::vector in C++
9205  */
9206 typedef struct LDKCVec_UpdateAddHTLCZ {
9207    /**
9208     * The elements in the array.
9209     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9210     */
9211    struct LDKUpdateAddHTLC *data;
9212    /**
9213     * The number of elements pointed to by `data`.
9214     */
9215    uintptr_t datalen;
9216 } LDKCVec_UpdateAddHTLCZ;
9217
9218
9219
9220 /**
9221  * An update_fulfill_htlc message to be sent or received from a peer
9222  */
9223 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
9224    /**
9225     * A pointer to the opaque Rust object.
9226     * Nearly everywhere, inner must be non-null, however in places where
9227     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9228     */
9229    LDKnativeUpdateFulfillHTLC *inner;
9230    /**
9231     * Indicates that this is the only struct which contains the same pointer.
9232     * Rust functions which take ownership of an object provided via an argument require
9233     * this to be true and invalidate the object pointed to by inner.
9234     */
9235    bool is_owned;
9236 } LDKUpdateFulfillHTLC;
9237
9238 /**
9239  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9240  * This corresponds to std::vector in C++
9241  */
9242 typedef struct LDKCVec_UpdateFulfillHTLCZ {
9243    /**
9244     * The elements in the array.
9245     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9246     */
9247    struct LDKUpdateFulfillHTLC *data;
9248    /**
9249     * The number of elements pointed to by `data`.
9250     */
9251    uintptr_t datalen;
9252 } LDKCVec_UpdateFulfillHTLCZ;
9253
9254
9255
9256 /**
9257  * An update_fail_htlc message to be sent or received from a peer
9258  */
9259 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
9260    /**
9261     * A pointer to the opaque Rust object.
9262     * Nearly everywhere, inner must be non-null, however in places where
9263     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9264     */
9265    LDKnativeUpdateFailHTLC *inner;
9266    /**
9267     * Indicates that this is the only struct which contains the same pointer.
9268     * Rust functions which take ownership of an object provided via an argument require
9269     * this to be true and invalidate the object pointed to by inner.
9270     */
9271    bool is_owned;
9272 } LDKUpdateFailHTLC;
9273
9274 /**
9275  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9276  * This corresponds to std::vector in C++
9277  */
9278 typedef struct LDKCVec_UpdateFailHTLCZ {
9279    /**
9280     * The elements in the array.
9281     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9282     */
9283    struct LDKUpdateFailHTLC *data;
9284    /**
9285     * The number of elements pointed to by `data`.
9286     */
9287    uintptr_t datalen;
9288 } LDKCVec_UpdateFailHTLCZ;
9289
9290
9291
9292 /**
9293  * An update_fail_malformed_htlc message to be sent or received from a peer
9294  */
9295 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
9296    /**
9297     * A pointer to the opaque Rust object.
9298     * Nearly everywhere, inner must be non-null, however in places where
9299     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9300     */
9301    LDKnativeUpdateFailMalformedHTLC *inner;
9302    /**
9303     * Indicates that this is the only struct which contains the same pointer.
9304     * Rust functions which take ownership of an object provided via an argument require
9305     * this to be true and invalidate the object pointed to by inner.
9306     */
9307    bool is_owned;
9308 } LDKUpdateFailMalformedHTLC;
9309
9310 /**
9311  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9312  * This corresponds to std::vector in C++
9313  */
9314 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
9315    /**
9316     * The elements in the array.
9317     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9318     */
9319    struct LDKUpdateFailMalformedHTLC *data;
9320    /**
9321     * The number of elements pointed to by `data`.
9322     */
9323    uintptr_t datalen;
9324 } LDKCVec_UpdateFailMalformedHTLCZ;
9325
9326 /**
9327  * The contents of CResult_AcceptChannelDecodeErrorZ
9328  */
9329 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
9330    /**
9331     * A pointer to the contents in the success state.
9332     * Reading from this pointer when `result_ok` is not set is undefined.
9333     */
9334    struct LDKAcceptChannel *result;
9335    /**
9336     * A pointer to the contents in the error state.
9337     * Reading from this pointer when `result_ok` is set is undefined.
9338     */
9339    struct LDKDecodeError *err;
9340 } LDKCResult_AcceptChannelDecodeErrorZPtr;
9341
9342 /**
9343  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9344  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9345  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9346  */
9347 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
9348    /**
9349     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9350     * `err` or `result` depending on the state of `result_ok`.
9351     */
9352    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
9353    /**
9354     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9355     */
9356    bool result_ok;
9357 } LDKCResult_AcceptChannelDecodeErrorZ;
9358
9359 /**
9360  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9361  */
9362 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
9363    /**
9364     * A pointer to the contents in the success state.
9365     * Reading from this pointer when `result_ok` is not set is undefined.
9366     */
9367    struct LDKAnnouncementSignatures *result;
9368    /**
9369     * A pointer to the contents in the error state.
9370     * Reading from this pointer when `result_ok` is set is undefined.
9371     */
9372    struct LDKDecodeError *err;
9373 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
9374
9375 /**
9376  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9377  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9378  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9379  */
9380 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
9381    /**
9382     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9383     * `err` or `result` depending on the state of `result_ok`.
9384     */
9385    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
9386    /**
9387     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9388     */
9389    bool result_ok;
9390 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
9391
9392 /**
9393  * The contents of CResult_ChannelReestablishDecodeErrorZ
9394  */
9395 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
9396    /**
9397     * A pointer to the contents in the success state.
9398     * Reading from this pointer when `result_ok` is not set is undefined.
9399     */
9400    struct LDKChannelReestablish *result;
9401    /**
9402     * A pointer to the contents in the error state.
9403     * Reading from this pointer when `result_ok` is set is undefined.
9404     */
9405    struct LDKDecodeError *err;
9406 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
9407
9408 /**
9409  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9410  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9411  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9412  */
9413 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
9414    /**
9415     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9416     * `err` or `result` depending on the state of `result_ok`.
9417     */
9418    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
9419    /**
9420     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9421     */
9422    bool result_ok;
9423 } LDKCResult_ChannelReestablishDecodeErrorZ;
9424
9425 /**
9426  * The contents of CResult_ClosingSignedDecodeErrorZ
9427  */
9428 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
9429    /**
9430     * A pointer to the contents in the success state.
9431     * Reading from this pointer when `result_ok` is not set is undefined.
9432     */
9433    struct LDKClosingSigned *result;
9434    /**
9435     * A pointer to the contents in the error state.
9436     * Reading from this pointer when `result_ok` is set is undefined.
9437     */
9438    struct LDKDecodeError *err;
9439 } LDKCResult_ClosingSignedDecodeErrorZPtr;
9440
9441 /**
9442  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9443  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9444  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9445  */
9446 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
9447    /**
9448     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9449     * `err` or `result` depending on the state of `result_ok`.
9450     */
9451    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
9452    /**
9453     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9454     */
9455    bool result_ok;
9456 } LDKCResult_ClosingSignedDecodeErrorZ;
9457
9458
9459
9460 /**
9461  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
9462  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
9463  * to use.
9464  */
9465 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
9466    /**
9467     * A pointer to the opaque Rust object.
9468     * Nearly everywhere, inner must be non-null, however in places where
9469     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9470     */
9471    LDKnativeClosingSignedFeeRange *inner;
9472    /**
9473     * Indicates that this is the only struct which contains the same pointer.
9474     * Rust functions which take ownership of an object provided via an argument require
9475     * this to be true and invalidate the object pointed to by inner.
9476     */
9477    bool is_owned;
9478 } LDKClosingSignedFeeRange;
9479
9480 /**
9481  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9482  */
9483 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9484    /**
9485     * A pointer to the contents in the success state.
9486     * Reading from this pointer when `result_ok` is not set is undefined.
9487     */
9488    struct LDKClosingSignedFeeRange *result;
9489    /**
9490     * A pointer to the contents in the error state.
9491     * Reading from this pointer when `result_ok` is set is undefined.
9492     */
9493    struct LDKDecodeError *err;
9494 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
9495
9496 /**
9497  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9498  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9499  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9500  */
9501 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
9502    /**
9503     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9504     * `err` or `result` depending on the state of `result_ok`.
9505     */
9506    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
9507    /**
9508     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9509     */
9510    bool result_ok;
9511 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
9512
9513
9514
9515 /**
9516  * A commitment_signed message to be sent or received from a peer
9517  */
9518 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
9519    /**
9520     * A pointer to the opaque Rust object.
9521     * Nearly everywhere, inner must be non-null, however in places where
9522     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9523     */
9524    LDKnativeCommitmentSigned *inner;
9525    /**
9526     * Indicates that this is the only struct which contains the same pointer.
9527     * Rust functions which take ownership of an object provided via an argument require
9528     * this to be true and invalidate the object pointed to by inner.
9529     */
9530    bool is_owned;
9531 } LDKCommitmentSigned;
9532
9533 /**
9534  * The contents of CResult_CommitmentSignedDecodeErrorZ
9535  */
9536 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
9537    /**
9538     * A pointer to the contents in the success state.
9539     * Reading from this pointer when `result_ok` is not set is undefined.
9540     */
9541    struct LDKCommitmentSigned *result;
9542    /**
9543     * A pointer to the contents in the error state.
9544     * Reading from this pointer when `result_ok` is set is undefined.
9545     */
9546    struct LDKDecodeError *err;
9547 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
9548
9549 /**
9550  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9551  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9552  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9553  */
9554 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
9555    /**
9556     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9557     * `err` or `result` depending on the state of `result_ok`.
9558     */
9559    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
9560    /**
9561     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9562     */
9563    bool result_ok;
9564 } LDKCResult_CommitmentSignedDecodeErrorZ;
9565
9566 /**
9567  * The contents of CResult_FundingCreatedDecodeErrorZ
9568  */
9569 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
9570    /**
9571     * A pointer to the contents in the success state.
9572     * Reading from this pointer when `result_ok` is not set is undefined.
9573     */
9574    struct LDKFundingCreated *result;
9575    /**
9576     * A pointer to the contents in the error state.
9577     * Reading from this pointer when `result_ok` is set is undefined.
9578     */
9579    struct LDKDecodeError *err;
9580 } LDKCResult_FundingCreatedDecodeErrorZPtr;
9581
9582 /**
9583  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9584  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9585  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9586  */
9587 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
9588    /**
9589     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9590     * `err` or `result` depending on the state of `result_ok`.
9591     */
9592    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
9593    /**
9594     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9595     */
9596    bool result_ok;
9597 } LDKCResult_FundingCreatedDecodeErrorZ;
9598
9599 /**
9600  * The contents of CResult_FundingSignedDecodeErrorZ
9601  */
9602 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
9603    /**
9604     * A pointer to the contents in the success state.
9605     * Reading from this pointer when `result_ok` is not set is undefined.
9606     */
9607    struct LDKFundingSigned *result;
9608    /**
9609     * A pointer to the contents in the error state.
9610     * Reading from this pointer when `result_ok` is set is undefined.
9611     */
9612    struct LDKDecodeError *err;
9613 } LDKCResult_FundingSignedDecodeErrorZPtr;
9614
9615 /**
9616  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
9617  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9618  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9619  */
9620 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
9621    /**
9622     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
9623     * `err` or `result` depending on the state of `result_ok`.
9624     */
9625    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
9626    /**
9627     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
9628     */
9629    bool result_ok;
9630 } LDKCResult_FundingSignedDecodeErrorZ;
9631
9632 /**
9633  * The contents of CResult_ChannelReadyDecodeErrorZ
9634  */
9635 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
9636    /**
9637     * A pointer to the contents in the success state.
9638     * Reading from this pointer when `result_ok` is not set is undefined.
9639     */
9640    struct LDKChannelReady *result;
9641    /**
9642     * A pointer to the contents in the error state.
9643     * Reading from this pointer when `result_ok` is set is undefined.
9644     */
9645    struct LDKDecodeError *err;
9646 } LDKCResult_ChannelReadyDecodeErrorZPtr;
9647
9648 /**
9649  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
9650  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
9651  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9652  */
9653 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
9654    /**
9655     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
9656     * `err` or `result` depending on the state of `result_ok`.
9657     */
9658    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
9659    /**
9660     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
9661     */
9662    bool result_ok;
9663 } LDKCResult_ChannelReadyDecodeErrorZ;
9664
9665
9666
9667 /**
9668  * An init message to be sent or received from a peer
9669  */
9670 typedef struct MUST_USE_STRUCT LDKInit {
9671    /**
9672     * A pointer to the opaque Rust object.
9673     * Nearly everywhere, inner must be non-null, however in places where
9674     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9675     */
9676    LDKnativeInit *inner;
9677    /**
9678     * Indicates that this is the only struct which contains the same pointer.
9679     * Rust functions which take ownership of an object provided via an argument require
9680     * this to be true and invalidate the object pointed to by inner.
9681     */
9682    bool is_owned;
9683 } LDKInit;
9684
9685 /**
9686  * The contents of CResult_InitDecodeErrorZ
9687  */
9688 typedef union LDKCResult_InitDecodeErrorZPtr {
9689    /**
9690     * A pointer to the contents in the success state.
9691     * Reading from this pointer when `result_ok` is not set is undefined.
9692     */
9693    struct LDKInit *result;
9694    /**
9695     * A pointer to the contents in the error state.
9696     * Reading from this pointer when `result_ok` is set is undefined.
9697     */
9698    struct LDKDecodeError *err;
9699 } LDKCResult_InitDecodeErrorZPtr;
9700
9701 /**
9702  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
9703  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
9704  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9705  */
9706 typedef struct LDKCResult_InitDecodeErrorZ {
9707    /**
9708     * The contents of this CResult_InitDecodeErrorZ, accessible via either
9709     * `err` or `result` depending on the state of `result_ok`.
9710     */
9711    union LDKCResult_InitDecodeErrorZPtr contents;
9712    /**
9713     * Whether this CResult_InitDecodeErrorZ represents a success state.
9714     */
9715    bool result_ok;
9716 } LDKCResult_InitDecodeErrorZ;
9717
9718 /**
9719  * The contents of CResult_OpenChannelDecodeErrorZ
9720  */
9721 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
9722    /**
9723     * A pointer to the contents in the success state.
9724     * Reading from this pointer when `result_ok` is not set is undefined.
9725     */
9726    struct LDKOpenChannel *result;
9727    /**
9728     * A pointer to the contents in the error state.
9729     * Reading from this pointer when `result_ok` is set is undefined.
9730     */
9731    struct LDKDecodeError *err;
9732 } LDKCResult_OpenChannelDecodeErrorZPtr;
9733
9734 /**
9735  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
9736  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9737  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9738  */
9739 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
9740    /**
9741     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
9742     * `err` or `result` depending on the state of `result_ok`.
9743     */
9744    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
9745    /**
9746     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
9747     */
9748    bool result_ok;
9749 } LDKCResult_OpenChannelDecodeErrorZ;
9750
9751 /**
9752  * The contents of CResult_RevokeAndACKDecodeErrorZ
9753  */
9754 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
9755    /**
9756     * A pointer to the contents in the success state.
9757     * Reading from this pointer when `result_ok` is not set is undefined.
9758     */
9759    struct LDKRevokeAndACK *result;
9760    /**
9761     * A pointer to the contents in the error state.
9762     * Reading from this pointer when `result_ok` is set is undefined.
9763     */
9764    struct LDKDecodeError *err;
9765 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
9766
9767 /**
9768  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
9769  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
9770  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9771  */
9772 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
9773    /**
9774     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
9775     * `err` or `result` depending on the state of `result_ok`.
9776     */
9777    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
9778    /**
9779     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
9780     */
9781    bool result_ok;
9782 } LDKCResult_RevokeAndACKDecodeErrorZ;
9783
9784 /**
9785  * The contents of CResult_ShutdownDecodeErrorZ
9786  */
9787 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
9788    /**
9789     * A pointer to the contents in the success state.
9790     * Reading from this pointer when `result_ok` is not set is undefined.
9791     */
9792    struct LDKShutdown *result;
9793    /**
9794     * A pointer to the contents in the error state.
9795     * Reading from this pointer when `result_ok` is set is undefined.
9796     */
9797    struct LDKDecodeError *err;
9798 } LDKCResult_ShutdownDecodeErrorZPtr;
9799
9800 /**
9801  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
9802  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
9803  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9804  */
9805 typedef struct LDKCResult_ShutdownDecodeErrorZ {
9806    /**
9807     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
9808     * `err` or `result` depending on the state of `result_ok`.
9809     */
9810    union LDKCResult_ShutdownDecodeErrorZPtr contents;
9811    /**
9812     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
9813     */
9814    bool result_ok;
9815 } LDKCResult_ShutdownDecodeErrorZ;
9816
9817 /**
9818  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
9819  */
9820 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
9821    /**
9822     * A pointer to the contents in the success state.
9823     * Reading from this pointer when `result_ok` is not set is undefined.
9824     */
9825    struct LDKUpdateFailHTLC *result;
9826    /**
9827     * A pointer to the contents in the error state.
9828     * Reading from this pointer when `result_ok` is set is undefined.
9829     */
9830    struct LDKDecodeError *err;
9831 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
9832
9833 /**
9834  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
9835  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9836  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9837  */
9838 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
9839    /**
9840     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
9841     * `err` or `result` depending on the state of `result_ok`.
9842     */
9843    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
9844    /**
9845     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
9846     */
9847    bool result_ok;
9848 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
9849
9850 /**
9851  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
9852  */
9853 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
9854    /**
9855     * A pointer to the contents in the success state.
9856     * Reading from this pointer when `result_ok` is not set is undefined.
9857     */
9858    struct LDKUpdateFailMalformedHTLC *result;
9859    /**
9860     * A pointer to the contents in the error state.
9861     * Reading from this pointer when `result_ok` is set is undefined.
9862     */
9863    struct LDKDecodeError *err;
9864 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
9865
9866 /**
9867  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
9868  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9869  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9870  */
9871 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
9872    /**
9873     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
9874     * `err` or `result` depending on the state of `result_ok`.
9875     */
9876    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
9877    /**
9878     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
9879     */
9880    bool result_ok;
9881 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
9882
9883
9884
9885 /**
9886  * An update_fee message to be sent or received from a peer
9887  */
9888 typedef struct MUST_USE_STRUCT LDKUpdateFee {
9889    /**
9890     * A pointer to the opaque Rust object.
9891     * Nearly everywhere, inner must be non-null, however in places where
9892     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9893     */
9894    LDKnativeUpdateFee *inner;
9895    /**
9896     * Indicates that this is the only struct which contains the same pointer.
9897     * Rust functions which take ownership of an object provided via an argument require
9898     * this to be true and invalidate the object pointed to by inner.
9899     */
9900    bool is_owned;
9901 } LDKUpdateFee;
9902
9903 /**
9904  * The contents of CResult_UpdateFeeDecodeErrorZ
9905  */
9906 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
9907    /**
9908     * A pointer to the contents in the success state.
9909     * Reading from this pointer when `result_ok` is not set is undefined.
9910     */
9911    struct LDKUpdateFee *result;
9912    /**
9913     * A pointer to the contents in the error state.
9914     * Reading from this pointer when `result_ok` is set is undefined.
9915     */
9916    struct LDKDecodeError *err;
9917 } LDKCResult_UpdateFeeDecodeErrorZPtr;
9918
9919 /**
9920  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
9921  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
9922  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9923  */
9924 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
9925    /**
9926     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
9927     * `err` or `result` depending on the state of `result_ok`.
9928     */
9929    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
9930    /**
9931     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
9932     */
9933    bool result_ok;
9934 } LDKCResult_UpdateFeeDecodeErrorZ;
9935
9936 /**
9937  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
9938  */
9939 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
9940    /**
9941     * A pointer to the contents in the success state.
9942     * Reading from this pointer when `result_ok` is not set is undefined.
9943     */
9944    struct LDKUpdateFulfillHTLC *result;
9945    /**
9946     * A pointer to the contents in the error state.
9947     * Reading from this pointer when `result_ok` is set is undefined.
9948     */
9949    struct LDKDecodeError *err;
9950 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
9951
9952 /**
9953  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
9954  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9955  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9956  */
9957 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
9958    /**
9959     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
9960     * `err` or `result` depending on the state of `result_ok`.
9961     */
9962    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
9963    /**
9964     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
9965     */
9966    bool result_ok;
9967 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
9968
9969 /**
9970  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
9971  */
9972 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
9973    /**
9974     * A pointer to the contents in the success state.
9975     * Reading from this pointer when `result_ok` is not set is undefined.
9976     */
9977    struct LDKUpdateAddHTLC *result;
9978    /**
9979     * A pointer to the contents in the error state.
9980     * Reading from this pointer when `result_ok` is set is undefined.
9981     */
9982    struct LDKDecodeError *err;
9983 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
9984
9985 /**
9986  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
9987  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
9988  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9989  */
9990 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
9991    /**
9992     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
9993     * `err` or `result` depending on the state of `result_ok`.
9994     */
9995    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
9996    /**
9997     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
9998     */
9999    bool result_ok;
10000 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
10001
10002
10003
10004 /**
10005  * A ping message to be sent or received from a peer
10006  */
10007 typedef struct MUST_USE_STRUCT LDKPing {
10008    /**
10009     * A pointer to the opaque Rust object.
10010     * Nearly everywhere, inner must be non-null, however in places where
10011     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10012     */
10013    LDKnativePing *inner;
10014    /**
10015     * Indicates that this is the only struct which contains the same pointer.
10016     * Rust functions which take ownership of an object provided via an argument require
10017     * this to be true and invalidate the object pointed to by inner.
10018     */
10019    bool is_owned;
10020 } LDKPing;
10021
10022 /**
10023  * The contents of CResult_PingDecodeErrorZ
10024  */
10025 typedef union LDKCResult_PingDecodeErrorZPtr {
10026    /**
10027     * A pointer to the contents in the success state.
10028     * Reading from this pointer when `result_ok` is not set is undefined.
10029     */
10030    struct LDKPing *result;
10031    /**
10032     * A pointer to the contents in the error state.
10033     * Reading from this pointer when `result_ok` is set is undefined.
10034     */
10035    struct LDKDecodeError *err;
10036 } LDKCResult_PingDecodeErrorZPtr;
10037
10038 /**
10039  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10040  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10041  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10042  */
10043 typedef struct LDKCResult_PingDecodeErrorZ {
10044    /**
10045     * The contents of this CResult_PingDecodeErrorZ, accessible via either
10046     * `err` or `result` depending on the state of `result_ok`.
10047     */
10048    union LDKCResult_PingDecodeErrorZPtr contents;
10049    /**
10050     * Whether this CResult_PingDecodeErrorZ represents a success state.
10051     */
10052    bool result_ok;
10053 } LDKCResult_PingDecodeErrorZ;
10054
10055
10056
10057 /**
10058  * A pong message to be sent or received from a peer
10059  */
10060 typedef struct MUST_USE_STRUCT LDKPong {
10061    /**
10062     * A pointer to the opaque Rust object.
10063     * Nearly everywhere, inner must be non-null, however in places where
10064     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10065     */
10066    LDKnativePong *inner;
10067    /**
10068     * Indicates that this is the only struct which contains the same pointer.
10069     * Rust functions which take ownership of an object provided via an argument require
10070     * this to be true and invalidate the object pointed to by inner.
10071     */
10072    bool is_owned;
10073 } LDKPong;
10074
10075 /**
10076  * The contents of CResult_PongDecodeErrorZ
10077  */
10078 typedef union LDKCResult_PongDecodeErrorZPtr {
10079    /**
10080     * A pointer to the contents in the success state.
10081     * Reading from this pointer when `result_ok` is not set is undefined.
10082     */
10083    struct LDKPong *result;
10084    /**
10085     * A pointer to the contents in the error state.
10086     * Reading from this pointer when `result_ok` is set is undefined.
10087     */
10088    struct LDKDecodeError *err;
10089 } LDKCResult_PongDecodeErrorZPtr;
10090
10091 /**
10092  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
10093  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
10094  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10095  */
10096 typedef struct LDKCResult_PongDecodeErrorZ {
10097    /**
10098     * The contents of this CResult_PongDecodeErrorZ, accessible via either
10099     * `err` or `result` depending on the state of `result_ok`.
10100     */
10101    union LDKCResult_PongDecodeErrorZPtr contents;
10102    /**
10103     * Whether this CResult_PongDecodeErrorZ represents a success state.
10104     */
10105    bool result_ok;
10106 } LDKCResult_PongDecodeErrorZ;
10107
10108 /**
10109  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
10110  */
10111 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10112    /**
10113     * A pointer to the contents in the success state.
10114     * Reading from this pointer when `result_ok` is not set is undefined.
10115     */
10116    struct LDKUnsignedChannelAnnouncement *result;
10117    /**
10118     * A pointer to the contents in the error state.
10119     * Reading from this pointer when `result_ok` is set is undefined.
10120     */
10121    struct LDKDecodeError *err;
10122 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
10123
10124 /**
10125  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10126  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10127  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10128  */
10129 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
10130    /**
10131     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10132     * `err` or `result` depending on the state of `result_ok`.
10133     */
10134    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
10135    /**
10136     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10137     */
10138    bool result_ok;
10139 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
10140
10141 /**
10142  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
10143  */
10144 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
10145    /**
10146     * A pointer to the contents in the success state.
10147     * Reading from this pointer when `result_ok` is not set is undefined.
10148     */
10149    struct LDKChannelAnnouncement *result;
10150    /**
10151     * A pointer to the contents in the error state.
10152     * Reading from this pointer when `result_ok` is set is undefined.
10153     */
10154    struct LDKDecodeError *err;
10155 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
10156
10157 /**
10158  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10159  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10160  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10161  */
10162 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
10163    /**
10164     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10165     * `err` or `result` depending on the state of `result_ok`.
10166     */
10167    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
10168    /**
10169     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10170     */
10171    bool result_ok;
10172 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
10173
10174
10175
10176 /**
10177  * The unsigned part of a channel_update
10178  */
10179 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
10180    /**
10181     * A pointer to the opaque Rust object.
10182     * Nearly everywhere, inner must be non-null, however in places where
10183     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10184     */
10185    LDKnativeUnsignedChannelUpdate *inner;
10186    /**
10187     * Indicates that this is the only struct which contains the same pointer.
10188     * Rust functions which take ownership of an object provided via an argument require
10189     * this to be true and invalidate the object pointed to by inner.
10190     */
10191    bool is_owned;
10192 } LDKUnsignedChannelUpdate;
10193
10194 /**
10195  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10196  */
10197 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
10198    /**
10199     * A pointer to the contents in the success state.
10200     * Reading from this pointer when `result_ok` is not set is undefined.
10201     */
10202    struct LDKUnsignedChannelUpdate *result;
10203    /**
10204     * A pointer to the contents in the error state.
10205     * Reading from this pointer when `result_ok` is set is undefined.
10206     */
10207    struct LDKDecodeError *err;
10208 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
10209
10210 /**
10211  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10212  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10213  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10214  */
10215 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
10216    /**
10217     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10218     * `err` or `result` depending on the state of `result_ok`.
10219     */
10220    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
10221    /**
10222     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10223     */
10224    bool result_ok;
10225 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
10226
10227 /**
10228  * The contents of CResult_ChannelUpdateDecodeErrorZ
10229  */
10230 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
10231    /**
10232     * A pointer to the contents in the success state.
10233     * Reading from this pointer when `result_ok` is not set is undefined.
10234     */
10235    struct LDKChannelUpdate *result;
10236    /**
10237     * A pointer to the contents in the error state.
10238     * Reading from this pointer when `result_ok` is set is undefined.
10239     */
10240    struct LDKDecodeError *err;
10241 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
10242
10243 /**
10244  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10245  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10246  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10247  */
10248 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
10249    /**
10250     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10251     * `err` or `result` depending on the state of `result_ok`.
10252     */
10253    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
10254    /**
10255     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10256     */
10257    bool result_ok;
10258 } LDKCResult_ChannelUpdateDecodeErrorZ;
10259
10260 /**
10261  * The contents of CResult_ErrorMessageDecodeErrorZ
10262  */
10263 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
10264    /**
10265     * A pointer to the contents in the success state.
10266     * Reading from this pointer when `result_ok` is not set is undefined.
10267     */
10268    struct LDKErrorMessage *result;
10269    /**
10270     * A pointer to the contents in the error state.
10271     * Reading from this pointer when `result_ok` is set is undefined.
10272     */
10273    struct LDKDecodeError *err;
10274 } LDKCResult_ErrorMessageDecodeErrorZPtr;
10275
10276 /**
10277  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10278  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10279  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10280  */
10281 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
10282    /**
10283     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10284     * `err` or `result` depending on the state of `result_ok`.
10285     */
10286    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
10287    /**
10288     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10289     */
10290    bool result_ok;
10291 } LDKCResult_ErrorMessageDecodeErrorZ;
10292
10293 /**
10294  * The contents of CResult_WarningMessageDecodeErrorZ
10295  */
10296 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
10297    /**
10298     * A pointer to the contents in the success state.
10299     * Reading from this pointer when `result_ok` is not set is undefined.
10300     */
10301    struct LDKWarningMessage *result;
10302    /**
10303     * A pointer to the contents in the error state.
10304     * Reading from this pointer when `result_ok` is set is undefined.
10305     */
10306    struct LDKDecodeError *err;
10307 } LDKCResult_WarningMessageDecodeErrorZPtr;
10308
10309 /**
10310  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
10311  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10312  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10313  */
10314 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
10315    /**
10316     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
10317     * `err` or `result` depending on the state of `result_ok`.
10318     */
10319    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
10320    /**
10321     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
10322     */
10323    bool result_ok;
10324 } LDKCResult_WarningMessageDecodeErrorZ;
10325
10326
10327
10328 /**
10329  * The unsigned part of a node_announcement
10330  */
10331 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
10332    /**
10333     * A pointer to the opaque Rust object.
10334     * Nearly everywhere, inner must be non-null, however in places where
10335     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10336     */
10337    LDKnativeUnsignedNodeAnnouncement *inner;
10338    /**
10339     * Indicates that this is the only struct which contains the same pointer.
10340     * Rust functions which take ownership of an object provided via an argument require
10341     * this to be true and invalidate the object pointed to by inner.
10342     */
10343    bool is_owned;
10344 } LDKUnsignedNodeAnnouncement;
10345
10346 /**
10347  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10348  */
10349 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10350    /**
10351     * A pointer to the contents in the success state.
10352     * Reading from this pointer when `result_ok` is not set is undefined.
10353     */
10354    struct LDKUnsignedNodeAnnouncement *result;
10355    /**
10356     * A pointer to the contents in the error state.
10357     * Reading from this pointer when `result_ok` is set is undefined.
10358     */
10359    struct LDKDecodeError *err;
10360 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
10361
10362 /**
10363  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10364  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10365  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10366  */
10367 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
10368    /**
10369     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10370     * `err` or `result` depending on the state of `result_ok`.
10371     */
10372    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
10373    /**
10374     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10375     */
10376    bool result_ok;
10377 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
10378
10379 /**
10380  * The contents of CResult_NodeAnnouncementDecodeErrorZ
10381  */
10382 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
10383    /**
10384     * A pointer to the contents in the success state.
10385     * Reading from this pointer when `result_ok` is not set is undefined.
10386     */
10387    struct LDKNodeAnnouncement *result;
10388    /**
10389     * A pointer to the contents in the error state.
10390     * Reading from this pointer when `result_ok` is set is undefined.
10391     */
10392    struct LDKDecodeError *err;
10393 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
10394
10395 /**
10396  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10397  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10398  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10399  */
10400 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
10401    /**
10402     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10403     * `err` or `result` depending on the state of `result_ok`.
10404     */
10405    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
10406    /**
10407     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10408     */
10409    bool result_ok;
10410 } LDKCResult_NodeAnnouncementDecodeErrorZ;
10411
10412 /**
10413  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10414  */
10415 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
10416    /**
10417     * A pointer to the contents in the success state.
10418     * Reading from this pointer when `result_ok` is not set is undefined.
10419     */
10420    struct LDKQueryShortChannelIds *result;
10421    /**
10422     * A pointer to the contents in the error state.
10423     * Reading from this pointer when `result_ok` is set is undefined.
10424     */
10425    struct LDKDecodeError *err;
10426 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
10427
10428 /**
10429  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10430  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10431  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10432  */
10433 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
10434    /**
10435     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10436     * `err` or `result` depending on the state of `result_ok`.
10437     */
10438    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
10439    /**
10440     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10441     */
10442    bool result_ok;
10443 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
10444
10445
10446
10447 /**
10448  * A reply_short_channel_ids_end message is sent as a reply to a
10449  * query_short_channel_ids message. The query recipient makes a best
10450  * effort to respond based on their local network view which may not be
10451  * a perfect view of the network.
10452  */
10453 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
10454    /**
10455     * A pointer to the opaque Rust object.
10456     * Nearly everywhere, inner must be non-null, however in places where
10457     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10458     */
10459    LDKnativeReplyShortChannelIdsEnd *inner;
10460    /**
10461     * Indicates that this is the only struct which contains the same pointer.
10462     * Rust functions which take ownership of an object provided via an argument require
10463     * this to be true and invalidate the object pointed to by inner.
10464     */
10465    bool is_owned;
10466 } LDKReplyShortChannelIdsEnd;
10467
10468 /**
10469  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10470  */
10471 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10472    /**
10473     * A pointer to the contents in the success state.
10474     * Reading from this pointer when `result_ok` is not set is undefined.
10475     */
10476    struct LDKReplyShortChannelIdsEnd *result;
10477    /**
10478     * A pointer to the contents in the error state.
10479     * Reading from this pointer when `result_ok` is set is undefined.
10480     */
10481    struct LDKDecodeError *err;
10482 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
10483
10484 /**
10485  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10486  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10487  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10488  */
10489 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
10490    /**
10491     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10492     * `err` or `result` depending on the state of `result_ok`.
10493     */
10494    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
10495    /**
10496     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10497     */
10498    bool result_ok;
10499 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
10500
10501 /**
10502  * The contents of CResult_QueryChannelRangeDecodeErrorZ
10503  */
10504 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
10505    /**
10506     * A pointer to the contents in the success state.
10507     * Reading from this pointer when `result_ok` is not set is undefined.
10508     */
10509    struct LDKQueryChannelRange *result;
10510    /**
10511     * A pointer to the contents in the error state.
10512     * Reading from this pointer when `result_ok` is set is undefined.
10513     */
10514    struct LDKDecodeError *err;
10515 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
10516
10517 /**
10518  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10519  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10520  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10521  */
10522 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
10523    /**
10524     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10525     * `err` or `result` depending on the state of `result_ok`.
10526     */
10527    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
10528    /**
10529     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10530     */
10531    bool result_ok;
10532 } LDKCResult_QueryChannelRangeDecodeErrorZ;
10533
10534 /**
10535  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
10536  */
10537 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
10538    /**
10539     * A pointer to the contents in the success state.
10540     * Reading from this pointer when `result_ok` is not set is undefined.
10541     */
10542    struct LDKReplyChannelRange *result;
10543    /**
10544     * A pointer to the contents in the error state.
10545     * Reading from this pointer when `result_ok` is set is undefined.
10546     */
10547    struct LDKDecodeError *err;
10548 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
10549
10550 /**
10551  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10552  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10554  */
10555 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
10556    /**
10557     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10558     * `err` or `result` depending on the state of `result_ok`.
10559     */
10560    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
10561    /**
10562     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10563     */
10564    bool result_ok;
10565 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
10566
10567 /**
10568  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
10569  */
10570 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
10571    /**
10572     * A pointer to the contents in the success state.
10573     * Reading from this pointer when `result_ok` is not set is undefined.
10574     */
10575    struct LDKGossipTimestampFilter *result;
10576    /**
10577     * A pointer to the contents in the error state.
10578     * Reading from this pointer when `result_ok` is set is undefined.
10579     */
10580    struct LDKDecodeError *err;
10581 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
10582
10583 /**
10584  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10585  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10586  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10587  */
10588 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
10589    /**
10590     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10591     * `err` or `result` depending on the state of `result_ok`.
10592     */
10593    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
10594    /**
10595     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10596     */
10597    bool result_ok;
10598 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
10599
10600 /**
10601  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
10602  * This corresponds to std::vector in C++
10603  */
10604 typedef struct LDKCVec_PhantomRouteHintsZ {
10605    /**
10606     * The elements in the array.
10607     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10608     */
10609    struct LDKPhantomRouteHints *data;
10610    /**
10611     * The number of elements pointed to by `data`.
10612     */
10613    uintptr_t datalen;
10614 } LDKCVec_PhantomRouteHintsZ;
10615
10616 /**
10617  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
10618  * may occur.
10619  */
10620 typedef enum LDKSignOrCreationError_Tag {
10621    /**
10622     * An error occurred during signing
10623     */
10624    LDKSignOrCreationError_SignError,
10625    /**
10626     * An error occurred while building the transaction
10627     */
10628    LDKSignOrCreationError_CreationError,
10629    /**
10630     * Must be last for serialization purposes
10631     */
10632    LDKSignOrCreationError_Sentinel,
10633 } LDKSignOrCreationError_Tag;
10634
10635 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
10636    LDKSignOrCreationError_Tag tag;
10637    union {
10638       struct {
10639          enum LDKCreationError creation_error;
10640       };
10641    };
10642 } LDKSignOrCreationError;
10643
10644 /**
10645  * The contents of CResult_InvoiceSignOrCreationErrorZ
10646  */
10647 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
10648    /**
10649     * A pointer to the contents in the success state.
10650     * Reading from this pointer when `result_ok` is not set is undefined.
10651     */
10652    struct LDKInvoice *result;
10653    /**
10654     * A pointer to the contents in the error state.
10655     * Reading from this pointer when `result_ok` is set is undefined.
10656     */
10657    struct LDKSignOrCreationError *err;
10658 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
10659
10660 /**
10661  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
10662  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
10663  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10664  */
10665 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
10666    /**
10667     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
10668     * `err` or `result` depending on the state of `result_ok`.
10669     */
10670    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
10671    /**
10672     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
10673     */
10674    bool result_ok;
10675 } LDKCResult_InvoiceSignOrCreationErrorZ;
10676
10677
10678
10679 /**
10680  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
10681  *
10682  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
10683  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
10684  * the return value of [`Filter::register_output`].
10685  *
10686  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
10687  * may have been spent there. See [`Filter::register_output`] for details.
10688  *
10689  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
10690  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
10691  */
10692 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
10693    /**
10694     * A pointer to the opaque Rust object.
10695     * Nearly everywhere, inner must be non-null, however in places where
10696     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10697     */
10698    LDKnativeWatchedOutput *inner;
10699    /**
10700     * Indicates that this is the only struct which contains the same pointer.
10701     * Rust functions which take ownership of an object provided via an argument require
10702     * this to be true and invalidate the object pointed to by inner.
10703     */
10704    bool is_owned;
10705 } LDKWatchedOutput;
10706
10707 /**
10708  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
10709  * channels.
10710  *
10711  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
10712  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
10713  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
10714  * receiving full blocks from a chain source, any further filtering is unnecessary.
10715  *
10716  * After an output has been registered, subsequent block retrievals from the chain source must not
10717  * exclude any transactions matching the new criteria nor any in-block descendants of such
10718  * transactions.
10719  *
10720  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
10721  * should not block on I/O. Implementations should instead queue the newly monitored data to be
10722  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
10723  * invocation that has called the `Filter` must return [`TemporaryFailure`].
10724  *
10725  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
10726  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
10727  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
10728  */
10729 typedef struct LDKFilter {
10730    /**
10731     * An opaque pointer which is passed to your function implementations as an argument.
10732     * This has no meaning in the LDK, and can be NULL or any other value.
10733     */
10734    void *this_arg;
10735    /**
10736     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
10737     * a spending condition.
10738     */
10739    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
10740    /**
10741     * Registers interest in spends of a transaction output.
10742     *
10743     * Optionally, when `output.block_hash` is set, should return any transaction spending the
10744     * output that is found in the corresponding block along with its index.
10745     *
10746     * This return value is useful for Electrum clients in order to supply in-block descendant
10747     * transactions which otherwise were not included. This is not necessary for other clients if
10748     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
10749     * full block).
10750     */
10751    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
10752    /**
10753     * Frees any resources associated with this object given its this_arg pointer.
10754     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10755     */
10756    void (*free)(void *this_arg);
10757 } LDKFilter;
10758
10759 /**
10760  * An enum which can either contain a crate::lightning::chain::Filter or not
10761  */
10762 typedef enum LDKCOption_FilterZ_Tag {
10763    /**
10764     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
10765     */
10766    LDKCOption_FilterZ_Some,
10767    /**
10768     * When we're in this state, this COption_FilterZ contains nothing
10769     */
10770    LDKCOption_FilterZ_None,
10771    /**
10772     * Must be last for serialization purposes
10773     */
10774    LDKCOption_FilterZ_Sentinel,
10775 } LDKCOption_FilterZ_Tag;
10776
10777 typedef struct LDKCOption_FilterZ {
10778    LDKCOption_FilterZ_Tag tag;
10779    union {
10780       struct {
10781          struct LDKFilter some;
10782       };
10783    };
10784 } LDKCOption_FilterZ;
10785
10786
10787
10788 /**
10789  * A read-only reference to a current ChannelMonitor.
10790  *
10791  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
10792  * released.
10793  */
10794 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
10795    /**
10796     * A pointer to the opaque Rust object.
10797     * Nearly everywhere, inner must be non-null, however in places where
10798     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10799     */
10800    LDKnativeLockedChannelMonitor *inner;
10801    /**
10802     * Indicates that this is the only struct which contains the same pointer.
10803     * Rust functions which take ownership of an object provided via an argument require
10804     * this to be true and invalidate the object pointed to by inner.
10805     */
10806    bool is_owned;
10807 } LDKLockedChannelMonitor;
10808
10809 /**
10810  * The contents of CResult_LockedChannelMonitorNoneZ
10811  */
10812 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
10813    /**
10814     * A pointer to the contents in the success state.
10815     * Reading from this pointer when `result_ok` is not set is undefined.
10816     */
10817    struct LDKLockedChannelMonitor *result;
10818    /**
10819     * Note that this value is always NULL, as there are no contents in the Err variant
10820     */
10821    void *err;
10822 } LDKCResult_LockedChannelMonitorNoneZPtr;
10823
10824 /**
10825  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
10826  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
10827  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10828  */
10829 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
10830    /**
10831     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
10832     * `err` or `result` depending on the state of `result_ok`.
10833     */
10834    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
10835    /**
10836     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
10837     */
10838    bool result_ok;
10839 } LDKCResult_LockedChannelMonitorNoneZ;
10840
10841 /**
10842  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
10843  * This corresponds to std::vector in C++
10844  */
10845 typedef struct LDKCVec_OutPointZ {
10846    /**
10847     * The elements in the array.
10848     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10849     */
10850    struct LDKOutPoint *data;
10851    /**
10852     * The number of elements pointed to by `data`.
10853     */
10854    uintptr_t datalen;
10855 } LDKCVec_OutPointZ;
10856
10857 /**
10858  * A trait indicating an object may generate message send events
10859  */
10860 typedef struct LDKMessageSendEventsProvider {
10861    /**
10862     * An opaque pointer which is passed to your function implementations as an argument.
10863     * This has no meaning in the LDK, and can be NULL or any other value.
10864     */
10865    void *this_arg;
10866    /**
10867     * Gets the list of pending events which were generated by previous actions, clearing the list
10868     * in the process.
10869     */
10870    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
10871    /**
10872     * Frees any resources associated with this object given its this_arg pointer.
10873     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10874     */
10875    void (*free)(void *this_arg);
10876 } LDKMessageSendEventsProvider;
10877
10878 /**
10879  * A trait implemented for objects handling events from [`EventsProvider`].
10880  */
10881 typedef struct LDKEventHandler {
10882    /**
10883     * An opaque pointer which is passed to your function implementations as an argument.
10884     * This has no meaning in the LDK, and can be NULL or any other value.
10885     */
10886    void *this_arg;
10887    /**
10888     * Handles the given [`Event`].
10889     *
10890     * See [`EventsProvider`] for details that must be considered when implementing this method.
10891     */
10892    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
10893    /**
10894     * Frees any resources associated with this object given its this_arg pointer.
10895     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10896     */
10897    void (*free)(void *this_arg);
10898 } LDKEventHandler;
10899
10900 /**
10901  * A trait indicating an object may generate events.
10902  *
10903  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
10904  *
10905  * # Requirements
10906  *
10907  * See [`process_pending_events`] for requirements around event processing.
10908  *
10909  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
10910  * event since the last invocation. The handler must either act upon the event immediately
10911  * or preserve it for later handling.
10912  *
10913  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
10914  * consult the provider's documentation on the implication of processing events and how a handler
10915  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
10916  * [`ChainMonitor::process_pending_events`]).
10917  *
10918  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
10919  * own type(s).
10920  *
10921  * [`process_pending_events`]: Self::process_pending_events
10922  * [`handle_event`]: EventHandler::handle_event
10923  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
10924  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
10925  */
10926 typedef struct LDKEventsProvider {
10927    /**
10928     * An opaque pointer which is passed to your function implementations as an argument.
10929     * This has no meaning in the LDK, and can be NULL or any other value.
10930     */
10931    void *this_arg;
10932    /**
10933     * Processes any events generated since the last call using the given event handler.
10934     *
10935     * Subsequent calls must only process new events. However, handlers must be capable of handling
10936     * duplicate events across process restarts. This may occur if the provider was recovered from
10937     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
10938     */
10939    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
10940    /**
10941     * Frees any resources associated with this object given its this_arg pointer.
10942     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
10943     */
10944    void (*free)(void *this_arg);
10945 } LDKEventsProvider;
10946
10947
10948
10949 /**
10950  * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's
10951  * variable-length integers except that it is serialized in big-endian instead of little-endian.
10952  *
10953  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
10954  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
10955  * you're looking for an example of a variable-length integer to use for your own project, move
10956  * along, this is a rather poor design.
10957  */
10958 typedef struct MUST_USE_STRUCT LDKBigSize {
10959    /**
10960     * A pointer to the opaque Rust object.
10961     * Nearly everywhere, inner must be non-null, however in places where
10962     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10963     */
10964    LDKnativeBigSize *inner;
10965    /**
10966     * Indicates that this is the only struct which contains the same pointer.
10967     * Rust functions which take ownership of an object provided via an argument require
10968     * this to be true and invalidate the object pointed to by inner.
10969     */
10970    bool is_owned;
10971 } LDKBigSize;
10972
10973
10974
10975 /**
10976  * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
10977  */
10978 typedef struct MUST_USE_STRUCT LDKChannelUsage {
10979    /**
10980     * A pointer to the opaque Rust object.
10981     * Nearly everywhere, inner must be non-null, however in places where
10982     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10983     */
10984    LDKnativeChannelUsage *inner;
10985    /**
10986     * Indicates that this is the only struct which contains the same pointer.
10987     * Rust functions which take ownership of an object provided via an argument require
10988     * this to be true and invalidate the object pointed to by inner.
10989     */
10990    bool is_owned;
10991 } LDKChannelUsage;
10992
10993 /**
10994  * An interface used to score payment channels for path finding.
10995  *
10996  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
10997  */
10998 typedef struct LDKScore {
10999    /**
11000     * An opaque pointer which is passed to your function implementations as an argument.
11001     * This has no meaning in the LDK, and can be NULL or any other value.
11002     */
11003    void *this_arg;
11004    /**
11005     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
11006     * given channel in the direction from `source` to `target`.
11007     *
11008     * The channel's capacity (less any other MPP parts that are also being considered for use in
11009     * the same payment) is given by `capacity_msat`. It may be determined from various sources
11010     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
11011     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
11012     * Thus, implementations should be overflow-safe.
11013     */
11014    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);
11015    /**
11016     * Handles updating channel penalties after failing to route through a channel.
11017     */
11018    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
11019    /**
11020     * Handles updating channel penalties after successfully routing along a path.
11021     */
11022    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
11023    /**
11024     * Serialize the object into a byte array
11025     */
11026    struct LDKCVec_u8Z (*write)(const void *this_arg);
11027    /**
11028     * Frees any resources associated with this object given its this_arg pointer.
11029     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11030     */
11031    void (*free)(void *this_arg);
11032 } LDKScore;
11033
11034
11035
11036 /**
11037  * A concrete implementation of [`LockableScore`] which supports multi-threading.
11038  */
11039 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
11040    /**
11041     * A pointer to the opaque Rust object.
11042     * Nearly everywhere, inner must be non-null, however in places where
11043     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11044     */
11045    LDKnativeMultiThreadedLockableScore *inner;
11046    /**
11047     * Indicates that this is the only struct which contains the same pointer.
11048     * Rust functions which take ownership of an object provided via an argument require
11049     * this to be true and invalidate the object pointed to by inner.
11050     */
11051    bool is_owned;
11052 } LDKMultiThreadedLockableScore;
11053
11054 /**
11055  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`MultiThreadedLockableScore`] to disk.
11056  */
11057 typedef struct LDKPersister {
11058    /**
11059     * An opaque pointer which is passed to your function implementations as an argument.
11060     * This has no meaning in the LDK, and can be NULL or any other value.
11061     */
11062    void *this_arg;
11063    /**
11064     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
11065     */
11066    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
11067    /**
11068     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
11069     */
11070    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
11071    /**
11072     * Persist the given [`MultiThreadedLockableScore`] to disk, returning an error if persistence failed.
11073     */
11074    struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer);
11075    /**
11076     * Frees any resources associated with this object given its this_arg pointer.
11077     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11078     */
11079    void (*free)(void *this_arg);
11080 } LDKPersister;
11081
11082
11083
11084 /**
11085  * Configuration we set when applicable.
11086  *
11087  * Default::default() provides sane defaults.
11088  */
11089 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
11090    /**
11091     * A pointer to the opaque Rust object.
11092     * Nearly everywhere, inner must be non-null, however in places where
11093     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11094     */
11095    LDKnativeChannelHandshakeConfig *inner;
11096    /**
11097     * Indicates that this is the only struct which contains the same pointer.
11098     * Rust functions which take ownership of an object provided via an argument require
11099     * this to be true and invalidate the object pointed to by inner.
11100     */
11101    bool is_owned;
11102 } LDKChannelHandshakeConfig;
11103
11104
11105
11106 /**
11107  * Optional channel limits which are applied during channel creation.
11108  *
11109  * These limits are only applied to our counterparty's limits, not our own.
11110  *
11111  * Use 0/<type>::max_value() as appropriate to skip checking.
11112  *
11113  * Provides sane defaults for most configurations.
11114  *
11115  * Most additional limits are disabled except those with which specify a default in individual
11116  * field documentation. Note that this may result in barely-usable channels, but since they
11117  * are applied mostly only to incoming channels that's not much of a problem.
11118  */
11119 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
11120    /**
11121     * A pointer to the opaque Rust object.
11122     * Nearly everywhere, inner must be non-null, however in places where
11123     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11124     */
11125    LDKnativeChannelHandshakeLimits *inner;
11126    /**
11127     * Indicates that this is the only struct which contains the same pointer.
11128     * Rust functions which take ownership of an object provided via an argument require
11129     * this to be true and invalidate the object pointed to by inner.
11130     */
11131    bool is_owned;
11132 } LDKChannelHandshakeLimits;
11133
11134
11135
11136 /**
11137  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
11138  *
11139  * Default::default() provides sane defaults for most configurations
11140  * (but currently with 0 relay fees!)
11141  */
11142 typedef struct MUST_USE_STRUCT LDKUserConfig {
11143    /**
11144     * A pointer to the opaque Rust object.
11145     * Nearly everywhere, inner must be non-null, however in places where
11146     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11147     */
11148    LDKnativeUserConfig *inner;
11149    /**
11150     * Indicates that this is the only struct which contains the same pointer.
11151     * Rust functions which take ownership of an object provided via an argument require
11152     * this to be true and invalidate the object pointed to by inner.
11153     */
11154    bool is_owned;
11155 } LDKUserConfig;
11156
11157
11158
11159 /**
11160  * The best known block as identified by its hash and height.
11161  */
11162 typedef struct MUST_USE_STRUCT LDKBestBlock {
11163    /**
11164     * A pointer to the opaque Rust object.
11165     * Nearly everywhere, inner must be non-null, however in places where
11166     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11167     */
11168    LDKnativeBestBlock *inner;
11169    /**
11170     * Indicates that this is the only struct which contains the same pointer.
11171     * Rust functions which take ownership of an object provided via an argument require
11172     * this to be true and invalidate the object pointed to by inner.
11173     */
11174    bool is_owned;
11175 } LDKBestBlock;
11176
11177 /**
11178  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
11179  * chain.
11180  *
11181  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
11182  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
11183  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
11184  * when needed.
11185  *
11186  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
11187  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
11188  * other similar filtering.
11189  */
11190 typedef struct LDKListen {
11191    /**
11192     * An opaque pointer which is passed to your function implementations as an argument.
11193     * This has no meaning in the LDK, and can be NULL or any other value.
11194     */
11195    void *this_arg;
11196    /**
11197     * Notifies the listener that a block was added at the given height, with the transaction data
11198     * possibly filtered.
11199     */
11200    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
11201    /**
11202     * Notifies the listener that a block was added at the given height.
11203     */
11204    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
11205    /**
11206     * Notifies the listener that a block was removed at the given height.
11207     */
11208    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
11209    /**
11210     * Frees any resources associated with this object given its this_arg pointer.
11211     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11212     */
11213    void (*free)(void *this_arg);
11214 } LDKListen;
11215
11216 /**
11217  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
11218  * unconfirmed during a chain reorganization.
11219  *
11220  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
11221  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
11222  * related to registered transactions and outputs. Upon notification, it would pass along the
11223  * matching transactions using this interface.
11224  *
11225  * # Use
11226  *
11227  * The intended use is as follows:
11228  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
11229  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
11230  *   that has been reorganized out of the chain.
11231  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
11232  *
11233  * # Order
11234  *
11235  * Clients must call these methods in chain order. Specifically:
11236  * - Transactions confirmed in a block must be given before transactions confirmed in a later
11237  *   block.
11238  * - Dependent transactions within the same block must be given in topological order, possibly in
11239  *   separate calls.
11240  * - Unconfirmed transactions must be given after the original confirmations and before any
11241  *   reconfirmation.
11242  *
11243  * See individual method documentation for further details.
11244  *
11245  * [`transactions_confirmed`]: Self::transactions_confirmed
11246  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11247  * [`best_block_updated`]: Self::best_block_updated
11248  * [`get_relevant_txids`]: Self::get_relevant_txids
11249  */
11250 typedef struct LDKConfirm {
11251    /**
11252     * An opaque pointer which is passed to your function implementations as an argument.
11253     * This has no meaning in the LDK, and can be NULL or any other value.
11254     */
11255    void *this_arg;
11256    /**
11257     * Processes transactions confirmed in a block with a given header and height.
11258     *
11259     * Should be called for any transactions registered by [`Filter::register_tx`] or any
11260     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
11261     * appearing in the same block do not need to be included in the same call; instead, multiple
11262     * calls with additional transactions may be made so long as they are made in [chain order].
11263     *
11264     * May be called before or after [`best_block_updated`] for the corresponding block. However,
11265     * in the event of a chain reorganization, it must not be called with a `header` that is no
11266     * longer in the chain as of the last call to [`best_block_updated`].
11267     *
11268     * [chain order]: Confirm#Order
11269     * [`best_block_updated`]: Self::best_block_updated
11270     */
11271    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
11272    /**
11273     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
11274     *
11275     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
11276     * reorganized out of the best chain. Once called, the given transaction should not be returned
11277     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
11278     *
11279     * [`get_relevant_txids`]: Self::get_relevant_txids
11280     * [`transactions_confirmed`]: Self::transactions_confirmed
11281     */
11282    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
11283    /**
11284     * Processes an update to the best header connected at the given height.
11285     *
11286     * Should be called when a new header is available but may be skipped for intermediary blocks
11287     * if they become available at the same time.
11288     */
11289    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
11290    /**
11291     * Returns transactions that should be monitored for reorganization out of the chain.
11292     *
11293     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
11294     * confirmations to be safe from a chain reorganization. Should not include any transactions
11295     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
11296     *
11297     * May be called to determine the subset of transactions that must still be monitored for
11298     * reorganization. Will be idempotent between calls but may change as a result of calls to the
11299     * other interface methods. Thus, this is useful to determine which transactions may need to be
11300     * given to [`transaction_unconfirmed`].
11301     *
11302     * [`transactions_confirmed`]: Self::transactions_confirmed
11303     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11304     */
11305    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
11306    /**
11307     * Frees any resources associated with this object given its this_arg pointer.
11308     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11309     */
11310    void (*free)(void *this_arg);
11311 } LDKConfirm;
11312
11313
11314
11315 /**
11316  * An opaque identifier describing a specific [`Persist`] method call.
11317  */
11318 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
11319    /**
11320     * A pointer to the opaque Rust object.
11321     * Nearly everywhere, inner must be non-null, however in places where
11322     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11323     */
11324    LDKnativeMonitorUpdateId *inner;
11325    /**
11326     * Indicates that this is the only struct which contains the same pointer.
11327     * Rust functions which take ownership of an object provided via an argument require
11328     * this to be true and invalidate the object pointed to by inner.
11329     */
11330    bool is_owned;
11331 } LDKMonitorUpdateId;
11332
11333 /**
11334  * `Persist` defines behavior for persisting channel monitors: this could mean
11335  * writing once to disk, and/or uploading to one or more backup services.
11336  *
11337  * Each method can return three possible values:
11338  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
11339  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
11340  *  * If persistence happens asynchronously, implementations should first ensure the
11341  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
11342  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
11343  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
11344  *    called with the corresponding [`MonitorUpdateId`].
11345  *
11346  *    Note that unlike the direct [`chain::Watch`] interface,
11347  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
11348  *
11349  *  * If persistence fails for some reason, implementations should return
11350  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
11351  *    closed without broadcasting the latest state. See
11352  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
11353  */
11354 typedef struct LDKPersist {
11355    /**
11356     * An opaque pointer which is passed to your function implementations as an argument.
11357     * This has no meaning in the LDK, and can be NULL or any other value.
11358     */
11359    void *this_arg;
11360    /**
11361     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
11362     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
11363     *
11364     * The data can be stored any way you want, but the identifier provided by LDK is the
11365     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
11366     * and the stored channel data). Note that you **must** persist every new monitor to disk.
11367     *
11368     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11369     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11370     *
11371     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
11372     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11373     *
11374     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11375     * [`Writeable::write`]: crate::util::ser::Writeable::write
11376     */
11377    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
11378    /**
11379     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
11380     * update.
11381     *
11382     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
11383     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
11384     * details.
11385     *
11386     * During blockchain synchronization operations, this may be called with no
11387     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
11388     * Note that after the full [`ChannelMonitor`] is persisted any previous
11389     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
11390     * applied to the persisted [`ChannelMonitor`] as they were already applied.
11391     *
11392     * If an implementer chooses to persist the updates only, they need to make
11393     * sure that all the updates are applied to the `ChannelMonitors` *before*
11394     * the set of channel monitors is given to the `ChannelManager`
11395     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
11396     * applying a monitor update to a monitor. If full `ChannelMonitors` are
11397     * persisted, then there is no need to persist individual updates.
11398     *
11399     * Note that there could be a performance tradeoff between persisting complete
11400     * channel monitors on every update vs. persisting only updates and applying
11401     * them in batches. The size of each monitor grows `O(number of state updates)`
11402     * whereas updates are small and `O(1)`.
11403     *
11404     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11405     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11406     *
11407     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
11408     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
11409     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11410     *
11411     * [`Writeable::write`]: crate::util::ser::Writeable::write
11412     *
11413     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
11414     */
11415    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);
11416    /**
11417     * Frees any resources associated with this object given its this_arg pointer.
11418     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11419     */
11420    void (*free)(void *this_arg);
11421 } LDKPersist;
11422
11423
11424
11425 /**
11426  * An implementation of [`chain::Watch`] for monitoring channels.
11427  *
11428  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
11429  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
11430  * or used independently to monitor channels remotely. See the [module-level documentation] for
11431  * details.
11432  *
11433  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11434  * [module-level documentation]: crate::chain::chainmonitor
11435  */
11436 typedef struct MUST_USE_STRUCT LDKChainMonitor {
11437    /**
11438     * A pointer to the opaque Rust object.
11439     * Nearly everywhere, inner must be non-null, however in places where
11440     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11441     */
11442    LDKnativeChainMonitor *inner;
11443    /**
11444     * Indicates that this is the only struct which contains the same pointer.
11445     * Rust functions which take ownership of an object provided via an argument require
11446     * this to be true and invalidate the object pointed to by inner.
11447     */
11448    bool is_owned;
11449 } LDKChainMonitor;
11450
11451
11452
11453 /**
11454  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
11455  * and derives keys from that.
11456  *
11457  * Your node_id is seed/0'
11458  * ChannelMonitor closes may use seed/1'
11459  * Cooperative closes may use seed/2'
11460  * The two close keys may be needed to claim on-chain funds!
11461  *
11462  * This struct cannot be used for nodes that wish to support receiving phantom payments;
11463  * [`PhantomKeysManager`] must be used instead.
11464  *
11465  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
11466  * previously issued invoices and attempts to pay previous invoices will fail.
11467  */
11468 typedef struct MUST_USE_STRUCT LDKKeysManager {
11469    /**
11470     * A pointer to the opaque Rust object.
11471     * Nearly everywhere, inner must be non-null, however in places where
11472     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11473     */
11474    LDKnativeKeysManager *inner;
11475    /**
11476     * Indicates that this is the only struct which contains the same pointer.
11477     * Rust functions which take ownership of an object provided via an argument require
11478     * this to be true and invalidate the object pointed to by inner.
11479     */
11480    bool is_owned;
11481 } LDKKeysManager;
11482
11483
11484
11485 /**
11486  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
11487  * payments.
11488  *
11489  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
11490  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
11491  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
11492  * itself without ever needing to forward to this fake node.
11493  *
11494  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
11495  * provide some fault tolerance, because payers will automatically retry paying other provided
11496  * nodes in the case that one node goes down.
11497  *
11498  * Note that multi-path payments are not supported in phantom invoices for security reasons.
11499  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
11500  * invoices and attempts to pay previous invoices will fail.
11501  */
11502 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
11503    /**
11504     * A pointer to the opaque Rust object.
11505     * Nearly everywhere, inner must be non-null, however in places where
11506     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11507     */
11508    LDKnativePhantomKeysManager *inner;
11509    /**
11510     * Indicates that this is the only struct which contains the same pointer.
11511     * Rust functions which take ownership of an object provided via an argument require
11512     * this to be true and invalidate the object pointed to by inner.
11513     */
11514    bool is_owned;
11515 } LDKPhantomKeysManager;
11516
11517
11518
11519 /**
11520  * Chain-related parameters used to construct a new `ChannelManager`.
11521  *
11522  * Typically, the block-specific parameters are derived from the best block hash for the network,
11523  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
11524  * are not needed when deserializing a previously constructed `ChannelManager`.
11525  */
11526 typedef struct MUST_USE_STRUCT LDKChainParameters {
11527    /**
11528     * A pointer to the opaque Rust object.
11529     * Nearly everywhere, inner must be non-null, however in places where
11530     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11531     */
11532    LDKnativeChainParameters *inner;
11533    /**
11534     * Indicates that this is the only struct which contains the same pointer.
11535     * Rust functions which take ownership of an object provided via an argument require
11536     * this to be true and invalidate the object pointed to by inner.
11537     */
11538    bool is_owned;
11539 } LDKChainParameters;
11540
11541 /**
11542  * A 3-byte byte array.
11543  */
11544 typedef struct LDKThreeBytes {
11545    /**
11546     * The three bytes
11547     */
11548    uint8_t data[3];
11549 } LDKThreeBytes;
11550
11551 /**
11552  * A trait to describe an object which can receive channel messages.
11553  *
11554  * Messages MAY be called in parallel when they originate from different their_node_ids, however
11555  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
11556  */
11557 typedef struct LDKChannelMessageHandler {
11558    /**
11559     * An opaque pointer which is passed to your function implementations as an argument.
11560     * This has no meaning in the LDK, and can be NULL or any other value.
11561     */
11562    void *this_arg;
11563    /**
11564     * Handle an incoming open_channel message from the given peer.
11565     */
11566    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
11567    /**
11568     * Handle an incoming accept_channel message from the given peer.
11569     */
11570    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
11571    /**
11572     * Handle an incoming funding_created message from the given peer.
11573     */
11574    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
11575    /**
11576     * Handle an incoming funding_signed message from the given peer.
11577     */
11578    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
11579    /**
11580     * Handle an incoming channel_ready message from the given peer.
11581     */
11582    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
11583    /**
11584     * Handle an incoming shutdown message from the given peer.
11585     */
11586    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);
11587    /**
11588     * Handle an incoming closing_signed message from the given peer.
11589     */
11590    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
11591    /**
11592     * Handle an incoming update_add_htlc message from the given peer.
11593     */
11594    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
11595    /**
11596     * Handle an incoming update_fulfill_htlc message from the given peer.
11597     */
11598    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
11599    /**
11600     * Handle an incoming update_fail_htlc message from the given peer.
11601     */
11602    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
11603    /**
11604     * Handle an incoming update_fail_malformed_htlc message from the given peer.
11605     */
11606    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
11607    /**
11608     * Handle an incoming commitment_signed message from the given peer.
11609     */
11610    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
11611    /**
11612     * Handle an incoming revoke_and_ack message from the given peer.
11613     */
11614    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
11615    /**
11616     * Handle an incoming update_fee message from the given peer.
11617     */
11618    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
11619    /**
11620     * Handle an incoming announcement_signatures message from the given peer.
11621     */
11622    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
11623    /**
11624     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
11625     * is believed to be possible in the future (eg they're sending us messages we don't
11626     * understand or indicate they require unknown feature bits), no_connection_possible is set
11627     * and any outstanding channels should be failed.
11628     */
11629    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
11630    /**
11631     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
11632     */
11633    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
11634    /**
11635     * Handle an incoming channel_reestablish message from the given peer.
11636     */
11637    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
11638    /**
11639     * Handle an incoming channel update from the given peer.
11640     */
11641    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
11642    /**
11643     * Handle an incoming error message from the given peer.
11644     */
11645    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
11646    /**
11647     * Implementation of MessageSendEventsProvider for this object.
11648     */
11649    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11650    /**
11651     * Frees any resources associated with this object given its this_arg pointer.
11652     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11653     */
11654    void (*free)(void *this_arg);
11655 } LDKChannelMessageHandler;
11656
11657
11658
11659 /**
11660  * Arguments for the creation of a ChannelManager that are not deserialized.
11661  *
11662  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
11663  * is:
11664  * 1) Deserialize all stored [`ChannelMonitor`]s.
11665  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
11666  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
11667  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
11668  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
11669  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
11670  *    same way you would handle a [`chain::Filter`] call using
11671  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
11672  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
11673  * 5) Disconnect/connect blocks on the [`ChannelManager`].
11674  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
11675  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
11676  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
11677  *    the next step.
11678  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
11679  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
11680  *
11681  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
11682  * call any other methods on the newly-deserialized [`ChannelManager`].
11683  *
11684  * Note that because some channels may be closed during deserialization, it is critical that you
11685  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
11686  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
11687  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
11688  * not force-close the same channels but consider them live), you may end up revoking a state for
11689  * which you've already broadcasted the transaction.
11690  *
11691  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
11692  */
11693 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
11694    /**
11695     * A pointer to the opaque Rust object.
11696     * Nearly everywhere, inner must be non-null, however in places where
11697     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11698     */
11699    LDKnativeChannelManagerReadArgs *inner;
11700    /**
11701     * Indicates that this is the only struct which contains the same pointer.
11702     * Rust functions which take ownership of an object provided via an argument require
11703     * this to be true and invalidate the object pointed to by inner.
11704     */
11705    bool is_owned;
11706 } LDKChannelManagerReadArgs;
11707
11708
11709
11710 /**
11711  * A set of keys that were HKDF-expanded from an initial call to
11712  * [`KeysInterface::get_inbound_payment_key_material`].
11713  *
11714  * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material
11715  */
11716 typedef struct MUST_USE_STRUCT LDKExpandedKey {
11717    /**
11718     * A pointer to the opaque Rust object.
11719     * Nearly everywhere, inner must be non-null, however in places where
11720     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11721     */
11722    LDKnativeExpandedKey *inner;
11723    /**
11724     * Indicates that this is the only struct which contains the same pointer.
11725     * Rust functions which take ownership of an object provided via an argument require
11726     * this to be true and invalidate the object pointed to by inner.
11727     */
11728    bool is_owned;
11729 } LDKExpandedKey;
11730
11731
11732
11733 /**
11734  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
11735  * This is used to convince the recipient that the channel is at a certain commitment
11736  * number even if they lost that data due to a local failure.  Of course, the peer may lie
11737  * and even later commitments may have been revoked.
11738  */
11739 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
11740    /**
11741     * A pointer to the opaque Rust object.
11742     * Nearly everywhere, inner must be non-null, however in places where
11743     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11744     */
11745    LDKnativeDataLossProtect *inner;
11746    /**
11747     * Indicates that this is the only struct which contains the same pointer.
11748     * Rust functions which take ownership of an object provided via an argument require
11749     * this to be true and invalidate the object pointed to by inner.
11750     */
11751    bool is_owned;
11752 } LDKDataLossProtect;
11753
11754 /**
11755  * A trait to describe an object which can receive routing messages.
11756  *
11757  * # Implementor DoS Warnings
11758  *
11759  * For `gossip_queries` messages there are potential DoS vectors when handling
11760  * inbound queries. Implementors using an on-disk network graph should be aware of
11761  * repeated disk I/O for queries accessing different parts of the network graph.
11762  */
11763 typedef struct LDKRoutingMessageHandler {
11764    /**
11765     * An opaque pointer which is passed to your function implementations as an argument.
11766     * This has no meaning in the LDK, and can be NULL or any other value.
11767     */
11768    void *this_arg;
11769    /**
11770     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
11771     * false or returning an Err otherwise.
11772     */
11773    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
11774    /**
11775     * Handle a channel_announcement message, returning true if it should be forwarded on, false
11776     * or returning an Err otherwise.
11777     */
11778    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
11779    /**
11780     * Handle an incoming channel_update message, returning true if it should be forwarded on,
11781     * false or returning an Err otherwise.
11782     */
11783    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
11784    /**
11785     * Gets a subset of the channel announcements and updates required to dump our routing table
11786     * to a remote node, starting at the short_channel_id indicated by starting_point and
11787     * including the batch_amount entries immediately higher in numerical value than starting_point.
11788     */
11789    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
11790    /**
11791     * Gets a subset of the node announcements required to dump our routing table to a remote node,
11792     * starting at the node *after* the provided publickey and including batch_amount entries
11793     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
11794     * If None is provided for starting_point, we start at the first node.
11795     *
11796     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
11797     */
11798    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
11799    /**
11800     * Called when a connection is established with a peer. This can be used to
11801     * perform routing table synchronization using a strategy defined by the
11802     * implementor.
11803     */
11804    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
11805    /**
11806     * Handles the reply of a query we initiated to learn about channels
11807     * for a given range of blocks. We can expect to receive one or more
11808     * replies to a single query.
11809     */
11810    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
11811    /**
11812     * Handles the reply of a query we initiated asking for routing gossip
11813     * messages for a list of channels. We should receive this message when
11814     * a node has completed its best effort to send us the pertaining routing
11815     * gossip messages.
11816     */
11817    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
11818    /**
11819     * Handles when a peer asks us to send a list of short_channel_ids
11820     * for the requested range of blocks.
11821     */
11822    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
11823    /**
11824     * Handles when a peer asks us to send routing gossip messages for a
11825     * list of short_channel_ids.
11826     */
11827    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
11828    /**
11829     * Implementation of MessageSendEventsProvider for this object.
11830     */
11831    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
11832    /**
11833     * Frees any resources associated with this object given its this_arg pointer.
11834     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11835     */
11836    void (*free)(void *this_arg);
11837 } LDKRoutingMessageHandler;
11838
11839 /**
11840  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
11841  * decoders.
11842  */
11843 typedef struct LDKCustomMessageReader {
11844    /**
11845     * An opaque pointer which is passed to your function implementations as an argument.
11846     * This has no meaning in the LDK, and can be NULL or any other value.
11847     */
11848    void *this_arg;
11849    /**
11850     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
11851     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
11852     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
11853     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
11854     */
11855    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
11856    /**
11857     * Frees any resources associated with this object given its this_arg pointer.
11858     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11859     */
11860    void (*free)(void *this_arg);
11861 } LDKCustomMessageReader;
11862
11863 /**
11864  * Handler for BOLT1-compliant messages.
11865  */
11866 typedef struct LDKCustomMessageHandler {
11867    /**
11868     * An opaque pointer which is passed to your function implementations as an argument.
11869     * This has no meaning in the LDK, and can be NULL or any other value.
11870     */
11871    void *this_arg;
11872    /**
11873     * Called with the message type that was received and the buffer to be read.
11874     * Can return a `MessageHandlingError` if the message could not be handled.
11875     */
11876    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
11877    /**
11878     * Gets the list of pending messages which were generated by the custom message
11879     * handler, clearing the list in the process. The first tuple element must
11880     * correspond to the intended recipients node ids. If no connection to one of the
11881     * specified node does not exist, the message is simply not sent to it.
11882     */
11883    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
11884    /**
11885     * Implementation of CustomMessageReader for this object.
11886     */
11887    struct LDKCustomMessageReader CustomMessageReader;
11888    /**
11889     * Frees any resources associated with this object given its this_arg pointer.
11890     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11891     */
11892    void (*free)(void *this_arg);
11893 } LDKCustomMessageHandler;
11894
11895
11896
11897 /**
11898  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
11899  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
11900  */
11901 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
11902    /**
11903     * A pointer to the opaque Rust object.
11904     * Nearly everywhere, inner must be non-null, however in places where
11905     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11906     */
11907    LDKnativeIgnoringMessageHandler *inner;
11908    /**
11909     * Indicates that this is the only struct which contains the same pointer.
11910     * Rust functions which take ownership of an object provided via an argument require
11911     * this to be true and invalidate the object pointed to by inner.
11912     */
11913    bool is_owned;
11914 } LDKIgnoringMessageHandler;
11915
11916
11917
11918 /**
11919  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
11920  * You can provide one of these as the route_handler in a MessageHandler.
11921  */
11922 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
11923    /**
11924     * A pointer to the opaque Rust object.
11925     * Nearly everywhere, inner must be non-null, however in places where
11926     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11927     */
11928    LDKnativeErroringMessageHandler *inner;
11929    /**
11930     * Indicates that this is the only struct which contains the same pointer.
11931     * Rust functions which take ownership of an object provided via an argument require
11932     * this to be true and invalidate the object pointed to by inner.
11933     */
11934    bool is_owned;
11935 } LDKErroringMessageHandler;
11936
11937
11938
11939 /**
11940  * Provides references to trait impls which handle different types of messages.
11941  */
11942 typedef struct MUST_USE_STRUCT LDKMessageHandler {
11943    /**
11944     * A pointer to the opaque Rust object.
11945     * Nearly everywhere, inner must be non-null, however in places where
11946     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11947     */
11948    LDKnativeMessageHandler *inner;
11949    /**
11950     * Indicates that this is the only struct which contains the same pointer.
11951     * Rust functions which take ownership of an object provided via an argument require
11952     * this to be true and invalidate the object pointed to by inner.
11953     */
11954    bool is_owned;
11955 } LDKMessageHandler;
11956
11957 /**
11958  * Provides an object which can be used to send data to and which uniquely identifies a connection
11959  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
11960  * implement Hash to meet the PeerManager API.
11961  *
11962  * For efficiency, Clone should be relatively cheap for this type.
11963  *
11964  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
11965  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
11966  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
11967  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
11968  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
11969  * to simply use another value which is guaranteed to be globally unique instead.
11970  */
11971 typedef struct LDKSocketDescriptor {
11972    /**
11973     * An opaque pointer which is passed to your function implementations as an argument.
11974     * This has no meaning in the LDK, and can be NULL or any other value.
11975     */
11976    void *this_arg;
11977    /**
11978     * Attempts to send some data from the given slice to the peer.
11979     *
11980     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
11981     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
11982     * called and further write attempts may occur until that time.
11983     *
11984     * If the returned size is smaller than `data.len()`, a
11985     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
11986     * written. Additionally, until a `send_data` event completes fully, no further
11987     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
11988     * prevent denial-of-service issues, you should not read or buffer any data from the socket
11989     * until then.
11990     *
11991     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
11992     * (indicating that read events should be paused to prevent DoS in the send buffer),
11993     * `resume_read` may be set indicating that read events on this descriptor should resume. A
11994     * `resume_read` of false carries no meaning, and should not cause any action.
11995     */
11996    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
11997    /**
11998     * Disconnect the socket pointed to by this SocketDescriptor.
11999     *
12000     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
12001     * call (doing so is a noop).
12002     */
12003    void (*disconnect_socket)(void *this_arg);
12004    /**
12005     * Checks if two objects are equal given this object's this_arg pointer and another object.
12006     */
12007    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
12008    /**
12009     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
12010     * This is used, for example, for inclusion of this object in a hash map.
12011     */
12012    uint64_t (*hash)(const void *this_arg);
12013    /**
12014     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
12015     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
12016     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
12017     */
12018    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
12019    /**
12020     * Frees any resources associated with this object given its this_arg pointer.
12021     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12022     */
12023    void (*free)(void *this_arg);
12024 } LDKSocketDescriptor;
12025
12026
12027
12028 /**
12029  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
12030  * socket events into messages which it passes on to its [`MessageHandler`].
12031  *
12032  * Locks are taken internally, so you must never assume that reentrancy from a
12033  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
12034  *
12035  * Calls to [`read_event`] will decode relevant messages and pass them to the
12036  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
12037  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
12038  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
12039  * calls only after previous ones have returned.
12040  *
12041  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
12042  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
12043  * essentially you should default to using a SimpleRefPeerManager, and use a
12044  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
12045  * you're using lightning-net-tokio.
12046  *
12047  * [`read_event`]: PeerManager::read_event
12048  */
12049 typedef struct MUST_USE_STRUCT LDKPeerManager {
12050    /**
12051     * A pointer to the opaque Rust object.
12052     * Nearly everywhere, inner must be non-null, however in places where
12053     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12054     */
12055    LDKnativePeerManager *inner;
12056    /**
12057     * Indicates that this is the only struct which contains the same pointer.
12058     * Rust functions which take ownership of an object provided via an argument require
12059     * this to be true and invalidate the object pointed to by inner.
12060     */
12061    bool is_owned;
12062 } LDKPeerManager;
12063
12064
12065
12066 /**
12067  * Static channel fields used to build transactions given per-commitment fields, organized by
12068  * broadcaster/countersignatory.
12069  *
12070  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
12071  * as_holder_broadcastable and as_counterparty_broadcastable functions.
12072  */
12073 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
12074    /**
12075     * A pointer to the opaque Rust object.
12076     * Nearly everywhere, inner must be non-null, however in places where
12077     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12078     */
12079    LDKnativeDirectedChannelTransactionParameters *inner;
12080    /**
12081     * Indicates that this is the only struct which contains the same pointer.
12082     * Rust functions which take ownership of an object provided via an argument require
12083     * this to be true and invalidate the object pointed to by inner.
12084     */
12085    bool is_owned;
12086 } LDKDirectedChannelTransactionParameters;
12087
12088 /**
12089  * Integer in the range `0..=16`
12090  */
12091 typedef struct LDKWitnessVersion {
12092    uint8_t _0;
12093 } LDKWitnessVersion;
12094
12095
12096
12097 /**
12098  * A read-only view of [`NetworkGraph`].
12099  */
12100 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
12101    /**
12102     * A pointer to the opaque Rust object.
12103     * Nearly everywhere, inner must be non-null, however in places where
12104     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12105     */
12106    LDKnativeReadOnlyNetworkGraph *inner;
12107    /**
12108     * Indicates that this is the only struct which contains the same pointer.
12109     * Rust functions which take ownership of an object provided via an argument require
12110     * this to be true and invalidate the object pointed to by inner.
12111     */
12112    bool is_owned;
12113 } LDKReadOnlyNetworkGraph;
12114
12115
12116
12117 /**
12118  * Receives and validates network updates from peers,
12119  * stores authentic and relevant data as a network graph.
12120  * This network graph is then used for routing payments.
12121  * Provides interface to help with initial routing sync by
12122  * serving historical announcements.
12123  *
12124  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
12125  * [`NetworkGraph`].
12126  */
12127 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
12128    /**
12129     * A pointer to the opaque Rust object.
12130     * Nearly everywhere, inner must be non-null, however in places where
12131     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12132     */
12133    LDKnativeP2PGossipSync *inner;
12134    /**
12135     * Indicates that this is the only struct which contains the same pointer.
12136     * Rust functions which take ownership of an object provided via an argument require
12137     * this to be true and invalidate the object pointed to by inner.
12138     */
12139    bool is_owned;
12140 } LDKP2PGossipSync;
12141
12142
12143
12144 /**
12145  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
12146  * source node to a target node.
12147  */
12148 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
12149    /**
12150     * A pointer to the opaque Rust object.
12151     * Nearly everywhere, inner must be non-null, however in places where
12152     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12153     */
12154    LDKnativeDirectedChannelInfo *inner;
12155    /**
12156     * Indicates that this is the only struct which contains the same pointer.
12157     * Rust functions which take ownership of an object provided via an argument require
12158     * this to be true and invalidate the object pointed to by inner.
12159     */
12160    bool is_owned;
12161 } LDKDirectedChannelInfo;
12162
12163 /**
12164  * The effective capacity of a channel for routing purposes.
12165  *
12166  * While this may be smaller than the actual channel capacity, amounts greater than
12167  * [`Self::as_msat`] should not be routed through the channel.
12168  */
12169 typedef enum LDKEffectiveCapacity_Tag {
12170    /**
12171     * The available liquidity in the channel known from being a channel counterparty, and thus a
12172     * direct hop.
12173     */
12174    LDKEffectiveCapacity_ExactLiquidity,
12175    /**
12176     * The maximum HTLC amount in one direction as advertised on the gossip network.
12177     */
12178    LDKEffectiveCapacity_MaximumHTLC,
12179    /**
12180     * The total capacity of the channel as determined by the funding transaction.
12181     */
12182    LDKEffectiveCapacity_Total,
12183    /**
12184     * A capacity sufficient to route any payment, typically used for private channels provided by
12185     * an invoice.
12186     */
12187    LDKEffectiveCapacity_Infinite,
12188    /**
12189     * A capacity that is unknown possibly because either the chain state is unavailable to know
12190     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
12191     */
12192    LDKEffectiveCapacity_Unknown,
12193    /**
12194     * Must be last for serialization purposes
12195     */
12196    LDKEffectiveCapacity_Sentinel,
12197 } LDKEffectiveCapacity_Tag;
12198
12199 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
12200    /**
12201     * Either the inbound or outbound liquidity depending on the direction, denominated in
12202     * millisatoshi.
12203     */
12204    uint64_t liquidity_msat;
12205 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
12206
12207 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
12208    /**
12209     * The maximum HTLC amount denominated in millisatoshi.
12210     */
12211    uint64_t amount_msat;
12212 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
12213
12214 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
12215    /**
12216     * The funding amount denominated in millisatoshi.
12217     */
12218    uint64_t capacity_msat;
12219 } LDKEffectiveCapacity_LDKTotal_Body;
12220
12221 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
12222    LDKEffectiveCapacity_Tag tag;
12223    union {
12224       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
12225       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
12226       LDKEffectiveCapacity_LDKTotal_Body total;
12227    };
12228 } LDKEffectiveCapacity;
12229
12230 /**
12231  * A scorer that is accessed under a lock.
12232  *
12233  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
12234  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
12235  * implementations. Internal locking would be detrimental to route finding performance and could
12236  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
12237  *
12238  * [`find_route`]: crate::routing::router::find_route
12239  */
12240 typedef struct LDKLockableScore {
12241    /**
12242     * An opaque pointer which is passed to your function implementations as an argument.
12243     * This has no meaning in the LDK, and can be NULL or any other value.
12244     */
12245    void *this_arg;
12246    /**
12247     * Returns the locked scorer.
12248     */
12249    struct LDKScore (*lock)(const void *this_arg);
12250    /**
12251     * Frees any resources associated with this object given its this_arg pointer.
12252     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12253     */
12254    void (*free)(void *this_arg);
12255 } LDKLockableScore;
12256
12257
12258
12259 /**
12260  * Parameters for configuring [`ProbabilisticScorer`].
12261  *
12262  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
12263  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
12264  */
12265 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
12266    /**
12267     * A pointer to the opaque Rust object.
12268     * Nearly everywhere, inner must be non-null, however in places where
12269     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12270     */
12271    LDKnativeProbabilisticScoringParameters *inner;
12272    /**
12273     * Indicates that this is the only struct which contains the same pointer.
12274     * Rust functions which take ownership of an object provided via an argument require
12275     * this to be true and invalidate the object pointed to by inner.
12276     */
12277    bool is_owned;
12278 } LDKProbabilisticScoringParameters;
12279
12280
12281
12282 /**
12283  * FilesystemPersister persists channel data on disk, where each channel's
12284  * data is stored in a file named after its funding outpoint.
12285  *
12286  * Warning: this module does the best it can with calls to persist data, but it
12287  * can only guarantee that the data is passed to the drive. It is up to the
12288  * drive manufacturers to do the actual persistence properly, which they often
12289  * don't (especially on consumer-grade hardware). Therefore, it is up to the
12290  * user to validate their entire storage stack, to ensure the writes are
12291  * persistent.
12292  * Corollary: especially when dealing with larger amounts of money, it is best
12293  * practice to have multiple channel data backups and not rely only on one
12294  * FilesystemPersister.
12295  */
12296 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
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    LDKnativeFilesystemPersister *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 } LDKFilesystemPersister;
12310
12311
12312
12313 /**
12314  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
12315  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
12316  * responsibilities are:
12317  * * Processing [`Event`]s with a user-provided [`EventHandler`].
12318  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
12319  *   writing it to disk/backups by invoking the callback given to it at startup.
12320  *   [`ChannelManager`] persistence should be done in the background.
12321  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
12322  *   at the appropriate intervals.
12323  * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
12324  *   is provided to [`BackgroundProcessor::start`]).
12325  *
12326  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
12327  * upon as doing so may result in high latency.
12328  *
12329  * # Note
12330  *
12331  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
12332  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
12333  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
12334  * unilateral chain closure fees are at risk.
12335  *
12336  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
12337  * [`Event`]: lightning::util::events::Event
12338  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
12339  */
12340 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
12341    /**
12342     * A pointer to the opaque Rust object.
12343     * Nearly everywhere, inner must be non-null, however in places where
12344     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12345     */
12346    LDKnativeBackgroundProcessor *inner;
12347    /**
12348     * Indicates that this is the only struct which contains the same pointer.
12349     * Rust functions which take ownership of an object provided via an argument require
12350     * this to be true and invalidate the object pointed to by inner.
12351     */
12352    bool is_owned;
12353 } LDKBackgroundProcessor;
12354
12355
12356
12357 /**
12358  * Rapid Gossip Sync struct
12359  * See [crate-level documentation] for usage.
12360  *
12361  * [crate-level documentation]: crate
12362  */
12363 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
12364    /**
12365     * A pointer to the opaque Rust object.
12366     * Nearly everywhere, inner must be non-null, however in places where
12367     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12368     */
12369    LDKnativeRapidGossipSync *inner;
12370    /**
12371     * Indicates that this is the only struct which contains the same pointer.
12372     * Rust functions which take ownership of an object provided via an argument require
12373     * this to be true and invalidate the object pointed to by inner.
12374     */
12375    bool is_owned;
12376 } LDKRapidGossipSync;
12377
12378 /**
12379  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
12380  */
12381 typedef enum LDKGossipSync_Tag {
12382    /**
12383     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
12384     */
12385    LDKGossipSync_P2P,
12386    /**
12387     * Rapid gossip sync from a trusted server.
12388     */
12389    LDKGossipSync_Rapid,
12390    /**
12391     * No gossip sync.
12392     */
12393    LDKGossipSync_None,
12394    /**
12395     * Must be last for serialization purposes
12396     */
12397    LDKGossipSync_Sentinel,
12398 } LDKGossipSync_Tag;
12399
12400 typedef struct MUST_USE_STRUCT LDKGossipSync {
12401    LDKGossipSync_Tag tag;
12402    union {
12403       struct {
12404          /**
12405           * Note that this field is expected to be a reference.
12406           */
12407          struct LDKP2PGossipSync p2p;
12408       };
12409       struct {
12410          /**
12411           * Note that this field is expected to be a reference.
12412           */
12413          struct LDKRapidGossipSync rapid;
12414       };
12415    };
12416 } LDKGossipSync;
12417
12418
12419
12420 /**
12421  * Data of the `RawInvoice` that is encoded in the data part
12422  */
12423 typedef struct MUST_USE_STRUCT LDKRawDataPart {
12424    /**
12425     * A pointer to the opaque Rust object.
12426     * Nearly everywhere, inner must be non-null, however in places where
12427     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12428     */
12429    LDKnativeRawDataPart *inner;
12430    /**
12431     * Indicates that this is the only struct which contains the same pointer.
12432     * Rust functions which take ownership of an object provided via an argument require
12433     * this to be true and invalidate the object pointed to by inner.
12434     */
12435    bool is_owned;
12436 } LDKRawDataPart;
12437
12438
12439
12440 /**
12441  * SHA-256 hash
12442  */
12443 typedef struct MUST_USE_STRUCT LDKSha256 {
12444    /**
12445     * A pointer to the opaque Rust object.
12446     * Nearly everywhere, inner must be non-null, however in places where
12447     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12448     */
12449    LDKnativeSha256 *inner;
12450    /**
12451     * Indicates that this is the only struct which contains the same pointer.
12452     * Rust functions which take ownership of an object provided via an argument require
12453     * this to be true and invalidate the object pointed to by inner.
12454     */
12455    bool is_owned;
12456 } LDKSha256;
12457
12458
12459
12460 /**
12461  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
12462  * expires
12463  */
12464 typedef struct MUST_USE_STRUCT LDKExpiryTime {
12465    /**
12466     * A pointer to the opaque Rust object.
12467     * Nearly everywhere, inner must be non-null, however in places where
12468     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12469     */
12470    LDKnativeExpiryTime *inner;
12471    /**
12472     * Indicates that this is the only struct which contains the same pointer.
12473     * Rust functions which take ownership of an object provided via an argument require
12474     * this to be true and invalidate the object pointed to by inner.
12475     */
12476    bool is_owned;
12477 } LDKExpiryTime;
12478
12479
12480
12481 /**
12482  * `min_final_cltv_expiry` to use for the last HTLC in the route
12483  */
12484 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
12485    /**
12486     * A pointer to the opaque Rust object.
12487     * Nearly everywhere, inner must be non-null, however in places where
12488     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12489     */
12490    LDKnativeMinFinalCltvExpiry *inner;
12491    /**
12492     * Indicates that this is the only struct which contains the same pointer.
12493     * Rust functions which take ownership of an object provided via an argument require
12494     * this to be true and invalidate the object pointed to by inner.
12495     */
12496    bool is_owned;
12497 } LDKMinFinalCltvExpiry;
12498
12499 /**
12500  * A 20-byte byte array.
12501  */
12502 typedef struct LDKTwentyBytes {
12503    /**
12504     * The twenty bytes
12505     */
12506    uint8_t data[20];
12507 } LDKTwentyBytes;
12508
12509 /**
12510  * Fallback address in case no LN payment is possible
12511  */
12512 typedef enum LDKFallback_Tag {
12513    LDKFallback_SegWitProgram,
12514    LDKFallback_PubKeyHash,
12515    LDKFallback_ScriptHash,
12516    /**
12517     * Must be last for serialization purposes
12518     */
12519    LDKFallback_Sentinel,
12520 } LDKFallback_Tag;
12521
12522 typedef struct LDKFallback_LDKSegWitProgram_Body {
12523    struct LDKu5 version;
12524    struct LDKCVec_u8Z program;
12525 } LDKFallback_LDKSegWitProgram_Body;
12526
12527 typedef struct MUST_USE_STRUCT LDKFallback {
12528    LDKFallback_Tag tag;
12529    union {
12530       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
12531       struct {
12532          struct LDKTwentyBytes pub_key_hash;
12533       };
12534       struct {
12535          struct LDKTwentyBytes script_hash;
12536       };
12537    };
12538 } LDKFallback;
12539
12540 /**
12541  * A trait defining behavior of an [`Invoice`] payer.
12542  */
12543 typedef struct LDKPayer {
12544    /**
12545     * An opaque pointer which is passed to your function implementations as an argument.
12546     * This has no meaning in the LDK, and can be NULL or any other value.
12547     */
12548    void *this_arg;
12549    /**
12550     * Returns the payer's node id.
12551     */
12552    struct LDKPublicKey (*node_id)(const void *this_arg);
12553    /**
12554     * Returns the payer's channels.
12555     */
12556    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
12557    /**
12558     * Sends a payment over the Lightning Network using the given [`Route`].
12559     *
12560     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
12561     */
12562    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
12563    /**
12564     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
12565     */
12566    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
12567    /**
12568     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
12569     */
12570    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
12571    /**
12572     * Signals that no further retries for the given payment will occur.
12573     */
12574    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
12575    /**
12576     * Frees any resources associated with this object given its this_arg pointer.
12577     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12578     */
12579    void (*free)(void *this_arg);
12580 } LDKPayer;
12581
12582 /**
12583  * A trait defining behavior for routing an [`Invoice`] payment.
12584  */
12585 typedef struct LDKRouter {
12586    /**
12587     * An opaque pointer which is passed to your function implementations as an argument.
12588     * This has no meaning in the LDK, and can be NULL or any other value.
12589     */
12590    void *this_arg;
12591    /**
12592     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
12593     *
12594     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
12595     */
12596    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);
12597    /**
12598     * Frees any resources associated with this object given its this_arg pointer.
12599     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12600     */
12601    void (*free)(void *this_arg);
12602 } LDKRouter;
12603
12604
12605
12606 /**
12607  * A utility for paying [`Invoice`]s and sending spontaneous payments.
12608  *
12609  * See [module-level documentation] for details.
12610  *
12611  * [module-level documentation]: crate::payment
12612  */
12613 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
12614    /**
12615     * A pointer to the opaque Rust object.
12616     * Nearly everywhere, inner must be non-null, however in places where
12617     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12618     */
12619    LDKnativeInvoicePayer *inner;
12620    /**
12621     * Indicates that this is the only struct which contains the same pointer.
12622     * Rust functions which take ownership of an object provided via an argument require
12623     * this to be true and invalidate the object pointed to by inner.
12624     */
12625    bool is_owned;
12626 } LDKInvoicePayer;
12627
12628 /**
12629  * Strategies available to retry payment path failures for an [`Invoice`].
12630  *
12631  */
12632 typedef enum LDKRetry_Tag {
12633    /**
12634     * Max number of attempts to retry payment.
12635     *
12636     * Note that this is the number of *path* failures, not full payment retries. For multi-path
12637     * payments, if this is less than the total number of paths, we will never even retry all of the
12638     * payment's paths.
12639     */
12640    LDKRetry_Attempts,
12641    /**
12642     * Time elapsed before abandoning retries for a payment.
12643     */
12644    LDKRetry_Timeout,
12645    /**
12646     * Must be last for serialization purposes
12647     */
12648    LDKRetry_Sentinel,
12649 } LDKRetry_Tag;
12650
12651 typedef struct MUST_USE_STRUCT LDKRetry {
12652    LDKRetry_Tag tag;
12653    union {
12654       struct {
12655          uintptr_t attempts;
12656       };
12657       struct {
12658          uint64_t timeout;
12659       };
12660    };
12661 } LDKRetry;
12662
12663
12664
12665 /**
12666  * A [`Router`] implemented using [`find_route`].
12667  */
12668 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
12669    /**
12670     * A pointer to the opaque Rust object.
12671     * Nearly everywhere, inner must be non-null, however in places where
12672     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12673     */
12674    LDKnativeDefaultRouter *inner;
12675    /**
12676     * Indicates that this is the only struct which contains the same pointer.
12677     * Rust functions which take ownership of an object provided via an argument require
12678     * this to be true and invalidate the object pointed to by inner.
12679     */
12680    bool is_owned;
12681 } LDKDefaultRouter;
12682
12683 extern const uintptr_t MAX_BUF_SIZE;
12684
12685 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
12686
12687 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
12688
12689 extern const uint32_t ANTI_REORG_DELAY;
12690
12691 extern const uint16_t BREAKDOWN_TIMEOUT;
12692
12693 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
12694
12695 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
12696
12697 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
12698
12699 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
12700
12701 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
12702
12703 extern const uint64_t MAX_TIMESTAMP;
12704
12705 extern const uint64_t DEFAULT_EXPIRY_TIME;
12706
12707 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
12708
12709 extern const uint8_t TAG_PAYMENT_HASH;
12710
12711 extern const uint8_t TAG_DESCRIPTION;
12712
12713 extern const uint8_t TAG_PAYEE_PUB_KEY;
12714
12715 extern const uint8_t TAG_DESCRIPTION_HASH;
12716
12717 extern const uint8_t TAG_EXPIRY_TIME;
12718
12719 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
12720
12721 extern const uint8_t TAG_FALLBACK;
12722
12723 extern const uint8_t TAG_PRIVATE_ROUTE;
12724
12725 extern const uint8_t TAG_PAYMENT_SECRET;
12726
12727 extern const uint8_t TAG_FEATURES;
12728
12729 struct LDKStr _ldk_get_compiled_version(void);
12730
12731 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
12732
12733 /**
12734  * Creates a new Bech32Error which has the same data as `orig`
12735  */
12736 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
12737
12738 /**
12739  * Releases any memory held by the given `Bech32Error` (which is currently none)
12740  */
12741 void Bech32Error_free(struct LDKBech32Error o);
12742
12743 /**
12744  * Frees the data buffer, if data_is_owned is set and datalen > 0.
12745  */
12746 void Transaction_free(struct LDKTransaction _res);
12747
12748 /**
12749  * Convenience function for constructing a new TxOut
12750  */
12751 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
12752
12753 /**
12754  * Frees the data pointed to by script_pubkey.
12755  */
12756 void TxOut_free(struct LDKTxOut _res);
12757
12758 /**
12759  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
12760  */
12761 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
12762
12763 /**
12764  * Frees the data buffer, if chars_is_owned is set and len > 0.
12765  */
12766 void Str_free(struct LDKStr _res);
12767
12768 #if defined(LDK_DEBUG_BUILD)
12769 /**
12770  * This function exists for memory safety testing purposes. It should never be used in production
12771  * code
12772  */
12773 const void *__unmangle_inner_ptr(const void *ptr);
12774 #endif
12775
12776 /**
12777  * Creates a new CResult_NoneNoneZ in the success state.
12778  */
12779 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
12780
12781 /**
12782  * Creates a new CResult_NoneNoneZ in the error state.
12783  */
12784 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
12785
12786 /**
12787  * Checks if the given object is currently in the success state
12788  */
12789 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
12790
12791 /**
12792  * Frees any resources used by the CResult_NoneNoneZ.
12793  */
12794 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
12795
12796 /**
12797  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
12798  * but with all dynamically-allocated buffers duplicated in new buffers.
12799  */
12800 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
12801
12802 /**
12803  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
12804  */
12805 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
12806
12807 /**
12808  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
12809  */
12810 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
12811
12812 /**
12813  * Checks if the given object is currently in the success state
12814  */
12815 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
12816
12817 /**
12818  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
12819  */
12820 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
12821
12822 /**
12823  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
12824  * but with all dynamically-allocated buffers duplicated in new buffers.
12825  */
12826 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
12827
12828 /**
12829  * Creates a new CResult_SecretKeyErrorZ in the success state.
12830  */
12831 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
12832
12833 /**
12834  * Creates a new CResult_SecretKeyErrorZ in the error state.
12835  */
12836 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
12837
12838 /**
12839  * Checks if the given object is currently in the success state
12840  */
12841 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
12842
12843 /**
12844  * Frees any resources used by the CResult_SecretKeyErrorZ.
12845  */
12846 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
12847
12848 /**
12849  * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
12850  * but with all dynamically-allocated buffers duplicated in new buffers.
12851  */
12852 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
12853
12854 /**
12855  * Creates a new CResult_PublicKeyErrorZ in the success state.
12856  */
12857 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
12858
12859 /**
12860  * Creates a new CResult_PublicKeyErrorZ in the error state.
12861  */
12862 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
12863
12864 /**
12865  * Checks if the given object is currently in the success state
12866  */
12867 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
12868
12869 /**
12870  * Frees any resources used by the CResult_PublicKeyErrorZ.
12871  */
12872 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
12873
12874 /**
12875  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
12876  * but with all dynamically-allocated buffers duplicated in new buffers.
12877  */
12878 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
12879
12880 /**
12881  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
12882  */
12883 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
12884
12885 /**
12886  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
12887  */
12888 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
12889
12890 /**
12891  * Checks if the given object is currently in the success state
12892  */
12893 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
12894
12895 /**
12896  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
12897  */
12898 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
12899
12900 /**
12901  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
12902  * but with all dynamically-allocated buffers duplicated in new buffers.
12903  */
12904 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
12905
12906 /**
12907  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
12908  */
12909 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
12910
12911 /**
12912  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
12913  */
12914 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
12915
12916 /**
12917  * Checks if the given object is currently in the success state
12918  */
12919 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
12920
12921 /**
12922  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
12923  */
12924 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
12925
12926 /**
12927  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
12928  * but with all dynamically-allocated buffers duplicated in new buffers.
12929  */
12930 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
12931
12932 /**
12933  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
12934  */
12935 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
12936
12937 /**
12938  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
12939  */
12940 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
12941
12942 /**
12943  * Checks if the given object is currently in the success state
12944  */
12945 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
12946
12947 /**
12948  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
12949  */
12950 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
12951
12952 /**
12953  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
12954  * but with all dynamically-allocated buffers duplicated in new buffers.
12955  */
12956 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
12957
12958 /**
12959  * Constructs a new COption_u32Z containing a u32
12960  */
12961 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
12962
12963 /**
12964  * Constructs a new COption_u32Z containing nothing
12965  */
12966 struct LDKCOption_u32Z COption_u32Z_none(void);
12967
12968 /**
12969  * Frees any resources associated with the u32, if we are in the Some state
12970  */
12971 void COption_u32Z_free(struct LDKCOption_u32Z _res);
12972
12973 /**
12974  * Creates a new COption_u32Z which has the same data as `orig`
12975  * but with all dynamically-allocated buffers duplicated in new buffers.
12976  */
12977 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
12978
12979 /**
12980  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
12981  */
12982 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
12983
12984 /**
12985  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
12986  */
12987 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
12988
12989 /**
12990  * Checks if the given object is currently in the success state
12991  */
12992 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
12993
12994 /**
12995  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
12996  */
12997 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
12998
12999 /**
13000  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
13001  * but with all dynamically-allocated buffers duplicated in new buffers.
13002  */
13003 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
13004
13005 /**
13006  * Constructs a new COption_NoneZ containing a
13007  */
13008 enum LDKCOption_NoneZ COption_NoneZ_some(void);
13009
13010 /**
13011  * Constructs a new COption_NoneZ containing nothing
13012  */
13013 enum LDKCOption_NoneZ COption_NoneZ_none(void);
13014
13015 /**
13016  * Frees any resources associated with the , if we are in the Some state
13017  */
13018 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
13019
13020 /**
13021  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
13022  */
13023 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
13024
13025 /**
13026  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
13027  */
13028 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
13029
13030 /**
13031  * Checks if the given object is currently in the success state
13032  */
13033 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
13034
13035 /**
13036  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
13037  */
13038 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
13039
13040 /**
13041  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
13042  * but with all dynamically-allocated buffers duplicated in new buffers.
13043  */
13044 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
13045
13046 /**
13047  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
13048  */
13049 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
13050
13051 /**
13052  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
13053  */
13054 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
13055
13056 /**
13057  * Checks if the given object is currently in the success state
13058  */
13059 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
13060
13061 /**
13062  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
13063  */
13064 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
13065
13066 /**
13067  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
13068  * but with all dynamically-allocated buffers duplicated in new buffers.
13069  */
13070 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
13071
13072 /**
13073  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13074  */
13075 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
13076
13077 /**
13078  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
13079  */
13080 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
13081
13082 /**
13083  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
13084  */
13085 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13086
13087 /**
13088  * Checks if the given object is currently in the success state
13089  */
13090 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13091
13092 /**
13093  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
13094  */
13095 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
13096
13097 /**
13098  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
13099  * but with all dynamically-allocated buffers duplicated in new buffers.
13100  */
13101 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13102
13103 /**
13104  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
13105  */
13106 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
13107
13108 /**
13109  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
13110  */
13111 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13112
13113 /**
13114  * Checks if the given object is currently in the success state
13115  */
13116 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13117
13118 /**
13119  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
13120  */
13121 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
13122
13123 /**
13124  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
13125  * but with all dynamically-allocated buffers duplicated in new buffers.
13126  */
13127 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13128
13129 /**
13130  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
13131  */
13132 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
13133
13134 /**
13135  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
13136  */
13137 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
13138
13139 /**
13140  * Checks if the given object is currently in the success state
13141  */
13142 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
13143
13144 /**
13145  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
13146  */
13147 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
13148
13149 /**
13150  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
13151  */
13152 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
13153
13154 /**
13155  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
13156  */
13157 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13158
13159 /**
13160  * Checks if the given object is currently in the success state
13161  */
13162 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13163
13164 /**
13165  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
13166  */
13167 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
13168
13169 /**
13170  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
13171  * but with all dynamically-allocated buffers duplicated in new buffers.
13172  */
13173 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13174
13175 /**
13176  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
13177  */
13178 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
13179
13180 /**
13181  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
13182  */
13183 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
13184
13185 /**
13186  * Checks if the given object is currently in the success state
13187  */
13188 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
13189
13190 /**
13191  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
13192  */
13193 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
13194
13195 /**
13196  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
13197  */
13198 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
13199
13200 /**
13201  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
13202  */
13203 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
13204
13205 /**
13206  * Checks if the given object is currently in the success state
13207  */
13208 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
13209
13210 /**
13211  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
13212  */
13213 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
13214
13215 /**
13216  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
13217  * but with all dynamically-allocated buffers duplicated in new buffers.
13218  */
13219 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
13220
13221 /**
13222  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
13223  */
13224 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
13225
13226 /**
13227  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
13228  */
13229 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
13230
13231 /**
13232  * Checks if the given object is currently in the success state
13233  */
13234 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
13235
13236 /**
13237  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
13238  */
13239 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
13240
13241 /**
13242  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
13243  * but with all dynamically-allocated buffers duplicated in new buffers.
13244  */
13245 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
13246
13247 /**
13248  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
13249  */
13250 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
13251
13252 /**
13253  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
13254  */
13255 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
13256
13257 /**
13258  * Checks if the given object is currently in the success state
13259  */
13260 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
13261
13262 /**
13263  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
13264  */
13265 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
13266
13267 /**
13268  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
13269  * but with all dynamically-allocated buffers duplicated in new buffers.
13270  */
13271 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
13272
13273 /**
13274  * Creates a new CResult_NoneErrorZ in the success state.
13275  */
13276 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
13277
13278 /**
13279  * Creates a new CResult_NoneErrorZ in the error state.
13280  */
13281 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
13282
13283 /**
13284  * Checks if the given object is currently in the success state
13285  */
13286 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
13287
13288 /**
13289  * Frees any resources used by the CResult_NoneErrorZ.
13290  */
13291 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
13292
13293 /**
13294  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
13295  * but with all dynamically-allocated buffers duplicated in new buffers.
13296  */
13297 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
13298
13299 /**
13300  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
13301  */
13302 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
13303
13304 /**
13305  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
13306  */
13307 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
13308
13309 /**
13310  * Checks if the given object is currently in the success state
13311  */
13312 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
13313
13314 /**
13315  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
13316  */
13317 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
13318
13319 /**
13320  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
13321  * but with all dynamically-allocated buffers duplicated in new buffers.
13322  */
13323 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
13324
13325 /**
13326  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13327  */
13328 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
13329
13330 /**
13331  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13332  */
13333 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
13334
13335 /**
13336  * Creates a new CResult_RouteDecodeErrorZ in the success state.
13337  */
13338 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
13339
13340 /**
13341  * Creates a new CResult_RouteDecodeErrorZ in the error state.
13342  */
13343 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
13344
13345 /**
13346  * Checks if the given object is currently in the success state
13347  */
13348 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
13349
13350 /**
13351  * Frees any resources used by the CResult_RouteDecodeErrorZ.
13352  */
13353 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
13354
13355 /**
13356  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
13357  * but with all dynamically-allocated buffers duplicated in new buffers.
13358  */
13359 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
13360
13361 /**
13362  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
13363  */
13364 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
13365
13366 /**
13367  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
13368  */
13369 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
13370
13371 /**
13372  * Checks if the given object is currently in the success state
13373  */
13374 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
13375
13376 /**
13377  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
13378  */
13379 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
13380
13381 /**
13382  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
13383  * but with all dynamically-allocated buffers duplicated in new buffers.
13384  */
13385 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
13386
13387 /**
13388  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13389  */
13390 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
13391
13392 /**
13393  * Constructs a new COption_u64Z containing a u64
13394  */
13395 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
13396
13397 /**
13398  * Constructs a new COption_u64Z containing nothing
13399  */
13400 struct LDKCOption_u64Z COption_u64Z_none(void);
13401
13402 /**
13403  * Frees any resources associated with the u64, if we are in the Some state
13404  */
13405 void COption_u64Z_free(struct LDKCOption_u64Z _res);
13406
13407 /**
13408  * Creates a new COption_u64Z which has the same data as `orig`
13409  * but with all dynamically-allocated buffers duplicated in new buffers.
13410  */
13411 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
13412
13413 /**
13414  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
13415  */
13416 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
13417
13418 /**
13419  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
13420  */
13421 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
13422
13423 /**
13424  * Checks if the given object is currently in the success state
13425  */
13426 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
13427
13428 /**
13429  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
13430  */
13431 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
13432
13433 /**
13434  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
13435  * but with all dynamically-allocated buffers duplicated in new buffers.
13436  */
13437 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
13438
13439 /**
13440  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13441  */
13442 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
13443
13444 /**
13445  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
13446  */
13447 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
13448
13449 /**
13450  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
13451  */
13452 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
13453
13454 /**
13455  * Checks if the given object is currently in the success state
13456  */
13457 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
13458
13459 /**
13460  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
13461  */
13462 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
13463
13464 /**
13465  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
13466  * but with all dynamically-allocated buffers duplicated in new buffers.
13467  */
13468 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
13469
13470 /**
13471  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
13472  */
13473 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
13474
13475 /**
13476  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
13477  */
13478 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
13479
13480 /**
13481  * Checks if the given object is currently in the success state
13482  */
13483 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
13484
13485 /**
13486  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
13487  */
13488 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
13489
13490 /**
13491  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
13492  * but with all dynamically-allocated buffers duplicated in new buffers.
13493  */
13494 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
13495
13496 /**
13497  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13498  */
13499 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
13500
13501 /**
13502  * Creates a new CResult_RouteLightningErrorZ in the success state.
13503  */
13504 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
13505
13506 /**
13507  * Creates a new CResult_RouteLightningErrorZ in the error state.
13508  */
13509 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
13510
13511 /**
13512  * Checks if the given object is currently in the success state
13513  */
13514 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
13515
13516 /**
13517  * Frees any resources used by the CResult_RouteLightningErrorZ.
13518  */
13519 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
13520
13521 /**
13522  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
13523  * but with all dynamically-allocated buffers duplicated in new buffers.
13524  */
13525 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
13526
13527 /**
13528  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13529  */
13530 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
13531
13532 /**
13533  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
13534  */
13535 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
13536
13537 /**
13538  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
13539  */
13540 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
13541
13542 /**
13543  * Checks if the given object is currently in the success state
13544  */
13545 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
13546
13547 /**
13548  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
13549  */
13550 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
13551
13552 /**
13553  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
13554  * but with all dynamically-allocated buffers duplicated in new buffers.
13555  */
13556 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
13557
13558 /**
13559  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
13560  */
13561 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
13562
13563 /**
13564  * Constructs a new COption_ClosureReasonZ containing nothing
13565  */
13566 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
13567
13568 /**
13569  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
13570  */
13571 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
13572
13573 /**
13574  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
13575  * but with all dynamically-allocated buffers duplicated in new buffers.
13576  */
13577 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
13578
13579 /**
13580  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
13581  */
13582 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
13583
13584 /**
13585  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
13586  */
13587 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
13588
13589 /**
13590  * Checks if the given object is currently in the success state
13591  */
13592 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
13593
13594 /**
13595  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
13596  */
13597 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
13598
13599 /**
13600  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
13601  * but with all dynamically-allocated buffers duplicated in new buffers.
13602  */
13603 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
13604
13605 /**
13606  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
13607  */
13608 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
13609
13610 /**
13611  * Constructs a new COption_NetworkUpdateZ containing nothing
13612  */
13613 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
13614
13615 /**
13616  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
13617  */
13618 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
13619
13620 /**
13621  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
13622  * but with all dynamically-allocated buffers duplicated in new buffers.
13623  */
13624 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
13625
13626 /**
13627  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13628  */
13629 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
13630
13631 /**
13632  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
13633  */
13634 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
13635
13636 /**
13637  * Constructs a new COption_EventZ containing nothing
13638  */
13639 struct LDKCOption_EventZ COption_EventZ_none(void);
13640
13641 /**
13642  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
13643  */
13644 void COption_EventZ_free(struct LDKCOption_EventZ _res);
13645
13646 /**
13647  * Creates a new COption_EventZ which has the same data as `orig`
13648  * but with all dynamically-allocated buffers duplicated in new buffers.
13649  */
13650 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
13651
13652 /**
13653  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
13654  */
13655 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
13656
13657 /**
13658  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
13659  */
13660 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
13661
13662 /**
13663  * Checks if the given object is currently in the success state
13664  */
13665 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
13666
13667 /**
13668  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
13669  */
13670 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
13671
13672 /**
13673  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
13674  * but with all dynamically-allocated buffers duplicated in new buffers.
13675  */
13676 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
13677
13678 /**
13679  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13680  */
13681 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
13682
13683 /**
13684  * Creates a new CResult_TxOutAccessErrorZ in the success state.
13685  */
13686 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
13687
13688 /**
13689  * Creates a new CResult_TxOutAccessErrorZ in the error state.
13690  */
13691 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
13692
13693 /**
13694  * Checks if the given object is currently in the success state
13695  */
13696 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
13697
13698 /**
13699  * Frees any resources used by the CResult_TxOutAccessErrorZ.
13700  */
13701 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
13702
13703 /**
13704  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
13705  * but with all dynamically-allocated buffers duplicated in new buffers.
13706  */
13707 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
13708
13709 /**
13710  * Creates a new tuple which has the same data as `orig`
13711  * but with all dynamically-allocated buffers duplicated in new buffers.
13712  */
13713 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
13714
13715 /**
13716  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
13717  */
13718 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
13719
13720 /**
13721  * Frees any resources used by the C2Tuple_usizeTransactionZ.
13722  */
13723 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
13724
13725 /**
13726  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13727  */
13728 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
13729
13730 /**
13731  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13732  */
13733 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
13734
13735 /**
13736  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
13737  */
13738 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
13739
13740 /**
13741  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
13742  */
13743 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
13744
13745 /**
13746  * Checks if the given object is currently in the success state
13747  */
13748 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
13749
13750 /**
13751  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
13752  */
13753 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
13754
13755 /**
13756  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
13757  * but with all dynamically-allocated buffers duplicated in new buffers.
13758  */
13759 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
13760
13761 /**
13762  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13763  */
13764 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
13765
13766 /**
13767  * Creates a new tuple which has the same data as `orig`
13768  * but with all dynamically-allocated buffers duplicated in new buffers.
13769  */
13770 struct LDKC2Tuple_OutPointCVec_MonitorEventZZ C2Tuple_OutPointCVec_MonitorEventZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorEventZZ *NONNULL_PTR orig);
13771
13772 /**
13773  * Creates a new C2Tuple_OutPointCVec_MonitorEventZZ from the contained elements.
13774  */
13775 struct LDKC2Tuple_OutPointCVec_MonitorEventZZ C2Tuple_OutPointCVec_MonitorEventZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b);
13776
13777 /**
13778  * Frees any resources used by the C2Tuple_OutPointCVec_MonitorEventZZ.
13779  */
13780 void C2Tuple_OutPointCVec_MonitorEventZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorEventZZ _res);
13781
13782 /**
13783  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13784  */
13785 void CVec_C2Tuple_OutPointCVec_MonitorEventZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorEventZZZ _res);
13786
13787 /**
13788  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
13789  */
13790 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
13791
13792 /**
13793  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
13794  */
13795 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
13796
13797 /**
13798  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
13799  */
13800 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
13801
13802 /**
13803  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
13804  * but with all dynamically-allocated buffers duplicated in new buffers.
13805  */
13806 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
13807
13808 /**
13809  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
13810  */
13811 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
13812
13813 /**
13814  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
13815  */
13816 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
13817
13818 /**
13819  * Checks if the given object is currently in the success state
13820  */
13821 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
13822
13823 /**
13824  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
13825  */
13826 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
13827
13828 /**
13829  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
13830  * but with all dynamically-allocated buffers duplicated in new buffers.
13831  */
13832 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
13833
13834 /**
13835  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
13836  */
13837 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
13838
13839 /**
13840  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
13841  */
13842 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
13843
13844 /**
13845  * Checks if the given object is currently in the success state
13846  */
13847 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
13848
13849 /**
13850  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
13851  */
13852 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
13853
13854 /**
13855  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
13856  */
13857 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
13858
13859 /**
13860  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
13861  */
13862 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13863
13864 /**
13865  * Checks if the given object is currently in the success state
13866  */
13867 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
13868
13869 /**
13870  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
13871  */
13872 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
13873
13874 /**
13875  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
13876  * but with all dynamically-allocated buffers duplicated in new buffers.
13877  */
13878 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
13879
13880 /**
13881  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
13882  */
13883 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
13884
13885 /**
13886  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
13887  */
13888 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13889
13890 /**
13891  * Checks if the given object is currently in the success state
13892  */
13893 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
13894
13895 /**
13896  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
13897  */
13898 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
13899
13900 /**
13901  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
13902  * but with all dynamically-allocated buffers duplicated in new buffers.
13903  */
13904 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
13905
13906 /**
13907  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
13908  */
13909 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
13910
13911 /**
13912  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
13913  */
13914 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13915
13916 /**
13917  * Checks if the given object is currently in the success state
13918  */
13919 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
13920
13921 /**
13922  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
13923  */
13924 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
13925
13926 /**
13927  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
13928  * but with all dynamically-allocated buffers duplicated in new buffers.
13929  */
13930 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
13931
13932 /**
13933  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
13934  */
13935 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
13936
13937 /**
13938  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
13939  */
13940 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13941
13942 /**
13943  * Checks if the given object is currently in the success state
13944  */
13945 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
13946
13947 /**
13948  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
13949  */
13950 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
13951
13952 /**
13953  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
13954  * but with all dynamically-allocated buffers duplicated in new buffers.
13955  */
13956 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
13957
13958 /**
13959  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
13960  */
13961 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
13962
13963 /**
13964  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
13965  */
13966 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
13967
13968 /**
13969  * Checks if the given object is currently in the success state
13970  */
13971 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
13972
13973 /**
13974  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
13975  */
13976 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
13977
13978 /**
13979  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
13980  * but with all dynamically-allocated buffers duplicated in new buffers.
13981  */
13982 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
13983
13984 /**
13985  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
13986  */
13987 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
13988
13989 /**
13990  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
13991  */
13992 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
13993
13994 /**
13995  * Checks if the given object is currently in the success state
13996  */
13997 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
13998
13999 /**
14000  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
14001  */
14002 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
14003
14004 /**
14005  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
14006  * but with all dynamically-allocated buffers duplicated in new buffers.
14007  */
14008 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
14009
14010 /**
14011  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
14012  */
14013 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
14014
14015 /**
14016  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
14017  */
14018 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
14019
14020 /**
14021  * Checks if the given object is currently in the success state
14022  */
14023 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
14024
14025 /**
14026  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
14027  */
14028 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
14029
14030 /**
14031  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
14032  * but with all dynamically-allocated buffers duplicated in new buffers.
14033  */
14034 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
14035
14036 /**
14037  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
14038  */
14039 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
14040
14041 /**
14042  * Constructs a new COption_AccessZ containing nothing
14043  */
14044 struct LDKCOption_AccessZ COption_AccessZ_none(void);
14045
14046 /**
14047  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
14048  */
14049 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
14050
14051 /**
14052  * Creates a new CResult_boolLightningErrorZ in the success state.
14053  */
14054 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
14055
14056 /**
14057  * Creates a new CResult_boolLightningErrorZ in the error state.
14058  */
14059 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
14060
14061 /**
14062  * Checks if the given object is currently in the success state
14063  */
14064 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
14065
14066 /**
14067  * Frees any resources used by the CResult_boolLightningErrorZ.
14068  */
14069 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
14070
14071 /**
14072  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
14073  * but with all dynamically-allocated buffers duplicated in new buffers.
14074  */
14075 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
14076
14077 /**
14078  * Creates a new tuple which has the same data as `orig`
14079  * but with all dynamically-allocated buffers duplicated in new buffers.
14080  */
14081 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
14082
14083 /**
14084  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
14085  */
14086 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
14087
14088 /**
14089  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
14090  */
14091 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
14092
14093 /**
14094  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14095  */
14096 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
14097
14098 /**
14099  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14100  */
14101 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
14102
14103 /**
14104  * Creates a new CResult_NoneLightningErrorZ in the success state.
14105  */
14106 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
14107
14108 /**
14109  * Creates a new CResult_NoneLightningErrorZ in the error state.
14110  */
14111 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
14112
14113 /**
14114  * Checks if the given object is currently in the success state
14115  */
14116 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
14117
14118 /**
14119  * Frees any resources used by the CResult_NoneLightningErrorZ.
14120  */
14121 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
14122
14123 /**
14124  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
14125  * but with all dynamically-allocated buffers duplicated in new buffers.
14126  */
14127 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
14128
14129 /**
14130  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
14131  */
14132 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
14133
14134 /**
14135  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
14136  */
14137 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
14138
14139 /**
14140  * Checks if the given object is currently in the success state
14141  */
14142 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
14143
14144 /**
14145  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
14146  */
14147 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
14148
14149 /**
14150  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
14151  * but with all dynamically-allocated buffers duplicated in new buffers.
14152  */
14153 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
14154
14155 /**
14156  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
14157  */
14158 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
14159
14160 /**
14161  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
14162  */
14163 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
14164
14165 /**
14166  * Checks if the given object is currently in the success state
14167  */
14168 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
14169
14170 /**
14171  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
14172  */
14173 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
14174
14175 /**
14176  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
14177  * but with all dynamically-allocated buffers duplicated in new buffers.
14178  */
14179 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
14180
14181 /**
14182  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
14183  */
14184 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
14185
14186 /**
14187  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
14188  */
14189 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
14190
14191 /**
14192  * Checks if the given object is currently in the success state
14193  */
14194 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
14195
14196 /**
14197  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
14198  */
14199 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
14200
14201 /**
14202  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
14203  * but with all dynamically-allocated buffers duplicated in new buffers.
14204  */
14205 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
14206
14207 /**
14208  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14209  */
14210 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
14211
14212 /**
14213  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
14214  */
14215 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
14216
14217 /**
14218  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
14219  */
14220 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
14221
14222 /**
14223  * Checks if the given object is currently in the success state
14224  */
14225 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
14226
14227 /**
14228  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
14229  */
14230 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
14231
14232 /**
14233  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
14234  * but with all dynamically-allocated buffers duplicated in new buffers.
14235  */
14236 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
14237
14238 /**
14239  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14240  */
14241 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
14242
14243 /**
14244  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
14245  */
14246 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
14247
14248 /**
14249  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
14250  */
14251 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
14252
14253 /**
14254  * Checks if the given object is currently in the success state
14255  */
14256 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
14257
14258 /**
14259  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
14260  */
14261 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
14262
14263 /**
14264  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
14265  * but with all dynamically-allocated buffers duplicated in new buffers.
14266  */
14267 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
14268
14269 /**
14270  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
14271  */
14272 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
14273
14274 /**
14275  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
14276  */
14277 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
14278
14279 /**
14280  * Checks if the given object is currently in the success state
14281  */
14282 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
14283
14284 /**
14285  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
14286  */
14287 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
14288
14289 /**
14290  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
14291  */
14292 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
14293
14294 /**
14295  * Constructs a new COption_CVec_NetAddressZZ containing nothing
14296  */
14297 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
14298
14299 /**
14300  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
14301  */
14302 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
14303
14304 /**
14305  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
14306  * but with all dynamically-allocated buffers duplicated in new buffers.
14307  */
14308 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
14309
14310 /**
14311  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
14312  */
14313 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
14314
14315 /**
14316  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
14317  */
14318 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14319
14320 /**
14321  * Checks if the given object is currently in the success state
14322  */
14323 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14324
14325 /**
14326  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
14327  */
14328 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
14329
14330 /**
14331  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
14332  * but with all dynamically-allocated buffers duplicated in new buffers.
14333  */
14334 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14335
14336 /**
14337  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
14338  */
14339 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
14340
14341 /**
14342  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
14343  */
14344 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14345
14346 /**
14347  * Checks if the given object is currently in the success state
14348  */
14349 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14350
14351 /**
14352  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
14353  */
14354 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
14355
14356 /**
14357  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
14358  * but with all dynamically-allocated buffers duplicated in new buffers.
14359  */
14360 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14361
14362 /**
14363  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
14364  */
14365 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
14366
14367 /**
14368  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
14369  */
14370 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14371
14372 /**
14373  * Checks if the given object is currently in the success state
14374  */
14375 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14376
14377 /**
14378  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
14379  */
14380 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
14381
14382 /**
14383  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
14384  * but with all dynamically-allocated buffers duplicated in new buffers.
14385  */
14386 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14387
14388 /**
14389  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14390  */
14391 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
14392
14393 /**
14394  * Creates a new tuple which has the same data as `orig`
14395  * but with all dynamically-allocated buffers duplicated in new buffers.
14396  */
14397 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
14398
14399 /**
14400  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
14401  */
14402 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
14403
14404 /**
14405  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
14406  */
14407 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
14408
14409 /**
14410  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
14411  */
14412 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
14413
14414 /**
14415  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
14416  */
14417 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
14418
14419 /**
14420  * Checks if the given object is currently in the success state
14421  */
14422 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
14423
14424 /**
14425  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
14426  */
14427 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
14428
14429 /**
14430  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
14431  * but with all dynamically-allocated buffers duplicated in new buffers.
14432  */
14433 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
14434
14435 /**
14436  * Creates a new CResult_SignatureNoneZ in the success state.
14437  */
14438 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
14439
14440 /**
14441  * Creates a new CResult_SignatureNoneZ in the error state.
14442  */
14443 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
14444
14445 /**
14446  * Checks if the given object is currently in the success state
14447  */
14448 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
14449
14450 /**
14451  * Frees any resources used by the CResult_SignatureNoneZ.
14452  */
14453 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
14454
14455 /**
14456  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
14457  * but with all dynamically-allocated buffers duplicated in new buffers.
14458  */
14459 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
14460
14461 /**
14462  * Creates a new tuple which has the same data as `orig`
14463  * but with all dynamically-allocated buffers duplicated in new buffers.
14464  */
14465 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
14466
14467 /**
14468  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
14469  */
14470 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
14471
14472 /**
14473  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
14474  */
14475 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
14476
14477 /**
14478  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
14479  */
14480 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
14481
14482 /**
14483  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
14484  */
14485 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
14486
14487 /**
14488  * Checks if the given object is currently in the success state
14489  */
14490 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
14491
14492 /**
14493  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
14494  */
14495 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
14496
14497 /**
14498  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
14499  * but with all dynamically-allocated buffers duplicated in new buffers.
14500  */
14501 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
14502
14503 /**
14504  * Creates a new CResult_SecretKeyNoneZ in the success state.
14505  */
14506 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
14507
14508 /**
14509  * Creates a new CResult_SecretKeyNoneZ in the error state.
14510  */
14511 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
14512
14513 /**
14514  * Checks if the given object is currently in the success state
14515  */
14516 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
14517
14518 /**
14519  * Frees any resources used by the CResult_SecretKeyNoneZ.
14520  */
14521 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
14522
14523 /**
14524  * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
14525  * but with all dynamically-allocated buffers duplicated in new buffers.
14526  */
14527 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
14528
14529 /**
14530  * Creates a new CResult_SignDecodeErrorZ in the success state.
14531  */
14532 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
14533
14534 /**
14535  * Creates a new CResult_SignDecodeErrorZ in the error state.
14536  */
14537 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
14538
14539 /**
14540  * Checks if the given object is currently in the success state
14541  */
14542 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
14543
14544 /**
14545  * Frees any resources used by the CResult_SignDecodeErrorZ.
14546  */
14547 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
14548
14549 /**
14550  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
14551  * but with all dynamically-allocated buffers duplicated in new buffers.
14552  */
14553 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
14554
14555 /**
14556  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14557  */
14558 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
14559
14560 /**
14561  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
14562  */
14563 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
14564
14565 /**
14566  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
14567  */
14568 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
14569
14570 /**
14571  * Checks if the given object is currently in the success state
14572  */
14573 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
14574
14575 /**
14576  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
14577  */
14578 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
14579
14580 /**
14581  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
14582  * but with all dynamically-allocated buffers duplicated in new buffers.
14583  */
14584 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
14585
14586 /**
14587  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14588  */
14589 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
14590
14591 /**
14592  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14593  */
14594 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
14595
14596 /**
14597  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
14598  */
14599 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
14600
14601 /**
14602  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
14603  */
14604 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
14605
14606 /**
14607  * Checks if the given object is currently in the success state
14608  */
14609 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
14610
14611 /**
14612  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
14613  */
14614 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
14615
14616 /**
14617  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
14618  * but with all dynamically-allocated buffers duplicated in new buffers.
14619  */
14620 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
14621
14622 /**
14623  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
14624  */
14625 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
14626
14627 /**
14628  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
14629  */
14630 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
14631
14632 /**
14633  * Checks if the given object is currently in the success state
14634  */
14635 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
14636
14637 /**
14638  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
14639  */
14640 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
14641
14642 /**
14643  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
14644  * but with all dynamically-allocated buffers duplicated in new buffers.
14645  */
14646 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
14647
14648 /**
14649  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14650  */
14651 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
14652
14653 /**
14654  * Creates a new CResult_TransactionNoneZ in the success state.
14655  */
14656 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
14657
14658 /**
14659  * Creates a new CResult_TransactionNoneZ in the error state.
14660  */
14661 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
14662
14663 /**
14664  * Checks if the given object is currently in the success state
14665  */
14666 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
14667
14668 /**
14669  * Frees any resources used by the CResult_TransactionNoneZ.
14670  */
14671 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
14672
14673 /**
14674  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
14675  * but with all dynamically-allocated buffers duplicated in new buffers.
14676  */
14677 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
14678
14679 /**
14680  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
14681  */
14682 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
14683
14684 /**
14685  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
14686  */
14687 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
14688
14689 /**
14690  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14691  */
14692 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
14693
14694 /**
14695  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
14696  */
14697 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
14698
14699 /**
14700  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
14701  */
14702 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
14703
14704 /**
14705  * Checks if the given object is currently in the success state
14706  */
14707 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
14708
14709 /**
14710  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
14711  */
14712 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
14713
14714 /**
14715  * Constructs a new COption_u16Z containing a u16
14716  */
14717 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
14718
14719 /**
14720  * Constructs a new COption_u16Z containing nothing
14721  */
14722 struct LDKCOption_u16Z COption_u16Z_none(void);
14723
14724 /**
14725  * Frees any resources associated with the u16, if we are in the Some state
14726  */
14727 void COption_u16Z_free(struct LDKCOption_u16Z _res);
14728
14729 /**
14730  * Creates a new COption_u16Z which has the same data as `orig`
14731  * but with all dynamically-allocated buffers duplicated in new buffers.
14732  */
14733 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
14734
14735 /**
14736  * Creates a new CResult_NoneAPIErrorZ in the success state.
14737  */
14738 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
14739
14740 /**
14741  * Creates a new CResult_NoneAPIErrorZ in the error state.
14742  */
14743 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
14744
14745 /**
14746  * Checks if the given object is currently in the success state
14747  */
14748 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
14749
14750 /**
14751  * Frees any resources used by the CResult_NoneAPIErrorZ.
14752  */
14753 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
14754
14755 /**
14756  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
14757  * but with all dynamically-allocated buffers duplicated in new buffers.
14758  */
14759 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
14760
14761 /**
14762  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14763  */
14764 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
14765
14766 /**
14767  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14768  */
14769 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
14770
14771 /**
14772  * Creates a new CResult__u832APIErrorZ in the success state.
14773  */
14774 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
14775
14776 /**
14777  * Creates a new CResult__u832APIErrorZ in the error state.
14778  */
14779 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
14780
14781 /**
14782  * Checks if the given object is currently in the success state
14783  */
14784 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
14785
14786 /**
14787  * Frees any resources used by the CResult__u832APIErrorZ.
14788  */
14789 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
14790
14791 /**
14792  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
14793  * but with all dynamically-allocated buffers duplicated in new buffers.
14794  */
14795 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
14796
14797 /**
14798  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
14799  */
14800 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
14801
14802 /**
14803  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
14804  */
14805 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14806
14807 /**
14808  * Checks if the given object is currently in the success state
14809  */
14810 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
14811
14812 /**
14813  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
14814  */
14815 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
14816
14817 /**
14818  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
14819  * but with all dynamically-allocated buffers duplicated in new buffers.
14820  */
14821 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
14822
14823 /**
14824  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
14825  */
14826 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
14827
14828 /**
14829  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
14830  */
14831 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14832
14833 /**
14834  * Checks if the given object is currently in the success state
14835  */
14836 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
14837
14838 /**
14839  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
14840  */
14841 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
14842
14843 /**
14844  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
14845  * but with all dynamically-allocated buffers duplicated in new buffers.
14846  */
14847 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
14848
14849 /**
14850  * Creates a new tuple which has the same data as `orig`
14851  * but with all dynamically-allocated buffers duplicated in new buffers.
14852  */
14853 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
14854
14855 /**
14856  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
14857  */
14858 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14859
14860 /**
14861  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
14862  */
14863 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
14864
14865 /**
14866  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
14867  */
14868 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
14869
14870 /**
14871  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
14872  */
14873 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
14874
14875 /**
14876  * Checks if the given object is currently in the success state
14877  */
14878 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
14879
14880 /**
14881  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
14882  */
14883 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
14884
14885 /**
14886  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
14887  * but with all dynamically-allocated buffers duplicated in new buffers.
14888  */
14889 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
14890
14891 /**
14892  * Creates a new tuple which has the same data as `orig`
14893  * but with all dynamically-allocated buffers duplicated in new buffers.
14894  */
14895 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
14896
14897 /**
14898  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
14899  */
14900 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
14901
14902 /**
14903  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
14904  */
14905 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
14906
14907 /**
14908  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
14909  */
14910 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14911
14912 /**
14913  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
14914  */
14915 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
14916
14917 /**
14918  * Checks if the given object is currently in the success state
14919  */
14920 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
14921
14922 /**
14923  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
14924  */
14925 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
14926
14927 /**
14928  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
14929  * but with all dynamically-allocated buffers duplicated in new buffers.
14930  */
14931 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
14932
14933 /**
14934  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
14935  */
14936 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
14937
14938 /**
14939  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
14940  */
14941 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
14942
14943 /**
14944  * Checks if the given object is currently in the success state
14945  */
14946 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
14947
14948 /**
14949  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
14950  */
14951 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
14952
14953 /**
14954  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
14955  * but with all dynamically-allocated buffers duplicated in new buffers.
14956  */
14957 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
14958
14959 /**
14960  * Creates a new CResult_PaymentSecretNoneZ in the success state.
14961  */
14962 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
14963
14964 /**
14965  * Creates a new CResult_PaymentSecretNoneZ in the error state.
14966  */
14967 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
14968
14969 /**
14970  * Checks if the given object is currently in the success state
14971  */
14972 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
14973
14974 /**
14975  * Frees any resources used by the CResult_PaymentSecretNoneZ.
14976  */
14977 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
14978
14979 /**
14980  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
14981  * but with all dynamically-allocated buffers duplicated in new buffers.
14982  */
14983 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
14984
14985 /**
14986  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
14987  */
14988 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
14989
14990 /**
14991  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
14992  */
14993 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
14994
14995 /**
14996  * Checks if the given object is currently in the success state
14997  */
14998 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
14999
15000 /**
15001  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
15002  */
15003 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
15004
15005 /**
15006  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
15007  * but with all dynamically-allocated buffers duplicated in new buffers.
15008  */
15009 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
15010
15011 /**
15012  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
15013  */
15014 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
15015
15016 /**
15017  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
15018  */
15019 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
15020
15021 /**
15022  * Checks if the given object is currently in the success state
15023  */
15024 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
15025
15026 /**
15027  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
15028  */
15029 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
15030
15031 /**
15032  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
15033  * but with all dynamically-allocated buffers duplicated in new buffers.
15034  */
15035 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
15036
15037 /**
15038  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
15039  */
15040 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
15041
15042 /**
15043  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
15044  */
15045 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
15046
15047 /**
15048  * Checks if the given object is currently in the success state
15049  */
15050 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
15051
15052 /**
15053  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
15054  */
15055 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
15056
15057 /**
15058  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
15059  * but with all dynamically-allocated buffers duplicated in new buffers.
15060  */
15061 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
15062
15063 /**
15064  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
15065  */
15066 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
15067
15068 /**
15069  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
15070  */
15071 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
15072
15073 /**
15074  * Checks if the given object is currently in the success state
15075  */
15076 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
15077
15078 /**
15079  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
15080  */
15081 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
15082
15083 /**
15084  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
15085  * but with all dynamically-allocated buffers duplicated in new buffers.
15086  */
15087 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
15088
15089 /**
15090  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
15091  */
15092 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
15093
15094 /**
15095  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
15096  */
15097 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
15098
15099 /**
15100  * Checks if the given object is currently in the success state
15101  */
15102 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
15103
15104 /**
15105  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
15106  */
15107 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
15108
15109 /**
15110  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
15111  * but with all dynamically-allocated buffers duplicated in new buffers.
15112  */
15113 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
15114
15115 /**
15116  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
15117  */
15118 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
15119
15120 /**
15121  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
15122  */
15123 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
15124
15125 /**
15126  * Checks if the given object is currently in the success state
15127  */
15128 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
15129
15130 /**
15131  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
15132  */
15133 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
15134
15135 /**
15136  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
15137  * but with all dynamically-allocated buffers duplicated in new buffers.
15138  */
15139 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
15140
15141 /**
15142  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15143  */
15144 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
15145
15146 /**
15147  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
15148  */
15149 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
15150
15151 /**
15152  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
15153  */
15154 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
15155
15156 /**
15157  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
15158  */
15159 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
15160
15161 /**
15162  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
15163  */
15164 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
15165
15166 /**
15167  * Checks if the given object is currently in the success state
15168  */
15169 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
15170
15171 /**
15172  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
15173  */
15174 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
15175
15176 /**
15177  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
15178  */
15179 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
15180
15181 /**
15182  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
15183  */
15184 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
15185
15186 /**
15187  * Checks if the given object is currently in the success state
15188  */
15189 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
15190
15191 /**
15192  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
15193  */
15194 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
15195
15196 /**
15197  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
15198  * but with all dynamically-allocated buffers duplicated in new buffers.
15199  */
15200 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
15201
15202 /**
15203  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
15204  */
15205 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
15206
15207 /**
15208  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
15209  */
15210 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
15211
15212 /**
15213  * Checks if the given object is currently in the success state
15214  */
15215 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
15216
15217 /**
15218  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
15219  */
15220 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
15221
15222 /**
15223  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
15224  * but with all dynamically-allocated buffers duplicated in new buffers.
15225  */
15226 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
15227
15228 /**
15229  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
15230  */
15231 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
15232
15233 /**
15234  * Constructs a new COption_TypeZ containing nothing
15235  */
15236 struct LDKCOption_TypeZ COption_TypeZ_none(void);
15237
15238 /**
15239  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
15240  */
15241 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
15242
15243 /**
15244  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
15245  */
15246 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
15247
15248 /**
15249  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
15250  */
15251 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
15252
15253 /**
15254  * Checks if the given object is currently in the success state
15255  */
15256 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
15257
15258 /**
15259  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
15260  */
15261 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
15262
15263 /**
15264  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
15265  */
15266 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
15267
15268 /**
15269  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
15270  */
15271 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
15272
15273 /**
15274  * Checks if the given object is currently in the success state
15275  */
15276 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
15277
15278 /**
15279  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
15280  */
15281 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
15282
15283 /**
15284  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
15285  * but with all dynamically-allocated buffers duplicated in new buffers.
15286  */
15287 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
15288
15289 /**
15290  * Creates a new CResult_SiPrefixParseErrorZ in the success state.
15291  */
15292 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
15293
15294 /**
15295  * Creates a new CResult_SiPrefixParseErrorZ in the error state.
15296  */
15297 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
15298
15299 /**
15300  * Checks if the given object is currently in the success state
15301  */
15302 bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
15303
15304 /**
15305  * Frees any resources used by the CResult_SiPrefixParseErrorZ.
15306  */
15307 void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
15308
15309 /**
15310  * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
15311  * but with all dynamically-allocated buffers duplicated in new buffers.
15312  */
15313 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
15314
15315 /**
15316  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
15317  */
15318 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
15319
15320 /**
15321  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
15322  */
15323 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
15324
15325 /**
15326  * Checks if the given object is currently in the success state
15327  */
15328 bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
15329
15330 /**
15331  * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
15332  */
15333 void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
15334
15335 /**
15336  * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
15337  * but with all dynamically-allocated buffers duplicated in new buffers.
15338  */
15339 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
15340
15341 /**
15342  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
15343  */
15344 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
15345
15346 /**
15347  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
15348  */
15349 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
15350
15351 /**
15352  * Checks if the given object is currently in the success state
15353  */
15354 bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
15355
15356 /**
15357  * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
15358  */
15359 void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
15360
15361 /**
15362  * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
15363  * but with all dynamically-allocated buffers duplicated in new buffers.
15364  */
15365 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
15366
15367 /**
15368  * Creates a new tuple which has the same data as `orig`
15369  * but with all dynamically-allocated buffers duplicated in new buffers.
15370  */
15371 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
15372
15373 /**
15374  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
15375  */
15376 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
15377
15378 /**
15379  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
15380  */
15381 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
15382
15383 /**
15384  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
15385  */
15386 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
15387
15388 /**
15389  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
15390  */
15391 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
15392
15393 /**
15394  * Checks if the given object is currently in the success state
15395  */
15396 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
15397
15398 /**
15399  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
15400  */
15401 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
15402
15403 /**
15404  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
15405  * but with all dynamically-allocated buffers duplicated in new buffers.
15406  */
15407 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
15408
15409 /**
15410  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15411  */
15412 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
15413
15414 /**
15415  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
15416  */
15417 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
15418
15419 /**
15420  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
15421  */
15422 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
15423
15424 /**
15425  * Checks if the given object is currently in the success state
15426  */
15427 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
15428
15429 /**
15430  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
15431  */
15432 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
15433
15434 /**
15435  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
15436  * but with all dynamically-allocated buffers duplicated in new buffers.
15437  */
15438 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
15439
15440 /**
15441  * Creates a new CResult_NoneSemanticErrorZ in the success state.
15442  */
15443 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
15444
15445 /**
15446  * Creates a new CResult_NoneSemanticErrorZ in the error state.
15447  */
15448 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
15449
15450 /**
15451  * Checks if the given object is currently in the success state
15452  */
15453 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
15454
15455 /**
15456  * Frees any resources used by the CResult_NoneSemanticErrorZ.
15457  */
15458 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
15459
15460 /**
15461  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
15462  * but with all dynamically-allocated buffers duplicated in new buffers.
15463  */
15464 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
15465
15466 /**
15467  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
15468  */
15469 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
15470
15471 /**
15472  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
15473  */
15474 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
15475
15476 /**
15477  * Checks if the given object is currently in the success state
15478  */
15479 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
15480
15481 /**
15482  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
15483  */
15484 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
15485
15486 /**
15487  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
15488  * but with all dynamically-allocated buffers duplicated in new buffers.
15489  */
15490 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
15491
15492 /**
15493  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
15494  */
15495 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
15496
15497 /**
15498  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
15499  */
15500 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
15501
15502 /**
15503  * Checks if the given object is currently in the success state
15504  */
15505 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
15506
15507 /**
15508  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
15509  */
15510 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
15511
15512 /**
15513  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
15514  * but with all dynamically-allocated buffers duplicated in new buffers.
15515  */
15516 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
15517
15518 /**
15519  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
15520  */
15521 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
15522
15523 /**
15524  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
15525  */
15526 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
15527
15528 /**
15529  * Checks if the given object is currently in the success state
15530  */
15531 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
15532
15533 /**
15534  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
15535  */
15536 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
15537
15538 /**
15539  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
15540  * but with all dynamically-allocated buffers duplicated in new buffers.
15541  */
15542 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
15543
15544 /**
15545  * Creates a new CResult_StringErrorZ in the success state.
15546  */
15547 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
15548
15549 /**
15550  * Creates a new CResult_StringErrorZ in the error state.
15551  */
15552 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
15553
15554 /**
15555  * Checks if the given object is currently in the success state
15556  */
15557 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
15558
15559 /**
15560  * Frees any resources used by the CResult_StringErrorZ.
15561  */
15562 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
15563
15564 /**
15565  * Creates a new CResult_StringErrorZ which has the same data as `orig`
15566  * but with all dynamically-allocated buffers duplicated in new buffers.
15567  */
15568 struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
15569
15570 /**
15571  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
15572  */
15573 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
15574
15575 /**
15576  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
15577  */
15578 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15579
15580 /**
15581  * Checks if the given object is currently in the success state
15582  */
15583 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
15584
15585 /**
15586  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
15587  */
15588 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
15589
15590 /**
15591  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
15592  * but with all dynamically-allocated buffers duplicated in new buffers.
15593  */
15594 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
15595
15596 /**
15597  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
15598  */
15599 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
15600
15601 /**
15602  * Constructs a new COption_MonitorEventZ containing nothing
15603  */
15604 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
15605
15606 /**
15607  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
15608  */
15609 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
15610
15611 /**
15612  * Creates a new COption_MonitorEventZ which has the same data as `orig`
15613  * but with all dynamically-allocated buffers duplicated in new buffers.
15614  */
15615 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
15616
15617 /**
15618  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
15619  */
15620 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
15621
15622 /**
15623  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
15624  */
15625 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
15626
15627 /**
15628  * Checks if the given object is currently in the success state
15629  */
15630 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
15631
15632 /**
15633  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
15634  */
15635 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
15636
15637 /**
15638  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
15639  * but with all dynamically-allocated buffers duplicated in new buffers.
15640  */
15641 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
15642
15643 /**
15644  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
15645  */
15646 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
15647
15648 /**
15649  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
15650  */
15651 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
15652
15653 /**
15654  * Checks if the given object is currently in the success state
15655  */
15656 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
15657
15658 /**
15659  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
15660  */
15661 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
15662
15663 /**
15664  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
15665  * but with all dynamically-allocated buffers duplicated in new buffers.
15666  */
15667 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
15668
15669 /**
15670  * Creates a new tuple which has the same data as `orig`
15671  * but with all dynamically-allocated buffers duplicated in new buffers.
15672  */
15673 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
15674
15675 /**
15676  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
15677  */
15678 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
15679
15680 /**
15681  * Frees any resources used by the C2Tuple_OutPointScriptZ.
15682  */
15683 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
15684
15685 /**
15686  * Creates a new tuple which has the same data as `orig`
15687  * but with all dynamically-allocated buffers duplicated in new buffers.
15688  */
15689 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
15690
15691 /**
15692  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
15693  */
15694 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
15695
15696 /**
15697  * Frees any resources used by the C2Tuple_u32ScriptZ.
15698  */
15699 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
15700
15701 /**
15702  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15703  */
15704 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
15705
15706 /**
15707  * Creates a new tuple which has the same data as `orig`
15708  * but with all dynamically-allocated buffers duplicated in new buffers.
15709  */
15710 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
15711
15712 /**
15713  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
15714  */
15715 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
15716
15717 /**
15718  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
15719  */
15720 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
15721
15722 /**
15723  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15724  */
15725 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
15726
15727 /**
15728  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15729  */
15730 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
15731
15732 /**
15733  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15734  */
15735 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
15736
15737 /**
15738  * Creates a new tuple which has the same data as `orig`
15739  * but with all dynamically-allocated buffers duplicated in new buffers.
15740  */
15741 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
15742
15743 /**
15744  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
15745  */
15746 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
15747
15748 /**
15749  * Frees any resources used by the C2Tuple_u32TxOutZ.
15750  */
15751 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
15752
15753 /**
15754  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15755  */
15756 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
15757
15758 /**
15759  * Creates a new tuple which has the same data as `orig`
15760  * but with all dynamically-allocated buffers duplicated in new buffers.
15761  */
15762 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
15763
15764 /**
15765  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
15766  */
15767 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
15768
15769 /**
15770  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
15771  */
15772 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
15773
15774 /**
15775  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15776  */
15777 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
15778
15779 /**
15780  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15781  */
15782 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
15783
15784 /**
15785  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
15786  */
15787 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
15788
15789 /**
15790  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
15791  */
15792 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
15793
15794 /**
15795  * Checks if the given object is currently in the success state
15796  */
15797 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
15798
15799 /**
15800  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
15801  */
15802 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
15803
15804 /**
15805  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
15806  */
15807 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
15808
15809 /**
15810  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
15811  */
15812 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
15813
15814 /**
15815  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15816  */
15817 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
15818
15819 /**
15820  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
15821  */
15822 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
15823
15824 /**
15825  * Constructs a new COption_NetAddressZ containing nothing
15826  */
15827 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
15828
15829 /**
15830  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
15831  */
15832 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
15833
15834 /**
15835  * Creates a new COption_NetAddressZ which has the same data as `orig`
15836  * but with all dynamically-allocated buffers duplicated in new buffers.
15837  */
15838 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
15839
15840 /**
15841  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
15842  */
15843 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
15844
15845 /**
15846  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
15847  */
15848 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15849
15850 /**
15851  * Checks if the given object is currently in the success state
15852  */
15853 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
15854
15855 /**
15856  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
15857  */
15858 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
15859
15860 /**
15861  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
15862  * but with all dynamically-allocated buffers duplicated in new buffers.
15863  */
15864 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
15865
15866 /**
15867  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
15868  */
15869 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
15870
15871 /**
15872  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
15873  */
15874 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
15875
15876 /**
15877  * Checks if the given object is currently in the success state
15878  */
15879 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
15880
15881 /**
15882  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
15883  */
15884 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
15885
15886 /**
15887  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
15888  * but with all dynamically-allocated buffers duplicated in new buffers.
15889  */
15890 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
15891
15892 /**
15893  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
15894  */
15895 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
15896
15897 /**
15898  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
15899  */
15900 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
15901
15902 /**
15903  * Checks if the given object is currently in the success state
15904  */
15905 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
15906
15907 /**
15908  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
15909  */
15910 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
15911
15912 /**
15913  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
15914  * but with all dynamically-allocated buffers duplicated in new buffers.
15915  */
15916 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
15917
15918 /**
15919  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
15920  */
15921 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
15922
15923 /**
15924  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
15925  */
15926 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
15927
15928 /**
15929  * Checks if the given object is currently in the success state
15930  */
15931 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
15932
15933 /**
15934  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
15935  */
15936 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
15937
15938 /**
15939  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
15940  */
15941 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
15942
15943 /**
15944  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
15945  */
15946 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
15947
15948 /**
15949  * Checks if the given object is currently in the success state
15950  */
15951 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
15952
15953 /**
15954  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
15955  */
15956 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
15957
15958 /**
15959  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
15960  * but with all dynamically-allocated buffers duplicated in new buffers.
15961  */
15962 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
15963
15964 /**
15965  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15966  */
15967 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
15968
15969 /**
15970  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15971  */
15972 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
15973
15974 /**
15975  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15976  */
15977 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
15978
15979 /**
15980  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15981  */
15982 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
15983
15984 /**
15985  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
15986  */
15987 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
15988
15989 /**
15990  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
15991  */
15992 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
15993
15994 /**
15995  * Checks if the given object is currently in the success state
15996  */
15997 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
15998
15999 /**
16000  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
16001  */
16002 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
16003
16004 /**
16005  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
16006  * but with all dynamically-allocated buffers duplicated in new buffers.
16007  */
16008 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
16009
16010 /**
16011  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
16012  */
16013 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
16014
16015 /**
16016  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
16017  */
16018 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
16019
16020 /**
16021  * Checks if the given object is currently in the success state
16022  */
16023 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
16024
16025 /**
16026  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
16027  */
16028 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
16029
16030 /**
16031  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
16032  * but with all dynamically-allocated buffers duplicated in new buffers.
16033  */
16034 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
16035
16036 /**
16037  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
16038  */
16039 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
16040
16041 /**
16042  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
16043  */
16044 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
16045
16046 /**
16047  * Checks if the given object is currently in the success state
16048  */
16049 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
16050
16051 /**
16052  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
16053  */
16054 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
16055
16056 /**
16057  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
16058  * but with all dynamically-allocated buffers duplicated in new buffers.
16059  */
16060 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
16061
16062 /**
16063  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
16064  */
16065 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
16066
16067 /**
16068  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
16069  */
16070 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
16071
16072 /**
16073  * Checks if the given object is currently in the success state
16074  */
16075 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
16076
16077 /**
16078  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
16079  */
16080 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
16081
16082 /**
16083  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
16084  * but with all dynamically-allocated buffers duplicated in new buffers.
16085  */
16086 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
16087
16088 /**
16089  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
16090  */
16091 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
16092
16093 /**
16094  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
16095  */
16096 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
16097
16098 /**
16099  * Checks if the given object is currently in the success state
16100  */
16101 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
16102
16103 /**
16104  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
16105  */
16106 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
16107
16108 /**
16109  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
16110  * but with all dynamically-allocated buffers duplicated in new buffers.
16111  */
16112 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
16113
16114 /**
16115  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
16116  */
16117 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
16118
16119 /**
16120  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
16121  */
16122 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
16123
16124 /**
16125  * Checks if the given object is currently in the success state
16126  */
16127 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
16128
16129 /**
16130  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
16131  */
16132 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
16133
16134 /**
16135  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
16136  * but with all dynamically-allocated buffers duplicated in new buffers.
16137  */
16138 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
16139
16140 /**
16141  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
16142  */
16143 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
16144
16145 /**
16146  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
16147  */
16148 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
16149
16150 /**
16151  * Checks if the given object is currently in the success state
16152  */
16153 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
16154
16155 /**
16156  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
16157  */
16158 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
16159
16160 /**
16161  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
16162  * but with all dynamically-allocated buffers duplicated in new buffers.
16163  */
16164 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
16165
16166 /**
16167  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
16168  */
16169 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
16170
16171 /**
16172  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
16173  */
16174 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
16175
16176 /**
16177  * Checks if the given object is currently in the success state
16178  */
16179 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
16180
16181 /**
16182  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
16183  */
16184 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
16185
16186 /**
16187  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
16188  * but with all dynamically-allocated buffers duplicated in new buffers.
16189  */
16190 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
16191
16192 /**
16193  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
16194  */
16195 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
16196
16197 /**
16198  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
16199  */
16200 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
16201
16202 /**
16203  * Checks if the given object is currently in the success state
16204  */
16205 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
16206
16207 /**
16208  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
16209  */
16210 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
16211
16212 /**
16213  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
16214  * but with all dynamically-allocated buffers duplicated in new buffers.
16215  */
16216 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
16217
16218 /**
16219  * Creates a new CResult_InitDecodeErrorZ in the success state.
16220  */
16221 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
16222
16223 /**
16224  * Creates a new CResult_InitDecodeErrorZ in the error state.
16225  */
16226 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
16227
16228 /**
16229  * Checks if the given object is currently in the success state
16230  */
16231 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
16232
16233 /**
16234  * Frees any resources used by the CResult_InitDecodeErrorZ.
16235  */
16236 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
16237
16238 /**
16239  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
16240  * but with all dynamically-allocated buffers duplicated in new buffers.
16241  */
16242 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
16243
16244 /**
16245  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
16246  */
16247 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
16248
16249 /**
16250  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
16251  */
16252 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
16253
16254 /**
16255  * Checks if the given object is currently in the success state
16256  */
16257 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
16258
16259 /**
16260  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
16261  */
16262 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
16263
16264 /**
16265  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
16266  * but with all dynamically-allocated buffers duplicated in new buffers.
16267  */
16268 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
16269
16270 /**
16271  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
16272  */
16273 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
16274
16275 /**
16276  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
16277  */
16278 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
16279
16280 /**
16281  * Checks if the given object is currently in the success state
16282  */
16283 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
16284
16285 /**
16286  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
16287  */
16288 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
16289
16290 /**
16291  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
16292  * but with all dynamically-allocated buffers duplicated in new buffers.
16293  */
16294 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
16295
16296 /**
16297  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
16298  */
16299 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
16300
16301 /**
16302  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
16303  */
16304 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
16305
16306 /**
16307  * Checks if the given object is currently in the success state
16308  */
16309 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
16310
16311 /**
16312  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
16313  */
16314 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
16315
16316 /**
16317  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
16318  * but with all dynamically-allocated buffers duplicated in new buffers.
16319  */
16320 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
16321
16322 /**
16323  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
16324  */
16325 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
16326
16327 /**
16328  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
16329  */
16330 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16331
16332 /**
16333  * Checks if the given object is currently in the success state
16334  */
16335 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
16336
16337 /**
16338  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
16339  */
16340 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
16341
16342 /**
16343  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
16344  * but with all dynamically-allocated buffers duplicated in new buffers.
16345  */
16346 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
16347
16348 /**
16349  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
16350  */
16351 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
16352
16353 /**
16354  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
16355  */
16356 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16357
16358 /**
16359  * Checks if the given object is currently in the success state
16360  */
16361 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
16362
16363 /**
16364  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
16365  */
16366 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
16367
16368 /**
16369  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
16370  * but with all dynamically-allocated buffers duplicated in new buffers.
16371  */
16372 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
16373
16374 /**
16375  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16376  */
16377 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
16378
16379 /**
16380  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16381  */
16382 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
16383
16384 /**
16385  * Checks if the given object is currently in the success state
16386  */
16387 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
16388
16389 /**
16390  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16391  */
16392 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
16393
16394 /**
16395  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16396  * but with all dynamically-allocated buffers duplicated in new buffers.
16397  */
16398 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
16399
16400 /**
16401  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16402  */
16403 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
16404
16405 /**
16406  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16407  */
16408 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16409
16410 /**
16411  * Checks if the given object is currently in the success state
16412  */
16413 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
16414
16415 /**
16416  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16417  */
16418 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
16419
16420 /**
16421  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16422  * but with all dynamically-allocated buffers duplicated in new buffers.
16423  */
16424 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
16425
16426 /**
16427  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16428  */
16429 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
16430
16431 /**
16432  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16433  */
16434 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16435
16436 /**
16437  * Checks if the given object is currently in the success state
16438  */
16439 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
16440
16441 /**
16442  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16443  */
16444 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
16445
16446 /**
16447  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16448  * but with all dynamically-allocated buffers duplicated in new buffers.
16449  */
16450 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
16451
16452 /**
16453  * Creates a new CResult_PingDecodeErrorZ in the success state.
16454  */
16455 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
16456
16457 /**
16458  * Creates a new CResult_PingDecodeErrorZ in the error state.
16459  */
16460 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
16461
16462 /**
16463  * Checks if the given object is currently in the success state
16464  */
16465 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
16466
16467 /**
16468  * Frees any resources used by the CResult_PingDecodeErrorZ.
16469  */
16470 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
16471
16472 /**
16473  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16474  * but with all dynamically-allocated buffers duplicated in new buffers.
16475  */
16476 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
16477
16478 /**
16479  * Creates a new CResult_PongDecodeErrorZ in the success state.
16480  */
16481 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
16482
16483 /**
16484  * Creates a new CResult_PongDecodeErrorZ in the error state.
16485  */
16486 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
16487
16488 /**
16489  * Checks if the given object is currently in the success state
16490  */
16491 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
16492
16493 /**
16494  * Frees any resources used by the CResult_PongDecodeErrorZ.
16495  */
16496 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
16497
16498 /**
16499  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
16500  * but with all dynamically-allocated buffers duplicated in new buffers.
16501  */
16502 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
16503
16504 /**
16505  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
16506  */
16507 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
16508
16509 /**
16510  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
16511  */
16512 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16513
16514 /**
16515  * Checks if the given object is currently in the success state
16516  */
16517 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16518
16519 /**
16520  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
16521  */
16522 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
16523
16524 /**
16525  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16526  * but with all dynamically-allocated buffers duplicated in new buffers.
16527  */
16528 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16529
16530 /**
16531  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
16532  */
16533 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
16534
16535 /**
16536  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
16537  */
16538 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16539
16540 /**
16541  * Checks if the given object is currently in the success state
16542  */
16543 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
16544
16545 /**
16546  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
16547  */
16548 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
16549
16550 /**
16551  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
16552  * but with all dynamically-allocated buffers duplicated in new buffers.
16553  */
16554 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16555
16556 /**
16557  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
16558  */
16559 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
16560
16561 /**
16562  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
16563  */
16564 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16565
16566 /**
16567  * Checks if the given object is currently in the success state
16568  */
16569 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16570
16571 /**
16572  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
16573  */
16574 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
16575
16576 /**
16577  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
16578  * but with all dynamically-allocated buffers duplicated in new buffers.
16579  */
16580 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16581
16582 /**
16583  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
16584  */
16585 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
16586
16587 /**
16588  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
16589  */
16590 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16591
16592 /**
16593  * Checks if the given object is currently in the success state
16594  */
16595 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
16596
16597 /**
16598  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
16599  */
16600 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
16601
16602 /**
16603  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
16604  * but with all dynamically-allocated buffers duplicated in new buffers.
16605  */
16606 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
16607
16608 /**
16609  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
16610  */
16611 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
16612
16613 /**
16614  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
16615  */
16616 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
16617
16618 /**
16619  * Checks if the given object is currently in the success state
16620  */
16621 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
16622
16623 /**
16624  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
16625  */
16626 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
16627
16628 /**
16629  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
16630  * but with all dynamically-allocated buffers duplicated in new buffers.
16631  */
16632 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
16633
16634 /**
16635  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
16636  */
16637 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
16638
16639 /**
16640  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
16641  */
16642 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
16643
16644 /**
16645  * Checks if the given object is currently in the success state
16646  */
16647 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
16648
16649 /**
16650  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
16651  */
16652 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
16653
16654 /**
16655  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
16656  * but with all dynamically-allocated buffers duplicated in new buffers.
16657  */
16658 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
16659
16660 /**
16661  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
16662  */
16663 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
16664
16665 /**
16666  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
16667  */
16668 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16669
16670 /**
16671  * Checks if the given object is currently in the success state
16672  */
16673 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16674
16675 /**
16676  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
16677  */
16678 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
16679
16680 /**
16681  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
16682  * but with all dynamically-allocated buffers duplicated in new buffers.
16683  */
16684 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16685
16686 /**
16687  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
16688  */
16689 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
16690
16691 /**
16692  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
16693  */
16694 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
16695
16696 /**
16697  * Checks if the given object is currently in the success state
16698  */
16699 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
16700
16701 /**
16702  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
16703  */
16704 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
16705
16706 /**
16707  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
16708  * but with all dynamically-allocated buffers duplicated in new buffers.
16709  */
16710 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
16711
16712 /**
16713  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
16714  */
16715 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
16716
16717 /**
16718  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
16719  */
16720 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
16721
16722 /**
16723  * Checks if the given object is currently in the success state
16724  */
16725 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
16726
16727 /**
16728  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
16729  */
16730 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
16731
16732 /**
16733  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
16734  * but with all dynamically-allocated buffers duplicated in new buffers.
16735  */
16736 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
16737
16738 /**
16739  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
16740  */
16741 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
16742
16743 /**
16744  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
16745  */
16746 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
16747
16748 /**
16749  * Checks if the given object is currently in the success state
16750  */
16751 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
16752
16753 /**
16754  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
16755  */
16756 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
16757
16758 /**
16759  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
16760  * but with all dynamically-allocated buffers duplicated in new buffers.
16761  */
16762 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
16763
16764 /**
16765  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
16766  */
16767 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
16768
16769 /**
16770  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
16771  */
16772 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16773
16774 /**
16775  * Checks if the given object is currently in the success state
16776  */
16777 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
16778
16779 /**
16780  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
16781  */
16782 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
16783
16784 /**
16785  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
16786  * but with all dynamically-allocated buffers duplicated in new buffers.
16787  */
16788 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16789
16790 /**
16791  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
16792  */
16793 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
16794
16795 /**
16796  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
16797  */
16798 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
16799
16800 /**
16801  * Checks if the given object is currently in the success state
16802  */
16803 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
16804
16805 /**
16806  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
16807  */
16808 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
16809
16810 /**
16811  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
16812  * but with all dynamically-allocated buffers duplicated in new buffers.
16813  */
16814 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
16815
16816 /**
16817  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
16818  */
16819 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
16820
16821 /**
16822  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
16823  */
16824 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
16825
16826 /**
16827  * Checks if the given object is currently in the success state
16828  */
16829 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
16830
16831 /**
16832  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
16833  */
16834 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
16835
16836 /**
16837  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
16838  * but with all dynamically-allocated buffers duplicated in new buffers.
16839  */
16840 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
16841
16842 /**
16843  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16844  */
16845 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
16846
16847 /**
16848  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
16849  */
16850 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
16851
16852 /**
16853  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
16854  */
16855 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
16856
16857 /**
16858  * Checks if the given object is currently in the success state
16859  */
16860 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
16861
16862 /**
16863  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
16864  */
16865 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
16866
16867 /**
16868  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
16869  * but with all dynamically-allocated buffers duplicated in new buffers.
16870  */
16871 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
16872
16873 /**
16874  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
16875  */
16876 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
16877
16878 /**
16879  * Constructs a new COption_FilterZ containing nothing
16880  */
16881 struct LDKCOption_FilterZ COption_FilterZ_none(void);
16882
16883 /**
16884  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
16885  */
16886 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
16887
16888 /**
16889  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
16890  */
16891 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
16892
16893 /**
16894  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
16895  */
16896 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
16897
16898 /**
16899  * Checks if the given object is currently in the success state
16900  */
16901 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
16902
16903 /**
16904  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
16905  */
16906 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
16907
16908 /**
16909  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16910  */
16911 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
16912
16913 /**
16914  * Frees any resources used by the PaymentPurpose
16915  */
16916 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
16917
16918 /**
16919  * Creates a copy of the PaymentPurpose
16920  */
16921 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
16922
16923 /**
16924  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
16925  */
16926 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
16927
16928 /**
16929  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
16930  */
16931 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
16932
16933 /**
16934  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
16935  */
16936 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
16937
16938 /**
16939  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
16940  */
16941 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
16942
16943 /**
16944  * Frees any resources used by the ClosureReason
16945  */
16946 void ClosureReason_free(struct LDKClosureReason this_ptr);
16947
16948 /**
16949  * Creates a copy of the ClosureReason
16950  */
16951 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
16952
16953 /**
16954  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
16955  */
16956 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
16957
16958 /**
16959  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
16960  */
16961 struct LDKClosureReason ClosureReason_holder_force_closed(void);
16962
16963 /**
16964  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
16965  */
16966 struct LDKClosureReason ClosureReason_cooperative_closure(void);
16967
16968 /**
16969  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
16970  */
16971 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
16972
16973 /**
16974  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
16975  */
16976 struct LDKClosureReason ClosureReason_funding_timed_out(void);
16977
16978 /**
16979  * Utility method to constructs a new ProcessingError-variant ClosureReason
16980  */
16981 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
16982
16983 /**
16984  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
16985  */
16986 struct LDKClosureReason ClosureReason_disconnected_peer(void);
16987
16988 /**
16989  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
16990  */
16991 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
16992
16993 /**
16994  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
16995  */
16996 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
16997
16998 /**
16999  * Read a ClosureReason from a byte array, created by ClosureReason_write
17000  */
17001 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
17002
17003 /**
17004  * Frees any resources used by the Event
17005  */
17006 void Event_free(struct LDKEvent this_ptr);
17007
17008 /**
17009  * Creates a copy of the Event
17010  */
17011 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
17012
17013 /**
17014  * Utility method to constructs a new FundingGenerationReady-variant Event
17015  */
17016 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);
17017
17018 /**
17019  * Utility method to constructs a new PaymentReceived-variant Event
17020  */
17021 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
17022
17023 /**
17024  * Utility method to constructs a new PaymentClaimed-variant Event
17025  */
17026 struct LDKEvent Event_payment_claimed(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
17027
17028 /**
17029  * Utility method to constructs a new PaymentSent-variant Event
17030  */
17031 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
17032
17033 /**
17034  * Utility method to constructs a new PaymentFailed-variant Event
17035  */
17036 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
17037
17038 /**
17039  * Utility method to constructs a new PaymentPathSuccessful-variant Event
17040  */
17041 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
17042
17043 /**
17044  * Utility method to constructs a new PaymentPathFailed-variant Event
17045  */
17046 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);
17047
17048 /**
17049  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
17050  */
17051 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
17052
17053 /**
17054  * Utility method to constructs a new SpendableOutputs-variant Event
17055  */
17056 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
17057
17058 /**
17059  * Utility method to constructs a new PaymentForwarded-variant Event
17060  */
17061 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);
17062
17063 /**
17064  * Utility method to constructs a new ChannelClosed-variant Event
17065  */
17066 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
17067
17068 /**
17069  * Utility method to constructs a new DiscardFunding-variant Event
17070  */
17071 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
17072
17073 /**
17074  * Utility method to constructs a new OpenChannelRequest-variant Event
17075  */
17076 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);
17077
17078 /**
17079  * Serialize the Event object into a byte array which can be read by Event_read
17080  */
17081 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
17082
17083 /**
17084  * Read a Event from a byte array, created by Event_write
17085  */
17086 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
17087
17088 /**
17089  * Frees any resources used by the MessageSendEvent
17090  */
17091 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
17092
17093 /**
17094  * Creates a copy of the MessageSendEvent
17095  */
17096 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
17097
17098 /**
17099  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
17100  */
17101 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
17102
17103 /**
17104  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
17105  */
17106 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
17107
17108 /**
17109  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
17110  */
17111 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
17112
17113 /**
17114  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
17115  */
17116 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
17117
17118 /**
17119  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
17120  */
17121 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
17122
17123 /**
17124  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
17125  */
17126 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
17127
17128 /**
17129  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
17130  */
17131 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
17132
17133 /**
17134  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
17135  */
17136 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
17137
17138 /**
17139  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
17140  */
17141 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
17142
17143 /**
17144  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
17145  */
17146 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
17147
17148 /**
17149  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
17150  */
17151 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
17152
17153 /**
17154  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
17155  */
17156 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
17157
17158 /**
17159  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
17160  */
17161 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
17162
17163 /**
17164  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
17165  */
17166 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
17167
17168 /**
17169  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
17170  */
17171 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
17172
17173 /**
17174  * Utility method to constructs a new HandleError-variant MessageSendEvent
17175  */
17176 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
17177
17178 /**
17179  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
17180  */
17181 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
17182
17183 /**
17184  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
17185  */
17186 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
17187
17188 /**
17189  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
17190  */
17191 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
17192
17193 /**
17194  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
17195  */
17196 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
17197
17198 /**
17199  * Calls the free function if one is set
17200  */
17201 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
17202
17203 /**
17204  * Calls the free function if one is set
17205  */
17206 void EventsProvider_free(struct LDKEventsProvider this_ptr);
17207
17208 /**
17209  * Calls the free function if one is set
17210  */
17211 void EventHandler_free(struct LDKEventHandler this_ptr);
17212
17213 /**
17214  * Frees any resources used by the APIError
17215  */
17216 void APIError_free(struct LDKAPIError this_ptr);
17217
17218 /**
17219  * Creates a copy of the APIError
17220  */
17221 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
17222
17223 /**
17224  * Utility method to constructs a new APIMisuseError-variant APIError
17225  */
17226 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
17227
17228 /**
17229  * Utility method to constructs a new FeeRateTooHigh-variant APIError
17230  */
17231 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
17232
17233 /**
17234  * Utility method to constructs a new RouteError-variant APIError
17235  */
17236 struct LDKAPIError APIError_route_error(struct LDKStr err);
17237
17238 /**
17239  * Utility method to constructs a new ChannelUnavailable-variant APIError
17240  */
17241 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
17242
17243 /**
17244  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
17245  */
17246 struct LDKAPIError APIError_monitor_update_failed(void);
17247
17248 /**
17249  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
17250  */
17251 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
17252
17253 /**
17254  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
17255  */
17256 void BigSize_free(struct LDKBigSize this_obj);
17257
17258 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
17259
17260 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
17261
17262 /**
17263  * Constructs a new BigSize given each field
17264  */
17265 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
17266
17267 /**
17268  * Creates a digital signature of a message given a SecretKey, like the node's secret.
17269  * 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.
17270  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
17271  */
17272 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
17273
17274 /**
17275  * Recovers the PublicKey of the signer of the message given the message and the signature.
17276  */
17277 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
17278
17279 /**
17280  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
17281  * and the PublicKey.
17282  */
17283 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
17284
17285 /**
17286  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
17287  */
17288 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
17289
17290 /**
17291  * Calls the free function if one is set
17292  */
17293 void Persister_free(struct LDKPersister this_ptr);
17294
17295 /**
17296  * Creates a copy of the Level
17297  */
17298 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
17299
17300 /**
17301  * Utility method to constructs a new Gossip-variant Level
17302  */
17303 enum LDKLevel Level_gossip(void);
17304
17305 /**
17306  * Utility method to constructs a new Trace-variant Level
17307  */
17308 enum LDKLevel Level_trace(void);
17309
17310 /**
17311  * Utility method to constructs a new Debug-variant Level
17312  */
17313 enum LDKLevel Level_debug(void);
17314
17315 /**
17316  * Utility method to constructs a new Info-variant Level
17317  */
17318 enum LDKLevel Level_info(void);
17319
17320 /**
17321  * Utility method to constructs a new Warn-variant Level
17322  */
17323 enum LDKLevel Level_warn(void);
17324
17325 /**
17326  * Utility method to constructs a new Error-variant Level
17327  */
17328 enum LDKLevel Level_error(void);
17329
17330 /**
17331  * Checks if two Levels contain equal inner contents.
17332  * This ignores pointers and is_owned flags and looks at the values in fields.
17333  */
17334 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
17335
17336 /**
17337  * Checks if two Levels contain equal inner contents.
17338  */
17339 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
17340
17341 /**
17342  * Returns the most verbose logging level.
17343  */
17344 MUST_USE_RES enum LDKLevel Level_max(void);
17345
17346 /**
17347  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
17348  */
17349 void Record_free(struct LDKRecord this_obj);
17350
17351 /**
17352  * The verbosity level of the message.
17353  */
17354 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
17355
17356 /**
17357  * The verbosity level of the message.
17358  */
17359 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
17360
17361 /**
17362  * The message body.
17363  */
17364 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
17365
17366 /**
17367  * The message body.
17368  */
17369 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17370
17371 /**
17372  * The module path of the message.
17373  */
17374 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
17375
17376 /**
17377  * The module path of the message.
17378  */
17379 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17380
17381 /**
17382  * The source file containing the message.
17383  */
17384 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
17385
17386 /**
17387  * The source file containing the message.
17388  */
17389 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17390
17391 /**
17392  * The line containing the message.
17393  */
17394 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
17395
17396 /**
17397  * The line containing the message.
17398  */
17399 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
17400
17401 /**
17402  * Creates a copy of the Record
17403  */
17404 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
17405
17406 /**
17407  * Calls the free function if one is set
17408  */
17409 void Logger_free(struct LDKLogger this_ptr);
17410
17411 /**
17412  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
17413  */
17414 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
17415
17416 /**
17417  * Confirmations we will wait for before considering the channel locked in.
17418  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
17419  * equivalent limit applied to outbound channels).
17420  *
17421  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
17422  * transaction before operation. If you wish to accept channels with zero confirmations, see
17423  * [`UserConfig::manually_accept_inbound_channels`] and
17424  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
17425  *
17426  * Default value: 6.
17427  *
17428  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
17429  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
17430  */
17431 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17432
17433 /**
17434  * Confirmations we will wait for before considering the channel locked in.
17435  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
17436  * equivalent limit applied to outbound channels).
17437  *
17438  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
17439  * transaction before operation. If you wish to accept channels with zero confirmations, see
17440  * [`UserConfig::manually_accept_inbound_channels`] and
17441  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
17442  *
17443  * Default value: 6.
17444  *
17445  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
17446  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
17447  */
17448 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
17449
17450 /**
17451  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
17452  * the number of blocks we have to punish our counterparty if they broadcast a revoked
17453  * transaction).
17454  *
17455  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
17456  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
17457  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
17458  * possibly with time in between to RBF the spending transaction).
17459  *
17460  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
17461  * case of an honest unilateral channel close, which implicitly decrease the economic value of
17462  * our channel.
17463  *
17464  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
17465  * can tweak config to ask for more security, not less.
17466  */
17467 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17468
17469 /**
17470  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
17471  * the number of blocks we have to punish our counterparty if they broadcast a revoked
17472  * transaction).
17473  *
17474  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
17475  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
17476  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
17477  * possibly with time in between to RBF the spending transaction).
17478  *
17479  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
17480  * case of an honest unilateral channel close, which implicitly decrease the economic value of
17481  * our channel.
17482  *
17483  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
17484  * can tweak config to ask for more security, not less.
17485  */
17486 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
17487
17488 /**
17489  * Set to the smallest value HTLC we will accept to process.
17490  *
17491  * This value is sent to our counterparty on channel-open and we close the channel any time
17492  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
17493  *
17494  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
17495  * by the protocol.
17496  */
17497 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17498
17499 /**
17500  * Set to the smallest value HTLC we will accept to process.
17501  *
17502  * This value is sent to our counterparty on channel-open and we close the channel any time
17503  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
17504  *
17505  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
17506  * by the protocol.
17507  */
17508 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
17509
17510 /**
17511  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
17512  * HTLCs to.
17513  *
17514  * This can be set to a value between 1-100, where the value corresponds to the percent of the
17515  * channel value in whole percentages.
17516  *
17517  * Note that:
17518  * * If configured to another value than the default value 10, any new channels created with
17519  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
17520  * `ChannelManager`.
17521  *
17522  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
17523  * no way to configure the cap for the total value of outbound HTLCs in-flight.
17524  *
17525  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
17526  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
17527  * restrict exposure to loss due to being offline for too long.
17528  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
17529  * for more information.
17530  *
17531  * Default value: 10.
17532  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
17533  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
17534  */
17535 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17536
17537 /**
17538  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
17539  * HTLCs to.
17540  *
17541  * This can be set to a value between 1-100, where the value corresponds to the percent of the
17542  * channel value in whole percentages.
17543  *
17544  * Note that:
17545  * * If configured to another value than the default value 10, any new channels created with
17546  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
17547  * `ChannelManager`.
17548  *
17549  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
17550  * no way to configure the cap for the total value of outbound HTLCs in-flight.
17551  *
17552  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
17553  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
17554  * restrict exposure to loss due to being offline for too long.
17555  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
17556  * for more information.
17557  *
17558  * Default value: 10.
17559  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
17560  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
17561  */
17562 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
17563
17564 /**
17565  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
17566  * BOLTs) option for outbound private channels. This provides better privacy by not including
17567  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
17568  * relay HTLCs to us using the channel's SCID alias.
17569  *
17570  * If this option is set, channels may be created that will not be readable by LDK versions
17571  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
17572  * [`DecodeError:InvalidValue`].
17573  *
17574  * Note that setting this to true does *not* prevent us from opening channels with
17575  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
17576  * private channel without that option.
17577  *
17578  * Ignored if the channel is negotiated to be announced, see
17579  * [`ChannelConfig::announced_channel`] and
17580  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
17581  *
17582  * Default value: false. This value is likely to change to true in the future.
17583  *
17584  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17585  * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
17586  */
17587 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
17588
17589 /**
17590  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
17591  * BOLTs) option for outbound private channels. This provides better privacy by not including
17592  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
17593  * relay HTLCs to us using the channel's SCID alias.
17594  *
17595  * If this option is set, channels may be created that will not be readable by LDK versions
17596  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
17597  * [`DecodeError:InvalidValue`].
17598  *
17599  * Note that setting this to true does *not* prevent us from opening channels with
17600  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
17601  * private channel without that option.
17602  *
17603  * Ignored if the channel is negotiated to be announced, see
17604  * [`ChannelConfig::announced_channel`] and
17605  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
17606  *
17607  * Default value: false. This value is likely to change to true in the future.
17608  *
17609  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17610  * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
17611  */
17612 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
17613
17614 /**
17615  * Constructs a new ChannelHandshakeConfig given each field
17616  */
17617 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);
17618
17619 /**
17620  * Creates a copy of the ChannelHandshakeConfig
17621  */
17622 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
17623
17624 /**
17625  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
17626  */
17627 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
17628
17629 /**
17630  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
17631  */
17632 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
17633
17634 /**
17635  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
17636  * only applies to inbound channels.
17637  *
17638  * Default value: 0.
17639  */
17640 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17641
17642 /**
17643  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
17644  * only applies to inbound channels.
17645  *
17646  * Default value: 0.
17647  */
17648 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17649
17650 /**
17651  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
17652  * only applies to inbound channels.
17653  *
17654  * Default value: 2^24 - 1.
17655  */
17656 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17657
17658 /**
17659  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
17660  * only applies to inbound channels.
17661  *
17662  * Default value: 2^24 - 1.
17663  */
17664 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17665
17666 /**
17667  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
17668  * you to limit the maximum minimum-size they can require.
17669  *
17670  * Default value: u64::max_value.
17671  */
17672 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17673
17674 /**
17675  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
17676  * you to limit the maximum minimum-size they can require.
17677  *
17678  * Default value: u64::max_value.
17679  */
17680 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17681
17682 /**
17683  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17684  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17685  *
17686  * Default value: 0.
17687  */
17688 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17689
17690 /**
17691  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
17692  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
17693  *
17694  * Default value: 0.
17695  */
17696 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17697
17698 /**
17699  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17700  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17701  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17702  *
17703  * Default value: u64::max_value.
17704  */
17705 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17706
17707 /**
17708  * The remote node will require we keep a certain amount in direct payment to ourselves at all
17709  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
17710  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
17711  *
17712  * Default value: u64::max_value.
17713  */
17714 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
17715
17716 /**
17717  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17718  * time. This allows you to set a minimum such value.
17719  *
17720  * Default value: 0.
17721  */
17722 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17723
17724 /**
17725  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
17726  * time. This allows you to set a minimum such value.
17727  *
17728  * Default value: 0.
17729  */
17730 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17731
17732 /**
17733  * Before a channel is usable the funding transaction will need to be confirmed by at least a
17734  * certain number of blocks, specified by the node which is not the funder (as the funder can
17735  * assume they aren't going to double-spend themselves).
17736  * This config allows you to set a limit on the maximum amount of time to wait.
17737  *
17738  * Default value: 144, or roughly one day and only applies to outbound channels.
17739  */
17740 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17741
17742 /**
17743  * Before a channel is usable the funding transaction will need to be confirmed by at least a
17744  * certain number of blocks, specified by the node which is not the funder (as the funder can
17745  * assume they aren't going to double-spend themselves).
17746  * This config allows you to set a limit on the maximum amount of time to wait.
17747  *
17748  * Default value: 144, or roughly one day and only applies to outbound channels.
17749  */
17750 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
17751
17752 /**
17753  * Whether we implicitly trust funding transactions generated by us for our own outbound
17754  * channels to not be double-spent.
17755  *
17756  * If this is set, we assume that our own funding transactions are *never* double-spent, and
17757  * thus we can trust them without any confirmations. This is generally a reasonable
17758  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
17759  * control of the signing keys).
17760  *
17761  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
17762  * double-spend the funding transaction to RBF with an alternative channel open.
17763  *
17764  * This only applies if our counterparty set their confirmations-required value to 0, and we
17765  * always trust our own funding transaction at 1 confirmation irrespective of this value.
17766  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
17767  * `true` (0) and `false` (1).
17768  *
17769  * Default value: true
17770  */
17771 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17772
17773 /**
17774  * Whether we implicitly trust funding transactions generated by us for our own outbound
17775  * channels to not be double-spent.
17776  *
17777  * If this is set, we assume that our own funding transactions are *never* double-spent, and
17778  * thus we can trust them without any confirmations. This is generally a reasonable
17779  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
17780  * control of the signing keys).
17781  *
17782  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
17783  * double-spend the funding transaction to RBF with an alternative channel open.
17784  *
17785  * This only applies if our counterparty set their confirmations-required value to 0, and we
17786  * always trust our own funding transaction at 1 confirmation irrespective of this value.
17787  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
17788  * `true` (0) and `false` (1).
17789  *
17790  * Default value: true
17791  */
17792 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
17793
17794 /**
17795  * Set to force an incoming channel to match our announced channel preference in
17796  * [`ChannelConfig::announced_channel`].
17797  *
17798  * For a node which is not online reliably, this should be set to true and
17799  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
17800  * channels will ever be opened.
17801  *
17802  * Default value: true.
17803  */
17804 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17805
17806 /**
17807  * Set to force an incoming channel to match our announced channel preference in
17808  * [`ChannelConfig::announced_channel`].
17809  *
17810  * For a node which is not online reliably, this should be set to true and
17811  * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
17812  * channels will ever be opened.
17813  *
17814  * Default value: true.
17815  */
17816 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
17817
17818 /**
17819  * Set to the amount of time we're willing to wait to claim money back to us.
17820  *
17821  * Not checking this value would be a security issue, as our peer would be able to set it to
17822  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17823  *
17824  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17825  * reduce the loss of having useless locked funds (if your peer accepts)
17826  */
17827 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
17828
17829 /**
17830  * Set to the amount of time we're willing to wait to claim money back to us.
17831  *
17832  * Not checking this value would be a security issue, as our peer would be able to set it to
17833  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
17834  *
17835  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
17836  * reduce the loss of having useless locked funds (if your peer accepts)
17837  */
17838 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
17839
17840 /**
17841  * Constructs a new ChannelHandshakeLimits given each field
17842  */
17843 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);
17844
17845 /**
17846  * Creates a copy of the ChannelHandshakeLimits
17847  */
17848 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
17849
17850 /**
17851  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
17852  */
17853 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
17854
17855 /**
17856  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
17857  */
17858 void ChannelConfig_free(struct LDKChannelConfig this_obj);
17859
17860 /**
17861  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17862  * over the channel.
17863  * This may be allowed to change at runtime in a later update, however doing so must result in
17864  * update messages sent to notify all nodes of our updated relay fee.
17865  *
17866  * Default value: 0.
17867  */
17868 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17869
17870 /**
17871  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
17872  * over the channel.
17873  * This may be allowed to change at runtime in a later update, however doing so must result in
17874  * update messages sent to notify all nodes of our updated relay fee.
17875  *
17876  * Default value: 0.
17877  */
17878 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17879
17880 /**
17881  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17882  * excess of [`forwarding_fee_proportional_millionths`].
17883  * This may be allowed to change at runtime in a later update, however doing so must result in
17884  * update messages sent to notify all nodes of our updated relay fee.
17885  *
17886  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17887  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17888  * this node.
17889  *
17890  * Default value: 1000.
17891  *
17892  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17893  */
17894 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17895
17896 /**
17897  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
17898  * excess of [`forwarding_fee_proportional_millionths`].
17899  * This may be allowed to change at runtime in a later update, however doing so must result in
17900  * update messages sent to notify all nodes of our updated relay fee.
17901  *
17902  * The default value of a single satoshi roughly matches the market rate on many routing nodes
17903  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
17904  * this node.
17905  *
17906  * Default value: 1000.
17907  *
17908  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
17909  */
17910 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
17911
17912 /**
17913  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17914  * the channel this config applies to.
17915  *
17916  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17917  * HTLC balance when a channel appears on-chain whereas
17918  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17919  * (non-HTLC-encumbered) balance.
17920  *
17921  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17922  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17923  * commitment transaction at least once per this many blocks (minus some margin to allow us
17924  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17925  * the spending transaction).
17926  *
17927  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17928  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17929  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17930  *
17931  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17932  */
17933 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17934
17935 /**
17936  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
17937  * the channel this config applies to.
17938  *
17939  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
17940  * HTLC balance when a channel appears on-chain whereas
17941  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
17942  * (non-HTLC-encumbered) balance.
17943  *
17944  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
17945  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
17946  * commitment transaction at least once per this many blocks (minus some margin to allow us
17947  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
17948  * the spending transaction).
17949  *
17950  * Default value: 72 (12 hours at an average of 6 blocks/hour).
17951  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
17952  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
17953  *
17954  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
17955  */
17956 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
17957
17958 /**
17959  * Set to announce the channel publicly and notify all nodes that they can route via this
17960  * channel.
17961  *
17962  * This should only be set to true for nodes which expect to be online reliably.
17963  *
17964  * As the node which funds a channel picks this value this will only apply for new outbound
17965  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17966  *
17967  * This cannot be changed after the initial channel handshake.
17968  *
17969  * Default value: false.
17970  */
17971 bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
17972
17973 /**
17974  * Set to announce the channel publicly and notify all nodes that they can route via this
17975  * channel.
17976  *
17977  * This should only be set to true for nodes which expect to be online reliably.
17978  *
17979  * As the node which funds a channel picks this value this will only apply for new outbound
17980  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
17981  *
17982  * This cannot be changed after the initial channel handshake.
17983  *
17984  * Default value: false.
17985  */
17986 void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
17987
17988 /**
17989  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
17990  * supports it, they will then enforce the mutual-close output to us matches what we provided
17991  * at intialization, preventing us from closing to an alternate pubkey.
17992  *
17993  * This is set to true by default to provide a slight increase in security, though ultimately
17994  * any attacker who is able to take control of a channel can just as easily send the funds via
17995  * lightning payments, so we never require that our counterparties support this option.
17996  *
17997  * This cannot be changed after a channel has been initialized.
17998  *
17999  * Default value: true.
18000  */
18001 bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18002
18003 /**
18004  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
18005  * supports it, they will then enforce the mutual-close output to us matches what we provided
18006  * at intialization, preventing us from closing to an alternate pubkey.
18007  *
18008  * This is set to true by default to provide a slight increase in security, though ultimately
18009  * any attacker who is able to take control of a channel can just as easily send the funds via
18010  * lightning payments, so we never require that our counterparties support this option.
18011  *
18012  * This cannot be changed after a channel has been initialized.
18013  *
18014  * Default value: true.
18015  */
18016 void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
18017
18018 /**
18019  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
18020  * small to claim on-chain.
18021  *
18022  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
18023  * not be claimable on-chain, instead being turned into additional miner fees if either
18024  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
18025  * to such payments may be sustantial if there are many dust HTLCs present when the
18026  * channel is force-closed.
18027  *
18028  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
18029  * exposure across all three types per-channel. Setting this too low may prevent the
18030  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
18031  * important to prevent stealing of dust HTLCs by miners.
18032  *
18033  * Default value: 5_000_000 msat.
18034  */
18035 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18036
18037 /**
18038  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
18039  * small to claim on-chain.
18040  *
18041  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
18042  * not be claimable on-chain, instead being turned into additional miner fees if either
18043  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
18044  * to such payments may be sustantial if there are many dust HTLCs present when the
18045  * channel is force-closed.
18046  *
18047  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
18048  * exposure across all three types per-channel. Setting this too low may prevent the
18049  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
18050  * important to prevent stealing of dust HTLCs by miners.
18051  *
18052  * Default value: 5_000_000 msat.
18053  */
18054 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
18055
18056 /**
18057  * The additional fee we're willing to pay to avoid waiting for the counterparty's
18058  * `to_self_delay` to reclaim funds.
18059  *
18060  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
18061  * closing transaction which both sides find acceptable, ultimately paid by the channel
18062  * funder/initiator.
18063  *
18064  * When we are the funder, because we have to pay the channel closing fee, we bound the
18065  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
18066  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
18067  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
18068  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
18069  * funds.
18070  *
18071  * When we are not the funder, we require the closing transaction fee pay at least our
18072  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
18073  * Thus, this value is ignored when we are not the funder.
18074  *
18075  * Default value: 1000 satoshis.
18076  *
18077  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
18078  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
18079  */
18080 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18081
18082 /**
18083  * The additional fee we're willing to pay to avoid waiting for the counterparty's
18084  * `to_self_delay` to reclaim funds.
18085  *
18086  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
18087  * closing transaction which both sides find acceptable, ultimately paid by the channel
18088  * funder/initiator.
18089  *
18090  * When we are the funder, because we have to pay the channel closing fee, we bound the
18091  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
18092  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
18093  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
18094  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
18095  * funds.
18096  *
18097  * When we are not the funder, we require the closing transaction fee pay at least our
18098  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
18099  * Thus, this value is ignored when we are not the funder.
18100  *
18101  * Default value: 1000 satoshis.
18102  *
18103  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
18104  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
18105  */
18106 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
18107
18108 /**
18109  * Constructs a new ChannelConfig given each field
18110  */
18111 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);
18112
18113 /**
18114  * Creates a copy of the ChannelConfig
18115  */
18116 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
18117
18118 /**
18119  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
18120  */
18121 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
18122
18123 /**
18124  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
18125  */
18126 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
18127
18128 /**
18129  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
18130  */
18131 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
18132
18133 /**
18134  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
18135  */
18136 void UserConfig_free(struct LDKUserConfig this_obj);
18137
18138 /**
18139  * Channel config that we propose to our counterparty.
18140  */
18141 struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18142
18143 /**
18144  * Channel config that we propose to our counterparty.
18145  */
18146 void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
18147
18148 /**
18149  * Limits applied to our counterparty's proposed channel config settings.
18150  */
18151 struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18152
18153 /**
18154  * Limits applied to our counterparty's proposed channel config settings.
18155  */
18156 void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
18157
18158 /**
18159  * Channel config which affects behavior during channel lifetime.
18160  */
18161 struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18162
18163 /**
18164  * Channel config which affects behavior during channel lifetime.
18165  */
18166 void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
18167
18168 /**
18169  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
18170  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
18171  * node which is not online reliably.
18172  *
18173  * For nodes which are not online reliably, you should set all channels to *not* be announced
18174  * (using [`ChannelConfig::announced_channel`] and
18175  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
18176  * ensure you are not exposed to any forwarding risk.
18177  *
18178  * Note that because you cannot change a channel's announced state after creation, there is no
18179  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
18180  * from a publicly-announced forwarding node to a private non-forwarding node you must close
18181  * all your channels and open new ones. For privacy, you should also change your node_id
18182  * (swapping all private and public key material for new ones) at that time.
18183  *
18184  * Default value: false.
18185  */
18186 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18187
18188 /**
18189  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
18190  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
18191  * node which is not online reliably.
18192  *
18193  * For nodes which are not online reliably, you should set all channels to *not* be announced
18194  * (using [`ChannelConfig::announced_channel`] and
18195  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
18196  * ensure you are not exposed to any forwarding risk.
18197  *
18198  * Note that because you cannot change a channel's announced state after creation, there is no
18199  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
18200  * from a publicly-announced forwarding node to a private non-forwarding node you must close
18201  * all your channels and open new ones. For privacy, you should also change your node_id
18202  * (swapping all private and public key material for new ones) at that time.
18203  *
18204  * Default value: false.
18205  */
18206 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18207
18208 /**
18209  * If this is set to false, we do not accept inbound requests to open a new channel.
18210  * Default value: true.
18211  */
18212 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18213
18214 /**
18215  * If this is set to false, we do not accept inbound requests to open a new channel.
18216  * Default value: true.
18217  */
18218 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18219
18220 /**
18221  * If this is set to true, the user needs to manually accept inbound requests to open a new
18222  * channel.
18223  *
18224  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
18225  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
18226  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
18227  * user explicitly chooses to accept the request.
18228  *
18229  * Default value: false.
18230  *
18231  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
18232  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
18233  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
18234  */
18235 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18236
18237 /**
18238  * If this is set to true, the user needs to manually accept inbound requests to open a new
18239  * channel.
18240  *
18241  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
18242  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
18243  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
18244  * user explicitly chooses to accept the request.
18245  *
18246  * Default value: false.
18247  *
18248  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
18249  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
18250  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
18251  */
18252 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18253
18254 /**
18255  * Constructs a new UserConfig given each field
18256  */
18257 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);
18258
18259 /**
18260  * Creates a copy of the UserConfig
18261  */
18262 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
18263
18264 /**
18265  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
18266  */
18267 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
18268
18269 /**
18270  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
18271  */
18272 void BestBlock_free(struct LDKBestBlock this_obj);
18273
18274 /**
18275  * Creates a copy of the BestBlock
18276  */
18277 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
18278
18279 /**
18280  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
18281  * network.
18282  */
18283 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
18284
18285 /**
18286  * Returns a `BestBlock` as identified by the given block hash and height.
18287  */
18288 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
18289
18290 /**
18291  * Returns the best block hash.
18292  */
18293 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
18294
18295 /**
18296  * Returns the best block height.
18297  */
18298 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
18299
18300 /**
18301  * Creates a copy of the AccessError
18302  */
18303 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
18304
18305 /**
18306  * Utility method to constructs a new UnknownChain-variant AccessError
18307  */
18308 enum LDKAccessError AccessError_unknown_chain(void);
18309
18310 /**
18311  * Utility method to constructs a new UnknownTx-variant AccessError
18312  */
18313 enum LDKAccessError AccessError_unknown_tx(void);
18314
18315 /**
18316  * Calls the free function if one is set
18317  */
18318 void Access_free(struct LDKAccess this_ptr);
18319
18320 /**
18321  * Calls the free function if one is set
18322  */
18323 void Listen_free(struct LDKListen this_ptr);
18324
18325 /**
18326  * Calls the free function if one is set
18327  */
18328 void Confirm_free(struct LDKConfirm this_ptr);
18329
18330 /**
18331  * Creates a copy of the ChannelMonitorUpdateErr
18332  */
18333 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
18334
18335 /**
18336  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
18337  */
18338 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
18339
18340 /**
18341  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
18342  */
18343 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
18344
18345 /**
18346  * Calls the free function if one is set
18347  */
18348 void Watch_free(struct LDKWatch this_ptr);
18349
18350 /**
18351  * Calls the free function if one is set
18352  */
18353 void Filter_free(struct LDKFilter this_ptr);
18354
18355 /**
18356  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
18357  */
18358 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
18359
18360 /**
18361  * First block where the transaction output may have been spent.
18362  *
18363  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18364  */
18365 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18366
18367 /**
18368  * First block where the transaction output may have been spent.
18369  *
18370  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18371  */
18372 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18373
18374 /**
18375  * Outpoint identifying the transaction output.
18376  */
18377 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18378
18379 /**
18380  * Outpoint identifying the transaction output.
18381  */
18382 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18383
18384 /**
18385  * Spending condition of the transaction output.
18386  */
18387 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18388
18389 /**
18390  * Spending condition of the transaction output.
18391  */
18392 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
18393
18394 /**
18395  * Constructs a new WatchedOutput given each field
18396  */
18397 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
18398
18399 /**
18400  * Creates a copy of the WatchedOutput
18401  */
18402 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
18403
18404 /**
18405  * Checks if two WatchedOutputs contain equal inner contents.
18406  */
18407 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
18408
18409 /**
18410  * Calls the free function if one is set
18411  */
18412 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
18413
18414 /**
18415  * Creates a copy of the ConfirmationTarget
18416  */
18417 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
18418
18419 /**
18420  * Utility method to constructs a new Background-variant ConfirmationTarget
18421  */
18422 enum LDKConfirmationTarget ConfirmationTarget_background(void);
18423
18424 /**
18425  * Utility method to constructs a new Normal-variant ConfirmationTarget
18426  */
18427 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
18428
18429 /**
18430  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
18431  */
18432 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
18433
18434 /**
18435  * Checks if two ConfirmationTargets contain equal inner contents.
18436  * This ignores pointers and is_owned flags and looks at the values in fields.
18437  */
18438 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
18439
18440 /**
18441  * Calls the free function if one is set
18442  */
18443 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
18444
18445 /**
18446  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
18447  */
18448 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
18449
18450 /**
18451  * Creates a copy of the MonitorUpdateId
18452  */
18453 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
18454
18455 /**
18456  * Checks if two MonitorUpdateIds contain equal inner contents.
18457  */
18458 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
18459
18460 /**
18461  * Checks if two MonitorUpdateIds contain equal inner contents.
18462  * This ignores pointers and is_owned flags and looks at the values in fields.
18463  * Two objects with NULL inner values will be considered "equal" here.
18464  */
18465 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
18466
18467 /**
18468  * Calls the free function if one is set
18469  */
18470 void Persist_free(struct LDKPersist this_ptr);
18471
18472 /**
18473  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
18474  */
18475 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
18476
18477 /**
18478  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
18479  */
18480 void ChainMonitor_free(struct LDKChainMonitor this_obj);
18481
18482 /**
18483  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
18484  *
18485  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
18486  * will call back to it indicating transactions and outputs of interest. This allows clients to
18487  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
18488  * always need to fetch full blocks absent another means for determining which blocks contain
18489  * transactions relevant to the watched channels.
18490  */
18491 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
18492
18493 /**
18494  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
18495  * claims which are awaiting confirmation.
18496  *
18497  * Includes the balances from each [`ChannelMonitor`] *except* those included in
18498  * `ignored_channels`, allowing you to filter out balances from channels which are still open
18499  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
18500  *
18501  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
18502  * inclusion in the return value.
18503  */
18504 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
18505
18506 /**
18507  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
18508  * such [`ChannelMonitor`] is currently being monitored for.
18509  *
18510  * Note that the result holds a mutex over our monitor set, and should not be held
18511  * indefinitely.
18512  */
18513 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
18514
18515 /**
18516  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
18517  *
18518  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
18519  * monitoring for on-chain state resolutions.
18520  */
18521 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18522
18523 /**
18524  * Indicates the persistence of a [`ChannelMonitor`] has completed after
18525  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
18526  *
18527  * Thus, the anticipated use is, at a high level:
18528  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
18529  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
18530  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
18531  *  2) once all remote copies are updated, you call this function with the
18532  *     `completed_update_id` that completed, and once all pending updates have completed the
18533  *     channel will be re-enabled.
18534  *
18535  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
18536  * registered [`ChannelMonitor`]s.
18537  */
18538 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);
18539
18540 /**
18541  * Constructs a new Listen which calls the relevant methods on this_arg.
18542  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
18543  */
18544 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18545
18546 /**
18547  * Constructs a new Confirm which calls the relevant methods on this_arg.
18548  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
18549  */
18550 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18551
18552 /**
18553  * Constructs a new Watch which calls the relevant methods on this_arg.
18554  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
18555  */
18556 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18557
18558 /**
18559  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
18560  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
18561  */
18562 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
18563
18564 /**
18565  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
18566  */
18567 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
18568
18569 /**
18570  * The sequence number of this update. Updates *must* be replayed in-order according to this
18571  * sequence number (and updates may panic if they are not). The update_id values are strictly
18572  * increasing and increase by one for each new update, with one exception specified below.
18573  *
18574  * This sequence number is also used to track up to which points updates which returned
18575  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
18576  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
18577  *
18578  * The only instance where update_id values are not strictly increasing is the case where we
18579  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
18580  * its docs for more details.
18581  */
18582 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
18583
18584 /**
18585  * The sequence number of this update. Updates *must* be replayed in-order according to this
18586  * sequence number (and updates may panic if they are not). The update_id values are strictly
18587  * increasing and increase by one for each new update, with one exception specified below.
18588  *
18589  * This sequence number is also used to track up to which points updates which returned
18590  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
18591  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
18592  *
18593  * The only instance where update_id values are not strictly increasing is the case where we
18594  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
18595  * its docs for more details.
18596  */
18597 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
18598
18599 /**
18600  * Creates a copy of the ChannelMonitorUpdate
18601  */
18602 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
18603
18604 /**
18605  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
18606  */
18607 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
18608
18609 /**
18610  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
18611  */
18612 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
18613
18614 /**
18615  * Frees any resources used by the MonitorEvent
18616  */
18617 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
18618
18619 /**
18620  * Creates a copy of the MonitorEvent
18621  */
18622 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
18623
18624 /**
18625  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
18626  */
18627 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
18628
18629 /**
18630  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
18631  */
18632 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
18633
18634 /**
18635  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
18636  */
18637 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
18638
18639 /**
18640  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
18641  */
18642 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
18643
18644 /**
18645  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
18646  */
18647 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
18648
18649 /**
18650  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
18651  */
18652 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
18653
18654 /**
18655  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
18656  */
18657 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
18658
18659 /**
18660  * Creates a copy of the HTLCUpdate
18661  */
18662 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
18663
18664 /**
18665  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
18666  */
18667 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
18668
18669 /**
18670  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
18671  */
18672 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
18673
18674 /**
18675  * Frees any resources used by the Balance
18676  */
18677 void Balance_free(struct LDKBalance this_ptr);
18678
18679 /**
18680  * Creates a copy of the Balance
18681  */
18682 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
18683
18684 /**
18685  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
18686  */
18687 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
18688
18689 /**
18690  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
18691  */
18692 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
18693
18694 /**
18695  * Utility method to constructs a new ContentiousClaimable-variant Balance
18696  */
18697 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
18698
18699 /**
18700  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
18701  */
18702 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
18703
18704 /**
18705  * Checks if two Balances contain equal inner contents.
18706  * This ignores pointers and is_owned flags and looks at the values in fields.
18707  */
18708 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
18709
18710 /**
18711  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
18712  */
18713 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
18714
18715 /**
18716  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
18717  */
18718 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
18719
18720 /**
18721  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
18722  * itself.
18723  *
18724  * panics if the given update is not the next update by update_id.
18725  */
18726 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);
18727
18728 /**
18729  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
18730  * ChannelMonitor.
18731  */
18732 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18733
18734 /**
18735  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
18736  */
18737 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18738
18739 /**
18740  * Gets a list of txids, with their output scripts (in the order they appear in the
18741  * transaction), which we must learn about spends of via block_connected().
18742  */
18743 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18744
18745 /**
18746  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
18747  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
18748  * have been registered.
18749  */
18750 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
18751
18752 /**
18753  * Get the list of HTLCs who's status has been updated on chain. This should be called by
18754  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
18755  */
18756 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18757
18758 /**
18759  * Gets the list of pending events which were generated by previous actions, clearing the list
18760  * in the process.
18761  *
18762  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
18763  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
18764  * no internal locking in ChannelMonitors.
18765  */
18766 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18767
18768 /**
18769  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
18770  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
18771  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
18772  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
18773  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
18774  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
18775  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
18776  * out-of-band the other node operator to coordinate with him if option is available to you.
18777  * In any-case, choice is up to the user.
18778  */
18779 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);
18780
18781 /**
18782  * Processes transactions in a newly connected block, which may result in any of the following:
18783  * - update the monitor's state against resolved HTLCs
18784  * - punish the counterparty in the case of seeing a revoked commitment transaction
18785  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
18786  * - detect settled outputs for later spending
18787  * - schedule and bump any in-flight claims
18788  *
18789  * Returns any new outputs to watch from `txdata`; after called, these are also included in
18790  * [`get_outputs_to_watch`].
18791  *
18792  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
18793  */
18794 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);
18795
18796 /**
18797  * Determines if the disconnected block contained any transactions of interest and updates
18798  * appropriately.
18799  */
18800 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);
18801
18802 /**
18803  * Processes transactions confirmed in a block with the given header and height, returning new
18804  * outputs to watch. See [`block_connected`] for details.
18805  *
18806  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
18807  * blocks. See [`chain::Confirm`] for calling expectations.
18808  *
18809  * [`block_connected`]: Self::block_connected
18810  */
18811 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);
18812
18813 /**
18814  * Processes a transaction that was reorganized out of the chain.
18815  *
18816  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
18817  * than blocks. See [`chain::Confirm`] for calling expectations.
18818  *
18819  * [`block_disconnected`]: Self::block_disconnected
18820  */
18821 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);
18822
18823 /**
18824  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
18825  * [`block_connected`] for details.
18826  *
18827  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
18828  * blocks. See [`chain::Confirm`] for calling expectations.
18829  *
18830  * [`block_connected`]: Self::block_connected
18831  */
18832 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);
18833
18834 /**
18835  * Returns the set of txids that should be monitored for re-organization out of the chain.
18836  */
18837 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18838
18839 /**
18840  * Gets the latest best block which was connected either via the [`chain::Listen`] or
18841  * [`chain::Confirm`] interfaces.
18842  */
18843 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18844
18845 /**
18846  * Gets the balances in this channel which are either claimable by us if we were to
18847  * force-close the channel now or which are claimable on-chain (possibly awaiting
18848  * confirmation).
18849  *
18850  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
18851  * included here until an [`Event::SpendableOutputs`] event has been generated for the
18852  * balance, or until our counterparty has claimed the balance and accrued several
18853  * confirmations on the claim transaction.
18854  *
18855  * Note that the balances available when you or your counterparty have broadcasted revoked
18856  * state(s) may not be fully captured here.
18857  *
18858  * See [`Balance`] for additional details on the types of claimable balances which
18859  * may be returned here and their meanings.
18860  */
18861 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
18862
18863 /**
18864  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
18865  */
18866 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
18867
18868 /**
18869  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
18870  */
18871 void OutPoint_free(struct LDKOutPoint this_obj);
18872
18873 /**
18874  * The referenced transaction's txid.
18875  */
18876 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
18877
18878 /**
18879  * The referenced transaction's txid.
18880  */
18881 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18882
18883 /**
18884  * The index of the referenced output in its transaction's vout.
18885  */
18886 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
18887
18888 /**
18889  * The index of the referenced output in its transaction's vout.
18890  */
18891 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
18892
18893 /**
18894  * Constructs a new OutPoint given each field
18895  */
18896 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
18897
18898 /**
18899  * Creates a copy of the OutPoint
18900  */
18901 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
18902
18903 /**
18904  * Checks if two OutPoints contain equal inner contents.
18905  * This ignores pointers and is_owned flags and looks at the values in fields.
18906  * Two objects with NULL inner values will be considered "equal" here.
18907  */
18908 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
18909
18910 /**
18911  * Checks if two OutPoints contain equal inner contents.
18912  */
18913 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
18914
18915 /**
18916  * Convert an `OutPoint` to a lightning channel id.
18917  */
18918 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
18919
18920 /**
18921  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
18922  */
18923 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
18924
18925 /**
18926  * Read a OutPoint from a byte array, created by OutPoint_write
18927  */
18928 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
18929
18930 /**
18931  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
18932  */
18933 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
18934
18935 /**
18936  * The outpoint which is spendable
18937  */
18938 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18939
18940 /**
18941  * The outpoint which is spendable
18942  */
18943 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18944
18945 /**
18946  * Per commitment point to derive delayed_payment_key by key holder
18947  */
18948 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18949
18950 /**
18951  * Per commitment point to derive delayed_payment_key by key holder
18952  */
18953 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18954
18955 /**
18956  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
18957  * the witness_script.
18958  */
18959 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18960
18961 /**
18962  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
18963  * the witness_script.
18964  */
18965 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
18966
18967 /**
18968  * The output which is referenced by the given outpoint
18969  */
18970 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
18971
18972 /**
18973  * The revocation point specific to the commitment transaction which was broadcast. Used to
18974  * derive the witnessScript for this output.
18975  */
18976 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
18977
18978 /**
18979  * The revocation point specific to the commitment transaction which was broadcast. Used to
18980  * derive the witnessScript for this output.
18981  */
18982 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
18983
18984 /**
18985  * Arbitrary identification information returned by a call to
18986  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18987  * the channel to spend the output.
18988  */
18989 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
18990
18991 /**
18992  * Arbitrary identification information returned by a call to
18993  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
18994  * the channel to spend the output.
18995  */
18996 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18997
18998 /**
18999  * The value of the channel which this output originated from, possibly indirectly.
19000  */
19001 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19002
19003 /**
19004  * The value of the channel which this output originated from, possibly indirectly.
19005  */
19006 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
19007
19008 /**
19009  * Constructs a new DelayedPaymentOutputDescriptor given each field
19010  */
19011 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);
19012
19013 /**
19014  * Creates a copy of the DelayedPaymentOutputDescriptor
19015  */
19016 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
19017
19018 /**
19019  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
19020  */
19021 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
19022
19023 /**
19024  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
19025  */
19026 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
19027
19028 /**
19029  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
19030  */
19031 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
19032
19033 /**
19034  * The outpoint which is spendable
19035  */
19036 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19037
19038 /**
19039  * The outpoint which is spendable
19040  */
19041 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19042
19043 /**
19044  * The output which is referenced by the given outpoint
19045  */
19046 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
19047
19048 /**
19049  * Arbitrary identification information returned by a call to
19050  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19051  * the channel to spend the output.
19052  */
19053 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
19054
19055 /**
19056  * Arbitrary identification information returned by a call to
19057  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19058  * the channel to spend the output.
19059  */
19060 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19061
19062 /**
19063  * The value of the channel which this transactions spends.
19064  */
19065 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19066
19067 /**
19068  * The value of the channel which this transactions spends.
19069  */
19070 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
19071
19072 /**
19073  * Constructs a new StaticPaymentOutputDescriptor given each field
19074  */
19075 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);
19076
19077 /**
19078  * Creates a copy of the StaticPaymentOutputDescriptor
19079  */
19080 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
19081
19082 /**
19083  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
19084  */
19085 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
19086
19087 /**
19088  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
19089  */
19090 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
19091
19092 /**
19093  * Frees any resources used by the SpendableOutputDescriptor
19094  */
19095 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
19096
19097 /**
19098  * Creates a copy of the SpendableOutputDescriptor
19099  */
19100 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
19101
19102 /**
19103  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
19104  */
19105 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
19106
19107 /**
19108  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
19109  */
19110 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
19111
19112 /**
19113  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
19114  */
19115 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
19116
19117 /**
19118  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
19119  */
19120 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
19121
19122 /**
19123  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
19124  */
19125 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
19126
19127 /**
19128  * Calls the free function if one is set
19129  */
19130 void BaseSign_free(struct LDKBaseSign this_ptr);
19131
19132 /**
19133  * Creates a copy of a Sign
19134  */
19135 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
19136
19137 /**
19138  * Calls the free function if one is set
19139  */
19140 void Sign_free(struct LDKSign this_ptr);
19141
19142 /**
19143  * Creates a copy of the Recipient
19144  */
19145 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
19146
19147 /**
19148  * Utility method to constructs a new Node-variant Recipient
19149  */
19150 enum LDKRecipient Recipient_node(void);
19151
19152 /**
19153  * Utility method to constructs a new PhantomNode-variant Recipient
19154  */
19155 enum LDKRecipient Recipient_phantom_node(void);
19156
19157 /**
19158  * Calls the free function if one is set
19159  */
19160 void KeysInterface_free(struct LDKKeysInterface this_ptr);
19161
19162 /**
19163  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
19164  */
19165 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
19166
19167 /**
19168  * Private key of anchor tx
19169  */
19170 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19171
19172 /**
19173  * Private key of anchor tx
19174  */
19175 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19176
19177 /**
19178  * Holder secret key for blinded revocation pubkey
19179  */
19180 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19181
19182 /**
19183  * Holder secret key for blinded revocation pubkey
19184  */
19185 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19186
19187 /**
19188  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
19189  */
19190 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19191
19192 /**
19193  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
19194  */
19195 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19196
19197 /**
19198  * Holder secret key used in HTLC tx
19199  */
19200 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19201
19202 /**
19203  * Holder secret key used in HTLC tx
19204  */
19205 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19206
19207 /**
19208  * Holder htlc secret key used in commitment tx htlc outputs
19209  */
19210 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19211
19212 /**
19213  * Holder htlc secret key used in commitment tx htlc outputs
19214  */
19215 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19216
19217 /**
19218  * Commitment seed
19219  */
19220 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19221
19222 /**
19223  * Commitment seed
19224  */
19225 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19226
19227 /**
19228  * Creates a copy of the InMemorySigner
19229  */
19230 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
19231
19232 /**
19233  * Create a new InMemorySigner
19234  */
19235 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);
19236
19237 /**
19238  * Counterparty pubkeys.
19239  * Will panic if ready_channel wasn't called.
19240  */
19241 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19242
19243 /**
19244  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
19245  * transactions, ie the amount of time that we have to wait to recover our funds if we
19246  * broadcast a transaction.
19247  * Will panic if ready_channel wasn't called.
19248  */
19249 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19250
19251 /**
19252  * The contest_delay value specified by us and applied on transactions broadcastable
19253  * by our counterparty, ie the amount of time that they have to wait to recover their funds
19254  * if they broadcast a transaction.
19255  * Will panic if ready_channel wasn't called.
19256  */
19257 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19258
19259 /**
19260  * Whether the holder is the initiator
19261  * Will panic if ready_channel wasn't called.
19262  */
19263 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19264
19265 /**
19266  * Funding outpoint
19267  * Will panic if ready_channel wasn't called.
19268  */
19269 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19270
19271 /**
19272  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
19273  * building transactions.
19274  *
19275  * Will panic if ready_channel wasn't called.
19276  */
19277 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19278
19279 /**
19280  * Whether anchors should be used.
19281  * Will panic if ready_channel wasn't called.
19282  */
19283 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19284
19285 /**
19286  * Sign the single input of spend_tx at index `input_idx` which spends the output
19287  * described by descriptor, returning the witness stack for the input.
19288  *
19289  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
19290  * is not spending the outpoint described by `descriptor.outpoint`,
19291  * or if an output descriptor script_pubkey does not match the one we can spend.
19292  */
19293 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);
19294
19295 /**
19296  * Sign the single input of spend_tx at index `input_idx` which spends the output
19297  * described by descriptor, returning the witness stack for the input.
19298  *
19299  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
19300  * is not spending the outpoint described by `descriptor.outpoint`, does not have a
19301  * sequence set to `descriptor.to_self_delay`, or if an output descriptor
19302  * script_pubkey does not match the one we can spend.
19303  */
19304 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);
19305
19306 /**
19307  * Constructs a new BaseSign which calls the relevant methods on this_arg.
19308  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
19309  */
19310 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19311
19312 /**
19313  * Constructs a new Sign which calls the relevant methods on this_arg.
19314  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
19315  */
19316 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19317
19318 /**
19319  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
19320  */
19321 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
19322
19323 /**
19324  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
19325  */
19326 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
19327
19328 /**
19329  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
19330  */
19331 void KeysManager_free(struct LDKKeysManager this_obj);
19332
19333 /**
19334  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
19335  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
19336  * starting_time isn't strictly required to actually be a time, but it must absolutely,
19337  * without a doubt, be unique to this instance. ie if you start multiple times with the same
19338  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
19339  * simply use the current time (with very high precision).
19340  *
19341  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
19342  * obviously, starting_time should be unique every time you reload the library - it is only
19343  * used to generate new ephemeral key data (which will be stored by the individual channel if
19344  * necessary).
19345  *
19346  * Note that the seed is required to recover certain on-chain funds independent of
19347  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
19348  * channel, and some on-chain during-closing funds.
19349  *
19350  * Note that until the 0.1 release there is no guarantee of backward compatibility between
19351  * versions. Once the library is more fully supported, the docs will be updated to include a
19352  * detailed description of the guarantee.
19353  */
19354 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
19355
19356 /**
19357  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
19358  *
19359  * Key derivation parameters are accessible through a per-channel secrets
19360  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
19361  * onchain output detection for which a corresponding delayed_payment_key must be derived.
19362  */
19363 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]);
19364
19365 /**
19366  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
19367  * output to the given change destination (if sufficient change value remains). The
19368  * transaction will have a feerate, at least, of the given value.
19369  *
19370  * Returns `Err(())` if the output value is greater than the input value minus required fee,
19371  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
19372  * does not match the one we can spend.
19373  *
19374  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
19375  *
19376  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
19377  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
19378  */
19379 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);
19380
19381 /**
19382  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
19383  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
19384  */
19385 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
19386
19387 /**
19388  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
19389  */
19390 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
19391
19392 /**
19393  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
19394  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
19395  */
19396 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
19397
19398 /**
19399  * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
19400  * that is shared across all nodes that intend to participate in [phantom node payments] together.
19401  *
19402  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
19403  * `starting_time_nanos`.
19404  *
19405  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
19406  * same across restarts, or else inbound payments may fail.
19407  *
19408  * [phantom node payments]: PhantomKeysManager
19409  */
19410 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]);
19411
19412 /**
19413  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
19414  */
19415 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);
19416
19417 /**
19418  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
19419  */
19420 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]);
19421
19422 /**
19423  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
19424  */
19425 void ChannelManager_free(struct LDKChannelManager this_obj);
19426
19427 /**
19428  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
19429  */
19430 void ChainParameters_free(struct LDKChainParameters this_obj);
19431
19432 /**
19433  * The network for determining the `chain_hash` in Lightning messages.
19434  */
19435 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
19436
19437 /**
19438  * The network for determining the `chain_hash` in Lightning messages.
19439  */
19440 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
19441
19442 /**
19443  * The hash and height of the latest block successfully connected.
19444  *
19445  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
19446  */
19447 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
19448
19449 /**
19450  * The hash and height of the latest block successfully connected.
19451  *
19452  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
19453  */
19454 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
19455
19456 /**
19457  * Constructs a new ChainParameters given each field
19458  */
19459 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
19460
19461 /**
19462  * Creates a copy of the ChainParameters
19463  */
19464 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
19465
19466 /**
19467  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
19468  */
19469 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
19470
19471 /**
19472  * Base routing fee in millisatoshis.
19473  */
19474 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19475
19476 /**
19477  * Base routing fee in millisatoshis.
19478  */
19479 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
19480
19481 /**
19482  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
19483  */
19484 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19485
19486 /**
19487  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
19488  */
19489 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
19490
19491 /**
19492  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
19493  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
19494  * `cltv_expiry_delta` for more details.
19495  */
19496 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
19497
19498 /**
19499  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
19500  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
19501  * `cltv_expiry_delta` for more details.
19502  */
19503 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
19504
19505 /**
19506  * Constructs a new CounterpartyForwardingInfo given each field
19507  */
19508 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);
19509
19510 /**
19511  * Creates a copy of the CounterpartyForwardingInfo
19512  */
19513 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
19514
19515 /**
19516  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
19517  */
19518 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
19519
19520 /**
19521  * The node_id of our counterparty
19522  */
19523 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19524
19525 /**
19526  * The node_id of our counterparty
19527  */
19528 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19529
19530 /**
19531  * The Features the channel counterparty provided upon last connection.
19532  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
19533  * many routing-relevant features are present in the init context.
19534  */
19535 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19536
19537 /**
19538  * The Features the channel counterparty provided upon last connection.
19539  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
19540  * many routing-relevant features are present in the init context.
19541  */
19542 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
19543
19544 /**
19545  * The value, in satoshis, that must always be held in the channel for our counterparty. This
19546  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
19547  * claiming at least this value on chain.
19548  *
19549  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
19550  *
19551  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
19552  */
19553 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19554
19555 /**
19556  * The value, in satoshis, that must always be held in the channel for our counterparty. This
19557  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
19558  * claiming at least this value on chain.
19559  *
19560  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
19561  *
19562  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
19563  */
19564 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
19565
19566 /**
19567  * Information on the fees and requirements that the counterparty requires when forwarding
19568  * payments to us through this channel.
19569  *
19570  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19571  */
19572 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19573
19574 /**
19575  * Information on the fees and requirements that the counterparty requires when forwarding
19576  * payments to us through this channel.
19577  *
19578  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19579  */
19580 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
19581
19582 /**
19583  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
19584  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
19585  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
19586  */
19587 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19588
19589 /**
19590  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
19591  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
19592  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
19593  */
19594 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19595
19596 /**
19597  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
19598  */
19599 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
19600
19601 /**
19602  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
19603  */
19604 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19605
19606 /**
19607  * Constructs a new ChannelCounterparty given each field
19608  */
19609 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);
19610
19611 /**
19612  * Creates a copy of the ChannelCounterparty
19613  */
19614 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
19615
19616 /**
19617  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
19618  */
19619 void ChannelDetails_free(struct LDKChannelDetails this_obj);
19620
19621 /**
19622  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
19623  * thereafter this is the txid of the funding transaction xor the funding transaction output).
19624  * Note that this means this value is *not* persistent - it can change once during the
19625  * lifetime of the channel.
19626  */
19627 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
19628
19629 /**
19630  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
19631  * thereafter this is the txid of the funding transaction xor the funding transaction output).
19632  * Note that this means this value is *not* persistent - it can change once during the
19633  * lifetime of the channel.
19634  */
19635 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19636
19637 /**
19638  * Parameters which apply to our counterparty. See individual fields for more information.
19639  */
19640 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19641
19642 /**
19643  * Parameters which apply to our counterparty. See individual fields for more information.
19644  */
19645 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
19646
19647 /**
19648  * The Channel's funding transaction output, if we've negotiated the funding transaction with
19649  * our counterparty already.
19650  *
19651  * Note that, if this has been set, `channel_id` will be equivalent to
19652  * `funding_txo.unwrap().to_channel_id()`.
19653  *
19654  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19655  */
19656 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19657
19658 /**
19659  * The Channel's funding transaction output, if we've negotiated the funding transaction with
19660  * our counterparty already.
19661  *
19662  * Note that, if this has been set, `channel_id` will be equivalent to
19663  * `funding_txo.unwrap().to_channel_id()`.
19664  *
19665  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19666  */
19667 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19668
19669 /**
19670  * The features which this channel operates with. See individual features for more info.
19671  *
19672  * `None` until negotiation completes and the channel type is finalized.
19673  *
19674  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19675  */
19676 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19677
19678 /**
19679  * The features which this channel operates with. See individual features for more info.
19680  *
19681  * `None` until negotiation completes and the channel type is finalized.
19682  *
19683  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
19684  */
19685 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
19686
19687 /**
19688  * The position of the funding transaction in the chain. None if the funding transaction has
19689  * not yet been confirmed and the channel fully opened.
19690  *
19691  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
19692  * payments instead of this. See [`get_inbound_payment_scid`].
19693  *
19694  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
19695  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
19696  *
19697  * [`inbound_scid_alias`]: Self::inbound_scid_alias
19698  * [`outbound_scid_alias`]: Self::outbound_scid_alias
19699  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
19700  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
19701  * [`confirmations_required`]: Self::confirmations_required
19702  */
19703 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19704
19705 /**
19706  * The position of the funding transaction in the chain. None if the funding transaction has
19707  * not yet been confirmed and the channel fully opened.
19708  *
19709  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
19710  * payments instead of this. See [`get_inbound_payment_scid`].
19711  *
19712  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
19713  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
19714  *
19715  * [`inbound_scid_alias`]: Self::inbound_scid_alias
19716  * [`outbound_scid_alias`]: Self::outbound_scid_alias
19717  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
19718  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
19719  * [`confirmations_required`]: Self::confirmations_required
19720  */
19721 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19722
19723 /**
19724  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
19725  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
19726  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
19727  * `Some(0)`).
19728  *
19729  * This will be `None` as long as the channel is not available for routing outbound payments.
19730  *
19731  * [`short_channel_id`]: Self::short_channel_id
19732  * [`confirmations_required`]: Self::confirmations_required
19733  */
19734 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19735
19736 /**
19737  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
19738  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
19739  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
19740  * `Some(0)`).
19741  *
19742  * This will be `None` as long as the channel is not available for routing outbound payments.
19743  *
19744  * [`short_channel_id`]: Self::short_channel_id
19745  * [`confirmations_required`]: Self::confirmations_required
19746  */
19747 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19748
19749 /**
19750  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
19751  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
19752  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
19753  * when they see a payment to be routed to us.
19754  *
19755  * Our counterparty may choose to rotate this value at any time, though will always recognize
19756  * previous values for inbound payment forwarding.
19757  *
19758  * [`short_channel_id`]: Self::short_channel_id
19759  */
19760 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19761
19762 /**
19763  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
19764  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
19765  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
19766  * when they see a payment to be routed to us.
19767  *
19768  * Our counterparty may choose to rotate this value at any time, though will always recognize
19769  * previous values for inbound payment forwarding.
19770  *
19771  * [`short_channel_id`]: Self::short_channel_id
19772  */
19773 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19774
19775 /**
19776  * The value, in satoshis, of this channel as appears in the funding output
19777  */
19778 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19779
19780 /**
19781  * The value, in satoshis, of this channel as appears in the funding output
19782  */
19783 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19784
19785 /**
19786  * The value, in satoshis, that must always be held in the channel for us. This value ensures
19787  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
19788  * this value on chain.
19789  *
19790  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
19791  *
19792  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19793  *
19794  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
19795  */
19796 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19797
19798 /**
19799  * The value, in satoshis, that must always be held in the channel for us. This value ensures
19800  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
19801  * this value on chain.
19802  *
19803  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
19804  *
19805  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19806  *
19807  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
19808  */
19809 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
19810
19811 /**
19812  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
19813  */
19814 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19815
19816 /**
19817  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
19818  */
19819 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19820
19821 /**
19822  * Our total balance.  This is the amount we would get if we close the channel.
19823  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
19824  * amount is not likely to be recoverable on close.
19825  *
19826  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
19827  * balance is not available for inclusion in new outbound HTLCs). This further does not include
19828  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
19829  * This does not consider any on-chain fees.
19830  *
19831  * See also [`ChannelDetails::outbound_capacity_msat`]
19832  */
19833 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19834
19835 /**
19836  * Our total balance.  This is the amount we would get if we close the channel.
19837  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
19838  * amount is not likely to be recoverable on close.
19839  *
19840  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
19841  * balance is not available for inclusion in new outbound HTLCs). This further does not include
19842  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
19843  * This does not consider any on-chain fees.
19844  *
19845  * See also [`ChannelDetails::outbound_capacity_msat`]
19846  */
19847 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19848
19849 /**
19850  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
19851  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19852  * available for inclusion in new outbound HTLCs). This further does not include any pending
19853  * outgoing HTLCs which are awaiting some other resolution to be sent.
19854  *
19855  * See also [`ChannelDetails::balance_msat`]
19856  *
19857  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19858  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
19859  * should be able to spend nearly this amount.
19860  */
19861 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19862
19863 /**
19864  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
19865  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19866  * available for inclusion in new outbound HTLCs). This further does not include any pending
19867  * outgoing HTLCs which are awaiting some other resolution to be sent.
19868  *
19869  * See also [`ChannelDetails::balance_msat`]
19870  *
19871  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19872  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
19873  * should be able to spend nearly this amount.
19874  */
19875 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19876
19877 /**
19878  * The available outbound capacity for sending a single HTLC to the remote peer. This is
19879  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
19880  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
19881  * to use a limit as close as possible to the HTLC limit we can currently send.
19882  *
19883  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
19884  */
19885 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19886
19887 /**
19888  * The available outbound capacity for sending a single HTLC to the remote peer. This is
19889  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
19890  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
19891  * to use a limit as close as possible to the HTLC limit we can currently send.
19892  *
19893  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
19894  */
19895 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19896
19897 /**
19898  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
19899  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19900  * available for inclusion in new inbound HTLCs).
19901  * Note that there are some corner cases not fully handled here, so the actual available
19902  * inbound capacity may be slightly higher than this.
19903  *
19904  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19905  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
19906  * However, our counterparty should be able to spend nearly this amount.
19907  */
19908 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19909
19910 /**
19911  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
19912  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
19913  * available for inclusion in new inbound HTLCs).
19914  * Note that there are some corner cases not fully handled here, so the actual available
19915  * inbound capacity may be slightly higher than this.
19916  *
19917  * This value is not exact. Due to various in-flight changes, feerate changes, and our
19918  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
19919  * However, our counterparty should be able to spend nearly this amount.
19920  */
19921 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
19922
19923 /**
19924  * The number of required confirmations on the funding transaction before the funding will be
19925  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
19926  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
19927  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
19928  * [`ChannelHandshakeLimits::max_minimum_depth`].
19929  *
19930  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19931  *
19932  * [`is_outbound`]: ChannelDetails::is_outbound
19933  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
19934  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
19935  */
19936 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19937
19938 /**
19939  * The number of required confirmations on the funding transaction before the funding will be
19940  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
19941  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
19942  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
19943  * [`ChannelHandshakeLimits::max_minimum_depth`].
19944  *
19945  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19946  *
19947  * [`is_outbound`]: ChannelDetails::is_outbound
19948  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
19949  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
19950  */
19951 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
19952
19953 /**
19954  * The number of blocks (after our commitment transaction confirms) that we will need to wait
19955  * until we can claim our funds after we force-close the channel. During this time our
19956  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
19957  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
19958  * time to claim our non-HTLC-encumbered funds.
19959  *
19960  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19961  */
19962 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19963
19964 /**
19965  * The number of blocks (after our commitment transaction confirms) that we will need to wait
19966  * until we can claim our funds after we force-close the channel. During this time our
19967  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
19968  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
19969  * time to claim our non-HTLC-encumbered funds.
19970  *
19971  * This value will be `None` for outbound channels until the counterparty accepts the channel.
19972  */
19973 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
19974
19975 /**
19976  * True if the channel was initiated (and thus funded) by us.
19977  */
19978 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19979
19980 /**
19981  * True if the channel was initiated (and thus funded) by us.
19982  */
19983 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
19984
19985 /**
19986  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
19987  * channel is not currently being shut down. `channel_ready` message exchange implies the
19988  * required confirmation count has been reached (and we were connected to the peer at some
19989  * point after the funding transaction received enough confirmations). The required
19990  * confirmation count is provided in [`confirmations_required`].
19991  *
19992  * [`confirmations_required`]: ChannelDetails::confirmations_required
19993  */
19994 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
19995
19996 /**
19997  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
19998  * channel is not currently being shut down. `channel_ready` message exchange implies the
19999  * required confirmation count has been reached (and we were connected to the peer at some
20000  * point after the funding transaction received enough confirmations). The required
20001  * confirmation count is provided in [`confirmations_required`].
20002  *
20003  * [`confirmations_required`]: ChannelDetails::confirmations_required
20004  */
20005 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20006
20007 /**
20008  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
20009  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
20010  *
20011  * This is a strict superset of `is_channel_ready`.
20012  */
20013 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20014
20015 /**
20016  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
20017  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
20018  *
20019  * This is a strict superset of `is_channel_ready`.
20020  */
20021 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20022
20023 /**
20024  * True if this channel is (or will be) publicly-announced.
20025  */
20026 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20027
20028 /**
20029  * True if this channel is (or will be) publicly-announced.
20030  */
20031 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20032
20033 /**
20034  * The smallest value HTLC (in msat) we will accept, for this channel. This field
20035  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
20036  */
20037 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20038
20039 /**
20040  * The smallest value HTLC (in msat) we will accept, for this channel. This field
20041  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
20042  */
20043 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20044
20045 /**
20046  * The largest value HTLC (in msat) we currently will accept, for this channel.
20047  */
20048 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20049
20050 /**
20051  * The largest value HTLC (in msat) we currently will accept, for this channel.
20052  */
20053 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20054
20055 /**
20056  * Constructs a new ChannelDetails given each field
20057  */
20058 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);
20059
20060 /**
20061  * Creates a copy of the ChannelDetails
20062  */
20063 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
20064
20065 /**
20066  * Gets the current SCID which should be used to identify this channel for inbound payments.
20067  * This should be used for providing invoice hints or in any other context where our
20068  * counterparty will forward a payment to us.
20069  *
20070  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
20071  * [`ChannelDetails::short_channel_id`]. See those for more information.
20072  */
20073 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
20074
20075 /**
20076  * Gets the current SCID which should be used to identify this channel for outbound payments.
20077  * This should be used in [`Route`]s to describe the first hop or in other contexts where
20078  * we're sending or forwarding a payment outbound over this channel.
20079  *
20080  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
20081  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
20082  */
20083 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
20084
20085 /**
20086  * Frees any resources used by the PaymentSendFailure
20087  */
20088 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
20089
20090 /**
20091  * Creates a copy of the PaymentSendFailure
20092  */
20093 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
20094
20095 /**
20096  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
20097  */
20098 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
20099
20100 /**
20101  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
20102  */
20103 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
20104
20105 /**
20106  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
20107  */
20108 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
20109
20110 /**
20111  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
20112  */
20113 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
20114
20115 /**
20116  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
20117  */
20118 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
20119
20120 /**
20121  * The list of channels to be included in the invoice route hints.
20122  */
20123 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20124
20125 /**
20126  * The list of channels to be included in the invoice route hints.
20127  */
20128 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
20129
20130 /**
20131  * A fake scid used for representing the phantom node's fake channel in generating the invoice
20132  * route hints.
20133  */
20134 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20135
20136 /**
20137  * A fake scid used for representing the phantom node's fake channel in generating the invoice
20138  * route hints.
20139  */
20140 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
20141
20142 /**
20143  * The pubkey of the real backing node that would ultimately receive the payment.
20144  */
20145 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20146
20147 /**
20148  * The pubkey of the real backing node that would ultimately receive the payment.
20149  */
20150 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20151
20152 /**
20153  * Constructs a new PhantomRouteHints given each field
20154  */
20155 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
20156
20157 /**
20158  * Creates a copy of the PhantomRouteHints
20159  */
20160 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
20161
20162 /**
20163  * Constructs a new ChannelManager to hold several channels and route between them.
20164  *
20165  * This is the main \"logic hub\" for all channel-related actions, and implements
20166  * ChannelMessageHandler.
20167  *
20168  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
20169  *
20170  * Users need to notify the new ChannelManager when a new block is connected or
20171  * disconnected using its `block_connected` and `block_disconnected` methods, starting
20172  * from after `params.latest_hash`.
20173  */
20174 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);
20175
20176 /**
20177  * Gets the current configuration applied to all new channels,  as
20178  */
20179 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
20180
20181 /**
20182  * Creates a new outbound channel to the given remote node and with the given value.
20183  *
20184  * `user_channel_id` will be provided back as in
20185  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
20186  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
20187  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
20188  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
20189  * ignored.
20190  *
20191  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
20192  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
20193  *
20194  * Note that we do not check if you are currently connected to the given peer. If no
20195  * connection is available, the outbound `open_channel` message may fail to send, resulting in
20196  * the channel eventually being silently forgotten (dropped on reload).
20197  *
20198  * Returns the new Channel's temporary `channel_id`. This ID will appear as
20199  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
20200  * [`ChannelDetails::channel_id`] until after
20201  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
20202  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
20203  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
20204  *
20205  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
20206  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
20207  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
20208  *
20209  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
20210  */
20211 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);
20212
20213 /**
20214  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
20215  * more information.
20216  */
20217 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
20218
20219 /**
20220  * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`]
20221  * to ensure non-announced channels are used.
20222  *
20223  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
20224  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
20225  * are.
20226  *
20227  * [`find_route`]: crate::routing::router::find_route
20228  */
20229 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
20230
20231 /**
20232  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
20233  * will be accepted on the given channel, and after additional timeout/the closing of all
20234  * pending HTLCs, the channel will be closed on chain.
20235  *
20236  *  * If we are the channel initiator, we will pay between our [`Background`] and
20237  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
20238  *    estimate.
20239  *  * If our counterparty is the channel initiator, we will require a channel closing
20240  *    transaction feerate of at least our [`Background`] feerate or the feerate which
20241  *    would appear on a force-closure transaction, whichever is lower. We will allow our
20242  *    counterparty to pay as much fee as they'd like, however.
20243  *
20244  * May generate a SendShutdown message event on success, which should be relayed.
20245  *
20246  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
20247  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20248  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20249  */
20250 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);
20251
20252 /**
20253  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
20254  * will be accepted on the given channel, and after additional timeout/the closing of all
20255  * pending HTLCs, the channel will be closed on chain.
20256  *
20257  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
20258  * the channel being closed or not:
20259  *  * If we are the channel initiator, we will pay at least this feerate on the closing
20260  *    transaction. The upper-bound is set by
20261  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
20262  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
20263  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
20264  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
20265  *    will appear on a force-closure transaction, whichever is lower).
20266  *
20267  * May generate a SendShutdown message event on success, which should be relayed.
20268  *
20269  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
20270  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20271  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20272  */
20273 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);
20274
20275 /**
20276  * Force closes a channel, immediately broadcasting the latest local commitment transaction to
20277  * the chain and rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
20278  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
20279  * channel.
20280  */
20281 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);
20282
20283 /**
20284  * Force close all channels, immediately broadcasting the latest local commitment transaction
20285  * for each to the chain and rejecting new HTLCs on each.
20286  */
20287 void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
20288
20289 /**
20290  * Sends a payment along a given route.
20291  *
20292  * Value parameters are provided via the last hop in route, see documentation for RouteHop
20293  * fields for more info.
20294  *
20295  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
20296  * payment), we don't do anything to stop you! We always try to ensure that if the provided
20297  * next hop knows the preimage to payment_hash they can claim an additional amount as
20298  * specified in the last hop in the route! Thus, you should probably do your own
20299  * payment_preimage tracking (which you should already be doing as they represent \"proof of
20300  * payment\") and prevent double-sends yourself.
20301  *
20302  * May generate SendHTLCs message(s) event on success, which should be relayed.
20303  *
20304  * Each path may have a different return value, and PaymentSendValue may return a Vec with
20305  * each entry matching the corresponding-index entry in the route paths, see
20306  * PaymentSendFailure for more info.
20307  *
20308  * In general, a path may raise:
20309  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
20310  *    node public key) is specified.
20311  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
20312  *    (including due to previous monitor update failure or new permanent monitor update
20313  *    failure).
20314  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
20315  *    relevant updates.
20316  *
20317  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
20318  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
20319  * different route unless you intend to pay twice!
20320  *
20321  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
20322  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
20323  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
20324  * must not contain multiple paths as multi-path payments require a recipient-provided
20325  * payment_secret.
20326  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
20327  * bit set (either as required or as available). If multiple paths are present in the Route,
20328  * we assume the invoice had the basic_mpp feature set.
20329  *
20330  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
20331  */
20332 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);
20333
20334 /**
20335  * Retries a payment along the given [`Route`].
20336  *
20337  * Errors returned are a superset of those returned from [`send_payment`], so see
20338  * [`send_payment`] documentation for more details on errors. This method will also error if the
20339  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
20340  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
20341  * further retries have been disabled with [`abandon_payment`].
20342  *
20343  * [`send_payment`]: [`ChannelManager::send_payment`]
20344  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
20345  */
20346 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);
20347
20348 /**
20349  * Signals that no further retries for the given payment will occur.
20350  *
20351  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
20352  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
20353  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
20354  * pending HTLCs for this payment.
20355  *
20356  * Note that calling this method does *not* prevent a payment from succeeding. You must still
20357  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
20358  * determine the ultimate status of a payment.
20359  *
20360  * [`retry_payment`]: Self::retry_payment
20361  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
20362  * [`Event::PaymentSent`]: events::Event::PaymentSent
20363  */
20364 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
20365
20366 /**
20367  * Send a spontaneous payment, which is a payment that does not require the recipient to have
20368  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
20369  * the preimage, it must be a cryptographically secure random value that no intermediate node
20370  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
20371  * never reach the recipient.
20372  *
20373  * See [`send_payment`] documentation for more details on the return value of this function.
20374  *
20375  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
20376  * [`send_payment`] for more information about the risks of duplicate preimage usage.
20377  *
20378  * Note that `route` must have exactly one path.
20379  *
20380  * [`send_payment`]: Self::send_payment
20381  *
20382  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
20383  */
20384 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);
20385
20386 /**
20387  * Call this upon creation of a funding transaction for the given channel.
20388  *
20389  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
20390  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
20391  *
20392  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
20393  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
20394  *
20395  * May panic if the output found in the funding transaction is duplicative with some other
20396  * channel (note that this should be trivially prevented by using unique funding transaction
20397  * keys per-channel).
20398  *
20399  * Do NOT broadcast the funding transaction yourself. When we have safely received our
20400  * counterparty's signature the funding transaction will automatically be broadcast via the
20401  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
20402  *
20403  * Note that this includes RBF or similar transaction replacement strategies - lightning does
20404  * not currently support replacing a funding transaction on an existing channel. Instead,
20405  * create a new channel with a conflicting funding transaction.
20406  *
20407  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
20408  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
20409  */
20410 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);
20411
20412 /**
20413  * Regenerates channel_announcements and generates a signed node_announcement from the given
20414  * arguments, providing them in corresponding events via
20415  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
20416  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
20417  * announcement to ensure that the lightning P2P network is aware of the channels we have and
20418  * our network addresses.
20419  *
20420  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
20421  * node to humans. They carry no in-protocol meaning.
20422  *
20423  * `addresses` represent the set (possibly empty) of socket addresses on which this node
20424  * accepts incoming connections. These will be included in the node_announcement, publicly
20425  * tying these addresses together and to this node. If you wish to preserve user privacy,
20426  * addresses should likely contain only Tor Onion addresses.
20427  *
20428  * Panics if `addresses` is absurdly large (more than 500).
20429  *
20430  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
20431  */
20432 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
20433
20434 /**
20435  * Processes HTLCs which are pending waiting on random forward delay.
20436  *
20437  * Should only really ever be called in response to a PendingHTLCsForwardable event.
20438  * Will likely generate further events.
20439  */
20440 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
20441
20442 /**
20443  * Performs actions which should happen on startup and roughly once per minute thereafter.
20444  *
20445  * This currently includes:
20446  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
20447  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
20448  *    than a minute, informing the network that they should no longer attempt to route over
20449  *    the channel.
20450  *
20451  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
20452  * estimate fetches.
20453  */
20454 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
20455
20456 /**
20457  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
20458  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
20459  * along the path (including in our own channel on which we received it).
20460  *
20461  * Note that in some cases around unclean shutdown, it is possible the payment may have
20462  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
20463  * second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment
20464  * may have already been failed automatically by LDK if it was nearing its expiration time.
20465  *
20466  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
20467  * [`ChannelManager::claim_funds`]), you should still monitor for
20468  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
20469  * startup during which time claims that were in-progress at shutdown may be replayed.
20470  */
20471 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
20472
20473 /**
20474  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
20475  * [`MessageSendEvent`]s needed to claim the payment.
20476  *
20477  * Note that calling this method does *not* guarantee that the payment has been claimed. You
20478  * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
20479  * provided to your [`EventHandler`] when [`process_pending_events`] is next called.
20480  *
20481  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
20482  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
20483  * event matches your expectation. If you fail to do so and call this method, you may provide
20484  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
20485  *
20486  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
20487  * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
20488  * [`process_pending_events`]: EventsProvider::process_pending_events
20489  * [`create_inbound_payment`]: Self::create_inbound_payment
20490  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
20491  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
20492  */
20493 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
20494
20495 /**
20496  * Gets the node_id held by this ChannelManager
20497  */
20498 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
20499
20500 /**
20501  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
20502  *
20503  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
20504  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
20505  * the channel.
20506  *
20507  * The `user_channel_id` parameter will be provided back in
20508  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
20509  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
20510  *
20511  * Note that this method will return an error and reject the channel, if it requires support
20512  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
20513  * used to accept such channels.
20514  *
20515  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
20516  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
20517  */
20518 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);
20519
20520 /**
20521  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
20522  * it as confirmed immediately.
20523  *
20524  * The `user_channel_id` parameter will be provided back in
20525  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
20526  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
20527  *
20528  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
20529  * and (if the counterparty agrees), enables forwarding of payments immediately.
20530  *
20531  * This fully trusts that the counterparty has honestly and correctly constructed the funding
20532  * transaction and blindly assumes that it will eventually confirm.
20533  *
20534  * If it does not confirm before we decide to close the channel, or if the funding transaction
20535  * does not pay to the correct script the correct amount, *you will lose funds*.
20536  *
20537  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
20538  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
20539  */
20540 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);
20541
20542 /**
20543  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
20544  * to pay us.
20545  *
20546  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
20547  * [`PaymentHash`] and [`PaymentPreimage`] for you.
20548  *
20549  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
20550  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
20551  * passed directly to [`claim_funds`].
20552  *
20553  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
20554  *
20555  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
20556  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
20557  *
20558  * # Note
20559  *
20560  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
20561  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
20562  *
20563  * Errors if `min_value_msat` is greater than total bitcoin supply.
20564  *
20565  * [`claim_funds`]: Self::claim_funds
20566  * [`PaymentReceived`]: events::Event::PaymentReceived
20567  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
20568  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
20569  */
20570 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);
20571
20572 /**
20573  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
20574  * serialized state with LDK node(s) running 0.0.103 and earlier.
20575  *
20576  * May panic if `invoice_expiry_delta_secs` is greater than one year.
20577  *
20578  * # Note
20579  * This method is deprecated and will be removed soon.
20580  *
20581  * [`create_inbound_payment`]: Self::create_inbound_payment
20582  */
20583 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);
20584
20585 /**
20586  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
20587  * stored external to LDK.
20588  *
20589  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
20590  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
20591  * the `min_value_msat` provided here, if one is provided.
20592  *
20593  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
20594  * note that LDK will not stop you from registering duplicate payment hashes for inbound
20595  * payments.
20596  *
20597  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
20598  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
20599  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
20600  * sender \"proof-of-payment\" unless they have paid the required amount.
20601  *
20602  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
20603  * in excess of the current time. This should roughly match the expiry time set in the invoice.
20604  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
20605  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
20606  * invoices when no timeout is set.
20607  *
20608  * Note that we use block header time to time-out pending inbound payments (with some margin
20609  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
20610  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
20611  * If you need exact expiry semantics, you should enforce them upon receipt of
20612  * [`PaymentReceived`].
20613  *
20614  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
20615  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
20616  *
20617  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
20618  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
20619  *
20620  * # Note
20621  *
20622  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
20623  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
20624  *
20625  * Errors if `min_value_msat` is greater than total bitcoin supply.
20626  *
20627  * [`create_inbound_payment`]: Self::create_inbound_payment
20628  * [`PaymentReceived`]: events::Event::PaymentReceived
20629  */
20630 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);
20631
20632 /**
20633  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
20634  * serialized state with LDK node(s) running 0.0.103 and earlier.
20635  *
20636  * May panic if `invoice_expiry_delta_secs` is greater than one year.
20637  *
20638  * # Note
20639  * This method is deprecated and will be removed soon.
20640  *
20641  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
20642  */
20643 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);
20644
20645 /**
20646  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
20647  * previously returned from [`create_inbound_payment`].
20648  *
20649  * [`create_inbound_payment`]: Self::create_inbound_payment
20650  */
20651 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);
20652
20653 /**
20654  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
20655  * are used when constructing the phantom invoice's route hints.
20656  *
20657  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20658  */
20659 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
20660
20661 /**
20662  * Gets route hints for use in receiving [phantom node payments].
20663  *
20664  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20665  */
20666 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
20667
20668 /**
20669  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
20670  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
20671  */
20672 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
20673
20674 /**
20675  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
20676  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
20677  */
20678 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
20679
20680 /**
20681  * Constructs a new Listen which calls the relevant methods on this_arg.
20682  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
20683  */
20684 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
20685
20686 /**
20687  * Constructs a new Confirm which calls the relevant methods on this_arg.
20688  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
20689  */
20690 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
20691
20692 /**
20693  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
20694  * indicating whether persistence is necessary. Only one listener on
20695  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
20696  * up.
20697  *
20698  * Note that this method is not available with the `no-std` feature.
20699  */
20700 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
20701
20702 /**
20703  * Blocks until ChannelManager needs to be persisted. Only one listener on
20704  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
20705  * up.
20706  */
20707 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
20708
20709 /**
20710  * Gets the latest best block which was connected either via the [`chain::Listen`] or
20711  * [`chain::Confirm`] interfaces.
20712  */
20713 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
20714
20715 /**
20716  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
20717  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
20718  */
20719 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
20720
20721 /**
20722  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
20723  */
20724 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
20725
20726 /**
20727  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
20728  */
20729 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
20730
20731 /**
20732  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
20733  */
20734 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
20735
20736 /**
20737  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
20738  */
20739 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
20740
20741 /**
20742  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
20743  */
20744 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
20745
20746 /**
20747  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
20748  */
20749 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
20750
20751 /**
20752  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
20753  */
20754 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
20755
20756 /**
20757  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
20758  */
20759 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
20760
20761 /**
20762  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
20763  */
20764 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
20765
20766 /**
20767  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
20768  */
20769 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
20770
20771 /**
20772  * The keys provider which will give us relevant keys. Some keys will be loaded during
20773  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
20774  * signing data.
20775  */
20776 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20777
20778 /**
20779  * The keys provider which will give us relevant keys. Some keys will be loaded during
20780  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
20781  * signing data.
20782  */
20783 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
20784
20785 /**
20786  * The fee_estimator for use in the ChannelManager in the future.
20787  *
20788  * No calls to the FeeEstimator will be made during deserialization.
20789  */
20790 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20791
20792 /**
20793  * The fee_estimator for use in the ChannelManager in the future.
20794  *
20795  * No calls to the FeeEstimator will be made during deserialization.
20796  */
20797 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
20798
20799 /**
20800  * The chain::Watch for use in the ChannelManager in the future.
20801  *
20802  * No calls to the chain::Watch will be made during deserialization. It is assumed that
20803  * you have deserialized ChannelMonitors separately and will add them to your
20804  * chain::Watch after deserializing this ChannelManager.
20805  */
20806 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20807
20808 /**
20809  * The chain::Watch for use in the ChannelManager in the future.
20810  *
20811  * No calls to the chain::Watch will be made during deserialization. It is assumed that
20812  * you have deserialized ChannelMonitors separately and will add them to your
20813  * chain::Watch after deserializing this ChannelManager.
20814  */
20815 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
20816
20817 /**
20818  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
20819  * used to broadcast the latest local commitment transactions of channels which must be
20820  * force-closed during deserialization.
20821  */
20822 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20823
20824 /**
20825  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
20826  * used to broadcast the latest local commitment transactions of channels which must be
20827  * force-closed during deserialization.
20828  */
20829 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
20830
20831 /**
20832  * The Logger for use in the ChannelManager and which may be used to log information during
20833  * deserialization.
20834  */
20835 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20836
20837 /**
20838  * The Logger for use in the ChannelManager and which may be used to log information during
20839  * deserialization.
20840  */
20841 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
20842
20843 /**
20844  * Default settings used for new channels. Any existing channels will continue to use the
20845  * runtime settings which were stored when the ChannelManager was serialized.
20846  */
20847 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
20848
20849 /**
20850  * Default settings used for new channels. Any existing channels will continue to use the
20851  * runtime settings which were stored when the ChannelManager was serialized.
20852  */
20853 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
20854
20855 /**
20856  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
20857  * HashMap for you. This is primarily useful for C bindings where it is not practical to
20858  * populate a HashMap directly from C.
20859  */
20860 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);
20861
20862 /**
20863  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
20864  */
20865 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
20866
20867 /**
20868  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
20869  */
20870 void ExpandedKey_free(struct LDKExpandedKey this_obj);
20871
20872 /**
20873  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
20874  *
20875  * It is recommended to cache this value and not regenerate it for each new inbound payment.
20876  */
20877 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
20878
20879 /**
20880  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
20881  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
20882  * a `ChannelManager`.
20883  *
20884  * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
20885  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
20886  * regenerate it for each new inbound payment.
20887  *
20888  * `current_time` is a Unix timestamp representing the current time.
20889  *
20890  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20891  */
20892 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);
20893
20894 /**
20895  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
20896  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
20897  * without a `ChannelManager`.
20898  *
20899  * See [`create`] for information on the `keys` and `current_time` parameters.
20900  *
20901  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
20902  */
20903 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);
20904
20905 /**
20906  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
20907  */
20908 void DecodeError_free(struct LDKDecodeError this_obj);
20909
20910 /**
20911  * Creates a copy of the DecodeError
20912  */
20913 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
20914
20915 /**
20916  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
20917  */
20918 void Init_free(struct LDKInit this_obj);
20919
20920 /**
20921  * The relevant features which the sender supports
20922  */
20923 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
20924
20925 /**
20926  * The relevant features which the sender supports
20927  */
20928 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
20929
20930 /**
20931  * The receipient's network address. This adds the option to report a remote IP address
20932  * back to a connecting peer using the init message. A node can decide to use that information
20933  * to discover a potential update to its public IPv4 address (NAT) and use
20934  * that for a node_announcement update message containing the new address.
20935  */
20936 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
20937
20938 /**
20939  * The receipient's network address. This adds the option to report a remote IP address
20940  * back to a connecting peer using the init message. A node can decide to use that information
20941  * to discover a potential update to its public IPv4 address (NAT) and use
20942  * that for a node_announcement update message containing the new address.
20943  */
20944 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
20945
20946 /**
20947  * Constructs a new Init given each field
20948  */
20949 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
20950
20951 /**
20952  * Creates a copy of the Init
20953  */
20954 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
20955
20956 /**
20957  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
20958  */
20959 void ErrorMessage_free(struct LDKErrorMessage this_obj);
20960
20961 /**
20962  * The channel ID involved in the error.
20963  *
20964  * All-0s indicates a general error unrelated to a specific channel, after which all channels
20965  * with the sending peer should be closed.
20966  */
20967 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
20968
20969 /**
20970  * The channel ID involved in the error.
20971  *
20972  * All-0s indicates a general error unrelated to a specific channel, after which all channels
20973  * with the sending peer should be closed.
20974  */
20975 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20976
20977 /**
20978  * A possibly human-readable error description.
20979  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20980  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20981  * the terminal emulator or the logging subsystem.
20982  */
20983 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
20984
20985 /**
20986  * A possibly human-readable error description.
20987  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
20988  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
20989  * the terminal emulator or the logging subsystem.
20990  */
20991 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
20992
20993 /**
20994  * Constructs a new ErrorMessage given each field
20995  */
20996 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
20997
20998 /**
20999  * Creates a copy of the ErrorMessage
21000  */
21001 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
21002
21003 /**
21004  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
21005  */
21006 void WarningMessage_free(struct LDKWarningMessage this_obj);
21007
21008 /**
21009  * The channel ID involved in the warning.
21010  *
21011  * All-0s indicates a warning unrelated to a specific channel.
21012  */
21013 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
21014
21015 /**
21016  * The channel ID involved in the warning.
21017  *
21018  * All-0s indicates a warning unrelated to a specific channel.
21019  */
21020 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21021
21022 /**
21023  * A possibly human-readable warning description.
21024  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21025  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21026  * the terminal emulator or the logging subsystem.
21027  */
21028 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
21029
21030 /**
21031  * A possibly human-readable warning description.
21032  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21033  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21034  * the terminal emulator or the logging subsystem.
21035  */
21036 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
21037
21038 /**
21039  * Constructs a new WarningMessage given each field
21040  */
21041 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
21042
21043 /**
21044  * Creates a copy of the WarningMessage
21045  */
21046 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
21047
21048 /**
21049  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
21050  */
21051 void Ping_free(struct LDKPing this_obj);
21052
21053 /**
21054  * The desired response length
21055  */
21056 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
21057
21058 /**
21059  * The desired response length
21060  */
21061 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
21062
21063 /**
21064  * The ping packet size.
21065  * This field is not sent on the wire. byteslen zeros are sent.
21066  */
21067 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
21068
21069 /**
21070  * The ping packet size.
21071  * This field is not sent on the wire. byteslen zeros are sent.
21072  */
21073 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
21074
21075 /**
21076  * Constructs a new Ping given each field
21077  */
21078 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
21079
21080 /**
21081  * Creates a copy of the Ping
21082  */
21083 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
21084
21085 /**
21086  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
21087  */
21088 void Pong_free(struct LDKPong this_obj);
21089
21090 /**
21091  * The pong packet size.
21092  * This field is not sent on the wire. byteslen zeros are sent.
21093  */
21094 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
21095
21096 /**
21097  * The pong packet size.
21098  * This field is not sent on the wire. byteslen zeros are sent.
21099  */
21100 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
21101
21102 /**
21103  * Constructs a new Pong given each field
21104  */
21105 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
21106
21107 /**
21108  * Creates a copy of the Pong
21109  */
21110 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
21111
21112 /**
21113  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
21114  */
21115 void OpenChannel_free(struct LDKOpenChannel this_obj);
21116
21117 /**
21118  * The genesis hash of the blockchain where the channel is to be opened
21119  */
21120 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
21121
21122 /**
21123  * The genesis hash of the blockchain where the channel is to be opened
21124  */
21125 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21126
21127 /**
21128  * A temporary channel ID, until the funding outpoint is announced
21129  */
21130 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
21131
21132 /**
21133  * A temporary channel ID, until the funding outpoint is announced
21134  */
21135 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21136
21137 /**
21138  * The channel value
21139  */
21140 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21141
21142 /**
21143  * The channel value
21144  */
21145 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21146
21147 /**
21148  * The amount to push to the counterparty as part of the open, in milli-satoshi
21149  */
21150 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21151
21152 /**
21153  * The amount to push to the counterparty as part of the open, in milli-satoshi
21154  */
21155 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21156
21157 /**
21158  * The threshold below which outputs on transactions broadcast by sender will be omitted
21159  */
21160 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21161
21162 /**
21163  * The threshold below which outputs on transactions broadcast by sender will be omitted
21164  */
21165 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21166
21167 /**
21168  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21169  */
21170 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21171
21172 /**
21173  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21174  */
21175 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21176
21177 /**
21178  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21179  */
21180 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21181
21182 /**
21183  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21184  */
21185 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21186
21187 /**
21188  * The minimum HTLC size incoming to sender, in milli-satoshi
21189  */
21190 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21191
21192 /**
21193  * The minimum HTLC size incoming to sender, in milli-satoshi
21194  */
21195 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21196
21197 /**
21198  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
21199  */
21200 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21201
21202 /**
21203  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
21204  */
21205 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
21206
21207 /**
21208  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21209  */
21210 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21211
21212 /**
21213  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21214  */
21215 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
21216
21217 /**
21218  * The maximum number of inbound HTLCs towards sender
21219  */
21220 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21221
21222 /**
21223  * The maximum number of inbound HTLCs towards sender
21224  */
21225 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
21226
21227 /**
21228  * The sender's key controlling the funding transaction
21229  */
21230 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21231
21232 /**
21233  * The sender's key controlling the funding transaction
21234  */
21235 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21236
21237 /**
21238  * Used to derive a revocation key for transactions broadcast by counterparty
21239  */
21240 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21241
21242 /**
21243  * Used to derive a revocation key for transactions broadcast by counterparty
21244  */
21245 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21246
21247 /**
21248  * A payment key to sender for transactions broadcast by counterparty
21249  */
21250 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21251
21252 /**
21253  * A payment key to sender for transactions broadcast by counterparty
21254  */
21255 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21256
21257 /**
21258  * Used to derive a payment key to sender for transactions broadcast by sender
21259  */
21260 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21261
21262 /**
21263  * Used to derive a payment key to sender for transactions broadcast by sender
21264  */
21265 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21266
21267 /**
21268  * Used to derive an HTLC payment key to sender
21269  */
21270 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21271
21272 /**
21273  * Used to derive an HTLC payment key to sender
21274  */
21275 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21276
21277 /**
21278  * The first to-be-broadcast-by-sender transaction's per commitment point
21279  */
21280 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21281
21282 /**
21283  * The first to-be-broadcast-by-sender transaction's per commitment point
21284  */
21285 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21286
21287 /**
21288  * Channel flags
21289  */
21290 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21291
21292 /**
21293  * Channel flags
21294  */
21295 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
21296
21297 /**
21298  * The channel type that this channel will represent. If none is set, we derive the channel
21299  * type from the intersection of our feature bits with our counterparty's feature bits from
21300  * the Init message.
21301  *
21302  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21303  */
21304 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21305
21306 /**
21307  * The channel type that this channel will represent. If none is set, we derive the channel
21308  * type from the intersection of our feature bits with our counterparty's feature bits from
21309  * the Init message.
21310  *
21311  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21312  */
21313 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
21314
21315 /**
21316  * Creates a copy of the OpenChannel
21317  */
21318 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
21319
21320 /**
21321  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
21322  */
21323 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
21324
21325 /**
21326  * A temporary channel ID, until the funding outpoint is announced
21327  */
21328 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
21329
21330 /**
21331  * A temporary channel ID, until the funding outpoint is announced
21332  */
21333 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21334
21335 /**
21336  * The threshold below which outputs on transactions broadcast by sender will be omitted
21337  */
21338 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21339
21340 /**
21341  * The threshold below which outputs on transactions broadcast by sender will be omitted
21342  */
21343 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21344
21345 /**
21346  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21347  */
21348 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21349
21350 /**
21351  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21352  */
21353 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21354
21355 /**
21356  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21357  */
21358 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21359
21360 /**
21361  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21362  */
21363 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21364
21365 /**
21366  * The minimum HTLC size incoming to sender, in milli-satoshi
21367  */
21368 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21369
21370 /**
21371  * The minimum HTLC size incoming to sender, in milli-satoshi
21372  */
21373 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
21374
21375 /**
21376  * Minimum depth of the funding transaction before the channel is considered open
21377  */
21378 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21379
21380 /**
21381  * Minimum depth of the funding transaction before the channel is considered open
21382  */
21383 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
21384
21385 /**
21386  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21387  */
21388 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21389
21390 /**
21391  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21392  */
21393 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
21394
21395 /**
21396  * The maximum number of inbound HTLCs towards sender
21397  */
21398 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21399
21400 /**
21401  * The maximum number of inbound HTLCs towards sender
21402  */
21403 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
21404
21405 /**
21406  * The sender's key controlling the funding transaction
21407  */
21408 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21409
21410 /**
21411  * The sender's key controlling the funding transaction
21412  */
21413 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21414
21415 /**
21416  * Used to derive a revocation key for transactions broadcast by counterparty
21417  */
21418 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21419
21420 /**
21421  * Used to derive a revocation key for transactions broadcast by counterparty
21422  */
21423 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21424
21425 /**
21426  * A payment key to sender for transactions broadcast by counterparty
21427  */
21428 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21429
21430 /**
21431  * A payment key to sender for transactions broadcast by counterparty
21432  */
21433 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21434
21435 /**
21436  * Used to derive a payment key to sender for transactions broadcast by sender
21437  */
21438 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21439
21440 /**
21441  * Used to derive a payment key to sender for transactions broadcast by sender
21442  */
21443 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21444
21445 /**
21446  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
21447  */
21448 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21449
21450 /**
21451  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
21452  */
21453 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21454
21455 /**
21456  * The first to-be-broadcast-by-sender transaction's per commitment point
21457  */
21458 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21459
21460 /**
21461  * The first to-be-broadcast-by-sender transaction's per commitment point
21462  */
21463 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21464
21465 /**
21466  * The channel type that this channel will represent. If none is set, we derive the channel
21467  * type from the intersection of our feature bits with our counterparty's feature bits from
21468  * the Init message.
21469  *
21470  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
21471  *
21472  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21473  */
21474 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
21475
21476 /**
21477  * The channel type that this channel will represent. If none is set, we derive the channel
21478  * type from the intersection of our feature bits with our counterparty's feature bits from
21479  * the Init message.
21480  *
21481  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
21482  *
21483  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21484  */
21485 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
21486
21487 /**
21488  * Creates a copy of the AcceptChannel
21489  */
21490 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
21491
21492 /**
21493  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
21494  */
21495 void FundingCreated_free(struct LDKFundingCreated this_obj);
21496
21497 /**
21498  * A temporary channel ID, until the funding is established
21499  */
21500 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
21501
21502 /**
21503  * A temporary channel ID, until the funding is established
21504  */
21505 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21506
21507 /**
21508  * The funding transaction ID
21509  */
21510 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
21511
21512 /**
21513  * The funding transaction ID
21514  */
21515 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21516
21517 /**
21518  * The specific output index funding this channel
21519  */
21520 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
21521
21522 /**
21523  * The specific output index funding this channel
21524  */
21525 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
21526
21527 /**
21528  * The signature of the channel initiator (funder) on the initial commitment transaction
21529  */
21530 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
21531
21532 /**
21533  * The signature of the channel initiator (funder) on the initial commitment transaction
21534  */
21535 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
21536
21537 /**
21538  * Constructs a new FundingCreated given each field
21539  */
21540 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);
21541
21542 /**
21543  * Creates a copy of the FundingCreated
21544  */
21545 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
21546
21547 /**
21548  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
21549  */
21550 void FundingSigned_free(struct LDKFundingSigned this_obj);
21551
21552 /**
21553  * The channel ID
21554  */
21555 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
21556
21557 /**
21558  * The channel ID
21559  */
21560 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21561
21562 /**
21563  * The signature of the channel acceptor (fundee) on the initial commitment transaction
21564  */
21565 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
21566
21567 /**
21568  * The signature of the channel acceptor (fundee) on the initial commitment transaction
21569  */
21570 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
21571
21572 /**
21573  * Constructs a new FundingSigned given each field
21574  */
21575 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
21576
21577 /**
21578  * Creates a copy of the FundingSigned
21579  */
21580 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
21581
21582 /**
21583  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
21584  */
21585 void ChannelReady_free(struct LDKChannelReady this_obj);
21586
21587 /**
21588  * The channel ID
21589  */
21590 const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
21591
21592 /**
21593  * The channel ID
21594  */
21595 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21596
21597 /**
21598  * The per-commitment point of the second commitment transaction
21599  */
21600 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
21601
21602 /**
21603  * The per-commitment point of the second commitment transaction
21604  */
21605 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21606
21607 /**
21608  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
21609  * to be forwarded over this SCID and forward them to this messages' recipient.
21610  */
21611 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
21612
21613 /**
21614  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
21615  * to be forwarded over this SCID and forward them to this messages' recipient.
21616  */
21617 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
21618
21619 /**
21620  * Constructs a new ChannelReady given each field
21621  */
21622 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);
21623
21624 /**
21625  * Creates a copy of the ChannelReady
21626  */
21627 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
21628
21629 /**
21630  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
21631  */
21632 void Shutdown_free(struct LDKShutdown this_obj);
21633
21634 /**
21635  * The channel ID
21636  */
21637 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
21638
21639 /**
21640  * The channel ID
21641  */
21642 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21643
21644 /**
21645  * The destination of this peer's funds on closing.
21646  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
21647  */
21648 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
21649
21650 /**
21651  * The destination of this peer's funds on closing.
21652  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
21653  */
21654 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
21655
21656 /**
21657  * Constructs a new Shutdown given each field
21658  */
21659 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
21660
21661 /**
21662  * Creates a copy of the Shutdown
21663  */
21664 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
21665
21666 /**
21667  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
21668  */
21669 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
21670
21671 /**
21672  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
21673  * transaction.
21674  */
21675 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
21676
21677 /**
21678  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
21679  * transaction.
21680  */
21681 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
21682
21683 /**
21684  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
21685  * transaction.
21686  */
21687 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
21688
21689 /**
21690  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
21691  * transaction.
21692  */
21693 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
21694
21695 /**
21696  * Constructs a new ClosingSignedFeeRange given each field
21697  */
21698 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
21699
21700 /**
21701  * Creates a copy of the ClosingSignedFeeRange
21702  */
21703 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
21704
21705 /**
21706  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
21707  */
21708 void ClosingSigned_free(struct LDKClosingSigned this_obj);
21709
21710 /**
21711  * The channel ID
21712  */
21713 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
21714
21715 /**
21716  * The channel ID
21717  */
21718 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21719
21720 /**
21721  * The proposed total fee for the closing transaction
21722  */
21723 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
21724
21725 /**
21726  * The proposed total fee for the closing transaction
21727  */
21728 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
21729
21730 /**
21731  * A signature on the closing transaction
21732  */
21733 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
21734
21735 /**
21736  * A signature on the closing transaction
21737  */
21738 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
21739
21740 /**
21741  * The minimum and maximum fees which the sender is willing to accept, provided only by new
21742  * nodes.
21743  *
21744  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21745  */
21746 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
21747
21748 /**
21749  * The minimum and maximum fees which the sender is willing to accept, provided only by new
21750  * nodes.
21751  *
21752  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21753  */
21754 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
21755
21756 /**
21757  * Constructs a new ClosingSigned given each field
21758  */
21759 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);
21760
21761 /**
21762  * Creates a copy of the ClosingSigned
21763  */
21764 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
21765
21766 /**
21767  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
21768  */
21769 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
21770
21771 /**
21772  * The channel ID
21773  */
21774 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
21775
21776 /**
21777  * The channel ID
21778  */
21779 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21780
21781 /**
21782  * The HTLC ID
21783  */
21784 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
21785
21786 /**
21787  * The HTLC ID
21788  */
21789 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
21790
21791 /**
21792  * The HTLC value in milli-satoshi
21793  */
21794 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
21795
21796 /**
21797  * The HTLC value in milli-satoshi
21798  */
21799 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
21800
21801 /**
21802  * The payment hash, the pre-image of which controls HTLC redemption
21803  */
21804 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
21805
21806 /**
21807  * The payment hash, the pre-image of which controls HTLC redemption
21808  */
21809 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21810
21811 /**
21812  * The expiry height of the HTLC
21813  */
21814 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
21815
21816 /**
21817  * The expiry height of the HTLC
21818  */
21819 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
21820
21821 /**
21822  * Creates a copy of the UpdateAddHTLC
21823  */
21824 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
21825
21826 /**
21827  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
21828  */
21829 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
21830
21831 /**
21832  * The channel ID
21833  */
21834 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
21835
21836 /**
21837  * The channel ID
21838  */
21839 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21840
21841 /**
21842  * The HTLC ID
21843  */
21844 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
21845
21846 /**
21847  * The HTLC ID
21848  */
21849 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
21850
21851 /**
21852  * The pre-image of the payment hash, allowing HTLC redemption
21853  */
21854 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
21855
21856 /**
21857  * The pre-image of the payment hash, allowing HTLC redemption
21858  */
21859 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21860
21861 /**
21862  * Constructs a new UpdateFulfillHTLC given each field
21863  */
21864 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
21865
21866 /**
21867  * Creates a copy of the UpdateFulfillHTLC
21868  */
21869 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
21870
21871 /**
21872  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
21873  */
21874 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
21875
21876 /**
21877  * The channel ID
21878  */
21879 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
21880
21881 /**
21882  * The channel ID
21883  */
21884 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21885
21886 /**
21887  * The HTLC ID
21888  */
21889 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
21890
21891 /**
21892  * The HTLC ID
21893  */
21894 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
21895
21896 /**
21897  * Creates a copy of the UpdateFailHTLC
21898  */
21899 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
21900
21901 /**
21902  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
21903  */
21904 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
21905
21906 /**
21907  * The channel ID
21908  */
21909 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
21910
21911 /**
21912  * The channel ID
21913  */
21914 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21915
21916 /**
21917  * The HTLC ID
21918  */
21919 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
21920
21921 /**
21922  * The HTLC ID
21923  */
21924 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
21925
21926 /**
21927  * The failure code
21928  */
21929 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
21930
21931 /**
21932  * The failure code
21933  */
21934 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
21935
21936 /**
21937  * Creates a copy of the UpdateFailMalformedHTLC
21938  */
21939 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
21940
21941 /**
21942  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
21943  */
21944 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
21945
21946 /**
21947  * The channel ID
21948  */
21949 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
21950
21951 /**
21952  * The channel ID
21953  */
21954 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21955
21956 /**
21957  * A signature on the commitment transaction
21958  */
21959 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
21960
21961 /**
21962  * A signature on the commitment transaction
21963  */
21964 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
21965
21966 /**
21967  * Signatures on the HTLC transactions
21968  */
21969 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
21970
21971 /**
21972  * Constructs a new CommitmentSigned given each field
21973  */
21974 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
21975
21976 /**
21977  * Creates a copy of the CommitmentSigned
21978  */
21979 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
21980
21981 /**
21982  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
21983  */
21984 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
21985
21986 /**
21987  * The channel ID
21988  */
21989 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
21990
21991 /**
21992  * The channel ID
21993  */
21994 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21995
21996 /**
21997  * The secret corresponding to the per-commitment point
21998  */
21999 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
22000
22001 /**
22002  * The secret corresponding to the per-commitment point
22003  */
22004 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22005
22006 /**
22007  * The next sender-broadcast commitment transaction's per-commitment point
22008  */
22009 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
22010
22011 /**
22012  * The next sender-broadcast commitment transaction's per-commitment point
22013  */
22014 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22015
22016 /**
22017  * Constructs a new RevokeAndACK given each field
22018  */
22019 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);
22020
22021 /**
22022  * Creates a copy of the RevokeAndACK
22023  */
22024 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
22025
22026 /**
22027  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
22028  */
22029 void UpdateFee_free(struct LDKUpdateFee this_obj);
22030
22031 /**
22032  * The channel ID
22033  */
22034 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
22035
22036 /**
22037  * The channel ID
22038  */
22039 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22040
22041 /**
22042  * Fee rate per 1000-weight of the transaction
22043  */
22044 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
22045
22046 /**
22047  * Fee rate per 1000-weight of the transaction
22048  */
22049 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
22050
22051 /**
22052  * Constructs a new UpdateFee given each field
22053  */
22054 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
22055
22056 /**
22057  * Creates a copy of the UpdateFee
22058  */
22059 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
22060
22061 /**
22062  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
22063  */
22064 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
22065
22066 /**
22067  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
22068  * belonging to the recipient
22069  */
22070 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
22071
22072 /**
22073  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
22074  * belonging to the recipient
22075  */
22076 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22077
22078 /**
22079  * The sender's per-commitment point for their current commitment transaction
22080  */
22081 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
22082
22083 /**
22084  * The sender's per-commitment point for their current commitment transaction
22085  */
22086 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22087
22088 /**
22089  * Constructs a new DataLossProtect given each field
22090  */
22091 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
22092
22093 /**
22094  * Creates a copy of the DataLossProtect
22095  */
22096 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
22097
22098 /**
22099  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
22100  */
22101 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
22102
22103 /**
22104  * The channel ID
22105  */
22106 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
22107
22108 /**
22109  * The channel ID
22110  */
22111 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22112
22113 /**
22114  * The next commitment number for the sender
22115  */
22116 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
22117
22118 /**
22119  * The next commitment number for the sender
22120  */
22121 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
22122
22123 /**
22124  * The next commitment number for the recipient
22125  */
22126 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
22127
22128 /**
22129  * The next commitment number for the recipient
22130  */
22131 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
22132
22133 /**
22134  * Creates a copy of the ChannelReestablish
22135  */
22136 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
22137
22138 /**
22139  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
22140  */
22141 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
22142
22143 /**
22144  * The channel ID
22145  */
22146 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
22147
22148 /**
22149  * The channel ID
22150  */
22151 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22152
22153 /**
22154  * The short channel ID
22155  */
22156 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22157
22158 /**
22159  * The short channel ID
22160  */
22161 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
22162
22163 /**
22164  * A signature by the node key
22165  */
22166 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22167
22168 /**
22169  * A signature by the node key
22170  */
22171 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
22172
22173 /**
22174  * A signature by the funding key
22175  */
22176 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22177
22178 /**
22179  * A signature by the funding key
22180  */
22181 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
22182
22183 /**
22184  * Constructs a new AnnouncementSignatures given each field
22185  */
22186 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);
22187
22188 /**
22189  * Creates a copy of the AnnouncementSignatures
22190  */
22191 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
22192
22193 /**
22194  * Frees any resources used by the NetAddress
22195  */
22196 void NetAddress_free(struct LDKNetAddress this_ptr);
22197
22198 /**
22199  * Creates a copy of the NetAddress
22200  */
22201 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
22202
22203 /**
22204  * Utility method to constructs a new IPv4-variant NetAddress
22205  */
22206 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
22207
22208 /**
22209  * Utility method to constructs a new IPv6-variant NetAddress
22210  */
22211 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
22212
22213 /**
22214  * Utility method to constructs a new OnionV2-variant NetAddress
22215  */
22216 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
22217
22218 /**
22219  * Utility method to constructs a new OnionV3-variant NetAddress
22220  */
22221 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
22222
22223 /**
22224  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
22225  */
22226 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
22227
22228 /**
22229  * Read a NetAddress from a byte array, created by NetAddress_write
22230  */
22231 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
22232
22233 /**
22234  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
22235  */
22236 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
22237
22238 /**
22239  * The advertised features
22240  */
22241 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22242
22243 /**
22244  * The advertised features
22245  */
22246 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
22247
22248 /**
22249  * A strictly monotonic announcement counter, with gaps allowed
22250  */
22251 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22252
22253 /**
22254  * A strictly monotonic announcement counter, with gaps allowed
22255  */
22256 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
22257
22258 /**
22259  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
22260  * to this node).
22261  */
22262 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22263
22264 /**
22265  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
22266  * to this node).
22267  */
22268 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22269
22270 /**
22271  * An RGB color for UI purposes
22272  */
22273 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
22274
22275 /**
22276  * An RGB color for UI purposes
22277  */
22278 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
22279
22280 /**
22281  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
22282  * of uniqueness.
22283  */
22284 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
22285
22286 /**
22287  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
22288  * of uniqueness.
22289  */
22290 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22291
22292 /**
22293  * List of addresses on which this node is reachable
22294  */
22295 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
22296
22297 /**
22298  * Creates a copy of the UnsignedNodeAnnouncement
22299  */
22300 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
22301
22302 /**
22303  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
22304  */
22305 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
22306
22307 /**
22308  * The signature by the node key
22309  */
22310 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
22311
22312 /**
22313  * The signature by the node key
22314  */
22315 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22316
22317 /**
22318  * The actual content of the announcement
22319  */
22320 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
22321
22322 /**
22323  * The actual content of the announcement
22324  */
22325 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
22326
22327 /**
22328  * Constructs a new NodeAnnouncement given each field
22329  */
22330 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
22331
22332 /**
22333  * Creates a copy of the NodeAnnouncement
22334  */
22335 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
22336
22337 /**
22338  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
22339  */
22340 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
22341
22342 /**
22343  * The advertised channel features
22344  */
22345 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22346
22347 /**
22348  * The advertised channel features
22349  */
22350 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
22351
22352 /**
22353  * The genesis hash of the blockchain where the channel is to be opened
22354  */
22355 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
22356
22357 /**
22358  * The genesis hash of the blockchain where the channel is to be opened
22359  */
22360 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22361
22362 /**
22363  * The short channel ID
22364  */
22365 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22366
22367 /**
22368  * The short channel ID
22369  */
22370 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
22371
22372 /**
22373  * One of the two node_ids which are endpoints of this channel
22374  */
22375 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22376
22377 /**
22378  * One of the two node_ids which are endpoints of this channel
22379  */
22380 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22381
22382 /**
22383  * The other of the two node_ids which are endpoints of this channel
22384  */
22385 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22386
22387 /**
22388  * The other of the two node_ids which are endpoints of this channel
22389  */
22390 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22391
22392 /**
22393  * The funding key for the first node
22394  */
22395 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22396
22397 /**
22398  * The funding key for the first node
22399  */
22400 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22401
22402 /**
22403  * The funding key for the second node
22404  */
22405 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
22406
22407 /**
22408  * The funding key for the second node
22409  */
22410 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22411
22412 /**
22413  * Creates a copy of the UnsignedChannelAnnouncement
22414  */
22415 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
22416
22417 /**
22418  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
22419  */
22420 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
22421
22422 /**
22423  * Authentication of the announcement by the first public node
22424  */
22425 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22426
22427 /**
22428  * Authentication of the announcement by the first public node
22429  */
22430 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22431
22432 /**
22433  * Authentication of the announcement by the second public node
22434  */
22435 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22436
22437 /**
22438  * Authentication of the announcement by the second public node
22439  */
22440 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22441
22442 /**
22443  * Proof of funding UTXO ownership by the first public node
22444  */
22445 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22446
22447 /**
22448  * Proof of funding UTXO ownership by the first public node
22449  */
22450 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22451
22452 /**
22453  * Proof of funding UTXO ownership by the second public node
22454  */
22455 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22456
22457 /**
22458  * Proof of funding UTXO ownership by the second public node
22459  */
22460 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22461
22462 /**
22463  * The actual announcement
22464  */
22465 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
22466
22467 /**
22468  * The actual announcement
22469  */
22470 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
22471
22472 /**
22473  * Constructs a new ChannelAnnouncement given each field
22474  */
22475 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);
22476
22477 /**
22478  * Creates a copy of the ChannelAnnouncement
22479  */
22480 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
22481
22482 /**
22483  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
22484  */
22485 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
22486
22487 /**
22488  * The genesis hash of the blockchain where the channel is to be opened
22489  */
22490 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
22491
22492 /**
22493  * The genesis hash of the blockchain where the channel is to be opened
22494  */
22495 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22496
22497 /**
22498  * The short channel ID
22499  */
22500 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22501
22502 /**
22503  * The short channel ID
22504  */
22505 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
22506
22507 /**
22508  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
22509  */
22510 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22511
22512 /**
22513  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
22514  */
22515 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
22516
22517 /**
22518  * Channel flags
22519  */
22520 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22521
22522 /**
22523  * Channel flags
22524  */
22525 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
22526
22527 /**
22528  * The number of blocks such that if:
22529  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
22530  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
22531  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
22532  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
22533  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
22534  * forwarding. Note that the HTLC sender is the one who originally sets this value when
22535  * constructing the route.
22536  */
22537 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22538
22539 /**
22540  * The number of blocks such that if:
22541  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
22542  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
22543  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
22544  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
22545  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
22546  * forwarding. Note that the HTLC sender is the one who originally sets this value when
22547  * constructing the route.
22548  */
22549 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
22550
22551 /**
22552  * The minimum HTLC size incoming to sender, in milli-satoshi
22553  */
22554 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22555
22556 /**
22557  * The minimum HTLC size incoming to sender, in milli-satoshi
22558  */
22559 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
22560
22561 /**
22562  * The base HTLC fee charged by sender, in milli-satoshi
22563  */
22564 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22565
22566 /**
22567  * The base HTLC fee charged by sender, in milli-satoshi
22568  */
22569 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
22570
22571 /**
22572  * The amount to fee multiplier, in micro-satoshi
22573  */
22574 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
22575
22576 /**
22577  * The amount to fee multiplier, in micro-satoshi
22578  */
22579 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
22580
22581 /**
22582  * Excess data which was signed as a part of the message which we do not (yet) understand how
22583  * to decode. This is stored to ensure forward-compatibility as new fields are added to the
22584  * lightning gossip
22585  */
22586 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
22587
22588 /**
22589  * Creates a copy of the UnsignedChannelUpdate
22590  */
22591 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
22592
22593 /**
22594  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
22595  */
22596 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
22597
22598 /**
22599  * A signature of the channel update
22600  */
22601 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
22602
22603 /**
22604  * A signature of the channel update
22605  */
22606 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
22607
22608 /**
22609  * The actual channel update
22610  */
22611 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
22612
22613 /**
22614  * The actual channel update
22615  */
22616 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
22617
22618 /**
22619  * Constructs a new ChannelUpdate given each field
22620  */
22621 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
22622
22623 /**
22624  * Creates a copy of the ChannelUpdate
22625  */
22626 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
22627
22628 /**
22629  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
22630  */
22631 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
22632
22633 /**
22634  * The genesis hash of the blockchain being queried
22635  */
22636 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
22637
22638 /**
22639  * The genesis hash of the blockchain being queried
22640  */
22641 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22642
22643 /**
22644  * The height of the first block for the channel UTXOs being queried
22645  */
22646 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
22647
22648 /**
22649  * The height of the first block for the channel UTXOs being queried
22650  */
22651 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22652
22653 /**
22654  * The number of blocks to include in the query results
22655  */
22656 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
22657
22658 /**
22659  * The number of blocks to include in the query results
22660  */
22661 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22662
22663 /**
22664  * Constructs a new QueryChannelRange given each field
22665  */
22666 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
22667
22668 /**
22669  * Creates a copy of the QueryChannelRange
22670  */
22671 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
22672
22673 /**
22674  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
22675  */
22676 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
22677
22678 /**
22679  * The genesis hash of the blockchain being queried
22680  */
22681 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
22682
22683 /**
22684  * The genesis hash of the blockchain being queried
22685  */
22686 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22687
22688 /**
22689  * The height of the first block in the range of the reply
22690  */
22691 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22692
22693 /**
22694  * The height of the first block in the range of the reply
22695  */
22696 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22697
22698 /**
22699  * The number of blocks included in the range of the reply
22700  */
22701 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22702
22703 /**
22704  * The number of blocks included in the range of the reply
22705  */
22706 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
22707
22708 /**
22709  * True when this is the final reply for a query
22710  */
22711 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
22712
22713 /**
22714  * True when this is the final reply for a query
22715  */
22716 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
22717
22718 /**
22719  * The short_channel_ids in the channel range
22720  */
22721 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
22722
22723 /**
22724  * Constructs a new ReplyChannelRange given each field
22725  */
22726 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);
22727
22728 /**
22729  * Creates a copy of the ReplyChannelRange
22730  */
22731 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
22732
22733 /**
22734  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
22735  */
22736 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
22737
22738 /**
22739  * The genesis hash of the blockchain being queried
22740  */
22741 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
22742
22743 /**
22744  * The genesis hash of the blockchain being queried
22745  */
22746 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22747
22748 /**
22749  * The short_channel_ids that are being queried
22750  */
22751 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
22752
22753 /**
22754  * Constructs a new QueryShortChannelIds given each field
22755  */
22756 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
22757
22758 /**
22759  * Creates a copy of the QueryShortChannelIds
22760  */
22761 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
22762
22763 /**
22764  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
22765  */
22766 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
22767
22768 /**
22769  * The genesis hash of the blockchain that was queried
22770  */
22771 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
22772
22773 /**
22774  * The genesis hash of the blockchain that was queried
22775  */
22776 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22777
22778 /**
22779  * Indicates if the query recipient maintains up-to-date channel
22780  * information for the chain_hash
22781  */
22782 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
22783
22784 /**
22785  * Indicates if the query recipient maintains up-to-date channel
22786  * information for the chain_hash
22787  */
22788 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
22789
22790 /**
22791  * Constructs a new ReplyShortChannelIdsEnd given each field
22792  */
22793 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
22794
22795 /**
22796  * Creates a copy of the ReplyShortChannelIdsEnd
22797  */
22798 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
22799
22800 /**
22801  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
22802  */
22803 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
22804
22805 /**
22806  * The genesis hash of the blockchain for channel and node information
22807  */
22808 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
22809
22810 /**
22811  * The genesis hash of the blockchain for channel and node information
22812  */
22813 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22814
22815 /**
22816  * The starting unix timestamp
22817  */
22818 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
22819
22820 /**
22821  * The starting unix timestamp
22822  */
22823 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
22824
22825 /**
22826  * The range of information in seconds
22827  */
22828 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
22829
22830 /**
22831  * The range of information in seconds
22832  */
22833 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
22834
22835 /**
22836  * Constructs a new GossipTimestampFilter given each field
22837  */
22838 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
22839
22840 /**
22841  * Creates a copy of the GossipTimestampFilter
22842  */
22843 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
22844
22845 /**
22846  * Frees any resources used by the ErrorAction
22847  */
22848 void ErrorAction_free(struct LDKErrorAction this_ptr);
22849
22850 /**
22851  * Creates a copy of the ErrorAction
22852  */
22853 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
22854
22855 /**
22856  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
22857  */
22858 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
22859
22860 /**
22861  * Utility method to constructs a new IgnoreError-variant ErrorAction
22862  */
22863 struct LDKErrorAction ErrorAction_ignore_error(void);
22864
22865 /**
22866  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
22867  */
22868 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
22869
22870 /**
22871  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
22872  */
22873 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
22874
22875 /**
22876  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
22877  */
22878 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
22879
22880 /**
22881  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
22882  */
22883 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
22884
22885 /**
22886  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
22887  */
22888 void LightningError_free(struct LDKLightningError this_obj);
22889
22890 /**
22891  * A human-readable message describing the error
22892  */
22893 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
22894
22895 /**
22896  * A human-readable message describing the error
22897  */
22898 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
22899
22900 /**
22901  * The action which should be taken against the offending peer.
22902  */
22903 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
22904
22905 /**
22906  * The action which should be taken against the offending peer.
22907  */
22908 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
22909
22910 /**
22911  * Constructs a new LightningError given each field
22912  */
22913 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
22914
22915 /**
22916  * Creates a copy of the LightningError
22917  */
22918 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
22919
22920 /**
22921  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
22922  */
22923 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
22924
22925 /**
22926  * update_add_htlc messages which should be sent
22927  */
22928 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22929
22930 /**
22931  * update_add_htlc messages which should be sent
22932  */
22933 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
22934
22935 /**
22936  * update_fulfill_htlc messages which should be sent
22937  */
22938 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22939
22940 /**
22941  * update_fulfill_htlc messages which should be sent
22942  */
22943 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
22944
22945 /**
22946  * update_fail_htlc messages which should be sent
22947  */
22948 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22949
22950 /**
22951  * update_fail_htlc messages which should be sent
22952  */
22953 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
22954
22955 /**
22956  * update_fail_malformed_htlc messages which should be sent
22957  */
22958 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22959
22960 /**
22961  * update_fail_malformed_htlc messages which should be sent
22962  */
22963 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
22964
22965 /**
22966  * An update_fee message which should be sent
22967  *
22968  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22969  */
22970 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22971
22972 /**
22973  * An update_fee message which should be sent
22974  *
22975  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22976  */
22977 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
22978
22979 /**
22980  * Finally, the commitment_signed message which should be sent
22981  */
22982 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
22983
22984 /**
22985  * Finally, the commitment_signed message which should be sent
22986  */
22987 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
22988
22989 /**
22990  * Constructs a new CommitmentUpdate given each field
22991  */
22992 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);
22993
22994 /**
22995  * Creates a copy of the CommitmentUpdate
22996  */
22997 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
22998
22999 /**
23000  * Calls the free function if one is set
23001  */
23002 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
23003
23004 /**
23005  * Calls the free function if one is set
23006  */
23007 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
23008
23009 /**
23010  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
23011  */
23012 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
23013
23014 /**
23015  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
23016  */
23017 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
23018
23019 /**
23020  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
23021  */
23022 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
23023
23024 /**
23025  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
23026  */
23027 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
23028
23029 /**
23030  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
23031  */
23032 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
23033
23034 /**
23035  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
23036  */
23037 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
23038
23039 /**
23040  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
23041  */
23042 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
23043
23044 /**
23045  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
23046  */
23047 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
23048
23049 /**
23050  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
23051  */
23052 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
23053
23054 /**
23055  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
23056  */
23057 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
23058
23059 /**
23060  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
23061  */
23062 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
23063
23064 /**
23065  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
23066  */
23067 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
23068
23069 /**
23070  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
23071  */
23072 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
23073
23074 /**
23075  * Read a FundingCreated from a byte array, created by FundingCreated_write
23076  */
23077 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
23078
23079 /**
23080  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
23081  */
23082 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
23083
23084 /**
23085  * Read a FundingSigned from a byte array, created by FundingSigned_write
23086  */
23087 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
23088
23089 /**
23090  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
23091  */
23092 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
23093
23094 /**
23095  * Read a ChannelReady from a byte array, created by ChannelReady_write
23096  */
23097 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
23098
23099 /**
23100  * Serialize the Init object into a byte array which can be read by Init_read
23101  */
23102 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
23103
23104 /**
23105  * Read a Init from a byte array, created by Init_write
23106  */
23107 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
23108
23109 /**
23110  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
23111  */
23112 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
23113
23114 /**
23115  * Read a OpenChannel from a byte array, created by OpenChannel_write
23116  */
23117 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
23118
23119 /**
23120  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
23121  */
23122 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
23123
23124 /**
23125  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
23126  */
23127 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
23128
23129 /**
23130  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
23131  */
23132 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
23133
23134 /**
23135  * Read a Shutdown from a byte array, created by Shutdown_write
23136  */
23137 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
23138
23139 /**
23140  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
23141  */
23142 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
23143
23144 /**
23145  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
23146  */
23147 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
23148
23149 /**
23150  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
23151  */
23152 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
23153
23154 /**
23155  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
23156  */
23157 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
23158
23159 /**
23160  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
23161  */
23162 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
23163
23164 /**
23165  * Read a UpdateFee from a byte array, created by UpdateFee_write
23166  */
23167 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
23168
23169 /**
23170  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
23171  */
23172 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
23173
23174 /**
23175  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
23176  */
23177 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
23178
23179 /**
23180  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
23181  */
23182 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
23183
23184 /**
23185  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
23186  */
23187 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
23188
23189 /**
23190  * Serialize the Ping object into a byte array which can be read by Ping_read
23191  */
23192 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
23193
23194 /**
23195  * Read a Ping from a byte array, created by Ping_write
23196  */
23197 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
23198
23199 /**
23200  * Serialize the Pong object into a byte array which can be read by Pong_read
23201  */
23202 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
23203
23204 /**
23205  * Read a Pong from a byte array, created by Pong_write
23206  */
23207 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
23208
23209 /**
23210  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
23211  */
23212 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
23213
23214 /**
23215  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
23216  */
23217 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
23218
23219 /**
23220  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
23221  */
23222 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
23223
23224 /**
23225  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
23226  */
23227 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
23228
23229 /**
23230  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
23231  */
23232 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
23233
23234 /**
23235  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
23236  */
23237 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
23238
23239 /**
23240  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
23241  */
23242 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
23243
23244 /**
23245  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
23246  */
23247 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
23248
23249 /**
23250  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
23251  */
23252 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
23253
23254 /**
23255  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
23256  */
23257 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
23258
23259 /**
23260  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
23261  */
23262 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
23263
23264 /**
23265  * Read a WarningMessage from a byte array, created by WarningMessage_write
23266  */
23267 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
23268
23269 /**
23270  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
23271  */
23272 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
23273
23274 /**
23275  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
23276  */
23277 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
23278
23279 /**
23280  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
23281  */
23282 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
23283
23284 /**
23285  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
23286  */
23287 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
23288
23289 /**
23290  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
23291  */
23292 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
23293
23294 /**
23295  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
23296  */
23297 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
23298
23299 /**
23300  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
23301  */
23302 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
23303
23304 /**
23305  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
23306  */
23307 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
23308
23309 /**
23310  *\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
23311  */
23312 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
23313
23314 /**
23315  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
23316  */
23317 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
23318
23319 /**
23320  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
23321  */
23322 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
23323
23324 /**
23325  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
23326  */
23327 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
23328
23329 /**
23330  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
23331  */
23332 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
23333
23334 /**
23335  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
23336  */
23337 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
23338
23339 /**
23340  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
23341  */
23342 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
23343
23344 /**
23345  * Calls the free function if one is set
23346  */
23347 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
23348
23349 /**
23350  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
23351  */
23352 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
23353
23354 /**
23355  * Constructs a new IgnoringMessageHandler given each field
23356  */
23357 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
23358
23359 /**
23360  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
23361  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
23362  */
23363 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23364
23365 /**
23366  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
23367  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
23368  */
23369 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23370
23371 /**
23372  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
23373  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
23374  */
23375 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23376
23377 /**
23378  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
23379  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
23380  */
23381 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
23382
23383 /**
23384  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
23385  */
23386 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
23387
23388 /**
23389  * Constructs a new ErroringMessageHandler
23390  */
23391 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
23392
23393 /**
23394  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
23395  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
23396  */
23397 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
23398
23399 /**
23400  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
23401  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
23402  */
23403 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
23404
23405 /**
23406  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
23407  */
23408 void MessageHandler_free(struct LDKMessageHandler this_obj);
23409
23410 /**
23411  * A message handler which handles messages specific to channels. Usually this is just a
23412  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
23413  *
23414  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23415  */
23416 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
23417
23418 /**
23419  * A message handler which handles messages specific to channels. Usually this is just a
23420  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
23421  *
23422  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23423  */
23424 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
23425
23426 /**
23427  * A message handler which handles messages updating our knowledge of the network channel
23428  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
23429  *
23430  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
23431  */
23432 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
23433
23434 /**
23435  * A message handler which handles messages updating our knowledge of the network channel
23436  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
23437  *
23438  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
23439  */
23440 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
23441
23442 /**
23443  * Constructs a new MessageHandler given each field
23444  */
23445 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
23446
23447 /**
23448  * Creates a copy of a SocketDescriptor
23449  */
23450 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
23451
23452 /**
23453  * Calls the free function if one is set
23454  */
23455 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
23456
23457 /**
23458  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
23459  */
23460 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
23461
23462 /**
23463  * Used to indicate that we probably can't make any future connections to this peer (e.g.
23464  * because we required features that our peer was missing, or vice versa).
23465  *
23466  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
23467  * any channels with this peer or check for new versions of LDK.
23468  *
23469  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23470  */
23471 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
23472
23473 /**
23474  * Used to indicate that we probably can't make any future connections to this peer (e.g.
23475  * because we required features that our peer was missing, or vice versa).
23476  *
23477  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
23478  * any channels with this peer or check for new versions of LDK.
23479  *
23480  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
23481  */
23482 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
23483
23484 /**
23485  * Constructs a new PeerHandleError given each field
23486  */
23487 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
23488
23489 /**
23490  * Creates a copy of the PeerHandleError
23491  */
23492 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
23493
23494 /**
23495  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
23496  */
23497 void PeerManager_free(struct LDKPeerManager this_obj);
23498
23499 /**
23500  * Constructs a new PeerManager with the given message handlers and node_id secret key
23501  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
23502  * cryptographically secure random bytes.
23503  */
23504 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);
23505
23506 /**
23507  * Get the list of node ids for peers which have completed the initial handshake.
23508  *
23509  * For outbound connections, this will be the same as the their_node_id parameter passed in to
23510  * new_outbound_connection, however entries will only appear once the initial handshake has
23511  * completed and we are sure the remote peer has the private key for the given node_id.
23512  */
23513 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
23514
23515 /**
23516  * Indicates a new outbound connection has been established to a node with the given node_id
23517  * and an optional remote network address.
23518  *
23519  * The remote network address adds the option to report a remote IP address back to a connecting
23520  * peer using the init message.
23521  * The user should pass the remote network address of the host they are connected to.
23522  *
23523  * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new
23524  * descriptor but must disconnect the connection immediately.
23525  *
23526  * Returns a small number of bytes to send to the remote node (currently always 50).
23527  *
23528  * Panics if descriptor is duplicative with some other descriptor which has not yet been
23529  * [`socket_disconnected()`].
23530  *
23531  * [`socket_disconnected()`]: PeerManager::socket_disconnected
23532  */
23533 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);
23534
23535 /**
23536  * Indicates a new inbound connection has been established to a node with an optional remote
23537  * network address.
23538  *
23539  * The remote network address adds the option to report a remote IP address back to a connecting
23540  * peer using the init message.
23541  * The user should pass the remote network address of the host they are connected to.
23542  *
23543  * May refuse the connection by returning an Err, but will never write bytes to the remote end
23544  * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT
23545  * call socket_disconnected for the new descriptor but must disconnect the connection
23546  * immediately.
23547  *
23548  * Panics if descriptor is duplicative with some other descriptor which has not yet been
23549  * [`socket_disconnected()`].
23550  *
23551  * [`socket_disconnected()`]: PeerManager::socket_disconnected
23552  */
23553 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);
23554
23555 /**
23556  * Indicates that there is room to write data to the given socket descriptor.
23557  *
23558  * May return an Err to indicate that the connection should be closed.
23559  *
23560  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
23561  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
23562  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
23563  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
23564  * sufficient!
23565  *
23566  * [`send_data`]: SocketDescriptor::send_data
23567  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
23568  */
23569 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
23570
23571 /**
23572  * Indicates that data was read from the given socket descriptor.
23573  *
23574  * May return an Err to indicate that the connection should be closed.
23575  *
23576  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
23577  * Thus, however, you should call [`process_events`] after any `read_event` to generate
23578  * [`send_data`] calls to handle responses.
23579  *
23580  * If `Ok(true)` is returned, further read_events should not be triggered until a
23581  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
23582  * send buffer).
23583  *
23584  * [`send_data`]: SocketDescriptor::send_data
23585  * [`process_events`]: PeerManager::process_events
23586  */
23587 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);
23588
23589 /**
23590  * Checks for any events generated by our handlers and processes them. Includes sending most
23591  * response messages as well as messages generated by calls to handler functions directly (eg
23592  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
23593  *
23594  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
23595  * issues!
23596  *
23597  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
23598  * or one of the other clients provided in our language bindings.
23599  *
23600  * Note that if there are any other calls to this function waiting on lock(s) this may return
23601  * without doing any work. All available events that need handling will be handled before the
23602  * other calls return.
23603  *
23604  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
23605  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
23606  * [`send_data`]: SocketDescriptor::send_data
23607  */
23608 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
23609
23610 /**
23611  * Indicates that the given socket descriptor's connection is now closed.
23612  */
23613 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
23614
23615 /**
23616  * Disconnect a peer given its node id.
23617  *
23618  * Set `no_connection_possible` to true to prevent any further connection with this peer,
23619  * force-closing any channels we have with it.
23620  *
23621  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
23622  * peer. Thus, be very careful about reentrancy issues.
23623  *
23624  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
23625  */
23626 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
23627
23628 /**
23629  * Disconnects all currently-connected peers. This is useful on platforms where there may be
23630  * an indication that TCP sockets have stalled even if we weren't around to time them out
23631  * using regular ping/pongs.
23632  */
23633 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
23634
23635 /**
23636  * Send pings to each peer and disconnect those which did not respond to the last round of
23637  * pings.
23638  *
23639  * This may be called on any timescale you want, however, roughly once every ten seconds is
23640  * preferred. The call rate determines both how often we send a ping to our peers and how much
23641  * time they have to respond before we disconnect them.
23642  *
23643  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
23644  * issues!
23645  *
23646  * [`send_data`]: SocketDescriptor::send_data
23647  */
23648 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
23649
23650 /**
23651  * Gets the weight for an HTLC-Success transaction.
23652  */
23653 uint64_t htlc_success_tx_weight(bool opt_anchors);
23654
23655 /**
23656  * Gets the weight for an HTLC-Timeout transaction.
23657  */
23658 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
23659
23660 /**
23661  * Build the commitment secret from the seed and the commitment number
23662  */
23663 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
23664
23665 /**
23666  * Build a closing transaction
23667  */
23668 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);
23669
23670 /**
23671  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
23672  */
23673 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
23674
23675 /**
23676  * Creates a copy of the CounterpartyCommitmentSecrets
23677  */
23678 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
23679
23680 /**
23681  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
23682  */
23683 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
23684
23685 /**
23686  * Returns the minimum index of all stored secrets. Note that indexes start
23687  * at 1 << 48 and get decremented by one for each new secret.
23688  */
23689 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
23690
23691 /**
23692  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
23693  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
23694  */
23695 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
23696
23697 /**
23698  * Returns the secret at `idx`.
23699  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
23700  *
23701  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23702  */
23703 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
23704
23705 /**
23706  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
23707  */
23708 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
23709
23710 /**
23711  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
23712  */
23713 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
23714
23715 /**
23716  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
23717  * from the base secret and the per_commitment_point.
23718  *
23719  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23720  * generated (ie our own).
23721  */
23722 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
23723
23724 /**
23725  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
23726  * from the base point and the per_commitment_key. This is the public equivalent of
23727  * derive_private_key - using only public keys to derive a public key instead of private keys.
23728  *
23729  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23730  * generated (ie our own).
23731  */
23732 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
23733
23734 /**
23735  * Derives a per-commitment-transaction revocation key from its constituent parts.
23736  *
23737  * Only the cheating participant owns a valid witness to propagate a revoked
23738  * commitment transaction, thus per_commitment_secret always come from cheater
23739  * and revocation_base_secret always come from punisher, which is the broadcaster
23740  * of the transaction spending with this key knowledge.
23741  *
23742  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23743  * generated (ie our own).
23744  */
23745 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
23746
23747 /**
23748  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
23749  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
23750  * public key instead of private keys.
23751  *
23752  * Only the cheating participant owns a valid witness to propagate a revoked
23753  * commitment transaction, thus per_commitment_point always come from cheater
23754  * and revocation_base_point always come from punisher, which is the broadcaster
23755  * of the transaction spending with this key knowledge.
23756  *
23757  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
23758  * generated (ie our own).
23759  */
23760 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
23761
23762 /**
23763  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
23764  */
23765 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
23766
23767 /**
23768  * The broadcaster's per-commitment public key which was used to derive the other keys.
23769  */
23770 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23771
23772 /**
23773  * The broadcaster's per-commitment public key which was used to derive the other keys.
23774  */
23775 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23776
23777 /**
23778  * The revocation key which is used to allow the broadcaster of the commitment
23779  * transaction to provide their counterparty the ability to punish them if they broadcast
23780  * an old state.
23781  */
23782 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23783
23784 /**
23785  * The revocation key which is used to allow the broadcaster of the commitment
23786  * transaction to provide their counterparty the ability to punish them if they broadcast
23787  * an old state.
23788  */
23789 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23790
23791 /**
23792  * Broadcaster's HTLC Key
23793  */
23794 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23795
23796 /**
23797  * Broadcaster's HTLC Key
23798  */
23799 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23800
23801 /**
23802  * Countersignatory's HTLC Key
23803  */
23804 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23805
23806 /**
23807  * Countersignatory's HTLC Key
23808  */
23809 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23810
23811 /**
23812  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
23813  */
23814 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
23815
23816 /**
23817  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
23818  */
23819 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23820
23821 /**
23822  * Constructs a new TxCreationKeys given each field
23823  */
23824 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);
23825
23826 /**
23827  * Creates a copy of the TxCreationKeys
23828  */
23829 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
23830
23831 /**
23832  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
23833  */
23834 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
23835
23836 /**
23837  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
23838  */
23839 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
23840
23841 /**
23842  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
23843  */
23844 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
23845
23846 /**
23847  * The public key which is used to sign all commitment transactions, as it appears in the
23848  * on-chain channel lock-in 2-of-2 multisig output.
23849  */
23850 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23851
23852 /**
23853  * The public key which is used to sign all commitment transactions, as it appears in the
23854  * on-chain channel lock-in 2-of-2 multisig output.
23855  */
23856 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23857
23858 /**
23859  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
23860  * revocation keys. This is combined with the per-commitment-secret generated by the
23861  * counterparty to create a secret which the counterparty can reveal to revoke previous
23862  * states.
23863  */
23864 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23865
23866 /**
23867  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
23868  * revocation keys. This is combined with the per-commitment-secret generated by the
23869  * counterparty to create a secret which the counterparty can reveal to revoke previous
23870  * states.
23871  */
23872 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23873
23874 /**
23875  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
23876  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
23877  * static across every commitment transaction.
23878  */
23879 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23880
23881 /**
23882  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
23883  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
23884  * static across every commitment transaction.
23885  */
23886 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23887
23888 /**
23889  * The base point which is used (with derive_public_key) to derive a per-commitment payment
23890  * public key which receives non-HTLC-encumbered funds which are only available for spending
23891  * after some delay (or can be claimed via the revocation path).
23892  */
23893 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23894
23895 /**
23896  * The base point which is used (with derive_public_key) to derive a per-commitment payment
23897  * public key which receives non-HTLC-encumbered funds which are only available for spending
23898  * after some delay (or can be claimed via the revocation path).
23899  */
23900 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23901
23902 /**
23903  * The base point which is used (with derive_public_key) to derive a per-commitment public key
23904  * which is used to encumber HTLC-in-flight outputs.
23905  */
23906 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
23907
23908 /**
23909  * The base point which is used (with derive_public_key) to derive a per-commitment public key
23910  * which is used to encumber HTLC-in-flight outputs.
23911  */
23912 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23913
23914 /**
23915  * Constructs a new ChannelPublicKeys given each field
23916  */
23917 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);
23918
23919 /**
23920  * Creates a copy of the ChannelPublicKeys
23921  */
23922 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
23923
23924 /**
23925  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
23926  */
23927 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
23928
23929 /**
23930  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
23931  */
23932 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
23933
23934 /**
23935  * Create per-state keys from channel base points and the per-commitment point.
23936  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
23937  */
23938 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);
23939
23940 /**
23941  * Generate per-state keys from channel static keys.
23942  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
23943  */
23944 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);
23945
23946 /**
23947  * A script either spendable by the revocation
23948  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
23949  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
23950  */
23951 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
23952
23953 /**
23954  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
23955  */
23956 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
23957
23958 /**
23959  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
23960  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
23961  * need to compare this value to whether the commitment transaction in question is that of
23962  * the counterparty or our own.
23963  */
23964 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23965
23966 /**
23967  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
23968  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
23969  * need to compare this value to whether the commitment transaction in question is that of
23970  * the counterparty or our own.
23971  */
23972 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
23973
23974 /**
23975  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
23976  * this divided by 1000.
23977  */
23978 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23979
23980 /**
23981  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
23982  * this divided by 1000.
23983  */
23984 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
23985
23986 /**
23987  * The CLTV lock-time at which this HTLC expires.
23988  */
23989 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
23990
23991 /**
23992  * The CLTV lock-time at which this HTLC expires.
23993  */
23994 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
23995
23996 /**
23997  * The hash of the preimage which unlocks this HTLC.
23998  */
23999 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
24000
24001 /**
24002  * The hash of the preimage which unlocks this HTLC.
24003  */
24004 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24005
24006 /**
24007  * The position within the commitment transactions' outputs. This may be None if the value is
24008  * below the dust limit (in which case no output appears in the commitment transaction and the
24009  * value is spent to additional transaction fees).
24010  */
24011 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24012
24013 /**
24014  * The position within the commitment transactions' outputs. This may be None if the value is
24015  * below the dust limit (in which case no output appears in the commitment transaction and the
24016  * value is spent to additional transaction fees).
24017  */
24018 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
24019
24020 /**
24021  * Constructs a new HTLCOutputInCommitment given each field
24022  */
24023 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);
24024
24025 /**
24026  * Creates a copy of the HTLCOutputInCommitment
24027  */
24028 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
24029
24030 /**
24031  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
24032  */
24033 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
24034
24035 /**
24036  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
24037  */
24038 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
24039
24040 /**
24041  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
24042  * does not need to have its previous_output_index filled.
24043  */
24044 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
24045
24046 /**
24047  * Gets the redeemscript for a funding output from the two funding public keys.
24048  * Note that the order of funding public keys does not matter.
24049  */
24050 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
24051
24052 /**
24053  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
24054  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
24055  * transaction which needs signing, and can be used to construct an HTLC transaction which is
24056  * broadcastable given a counterparty HTLC signature.
24057  *
24058  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
24059  * commitment transaction).
24060  */
24061 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);
24062
24063 /**
24064  * Gets the witnessScript for an anchor output from the funding public key.
24065  * The witness in the spending input must be:
24066  * <BIP 143 funding_signature>
24067  * After 16 blocks of confirmation, an alternative satisfying witness could be:
24068  * <>
24069  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
24070  */
24071 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
24072
24073 /**
24074  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24075  */
24076 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
24077
24078 /**
24079  * Holder public keys
24080  */
24081 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24082
24083 /**
24084  * Holder public keys
24085  */
24086 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
24087
24088 /**
24089  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
24090  */
24091 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24092
24093 /**
24094  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
24095  */
24096 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
24097
24098 /**
24099  * Whether the holder is the initiator of this channel.
24100  * This is an input to the commitment number obscure factor computation.
24101  */
24102 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24103
24104 /**
24105  * Whether the holder is the initiator of this channel.
24106  * This is an input to the commitment number obscure factor computation.
24107  */
24108 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
24109
24110 /**
24111  * The late-bound counterparty channel transaction parameters.
24112  * These parameters are populated at the point in the protocol where the counterparty provides them.
24113  *
24114  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24115  */
24116 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24117
24118 /**
24119  * The late-bound counterparty channel transaction parameters.
24120  * These parameters are populated at the point in the protocol where the counterparty provides them.
24121  *
24122  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24123  */
24124 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
24125
24126 /**
24127  * The late-bound funding outpoint
24128  *
24129  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24130  */
24131 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24132
24133 /**
24134  * The late-bound funding outpoint
24135  *
24136  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24137  */
24138 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
24139
24140 /**
24141  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
24142  */
24143 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24144
24145 /**
24146  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
24147  */
24148 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
24149
24150 /**
24151  * Constructs a new ChannelTransactionParameters given each field
24152  */
24153 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);
24154
24155 /**
24156  * Creates a copy of the ChannelTransactionParameters
24157  */
24158 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
24159
24160 /**
24161  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24162  */
24163 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
24164
24165 /**
24166  * Counter-party public keys
24167  */
24168 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
24169
24170 /**
24171  * Counter-party public keys
24172  */
24173 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
24174
24175 /**
24176  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
24177  */
24178 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
24179
24180 /**
24181  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
24182  */
24183 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
24184
24185 /**
24186  * Constructs a new CounterpartyChannelTransactionParameters given each field
24187  */
24188 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
24189
24190 /**
24191  * Creates a copy of the CounterpartyChannelTransactionParameters
24192  */
24193 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
24194
24195 /**
24196  * Whether the late bound parameters are populated.
24197  */
24198 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24199
24200 /**
24201  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
24202  * given that the holder is the broadcaster.
24203  *
24204  * self.is_populated() must be true before calling this function.
24205  */
24206 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24207
24208 /**
24209  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
24210  * given that the counterparty is the broadcaster.
24211  *
24212  * self.is_populated() must be true before calling this function.
24213  */
24214 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24215
24216 /**
24217  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
24218  */
24219 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
24220
24221 /**
24222  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
24223  */
24224 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
24225
24226 /**
24227  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
24228  */
24229 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
24230
24231 /**
24232  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
24233  */
24234 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
24235
24236 /**
24237  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24238  */
24239 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
24240
24241 /**
24242  * Get the channel pubkeys for the broadcaster
24243  */
24244 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24245
24246 /**
24247  * Get the channel pubkeys for the countersignatory
24248  */
24249 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24250
24251 /**
24252  * Get the contest delay applicable to the transactions.
24253  * Note that the contest delay was selected by the countersignatory.
24254  */
24255 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24256
24257 /**
24258  * Whether the channel is outbound from the broadcaster.
24259  *
24260  * The boolean representing the side that initiated the channel is
24261  * an input to the commitment number obscure factor computation.
24262  */
24263 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24264
24265 /**
24266  * The funding outpoint
24267  */
24268 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24269
24270 /**
24271  * Whether to use anchors for this channel
24272  */
24273 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24274
24275 /**
24276  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
24277  */
24278 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
24279
24280 /**
24281  * Our counterparty's signature for the transaction
24282  */
24283 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
24284
24285 /**
24286  * Our counterparty's signature for the transaction
24287  */
24288 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
24289
24290 /**
24291  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
24292  */
24293 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
24294
24295 /**
24296  * Creates a copy of the HolderCommitmentTransaction
24297  */
24298 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
24299
24300 /**
24301  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
24302  */
24303 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
24304
24305 /**
24306  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
24307  */
24308 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
24309
24310 /**
24311  * Create a new holder transaction with the given counterparty signatures.
24312  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
24313  */
24314 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);
24315
24316 /**
24317  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
24318  */
24319 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
24320
24321 /**
24322  * The commitment transaction
24323  */
24324 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
24325
24326 /**
24327  * The commitment transaction
24328  */
24329 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
24330
24331 /**
24332  * The txid for the commitment transaction.
24333  *
24334  * This is provided as a performance optimization, instead of calling transaction.txid()
24335  * multiple times.
24336  */
24337 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
24338
24339 /**
24340  * The txid for the commitment transaction.
24341  *
24342  * This is provided as a performance optimization, instead of calling transaction.txid()
24343  * multiple times.
24344  */
24345 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24346
24347 /**
24348  * Constructs a new BuiltCommitmentTransaction given each field
24349  */
24350 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
24351
24352 /**
24353  * Creates a copy of the BuiltCommitmentTransaction
24354  */
24355 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
24356
24357 /**
24358  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
24359  */
24360 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
24361
24362 /**
24363  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
24364  */
24365 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
24366
24367 /**
24368  * Get the SIGHASH_ALL sighash value of the transaction.
24369  *
24370  * This can be used to verify a signature.
24371  */
24372 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);
24373
24374 /**
24375  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
24376  * because we are about to broadcast a holder transaction.
24377  */
24378 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);
24379
24380 /**
24381  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
24382  */
24383 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
24384
24385 /**
24386  * Creates a copy of the ClosingTransaction
24387  */
24388 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
24389
24390 /**
24391  * Checks if two ClosingTransactions contain equal inner contents.
24392  */
24393 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
24394
24395 /**
24396  * Construct an object of the class
24397  */
24398 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);
24399
24400 /**
24401  * Trust our pre-built transaction.
24402  *
24403  * Applies a wrapper which allows access to the transaction.
24404  *
24405  * This should only be used if you fully trust the builder of this object. It should not
24406  * be used by an external signer - instead use the verify function.
24407  */
24408 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24409
24410 /**
24411  * Verify our pre-built transaction.
24412  *
24413  * Applies a wrapper which allows access to the transaction.
24414  *
24415  * An external validating signer must call this method before signing
24416  * or using the built transaction.
24417  */
24418 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
24419
24420 /**
24421  * The value to be sent to the holder, or zero if the output will be omitted
24422  */
24423 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24424
24425 /**
24426  * The value to be sent to the counterparty, or zero if the output will be omitted
24427  */
24428 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24429
24430 /**
24431  * The destination of the holder's output
24432  */
24433 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24434
24435 /**
24436  * The destination of the counterparty's output
24437  */
24438 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
24439
24440 /**
24441  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
24442  */
24443 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
24444
24445 /**
24446  * The pre-built Bitcoin commitment transaction
24447  */
24448 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
24449
24450 /**
24451  * Get the SIGHASH_ALL sighash value of the transaction.
24452  *
24453  * This can be used to verify a signature.
24454  */
24455 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);
24456
24457 /**
24458  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
24459  * because we are about to broadcast a holder transaction.
24460  */
24461 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);
24462
24463 /**
24464  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
24465  */
24466 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
24467
24468 /**
24469  * Creates a copy of the CommitmentTransaction
24470  */
24471 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
24472
24473 /**
24474  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
24475  */
24476 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
24477
24478 /**
24479  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
24480  */
24481 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
24482
24483 /**
24484  * The backwards-counting commitment number
24485  */
24486 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24487
24488 /**
24489  * The value to be sent to the broadcaster
24490  */
24491 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24492
24493 /**
24494  * The value to be sent to the counterparty
24495  */
24496 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24497
24498 /**
24499  * The feerate paid per 1000-weight-unit in this commitment transaction.
24500  */
24501 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24502
24503 /**
24504  * Trust our pre-built transaction and derived transaction creation public keys.
24505  *
24506  * Applies a wrapper which allows access to these fields.
24507  *
24508  * This should only be used if you fully trust the builder of this object.  It should not
24509  * be used by an external signer - instead use the verify function.
24510  */
24511 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
24512
24513 /**
24514  * Verify our pre-built transaction and derived transaction creation public keys.
24515  *
24516  * Applies a wrapper which allows access to these fields.
24517  *
24518  * An external validating signer must call this method before signing
24519  * or using the built transaction.
24520  */
24521 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);
24522
24523 /**
24524  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
24525  */
24526 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
24527
24528 /**
24529  * The transaction ID of the built Bitcoin transaction
24530  */
24531 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24532
24533 /**
24534  * The pre-built Bitcoin commitment transaction
24535  */
24536 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24537
24538 /**
24539  * The pre-calculated transaction creation public keys.
24540  */
24541 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24542
24543 /**
24544  * Should anchors be used.
24545  */
24546 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
24547
24548 /**
24549  * Get a signature for each HTLC which was included in the commitment transaction (ie for
24550  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
24551  *
24552  * The returned Vec has one entry for each HTLC, and in the same order.
24553  *
24554  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
24555  */
24556 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);
24557
24558 /**
24559  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
24560  * shared secret first. This prevents on-chain observers from discovering how many commitment
24561  * transactions occurred in a channel before it was closed.
24562  *
24563  * This function gets the shared secret from relevant channel public keys and can be used to
24564  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
24565  */
24566 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
24567
24568 /**
24569  * Checks if two InitFeaturess contain equal inner contents.
24570  * This ignores pointers and is_owned flags and looks at the values in fields.
24571  * Two objects with NULL inner values will be considered "equal" here.
24572  */
24573 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
24574
24575 /**
24576  * Checks if two NodeFeaturess contain equal inner contents.
24577  * This ignores pointers and is_owned flags and looks at the values in fields.
24578  * Two objects with NULL inner values will be considered "equal" here.
24579  */
24580 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
24581
24582 /**
24583  * Checks if two ChannelFeaturess contain equal inner contents.
24584  * This ignores pointers and is_owned flags and looks at the values in fields.
24585  * Two objects with NULL inner values will be considered "equal" here.
24586  */
24587 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
24588
24589 /**
24590  * Checks if two InvoiceFeaturess contain equal inner contents.
24591  * This ignores pointers and is_owned flags and looks at the values in fields.
24592  * Two objects with NULL inner values will be considered "equal" here.
24593  */
24594 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
24595
24596 /**
24597  * Checks if two ChannelTypeFeaturess contain equal inner contents.
24598  * This ignores pointers and is_owned flags and looks at the values in fields.
24599  * Two objects with NULL inner values will be considered "equal" here.
24600  */
24601 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
24602
24603 /**
24604  * Creates a copy of the InitFeatures
24605  */
24606 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
24607
24608 /**
24609  * Creates a copy of the NodeFeatures
24610  */
24611 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
24612
24613 /**
24614  * Creates a copy of the ChannelFeatures
24615  */
24616 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
24617
24618 /**
24619  * Creates a copy of the InvoiceFeatures
24620  */
24621 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
24622
24623 /**
24624  * Creates a copy of the ChannelTypeFeatures
24625  */
24626 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
24627
24628 /**
24629  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
24630  */
24631 void InitFeatures_free(struct LDKInitFeatures this_obj);
24632
24633 /**
24634  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
24635  */
24636 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
24637
24638 /**
24639  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
24640  */
24641 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
24642
24643 /**
24644  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
24645  */
24646 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
24647
24648 /**
24649  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
24650  */
24651 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
24652
24653 /**
24654  * Create a blank Features with no features set
24655  */
24656 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
24657
24658 /**
24659  * Creates a Features with the bits set which are known by the implementation
24660  */
24661 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
24662
24663 /**
24664  * Returns true if this `Features` object contains unknown feature flags which are set as
24665  * \"required\".
24666  */
24667 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24668
24669 /**
24670  * Create a blank Features with no features set
24671  */
24672 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
24673
24674 /**
24675  * Creates a Features with the bits set which are known by the implementation
24676  */
24677 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
24678
24679 /**
24680  * Returns true if this `Features` object contains unknown feature flags which are set as
24681  * \"required\".
24682  */
24683 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24684
24685 /**
24686  * Create a blank Features with no features set
24687  */
24688 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
24689
24690 /**
24691  * Creates a Features with the bits set which are known by the implementation
24692  */
24693 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
24694
24695 /**
24696  * Returns true if this `Features` object contains unknown feature flags which are set as
24697  * \"required\".
24698  */
24699 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
24700
24701 /**
24702  * Create a blank Features with no features set
24703  */
24704 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
24705
24706 /**
24707  * Creates a Features with the bits set which are known by the implementation
24708  */
24709 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
24710
24711 /**
24712  * Returns true if this `Features` object contains unknown feature flags which are set as
24713  * \"required\".
24714  */
24715 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24716
24717 /**
24718  * Create a blank Features with no features set
24719  */
24720 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
24721
24722 /**
24723  * Creates a Features with the bits set which are known by the implementation
24724  */
24725 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
24726
24727 /**
24728  * Returns true if this `Features` object contains unknown feature flags which are set as
24729  * \"required\".
24730  */
24731 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
24732
24733 /**
24734  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
24735  */
24736 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
24737
24738 /**
24739  * Read a InitFeatures from a byte array, created by InitFeatures_write
24740  */
24741 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
24742
24743 /**
24744  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
24745  */
24746 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
24747
24748 /**
24749  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
24750  */
24751 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
24752
24753 /**
24754  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
24755  */
24756 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
24757
24758 /**
24759  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
24760  */
24761 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
24762
24763 /**
24764  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
24765  */
24766 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
24767
24768 /**
24769  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
24770  */
24771 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
24772
24773 /**
24774  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
24775  */
24776 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
24777
24778 /**
24779  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
24780  */
24781 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
24782
24783 /**
24784  * Set this feature as optional.
24785  */
24786 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24787
24788 /**
24789  * Set this feature as required.
24790  */
24791 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24792
24793 /**
24794  * Checks if this feature is supported.
24795  */
24796 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24797
24798 /**
24799  * Set this feature as optional.
24800  */
24801 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24802
24803 /**
24804  * Set this feature as required.
24805  */
24806 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24807
24808 /**
24809  * Checks if this feature is supported.
24810  */
24811 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24812
24813 /**
24814  * Checks if this feature is required.
24815  */
24816 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24817
24818 /**
24819  * Checks if this feature is required.
24820  */
24821 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24822
24823 /**
24824  * Set this feature as optional.
24825  */
24826 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24827
24828 /**
24829  * Set this feature as required.
24830  */
24831 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24832
24833 /**
24834  * Checks if this feature is supported.
24835  */
24836 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24837
24838 /**
24839  * Set this feature as optional.
24840  */
24841 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24842
24843 /**
24844  * Set this feature as required.
24845  */
24846 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24847
24848 /**
24849  * Checks if this feature is supported.
24850  */
24851 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24852
24853 /**
24854  * Set this feature as optional.
24855  */
24856 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24857
24858 /**
24859  * Set this feature as required.
24860  */
24861 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24862
24863 /**
24864  * Checks if this feature is supported.
24865  */
24866 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24867
24868 /**
24869  * Checks if this feature is required.
24870  */
24871 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24872
24873 /**
24874  * Checks if this feature is required.
24875  */
24876 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24877
24878 /**
24879  * Set this feature as optional.
24880  */
24881 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24882
24883 /**
24884  * Set this feature as required.
24885  */
24886 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24887
24888 /**
24889  * Checks if this feature is supported.
24890  */
24891 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24892
24893 /**
24894  * Set this feature as optional.
24895  */
24896 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24897
24898 /**
24899  * Set this feature as required.
24900  */
24901 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24902
24903 /**
24904  * Checks if this feature is supported.
24905  */
24906 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24907
24908 /**
24909  * Checks if this feature is required.
24910  */
24911 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24912
24913 /**
24914  * Checks if this feature is required.
24915  */
24916 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24917
24918 /**
24919  * Set this feature as optional.
24920  */
24921 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24922
24923 /**
24924  * Set this feature as required.
24925  */
24926 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24927
24928 /**
24929  * Checks if this feature is supported.
24930  */
24931 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24932
24933 /**
24934  * Set this feature as optional.
24935  */
24936 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24937
24938 /**
24939  * Set this feature as required.
24940  */
24941 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24942
24943 /**
24944  * Checks if this feature is supported.
24945  */
24946 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24947
24948 /**
24949  * Set this feature as optional.
24950  */
24951 void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24952
24953 /**
24954  * Set this feature as required.
24955  */
24956 void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24957
24958 /**
24959  * Checks if this feature is supported.
24960  */
24961 MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24962
24963 /**
24964  * Checks if this feature is required.
24965  */
24966 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24967
24968 /**
24969  * Checks if this feature is required.
24970  */
24971 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
24972
24973 /**
24974  * Checks if this feature is required.
24975  */
24976 MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
24977
24978 /**
24979  * Set this feature as optional.
24980  */
24981 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
24982
24983 /**
24984  * Set this feature as required.
24985  */
24986 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
24987
24988 /**
24989  * Checks if this feature is supported.
24990  */
24991 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
24992
24993 /**
24994  * Set this feature as optional.
24995  */
24996 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
24997
24998 /**
24999  * Set this feature as required.
25000  */
25001 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25002
25003 /**
25004  * Checks if this feature is supported.
25005  */
25006 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25007
25008 /**
25009  * Set this feature as optional.
25010  */
25011 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25012
25013 /**
25014  * Set this feature as required.
25015  */
25016 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25017
25018 /**
25019  * Checks if this feature is supported.
25020  */
25021 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25022
25023 /**
25024  * Checks if this feature is required.
25025  */
25026 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25027
25028 /**
25029  * Checks if this feature is required.
25030  */
25031 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25032
25033 /**
25034  * Checks if this feature is required.
25035  */
25036 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25037
25038 /**
25039  * Set this feature as optional.
25040  */
25041 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25042
25043 /**
25044  * Set this feature as required.
25045  */
25046 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25047
25048 /**
25049  * Checks if this feature is supported.
25050  */
25051 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25052
25053 /**
25054  * Set this feature as optional.
25055  */
25056 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25057
25058 /**
25059  * Set this feature as required.
25060  */
25061 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25062
25063 /**
25064  * Checks if this feature is supported.
25065  */
25066 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25067
25068 /**
25069  * Set this feature as optional.
25070  */
25071 void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25072
25073 /**
25074  * Set this feature as required.
25075  */
25076 void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25077
25078 /**
25079  * Checks if this feature is supported.
25080  */
25081 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25082
25083 /**
25084  * Checks if this feature is required.
25085  */
25086 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25087
25088 /**
25089  * Checks if this feature is required.
25090  */
25091 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25092
25093 /**
25094  * Checks if this feature is required.
25095  */
25096 MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25097
25098 /**
25099  * Set this feature as optional.
25100  */
25101 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25102
25103 /**
25104  * Set this feature as required.
25105  */
25106 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25107
25108 /**
25109  * Checks if this feature is supported.
25110  */
25111 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25112
25113 /**
25114  * Set this feature as optional.
25115  */
25116 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25117
25118 /**
25119  * Set this feature as required.
25120  */
25121 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25122
25123 /**
25124  * Checks if this feature is supported.
25125  */
25126 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25127
25128 /**
25129  * Set this feature as optional.
25130  */
25131 void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25132
25133 /**
25134  * Set this feature as required.
25135  */
25136 void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25137
25138 /**
25139  * Checks if this feature is supported.
25140  */
25141 MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25142
25143 /**
25144  * Checks if this feature is required.
25145  */
25146 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25147
25148 /**
25149  * Checks if this feature is required.
25150  */
25151 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25152
25153 /**
25154  * Checks if this feature is required.
25155  */
25156 MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25157
25158 /**
25159  * Set this feature as optional.
25160  */
25161 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25162
25163 /**
25164  * Set this feature as required.
25165  */
25166 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25167
25168 /**
25169  * Checks if this feature is supported.
25170  */
25171 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25172
25173 /**
25174  * Set this feature as optional.
25175  */
25176 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25177
25178 /**
25179  * Set this feature as required.
25180  */
25181 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25182
25183 /**
25184  * Checks if this feature is supported.
25185  */
25186 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25187
25188 /**
25189  * Checks if this feature is required.
25190  */
25191 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25192
25193 /**
25194  * Checks if this feature is required.
25195  */
25196 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25197
25198 /**
25199  * Set this feature as optional.
25200  */
25201 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25202
25203 /**
25204  * Set this feature as required.
25205  */
25206 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25207
25208 /**
25209  * Checks if this feature is supported.
25210  */
25211 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25212
25213 /**
25214  * Set this feature as optional.
25215  */
25216 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25217
25218 /**
25219  * Set this feature as required.
25220  */
25221 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25222
25223 /**
25224  * Checks if this feature is supported.
25225  */
25226 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25227
25228 /**
25229  * Checks if this feature is required.
25230  */
25231 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25232
25233 /**
25234  * Checks if this feature is required.
25235  */
25236 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25237
25238 /**
25239  * Set this feature as optional.
25240  */
25241 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25242
25243 /**
25244  * Set this feature as required.
25245  */
25246 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25247
25248 /**
25249  * Checks if this feature is supported.
25250  */
25251 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25252
25253 /**
25254  * Set this feature as optional.
25255  */
25256 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25257
25258 /**
25259  * Set this feature as required.
25260  */
25261 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25262
25263 /**
25264  * Checks if this feature is supported.
25265  */
25266 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25267
25268 /**
25269  * Checks if this feature is required.
25270  */
25271 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25272
25273 /**
25274  * Checks if this feature is required.
25275  */
25276 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25277
25278 /**
25279  * Set this feature as optional.
25280  */
25281 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25282
25283 /**
25284  * Set this feature as required.
25285  */
25286 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25287
25288 /**
25289  * Checks if this feature is supported.
25290  */
25291 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25292
25293 /**
25294  * Set this feature as optional.
25295  */
25296 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25297
25298 /**
25299  * Set this feature as required.
25300  */
25301 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25302
25303 /**
25304  * Checks if this feature is supported.
25305  */
25306 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25307
25308 /**
25309  * Set this feature as optional.
25310  */
25311 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25312
25313 /**
25314  * Set this feature as required.
25315  */
25316 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25317
25318 /**
25319  * Checks if this feature is supported.
25320  */
25321 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25322
25323 /**
25324  * Checks if this feature is required.
25325  */
25326 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25327
25328 /**
25329  * Checks if this feature is required.
25330  */
25331 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25332
25333 /**
25334  * Checks if this feature is required.
25335  */
25336 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25337
25338 /**
25339  * Set this feature as optional.
25340  */
25341 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25342
25343 /**
25344  * Set this feature as required.
25345  */
25346 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25347
25348 /**
25349  * Checks if this feature is supported.
25350  */
25351 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25352
25353 /**
25354  * Set this feature as optional.
25355  */
25356 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25357
25358 /**
25359  * Set this feature as required.
25360  */
25361 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25362
25363 /**
25364  * Checks if this feature is supported.
25365  */
25366 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25367
25368 /**
25369  * Set this feature as optional.
25370  */
25371 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25372
25373 /**
25374  * Set this feature as required.
25375  */
25376 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25377
25378 /**
25379  * Checks if this feature is supported.
25380  */
25381 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25382
25383 /**
25384  * Checks if this feature is required.
25385  */
25386 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25387
25388 /**
25389  * Checks if this feature is required.
25390  */
25391 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25392
25393 /**
25394  * Checks if this feature is required.
25395  */
25396 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25397
25398 /**
25399  * Set this feature as optional.
25400  */
25401 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25402
25403 /**
25404  * Set this feature as required.
25405  */
25406 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25407
25408 /**
25409  * Checks if this feature is supported.
25410  */
25411 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25412
25413 /**
25414  * Checks if this feature is required.
25415  */
25416 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25417
25418 /**
25419  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
25420  */
25421 void ShutdownScript_free(struct LDKShutdownScript this_obj);
25422
25423 /**
25424  * Creates a copy of the ShutdownScript
25425  */
25426 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
25427
25428 /**
25429  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
25430  */
25431 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
25432
25433 /**
25434  * The script that did not meet the requirements from [BOLT #2].
25435  *
25436  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
25437  */
25438 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
25439
25440 /**
25441  * The script that did not meet the requirements from [BOLT #2].
25442  *
25443  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
25444  */
25445 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
25446
25447 /**
25448  * Constructs a new InvalidShutdownScript given each field
25449  */
25450 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
25451
25452 /**
25453  * Creates a copy of the InvalidShutdownScript
25454  */
25455 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
25456
25457 /**
25458  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
25459  */
25460 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
25461
25462 /**
25463  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
25464  */
25465 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
25466
25467 /**
25468  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
25469  */
25470 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
25471
25472 /**
25473  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
25474  */
25475 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
25476
25477 /**
25478  * Generates a witness script pubkey from the given segwit version and program.
25479  *
25480  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
25481  * [`ShutdownScript::new_p2wsh`] instead.
25482  *
25483  * # Errors
25484  *
25485  * This function may return an error if `program` is invalid for the segwit `version`.
25486  */
25487 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
25488
25489 /**
25490  * Converts the shutdown script into the underlying [`Script`].
25491  */
25492 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
25493
25494 /**
25495  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
25496  *
25497  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25498  */
25499 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
25500
25501 /**
25502  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
25503  *
25504  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
25505  */
25506 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
25507
25508 /**
25509  * Calls the free function if one is set
25510  */
25511 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
25512
25513 /**
25514  * Calls the free function if one is set
25515  */
25516 void Type_free(struct LDKType this_ptr);
25517
25518 /**
25519  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
25520  */
25521 void NodeId_free(struct LDKNodeId this_obj);
25522
25523 /**
25524  * Creates a copy of the NodeId
25525  */
25526 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
25527
25528 /**
25529  * Create a new NodeId from a public key
25530  */
25531 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
25532
25533 /**
25534  * Get the public key slice from this NodeId
25535  */
25536 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
25537
25538 /**
25539  * Checks if two NodeIds contain equal inner contents.
25540  */
25541 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
25542
25543 /**
25544  * Serialize the NodeId object into a byte array which can be read by NodeId_read
25545  */
25546 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
25547
25548 /**
25549  * Read a NodeId from a byte array, created by NodeId_write
25550  */
25551 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
25552
25553 /**
25554  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
25555  */
25556 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
25557
25558 /**
25559  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
25560  */
25561 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
25562
25563 /**
25564  * Frees any resources used by the NetworkUpdate
25565  */
25566 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
25567
25568 /**
25569  * Creates a copy of the NetworkUpdate
25570  */
25571 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
25572
25573 /**
25574  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
25575  */
25576 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
25577
25578 /**
25579  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
25580  */
25581 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
25582
25583 /**
25584  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
25585  */
25586 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
25587
25588 /**
25589  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
25590  */
25591 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
25592
25593 /**
25594  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
25595  */
25596 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
25597
25598 /**
25599  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
25600  */
25601 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
25602
25603 /**
25604  * Creates a new tracker of the actual state of the network of channels and nodes,
25605  * assuming an existing Network Graph.
25606  * Chain monitor is used to make sure announced channels exist on-chain,
25607  * channel data is correct, and that the announcement is signed with
25608  * channel owners' keys.
25609  */
25610 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
25611
25612 /**
25613  * Adds a provider used to check new announcements. Does not affect
25614  * existing announcements unless they are updated.
25615  * Add, update or remove the provider would replace the current one.
25616  */
25617 void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
25618
25619 /**
25620  * Constructs a new EventHandler which calls the relevant methods on this_arg.
25621  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
25622  */
25623 struct LDKEventHandler NetworkGraph_as_EventHandler(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
25624
25625 /**
25626  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
25627  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
25628  */
25629 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
25630
25631 /**
25632  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
25633  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
25634  */
25635 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
25636
25637 /**
25638  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
25639  */
25640 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
25641
25642 /**
25643  * When the last update to the channel direction was issued.
25644  * Value is opaque, as set in the announcement.
25645  */
25646 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25647
25648 /**
25649  * When the last update to the channel direction was issued.
25650  * Value is opaque, as set in the announcement.
25651  */
25652 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
25653
25654 /**
25655  * Whether the channel can be currently used for payments (in this one direction).
25656  */
25657 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25658
25659 /**
25660  * Whether the channel can be currently used for payments (in this one direction).
25661  */
25662 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
25663
25664 /**
25665  * The difference in CLTV values that you must have when routing through this channel.
25666  */
25667 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25668
25669 /**
25670  * The difference in CLTV values that you must have when routing through this channel.
25671  */
25672 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
25673
25674 /**
25675  * The minimum value, which must be relayed to the next hop via the channel
25676  */
25677 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25678
25679 /**
25680  * The minimum value, which must be relayed to the next hop via the channel
25681  */
25682 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
25683
25684 /**
25685  * The maximum value which may be relayed to the next hop via the channel.
25686  */
25687 struct LDKCOption_u64Z ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25688
25689 /**
25690  * The maximum value which may be relayed to the next hop via the channel.
25691  */
25692 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25693
25694 /**
25695  * Fees charged when the channel is used for routing
25696  */
25697 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25698
25699 /**
25700  * Fees charged when the channel is used for routing
25701  */
25702 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
25703
25704 /**
25705  * Most recent update for the channel received from the network
25706  * Mostly redundant with the data we store in fields explicitly.
25707  * Everything else is useful only for sending out for initial routing sync.
25708  * Not stored if contains excess data to prevent DoS.
25709  *
25710  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25711  */
25712 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
25713
25714 /**
25715  * Most recent update for the channel received from the network
25716  * Mostly redundant with the data we store in fields explicitly.
25717  * Everything else is useful only for sending out for initial routing sync.
25718  * Not stored if contains excess data to prevent DoS.
25719  *
25720  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25721  */
25722 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
25723
25724 /**
25725  * Constructs a new ChannelUpdateInfo given each field
25726  */
25727 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);
25728
25729 /**
25730  * Creates a copy of the ChannelUpdateInfo
25731  */
25732 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
25733
25734 /**
25735  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
25736  */
25737 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
25738
25739 /**
25740  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
25741  */
25742 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
25743
25744 /**
25745  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
25746  */
25747 void ChannelInfo_free(struct LDKChannelInfo this_obj);
25748
25749 /**
25750  * Protocol features of a channel communicated during its announcement
25751  */
25752 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25753
25754 /**
25755  * Protocol features of a channel communicated during its announcement
25756  */
25757 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
25758
25759 /**
25760  * Source node of the first direction of a channel
25761  */
25762 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25763
25764 /**
25765  * Source node of the first direction of a channel
25766  */
25767 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
25768
25769 /**
25770  * Details about the first direction of a channel
25771  *
25772  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25773  */
25774 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25775
25776 /**
25777  * Details about the first direction of a channel
25778  *
25779  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25780  */
25781 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
25782
25783 /**
25784  * Source node of the second direction of a channel
25785  */
25786 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25787
25788 /**
25789  * Source node of the second direction of a channel
25790  */
25791 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
25792
25793 /**
25794  * Details about the second direction of a channel
25795  *
25796  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25797  */
25798 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25799
25800 /**
25801  * Details about the second direction of a channel
25802  *
25803  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25804  */
25805 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
25806
25807 /**
25808  * The channel capacity as seen on-chain, if chain lookup is available.
25809  */
25810 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25811
25812 /**
25813  * The channel capacity as seen on-chain, if chain lookup is available.
25814  */
25815 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
25816
25817 /**
25818  * An initial announcement of the channel
25819  * Mostly redundant with the data we store in fields explicitly.
25820  * Everything else is useful only for sending out for initial routing sync.
25821  * Not stored if contains excess data to prevent DoS.
25822  *
25823  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25824  */
25825 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
25826
25827 /**
25828  * An initial announcement of the channel
25829  * Mostly redundant with the data we store in fields explicitly.
25830  * Everything else is useful only for sending out for initial routing sync.
25831  * Not stored if contains excess data to prevent DoS.
25832  *
25833  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
25834  */
25835 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
25836
25837 /**
25838  * Creates a copy of the ChannelInfo
25839  */
25840 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
25841
25842 /**
25843  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
25844  *
25845  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25846  */
25847 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
25848
25849 /**
25850  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
25851  */
25852 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
25853
25854 /**
25855  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
25856  */
25857 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
25858
25859 /**
25860  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
25861  */
25862 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
25863
25864 /**
25865  * Creates a copy of the DirectedChannelInfo
25866  */
25867 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
25868
25869 /**
25870  * Returns information for the channel.
25871  */
25872 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25873
25874 /**
25875  * Returns information for the direction.
25876  *
25877  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
25878  */
25879 MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25880
25881 /**
25882  * Returns the maximum HTLC amount allowed over the channel in the direction.
25883  */
25884 MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25885
25886 /**
25887  * Returns the [`EffectiveCapacity`] of the channel in the direction.
25888  *
25889  * This is either the total capacity from the funding transaction, if known, or the
25890  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
25891  * otherwise.
25892  */
25893 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
25894
25895 /**
25896  * Frees any resources used by the EffectiveCapacity
25897  */
25898 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
25899
25900 /**
25901  * Creates a copy of the EffectiveCapacity
25902  */
25903 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
25904
25905 /**
25906  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
25907  */
25908 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
25909
25910 /**
25911  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
25912  */
25913 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
25914
25915 /**
25916  * Utility method to constructs a new Total-variant EffectiveCapacity
25917  */
25918 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat);
25919
25920 /**
25921  * Utility method to constructs a new Infinite-variant EffectiveCapacity
25922  */
25923 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
25924
25925 /**
25926  * Utility method to constructs a new Unknown-variant EffectiveCapacity
25927  */
25928 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
25929
25930 /**
25931  * Returns the effective capacity denominated in millisatoshi.
25932  */
25933 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
25934
25935 /**
25936  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
25937  */
25938 void RoutingFees_free(struct LDKRoutingFees this_obj);
25939
25940 /**
25941  * Flat routing fee in satoshis
25942  */
25943 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
25944
25945 /**
25946  * Flat routing fee in satoshis
25947  */
25948 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
25949
25950 /**
25951  * Liquidity-based routing fee in millionths of a routed amount.
25952  * In other words, 10000 is 1%.
25953  */
25954 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
25955
25956 /**
25957  * Liquidity-based routing fee in millionths of a routed amount.
25958  * In other words, 10000 is 1%.
25959  */
25960 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
25961
25962 /**
25963  * Constructs a new RoutingFees given each field
25964  */
25965 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
25966
25967 /**
25968  * Checks if two RoutingFeess contain equal inner contents.
25969  * This ignores pointers and is_owned flags and looks at the values in fields.
25970  * Two objects with NULL inner values will be considered "equal" here.
25971  */
25972 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
25973
25974 /**
25975  * Creates a copy of the RoutingFees
25976  */
25977 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
25978
25979 /**
25980  * Checks if two RoutingFeess contain equal inner contents.
25981  */
25982 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
25983
25984 /**
25985  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
25986  */
25987 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
25988
25989 /**
25990  * Read a RoutingFees from a byte array, created by RoutingFees_write
25991  */
25992 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
25993
25994 /**
25995  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
25996  */
25997 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
25998
25999 /**
26000  * Protocol features the node announced support for
26001  */
26002 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26003
26004 /**
26005  * Protocol features the node announced support for
26006  */
26007 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
26008
26009 /**
26010  * When the last known update to the node state was issued.
26011  * Value is opaque, as set in the announcement.
26012  */
26013 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26014
26015 /**
26016  * When the last known update to the node state was issued.
26017  * Value is opaque, as set in the announcement.
26018  */
26019 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
26020
26021 /**
26022  * Color assigned to the node
26023  */
26024 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
26025
26026 /**
26027  * Color assigned to the node
26028  */
26029 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
26030
26031 /**
26032  * Moniker assigned to the node.
26033  * May be invalid or malicious (eg control chars),
26034  * should not be exposed to the user.
26035  */
26036 const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32];
26037
26038 /**
26039  * Moniker assigned to the node.
26040  * May be invalid or malicious (eg control chars),
26041  * should not be exposed to the user.
26042  */
26043 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26044
26045 /**
26046  * Internet-level addresses via which one can connect to the node
26047  */
26048 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
26049
26050 /**
26051  * An initial announcement of the node
26052  * Mostly redundant with the data we store in fields explicitly.
26053  * Everything else is useful only for sending out for initial routing sync.
26054  * Not stored if contains excess data to prevent DoS.
26055  *
26056  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26057  */
26058 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26059
26060 /**
26061  * An initial announcement of the node
26062  * Mostly redundant with the data we store in fields explicitly.
26063  * Everything else is useful only for sending out for initial routing sync.
26064  * Not stored if contains excess data to prevent DoS.
26065  *
26066  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26067  */
26068 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
26069
26070 /**
26071  * Constructs a new NodeAnnouncementInfo given each field
26072  */
26073 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);
26074
26075 /**
26076  * Creates a copy of the NodeAnnouncementInfo
26077  */
26078 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
26079
26080 /**
26081  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
26082  */
26083 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
26084
26085 /**
26086  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
26087  */
26088 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
26089
26090 /**
26091  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
26092  */
26093 void NodeInfo_free(struct LDKNodeInfo this_obj);
26094
26095 /**
26096  * All valid channels a node has announced
26097  */
26098 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
26099
26100 /**
26101  * Lowest fees enabling routing via any of the enabled, known channels to a node.
26102  * The two fields (flat and proportional fee) are independent,
26103  * meaning they don't have to refer to the same channel.
26104  *
26105  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26106  */
26107 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
26108
26109 /**
26110  * Lowest fees enabling routing via any of the enabled, known channels to a node.
26111  * The two fields (flat and proportional fee) are independent,
26112  * meaning they don't have to refer to the same channel.
26113  *
26114  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26115  */
26116 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
26117
26118 /**
26119  * More information about a node from node_announcement.
26120  * Optional because we store a Node entry after learning about it from
26121  * a channel announcement, but before receiving a node announcement.
26122  *
26123  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26124  */
26125 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
26126
26127 /**
26128  * More information about a node from node_announcement.
26129  * Optional because we store a Node entry after learning about it from
26130  * a channel announcement, but before receiving a node announcement.
26131  *
26132  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26133  */
26134 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
26135
26136 /**
26137  * Constructs a new NodeInfo given each field
26138  */
26139 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
26140
26141 /**
26142  * Creates a copy of the NodeInfo
26143  */
26144 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
26145
26146 /**
26147  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
26148  */
26149 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
26150
26151 /**
26152  * Read a NodeInfo from a byte array, created by NodeInfo_write
26153  */
26154 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
26155
26156 /**
26157  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
26158  */
26159 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
26160
26161 /**
26162  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
26163  */
26164 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
26165
26166 /**
26167  * Creates a new, empty, network graph.
26168  */
26169 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger);
26170
26171 /**
26172  * Returns a read-only view of the network graph.
26173  */
26174 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26175
26176 /**
26177  * The unix timestamp provided by the most recent rapid gossip sync.
26178  * It will be set by the rapid sync process after every sync completion.
26179  */
26180 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26181
26182 /**
26183  * Update the unix timestamp provided by the most recent rapid gossip sync.
26184  * This should be done automatically by the rapid sync process after every sync completion.
26185  */
26186 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
26187
26188 /**
26189  * For an already known node (from channel announcements), update its stored properties from a
26190  * given node announcement.
26191  *
26192  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26193  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26194  * routing messages from a source using a protocol other than the lightning P2P protocol.
26195  */
26196 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
26197
26198 /**
26199  * For an already known node (from channel announcements), update its stored properties from a
26200  * given node announcement without verifying the associated signatures. Because we aren't
26201  * given the associated signatures here we cannot relay the node announcement to any of our
26202  * peers.
26203  */
26204 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);
26205
26206 /**
26207  * Store or update channel info from a channel announcement.
26208  *
26209  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26210  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26211  * routing messages from a source using a protocol other than the lightning P2P protocol.
26212  *
26213  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
26214  * the corresponding UTXO exists on chain and is correctly-formatted.
26215  */
26216 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);
26217
26218 /**
26219  * Store or update channel info from a channel announcement without verifying the associated
26220  * signatures. Because we aren't given the associated signatures here we cannot relay the
26221  * channel announcement to any of our peers.
26222  *
26223  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
26224  * the corresponding UTXO exists on chain and is correctly-formatted.
26225  */
26226 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);
26227
26228 /**
26229  * Update channel from partial announcement data received via rapid gossip sync
26230  *
26231  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
26232  * rapid gossip sync server)
26233  *
26234  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
26235  */
26236 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);
26237
26238 /**
26239  * Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
26240  * If permanent, removes a channel from the local storage.
26241  * May cause the removal of nodes too, if this was their last channel.
26242  * If not permanent, makes channels unavailable for routing.
26243  */
26244 void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
26245
26246 /**
26247  * Marks a node in the graph as failed.
26248  */
26249 void NetworkGraph_node_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
26250
26251 /**
26252  * Removes information about channels that we haven't heard any updates about in some time.
26253  * This can be used regularly to prune the network graph of channels that likely no longer
26254  * exist.
26255  *
26256  * While there is no formal requirement that nodes regularly re-broadcast their channel
26257  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
26258  * pruning occur for updates which are at least two weeks old, which we implement here.
26259  *
26260  * Note that for users of the `lightning-background-processor` crate this method may be
26261  * automatically called regularly for you.
26262  *
26263  * This method is only available with the `std` feature. See
26264  * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
26265  */
26266 void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26267
26268 /**
26269  * Removes information about channels that we haven't heard any updates about in some time.
26270  * This can be used regularly to prune the network graph of channels that likely no longer
26271  * exist.
26272  *
26273  * While there is no formal requirement that nodes regularly re-broadcast their channel
26274  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
26275  * pruning occur for updates which are at least two weeks old, which we implement here.
26276  *
26277  * This function takes the current unix time as an argument. For users with the `std` feature
26278  * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
26279  */
26280 void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
26281
26282 /**
26283  * For an already known (from announcement) channel, update info about one of the directions
26284  * of the channel.
26285  *
26286  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26287  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26288  * routing messages from a source using a protocol other than the lightning P2P protocol.
26289  *
26290  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
26291  * materially in the future will be rejected.
26292  */
26293 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
26294
26295 /**
26296  * For an already known (from announcement) channel, update info about one of the directions
26297  * of the channel without verifying the associated signatures. Because we aren't given the
26298  * associated signatures here we cannot relay the channel update to any of our peers.
26299  *
26300  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
26301  * materially in the future will be rejected.
26302  */
26303 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
26304
26305 /**
26306  * Get network addresses by node id.
26307  * Returns None if the requested node is completely unknown,
26308  * or if node announcement for the node was never received.
26309  */
26310 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
26311
26312 /**
26313  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
26314  */
26315 void RouteHop_free(struct LDKRouteHop this_obj);
26316
26317 /**
26318  * The node_id of the node at this hop.
26319  */
26320 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26321
26322 /**
26323  * The node_id of the node at this hop.
26324  */
26325 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26326
26327 /**
26328  * The node_announcement features of the node at this hop. For the last hop, these may be
26329  * amended to match the features present in the invoice this node generated.
26330  */
26331 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26332
26333 /**
26334  * The node_announcement features of the node at this hop. For the last hop, these may be
26335  * amended to match the features present in the invoice this node generated.
26336  */
26337 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
26338
26339 /**
26340  * The channel that should be used from the previous hop to reach this node.
26341  */
26342 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26343
26344 /**
26345  * The channel that should be used from the previous hop to reach this node.
26346  */
26347 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
26348
26349 /**
26350  * The channel_announcement features of the channel that should be used from the previous hop
26351  * to reach this node.
26352  */
26353 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26354
26355 /**
26356  * The channel_announcement features of the channel that should be used from the previous hop
26357  * to reach this node.
26358  */
26359 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
26360
26361 /**
26362  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
26363  * For the last hop, this should be the full value of the payment (might be more than
26364  * requested if we had to match htlc_minimum_msat).
26365  */
26366 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26367
26368 /**
26369  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
26370  * For the last hop, this should be the full value of the payment (might be more than
26371  * requested if we had to match htlc_minimum_msat).
26372  */
26373 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
26374
26375 /**
26376  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
26377  * expected at the destination, in excess of the current block height.
26378  */
26379 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
26380
26381 /**
26382  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
26383  * expected at the destination, in excess of the current block height.
26384  */
26385 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
26386
26387 /**
26388  * Constructs a new RouteHop given each field
26389  */
26390 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);
26391
26392 /**
26393  * Creates a copy of the RouteHop
26394  */
26395 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
26396
26397 /**
26398  * Checks if two RouteHops contain equal inner contents.
26399  */
26400 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
26401
26402 /**
26403  * Checks if two RouteHops contain equal inner contents.
26404  * This ignores pointers and is_owned flags and looks at the values in fields.
26405  * Two objects with NULL inner values will be considered "equal" here.
26406  */
26407 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
26408
26409 /**
26410  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
26411  */
26412 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
26413
26414 /**
26415  * Read a RouteHop from a byte array, created by RouteHop_write
26416  */
26417 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
26418
26419 /**
26420  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
26421  */
26422 void Route_free(struct LDKRoute this_obj);
26423
26424 /**
26425  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
26426  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
26427  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
26428  * least length one. While the maximum length of any given path is variable, keeping the length
26429  * of any path less or equal to 19 should currently ensure it is viable.
26430  */
26431 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
26432
26433 /**
26434  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
26435  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
26436  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
26437  * least length one. While the maximum length of any given path is variable, keeping the length
26438  * of any path less or equal to 19 should currently ensure it is viable.
26439  */
26440 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
26441
26442 /**
26443  * The `payment_params` parameter passed to [`find_route`].
26444  * This is used by `ChannelManager` to track information which may be required for retries,
26445  * provided back to you via [`Event::PaymentPathFailed`].
26446  *
26447  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
26448  *
26449  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26450  */
26451 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
26452
26453 /**
26454  * The `payment_params` parameter passed to [`find_route`].
26455  * This is used by `ChannelManager` to track information which may be required for retries,
26456  * provided back to you via [`Event::PaymentPathFailed`].
26457  *
26458  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
26459  *
26460  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26461  */
26462 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
26463
26464 /**
26465  * Constructs a new Route given each field
26466  */
26467 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
26468
26469 /**
26470  * Creates a copy of the Route
26471  */
26472 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
26473
26474 /**
26475  * Checks if two Routes contain equal inner contents.
26476  */
26477 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
26478
26479 /**
26480  * Checks if two Routes contain equal inner contents.
26481  * This ignores pointers and is_owned flags and looks at the values in fields.
26482  * Two objects with NULL inner values will be considered "equal" here.
26483  */
26484 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
26485
26486 /**
26487  * Returns the total amount of fees paid on this [`Route`].
26488  *
26489  * This doesn't include any extra payment made to the recipient, which can happen in excess of
26490  * the amount passed to [`find_route`]'s `params.final_value_msat`.
26491  */
26492 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
26493
26494 /**
26495  * Returns the total amount paid on this [`Route`], excluding the fees.
26496  */
26497 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
26498
26499 /**
26500  * Serialize the Route object into a byte array which can be read by Route_read
26501  */
26502 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
26503
26504 /**
26505  * Read a Route from a byte array, created by Route_write
26506  */
26507 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
26508
26509 /**
26510  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
26511  */
26512 void RouteParameters_free(struct LDKRouteParameters this_obj);
26513
26514 /**
26515  * The parameters of the failed payment path.
26516  */
26517 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
26518
26519 /**
26520  * The parameters of the failed payment path.
26521  */
26522 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
26523
26524 /**
26525  * The amount in msats sent on the failed payment path.
26526  */
26527 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
26528
26529 /**
26530  * The amount in msats sent on the failed payment path.
26531  */
26532 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
26533
26534 /**
26535  * The CLTV on the final hop of the failed payment path.
26536  */
26537 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
26538
26539 /**
26540  * The CLTV on the final hop of the failed payment path.
26541  */
26542 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
26543
26544 /**
26545  * Constructs a new RouteParameters given each field
26546  */
26547 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);
26548
26549 /**
26550  * Creates a copy of the RouteParameters
26551  */
26552 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
26553
26554 /**
26555  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
26556  */
26557 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
26558
26559 /**
26560  * Read a RouteParameters from a byte array, created by RouteParameters_write
26561  */
26562 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
26563
26564 /**
26565  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
26566  */
26567 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
26568
26569 /**
26570  * The node id of the payee.
26571  */
26572 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26573
26574 /**
26575  * The node id of the payee.
26576  */
26577 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26578
26579 /**
26580  * Features supported by the payee.
26581  *
26582  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
26583  * does not contain any features.
26584  *
26585  * [`for_keysend`]: Self::for_keysend
26586  *
26587  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26588  */
26589 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26590
26591 /**
26592  * Features supported by the payee.
26593  *
26594  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
26595  * does not contain any features.
26596  *
26597  * [`for_keysend`]: Self::for_keysend
26598  *
26599  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26600  */
26601 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
26602
26603 /**
26604  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
26605  */
26606 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26607
26608 /**
26609  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
26610  */
26611 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
26612
26613 /**
26614  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
26615  */
26616 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26617
26618 /**
26619  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
26620  */
26621 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26622
26623 /**
26624  * The maximum total CLTV delta we accept for the route.
26625  */
26626 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
26627
26628 /**
26629  * The maximum total CLTV delta we accept for the route.
26630  */
26631 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
26632
26633 /**
26634  * Constructs a new PaymentParameters given each field
26635  */
26636 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);
26637
26638 /**
26639  * Creates a copy of the PaymentParameters
26640  */
26641 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
26642
26643 /**
26644  * Checks if two PaymentParameterss contain equal inner contents.
26645  */
26646 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
26647
26648 /**
26649  * Checks if two PaymentParameterss contain equal inner contents.
26650  * This ignores pointers and is_owned flags and looks at the values in fields.
26651  * Two objects with NULL inner values will be considered "equal" here.
26652  */
26653 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
26654
26655 /**
26656  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
26657  */
26658 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
26659
26660 /**
26661  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
26662  */
26663 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
26664
26665 /**
26666  * Creates a payee with the node id of the given `pubkey`.
26667  */
26668 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
26669
26670 /**
26671  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
26672  */
26673 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
26674
26675 /**
26676  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
26677  */
26678 void RouteHint_free(struct LDKRouteHint this_obj);
26679
26680 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
26681
26682 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
26683
26684 /**
26685  * Constructs a new RouteHint given each field
26686  */
26687 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
26688
26689 /**
26690  * Creates a copy of the RouteHint
26691  */
26692 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
26693
26694 /**
26695  * Checks if two RouteHints contain equal inner contents.
26696  */
26697 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
26698
26699 /**
26700  * Checks if two RouteHints contain equal inner contents.
26701  * This ignores pointers and is_owned flags and looks at the values in fields.
26702  * Two objects with NULL inner values will be considered "equal" here.
26703  */
26704 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
26705
26706 /**
26707  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
26708  */
26709 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
26710
26711 /**
26712  * Read a RouteHint from a byte array, created by RouteHint_write
26713  */
26714 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
26715
26716 /**
26717  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
26718  */
26719 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
26720
26721 /**
26722  * The node_id of the non-target end of the route
26723  */
26724 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26725
26726 /**
26727  * The node_id of the non-target end of the route
26728  */
26729 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
26730
26731 /**
26732  * The short_channel_id of this channel
26733  */
26734 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26735
26736 /**
26737  * The short_channel_id of this channel
26738  */
26739 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
26740
26741 /**
26742  * The fees which must be paid to use this channel
26743  */
26744 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26745
26746 /**
26747  * The fees which must be paid to use this channel
26748  */
26749 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
26750
26751 /**
26752  * The difference in CLTV values between this node and the next node.
26753  */
26754 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26755
26756 /**
26757  * The difference in CLTV values between this node and the next node.
26758  */
26759 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
26760
26761 /**
26762  * The minimum value, in msat, which must be relayed to the next hop.
26763  */
26764 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26765
26766 /**
26767  * The minimum value, in msat, which must be relayed to the next hop.
26768  */
26769 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26770
26771 /**
26772  * The maximum value in msat available for routing with a single HTLC.
26773  */
26774 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
26775
26776 /**
26777  * The maximum value in msat available for routing with a single HTLC.
26778  */
26779 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26780
26781 /**
26782  * Constructs a new RouteHintHop given each field
26783  */
26784 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);
26785
26786 /**
26787  * Creates a copy of the RouteHintHop
26788  */
26789 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
26790
26791 /**
26792  * Checks if two RouteHintHops contain equal inner contents.
26793  */
26794 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
26795
26796 /**
26797  * Checks if two RouteHintHops contain equal inner contents.
26798  * This ignores pointers and is_owned flags and looks at the values in fields.
26799  * Two objects with NULL inner values will be considered "equal" here.
26800  */
26801 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
26802
26803 /**
26804  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
26805  */
26806 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
26807
26808 /**
26809  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
26810  */
26811 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
26812
26813 /**
26814  * Finds a route from us (payer) to the given target node (payee).
26815  *
26816  * If the payee provided features in their invoice, they should be provided via `params.payee`.
26817  * Without this, MPP will only be used if the payee's features are available in the network graph.
26818  *
26819  * Private routing paths between a public node and the target may be included in `params.payee`.
26820  *
26821  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
26822  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
26823  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
26824  *
26825  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
26826  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
26827  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
26828  *
26829  * # Note
26830  *
26831  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
26832  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
26833  * function.
26834  *
26835  * # Panics
26836  *
26837  * Panics if first_hops contains channels without short_channel_ids;
26838  * [`ChannelManager::list_usable_channels`] will never include such channels.
26839  *
26840  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
26841  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
26842  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
26843  *
26844  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
26845  */
26846 struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]);
26847
26848 /**
26849  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
26850  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
26851  *
26852  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
26853  */
26854 struct LDKCResult_RouteLightningErrorZ build_route_from_hops(struct LDKPublicKey our_node_pubkey, struct LDKCVec_PublicKeyZ hops, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]);
26855
26856 /**
26857  * Calls the free function if one is set
26858  */
26859 void Score_free(struct LDKScore this_ptr);
26860
26861 /**
26862  * Calls the free function if one is set
26863  */
26864 void LockableScore_free(struct LDKLockableScore this_ptr);
26865
26866 /**
26867  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
26868  */
26869 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
26870
26871 /**
26872  * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
26873  */
26874 struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
26875
26876 /**
26877  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
26878  */
26879 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
26880
26881 /**
26882  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
26883  */
26884 void ChannelUsage_free(struct LDKChannelUsage this_obj);
26885
26886 /**
26887  * The amount to send through the channel, denominated in millisatoshis.
26888  */
26889 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
26890
26891 /**
26892  * The amount to send through the channel, denominated in millisatoshis.
26893  */
26894 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
26895
26896 /**
26897  * Total amount, denominated in millisatoshis, already allocated to send through the channel
26898  * as part of a multi-path payment.
26899  */
26900 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
26901
26902 /**
26903  * Total amount, denominated in millisatoshis, already allocated to send through the channel
26904  * as part of a multi-path payment.
26905  */
26906 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
26907
26908 /**
26909  * The effective capacity of the channel.
26910  */
26911 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
26912
26913 /**
26914  * The effective capacity of the channel.
26915  */
26916 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
26917
26918 /**
26919  * Constructs a new ChannelUsage given each field
26920  */
26921 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
26922
26923 /**
26924  * Creates a copy of the ChannelUsage
26925  */
26926 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
26927
26928 /**
26929  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
26930  */
26931 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
26932
26933 /**
26934  * Creates a copy of the FixedPenaltyScorer
26935  */
26936 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
26937
26938 /**
26939  * Creates a new scorer using `penalty_msat`.
26940  */
26941 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
26942
26943 /**
26944  * Constructs a new Score which calls the relevant methods on this_arg.
26945  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
26946  */
26947 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
26948
26949 /**
26950  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
26951  */
26952 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
26953
26954 /**
26955  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
26956  */
26957 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
26958
26959 /**
26960  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
26961  */
26962 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
26963
26964 /**
26965  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
26966  */
26967 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
26968
26969 /**
26970  * A fixed penalty in msats to apply to each channel.
26971  *
26972  * Default value: 500 msat
26973  */
26974 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
26975
26976 /**
26977  * A fixed penalty in msats to apply to each channel.
26978  *
26979  * Default value: 500 msat
26980  */
26981 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
26982
26983 /**
26984  * A multiplier used in conjunction with the negative `log10` of the channel's success
26985  * probability for a payment to determine the liquidity penalty.
26986  *
26987  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
26988  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
26989  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
26990  * lower bounding the success probability to `0.01`) when the amount falls within the
26991  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
26992  * result in a `u64::max_value` penalty, however.
26993  *
26994  * Default value: 40,000 msat
26995  *
26996  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
26997  */
26998 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
26999
27000 /**
27001  * A multiplier used in conjunction with the negative `log10` of the channel's success
27002  * probability for a payment to determine the liquidity penalty.
27003  *
27004  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
27005  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
27006  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
27007  * lower bounding the success probability to `0.01`) when the amount falls within the
27008  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
27009  * result in a `u64::max_value` penalty, however.
27010  *
27011  * Default value: 40,000 msat
27012  *
27013  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
27014  */
27015 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27016
27017 /**
27018  * The time required to elapse before any knowledge learned about channel liquidity balances is
27019  * cut in half.
27020  *
27021  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
27022  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
27023  * the certainty of the channel liquidity balance.
27024  *
27025  * Default value: 1 hour
27026  *
27027  * # Note
27028  *
27029  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
27030  * liquidity knowledge will never decay except when the bounds cross.
27031  */
27032 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27033
27034 /**
27035  * The time required to elapse before any knowledge learned about channel liquidity balances is
27036  * cut in half.
27037  *
27038  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
27039  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
27040  * the certainty of the channel liquidity balance.
27041  *
27042  * Default value: 1 hour
27043  *
27044  * # Note
27045  *
27046  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
27047  * liquidity knowledge will never decay except when the bounds cross.
27048  */
27049 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27050
27051 /**
27052  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
27053  * channel's success probability for the payment to determine the amount penalty.
27054  *
27055  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
27056  * fees plus penalty) for large payments. The penalty is computed as the product of this
27057  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
27058  * success probability.
27059  *
27060  * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
27061  *
27062  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
27063  * the amount will result in a penalty of the multiplier. And, as the success probability
27064  * decreases, the negative `log10` weighting will increase dramatically. For higher success
27065  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
27066  * fall below `1`.
27067  *
27068  * Default value: 256 msat
27069  */
27070 uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27071
27072 /**
27073  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
27074  * channel's success probability for the payment to determine the amount penalty.
27075  *
27076  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
27077  * fees plus penalty) for large payments. The penalty is computed as the product of this
27078  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
27079  * success probability.
27080  *
27081  * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20`
27082  *
27083  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
27084  * the amount will result in a penalty of the multiplier. And, as the success probability
27085  * decreases, the negative `log10` weighting will increase dramatically. For higher success
27086  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
27087  * fall below `1`.
27088  *
27089  * Default value: 256 msat
27090  */
27091 void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27092
27093 /**
27094  * Constructs a new ProbabilisticScoringParameters given each field
27095  */
27096 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);
27097
27098 /**
27099  * Creates a copy of the ProbabilisticScoringParameters
27100  */
27101 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
27102
27103 /**
27104  * Creates a new scorer using the given scoring parameters for sending payments from a node
27105  * through a network graph.
27106  */
27107 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
27108
27109 /**
27110  * Dump the contents of this scorer into the configured logger.
27111  *
27112  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
27113  * which may be a substantial amount of log output.
27114  */
27115 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
27116
27117 /**
27118  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
27119  */
27120 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
27121
27122 /**
27123  * Constructs a new Score which calls the relevant methods on this_arg.
27124  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
27125  */
27126 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
27127
27128 /**
27129  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
27130  */
27131 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
27132
27133 /**
27134  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
27135  */
27136 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
27137
27138 /**
27139  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
27140  */
27141 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
27142
27143 /**
27144  * Initialize a new FilesystemPersister and set the path to the individual channels'
27145  * files.
27146  */
27147 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
27148
27149 /**
27150  * Get the directory which was provided when this persister was initialized.
27151  */
27152 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
27153
27154 /**
27155  * Read `ChannelMonitor`s from disk.
27156  */
27157 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
27158
27159 /**
27160  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
27161  */
27162 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
27163
27164 /**
27165  * Frees any resources used by the GossipSync
27166  */
27167 void GossipSync_free(struct LDKGossipSync this_ptr);
27168
27169 /**
27170  * Utility method to constructs a new P2P-variant GossipSync
27171  */
27172 struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
27173
27174 /**
27175  * Utility method to constructs a new Rapid-variant GossipSync
27176  */
27177 struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
27178
27179 /**
27180  * Utility method to constructs a new None-variant GossipSync
27181  */
27182 struct LDKGossipSync GossipSync_none(void);
27183
27184 /**
27185  * Start a background thread that takes care of responsibilities enumerated in the [top-level
27186  * documentation].
27187  *
27188  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
27189  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
27190  * either [`join`] or [`stop`].
27191  *
27192  * # Data Persistence
27193  *
27194  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
27195  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
27196  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
27197  * provided implementation.
27198  *
27199  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
27200  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
27201  * See the `lightning-persister` crate for LDK's provided implementation.
27202  *
27203  * Typically, users should either implement [`Persister::persist_manager`] to never return an
27204  * error or call [`join`] and handle any error that may arise. For the latter case,
27205  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
27206  *
27207  * # Event Handling
27208  *
27209  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
27210  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
27211  * functionality implemented by other handlers.
27212  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
27213  *
27214  * # Rapid Gossip Sync
27215  *
27216  * If rapid gossip sync is meant to run at startup, pass a [`RapidGossipSync`] to `gossip_sync`
27217  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
27218  * until the [`RapidGossipSync`] instance completes its first sync.
27219  *
27220  * [top-level documentation]: BackgroundProcessor
27221  * [`join`]: Self::join
27222  * [`stop`]: Self::stop
27223  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
27224  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
27225  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
27226  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
27227  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
27228  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
27229  *
27230  * Note that scorer (or a relevant inner pointer) may be NULL or all-0s to represent None
27231  */
27232 MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger, struct LDKMultiThreadedLockableScore scorer);
27233
27234 /**
27235  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
27236  * [`ChannelManager`].
27237  *
27238  * # Panics
27239  *
27240  * This function panics if the background thread has panicked such as while persisting or
27241  * handling events.
27242  *
27243  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
27244  */
27245 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
27246
27247 /**
27248  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
27249  * [`ChannelManager`].
27250  *
27251  * # Panics
27252  *
27253  * This function panics if the background thread has panicked such as while persisting or
27254  * handling events.
27255  *
27256  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
27257  */
27258 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
27259
27260 /**
27261  * Frees any resources used by the ParseError
27262  */
27263 void ParseError_free(struct LDKParseError this_ptr);
27264
27265 /**
27266  * Creates a copy of the ParseError
27267  */
27268 struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
27269
27270 /**
27271  * Utility method to constructs a new Bech32Error-variant ParseError
27272  */
27273 struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
27274
27275 /**
27276  * Utility method to constructs a new ParseAmountError-variant ParseError
27277  */
27278 struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
27279
27280 /**
27281  * Utility method to constructs a new MalformedSignature-variant ParseError
27282  */
27283 struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
27284
27285 /**
27286  * Utility method to constructs a new BadPrefix-variant ParseError
27287  */
27288 struct LDKParseError ParseError_bad_prefix(void);
27289
27290 /**
27291  * Utility method to constructs a new UnknownCurrency-variant ParseError
27292  */
27293 struct LDKParseError ParseError_unknown_currency(void);
27294
27295 /**
27296  * Utility method to constructs a new UnknownSiPrefix-variant ParseError
27297  */
27298 struct LDKParseError ParseError_unknown_si_prefix(void);
27299
27300 /**
27301  * Utility method to constructs a new MalformedHRP-variant ParseError
27302  */
27303 struct LDKParseError ParseError_malformed_hrp(void);
27304
27305 /**
27306  * Utility method to constructs a new TooShortDataPart-variant ParseError
27307  */
27308 struct LDKParseError ParseError_too_short_data_part(void);
27309
27310 /**
27311  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
27312  */
27313 struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
27314
27315 /**
27316  * Utility method to constructs a new DescriptionDecodeError-variant ParseError
27317  */
27318 struct LDKParseError ParseError_description_decode_error(struct LDKError a);
27319
27320 /**
27321  * Utility method to constructs a new PaddingError-variant ParseError
27322  */
27323 struct LDKParseError ParseError_padding_error(void);
27324
27325 /**
27326  * Utility method to constructs a new IntegerOverflowError-variant ParseError
27327  */
27328 struct LDKParseError ParseError_integer_overflow_error(void);
27329
27330 /**
27331  * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
27332  */
27333 struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
27334
27335 /**
27336  * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
27337  */
27338 struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
27339
27340 /**
27341  * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
27342  */
27343 struct LDKParseError ParseError_invalid_script_hash_length(void);
27344
27345 /**
27346  * Utility method to constructs a new InvalidRecoveryId-variant ParseError
27347  */
27348 struct LDKParseError ParseError_invalid_recovery_id(void);
27349
27350 /**
27351  * Utility method to constructs a new InvalidSliceLength-variant ParseError
27352  */
27353 struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
27354
27355 /**
27356  * Utility method to constructs a new Skip-variant ParseError
27357  */
27358 struct LDKParseError ParseError_skip(void);
27359
27360 /**
27361  * Frees any resources used by the ParseOrSemanticError
27362  */
27363 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
27364
27365 /**
27366  * Creates a copy of the ParseOrSemanticError
27367  */
27368 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
27369
27370 /**
27371  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
27372  */
27373 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
27374
27375 /**
27376  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
27377  */
27378 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
27379
27380 /**
27381  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
27382  */
27383 void Invoice_free(struct LDKInvoice this_obj);
27384
27385 /**
27386  * Checks if two Invoices contain equal inner contents.
27387  * This ignores pointers and is_owned flags and looks at the values in fields.
27388  * Two objects with NULL inner values will be considered "equal" here.
27389  */
27390 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
27391
27392 /**
27393  * Creates a copy of the Invoice
27394  */
27395 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
27396
27397 /**
27398  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
27399  */
27400 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
27401
27402 /**
27403  * Checks if two SignedRawInvoices contain equal inner contents.
27404  * This ignores pointers and is_owned flags and looks at the values in fields.
27405  * Two objects with NULL inner values will be considered "equal" here.
27406  */
27407 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
27408
27409 /**
27410  * Creates a copy of the SignedRawInvoice
27411  */
27412 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
27413
27414 /**
27415  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
27416  */
27417 void RawInvoice_free(struct LDKRawInvoice this_obj);
27418
27419 /**
27420  * data part
27421  */
27422 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
27423
27424 /**
27425  * data part
27426  */
27427 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
27428
27429 /**
27430  * Checks if two RawInvoices contain equal inner contents.
27431  * This ignores pointers and is_owned flags and looks at the values in fields.
27432  * Two objects with NULL inner values will be considered "equal" here.
27433  */
27434 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
27435
27436 /**
27437  * Creates a copy of the RawInvoice
27438  */
27439 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
27440
27441 /**
27442  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
27443  */
27444 void RawDataPart_free(struct LDKRawDataPart this_obj);
27445
27446 /**
27447  * generation time of the invoice
27448  */
27449 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
27450
27451 /**
27452  * generation time of the invoice
27453  */
27454 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
27455
27456 /**
27457  * Checks if two RawDataParts contain equal inner contents.
27458  * This ignores pointers and is_owned flags and looks at the values in fields.
27459  * Two objects with NULL inner values will be considered "equal" here.
27460  */
27461 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
27462
27463 /**
27464  * Creates a copy of the RawDataPart
27465  */
27466 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
27467
27468 /**
27469  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
27470  */
27471 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
27472
27473 /**
27474  * Checks if two PositiveTimestamps contain equal inner contents.
27475  * This ignores pointers and is_owned flags and looks at the values in fields.
27476  * Two objects with NULL inner values will be considered "equal" here.
27477  */
27478 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
27479
27480 /**
27481  * Creates a copy of the PositiveTimestamp
27482  */
27483 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
27484
27485 /**
27486  * Creates a copy of the SiPrefix
27487  */
27488 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
27489
27490 /**
27491  * Utility method to constructs a new Milli-variant SiPrefix
27492  */
27493 enum LDKSiPrefix SiPrefix_milli(void);
27494
27495 /**
27496  * Utility method to constructs a new Micro-variant SiPrefix
27497  */
27498 enum LDKSiPrefix SiPrefix_micro(void);
27499
27500 /**
27501  * Utility method to constructs a new Nano-variant SiPrefix
27502  */
27503 enum LDKSiPrefix SiPrefix_nano(void);
27504
27505 /**
27506  * Utility method to constructs a new Pico-variant SiPrefix
27507  */
27508 enum LDKSiPrefix SiPrefix_pico(void);
27509
27510 /**
27511  * Checks if two SiPrefixs contain equal inner contents.
27512  * This ignores pointers and is_owned flags and looks at the values in fields.
27513  */
27514 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
27515
27516 /**
27517  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
27518  * This is effectively 10^12 * the prefix multiplier
27519  */
27520 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
27521
27522 /**
27523  * Creates a copy of the Currency
27524  */
27525 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
27526
27527 /**
27528  * Utility method to constructs a new Bitcoin-variant Currency
27529  */
27530 enum LDKCurrency Currency_bitcoin(void);
27531
27532 /**
27533  * Utility method to constructs a new BitcoinTestnet-variant Currency
27534  */
27535 enum LDKCurrency Currency_bitcoin_testnet(void);
27536
27537 /**
27538  * Utility method to constructs a new Regtest-variant Currency
27539  */
27540 enum LDKCurrency Currency_regtest(void);
27541
27542 /**
27543  * Utility method to constructs a new Simnet-variant Currency
27544  */
27545 enum LDKCurrency Currency_simnet(void);
27546
27547 /**
27548  * Utility method to constructs a new Signet-variant Currency
27549  */
27550 enum LDKCurrency Currency_signet(void);
27551
27552 /**
27553  * Checks if two Currencys contain equal inner contents.
27554  */
27555 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
27556
27557 /**
27558  * Checks if two Currencys contain equal inner contents.
27559  * This ignores pointers and is_owned flags and looks at the values in fields.
27560  */
27561 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
27562
27563 /**
27564  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
27565  */
27566 void Sha256_free(struct LDKSha256 this_obj);
27567
27568 /**
27569  * Creates a copy of the Sha256
27570  */
27571 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
27572
27573 /**
27574  * Checks if two Sha256s contain equal inner contents.
27575  */
27576 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
27577
27578 /**
27579  * Checks if two Sha256s contain equal inner contents.
27580  * This ignores pointers and is_owned flags and looks at the values in fields.
27581  * Two objects with NULL inner values will be considered "equal" here.
27582  */
27583 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
27584
27585 /**
27586  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
27587  */
27588 void Description_free(struct LDKDescription this_obj);
27589
27590 /**
27591  * Creates a copy of the Description
27592  */
27593 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
27594
27595 /**
27596  * Checks if two Descriptions contain equal inner contents.
27597  */
27598 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
27599
27600 /**
27601  * Checks if two Descriptions contain equal inner contents.
27602  * This ignores pointers and is_owned flags and looks at the values in fields.
27603  * Two objects with NULL inner values will be considered "equal" here.
27604  */
27605 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
27606
27607 /**
27608  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
27609  */
27610 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
27611
27612 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
27613
27614 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27615
27616 /**
27617  * Constructs a new PayeePubKey given each field
27618  */
27619 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
27620
27621 /**
27622  * Creates a copy of the PayeePubKey
27623  */
27624 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
27625
27626 /**
27627  * Checks if two PayeePubKeys contain equal inner contents.
27628  */
27629 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
27630
27631 /**
27632  * Checks if two PayeePubKeys contain equal inner contents.
27633  * This ignores pointers and is_owned flags and looks at the values in fields.
27634  * Two objects with NULL inner values will be considered "equal" here.
27635  */
27636 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
27637
27638 /**
27639  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
27640  */
27641 void ExpiryTime_free(struct LDKExpiryTime this_obj);
27642
27643 /**
27644  * Creates a copy of the ExpiryTime
27645  */
27646 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
27647
27648 /**
27649  * Checks if two ExpiryTimes contain equal inner contents.
27650  */
27651 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
27652
27653 /**
27654  * Checks if two ExpiryTimes contain equal inner contents.
27655  * This ignores pointers and is_owned flags and looks at the values in fields.
27656  * Two objects with NULL inner values will be considered "equal" here.
27657  */
27658 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
27659
27660 /**
27661  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
27662  */
27663 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
27664
27665 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
27666
27667 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
27668
27669 /**
27670  * Constructs a new MinFinalCltvExpiry given each field
27671  */
27672 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
27673
27674 /**
27675  * Creates a copy of the MinFinalCltvExpiry
27676  */
27677 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
27678
27679 /**
27680  * Checks if two MinFinalCltvExpirys contain equal inner contents.
27681  */
27682 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
27683
27684 /**
27685  * Checks if two MinFinalCltvExpirys contain equal inner contents.
27686  * This ignores pointers and is_owned flags and looks at the values in fields.
27687  * Two objects with NULL inner values will be considered "equal" here.
27688  */
27689 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
27690
27691 /**
27692  * Frees any resources used by the Fallback
27693  */
27694 void Fallback_free(struct LDKFallback this_ptr);
27695
27696 /**
27697  * Creates a copy of the Fallback
27698  */
27699 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
27700
27701 /**
27702  * Utility method to constructs a new SegWitProgram-variant Fallback
27703  */
27704 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
27705
27706 /**
27707  * Utility method to constructs a new PubKeyHash-variant Fallback
27708  */
27709 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
27710
27711 /**
27712  * Utility method to constructs a new ScriptHash-variant Fallback
27713  */
27714 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
27715
27716 /**
27717  * Checks if two Fallbacks contain equal inner contents.
27718  */
27719 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
27720
27721 /**
27722  * Checks if two Fallbacks contain equal inner contents.
27723  * This ignores pointers and is_owned flags and looks at the values in fields.
27724  */
27725 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
27726
27727 /**
27728  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
27729  */
27730 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
27731
27732 /**
27733  * Creates a copy of the InvoiceSignature
27734  */
27735 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
27736
27737 /**
27738  * Checks if two InvoiceSignatures contain equal inner contents.
27739  * This ignores pointers and is_owned flags and looks at the values in fields.
27740  * Two objects with NULL inner values will be considered "equal" here.
27741  */
27742 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
27743
27744 /**
27745  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
27746  */
27747 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
27748
27749 /**
27750  * Creates a copy of the PrivateRoute
27751  */
27752 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
27753
27754 /**
27755  * Checks if two PrivateRoutes contain equal inner contents.
27756  */
27757 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
27758
27759 /**
27760  * Checks if two PrivateRoutes contain equal inner contents.
27761  * This ignores pointers and is_owned flags and looks at the values in fields.
27762  * Two objects with NULL inner values will be considered "equal" here.
27763  */
27764 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
27765
27766 /**
27767  * Disassembles the `SignedRawInvoice` into its three parts:
27768  *  1. raw invoice
27769  *  2. hash of the raw invoice
27770  *  3. signature
27771  */
27772 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
27773
27774 /**
27775  * The `RawInvoice` which was signed.
27776  */
27777 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27778
27779 /**
27780  * The hash of the `RawInvoice` that was signed.
27781  */
27782 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
27783
27784 /**
27785  * InvoiceSignature for the invoice.
27786  */
27787 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27788
27789 /**
27790  * Recovers the public key used for signing the invoice from the recoverable signature.
27791  */
27792 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27793
27794 /**
27795  * Checks if the signature is valid for the included payee public key or if none exists if it's
27796  * valid for the recovered signature (which should always be true?).
27797  */
27798 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
27799
27800 /**
27801  * Calculate the hash of the encoded `RawInvoice`
27802  */
27803 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27804
27805 /**
27806  *
27807  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27808  */
27809 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27810
27811 /**
27812  *
27813  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27814  */
27815 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27816
27817 /**
27818  *
27819  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27820  */
27821 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27822
27823 /**
27824  *
27825  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27826  */
27827 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27828
27829 /**
27830  *
27831  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27832  */
27833 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27834
27835 /**
27836  *
27837  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27838  */
27839 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27840
27841 /**
27842  *
27843  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27844  */
27845 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27846
27847 /**
27848  *
27849  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27850  */
27851 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27852
27853 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27854
27855 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27856
27857 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
27858
27859 /**
27860  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
27861  *
27862  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
27863  */
27864 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
27865
27866 /**
27867  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
27868  * the range `0..=MAX_TIMESTAMP`.
27869  *
27870  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
27871  */
27872 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
27873
27874 /**
27875  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
27876  * `0..=MAX_TIMESTAMP`.
27877  *
27878  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
27879  */
27880 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
27881
27882 /**
27883  * Returns the Unix timestamp representing the stored time
27884  */
27885 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
27886
27887 /**
27888  * Returns the duration of the stored time since the Unix epoch
27889  */
27890 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
27891
27892 /**
27893  * Returns the [`SystemTime`] representing the stored time
27894  */
27895 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
27896
27897 /**
27898  * Transform the `Invoice` into it's unchecked version
27899  */
27900 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
27901
27902 /**
27903  * Check that the invoice is signed correctly and that key recovery works
27904  */
27905 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
27906
27907 /**
27908  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
27909  * ```
27910  * use lightning_invoice::*;
27911  *
27912  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
27913  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
27914  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
27915  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
27916  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
27917  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
27918  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
27919  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
27920  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
27921  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
27922  * j5r6drg6k6zcqj0fcwg\";
27923  *
27924  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
27925  *
27926  * assert!(Invoice::from_signed(signed).is_ok());
27927  * ```
27928  */
27929 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
27930
27931 /**
27932  * Returns the `Invoice`'s timestamp (should equal its creation time)
27933  */
27934 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
27935
27936 /**
27937  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
27938  */
27939 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
27940
27941 /**
27942  * Returns the hash to which we will receive the preimage on completion of the payment
27943  */
27944 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
27945
27946 /**
27947  * Get the payee's public key if one was included in the invoice
27948  *
27949  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27950  */
27951 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
27952
27953 /**
27954  * Get the payment secret if one was included in the invoice
27955  */
27956 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
27957
27958 /**
27959  * Get the invoice features if they were included in the invoice
27960  *
27961  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27962  */
27963 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
27964
27965 /**
27966  * Recover the payee's public key (only to be used if none was included in the invoice)
27967  */
27968 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
27969
27970 /**
27971  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
27972  */
27973 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
27974
27975 /**
27976  * Returns whether the invoice has expired.
27977  */
27978 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
27979
27980 /**
27981  * Returns whether the expiry time would pass at the given point in time.
27982  * `at_time` is the timestamp as a duration since the Unix epoch.
27983  */
27984 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
27985
27986 /**
27987  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
27988  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
27989  */
27990 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
27991
27992 /**
27993  * Returns a list of all routes included in the invoice
27994  */
27995 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
27996
27997 /**
27998  * Returns a list of all routes included in the invoice as the underlying hints
27999  */
28000 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
28001
28002 /**
28003  * Returns the currency for which the invoice was issued
28004  */
28005 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
28006
28007 /**
28008  * Returns the amount if specified in the invoice as millisatoshis.
28009  */
28010 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
28011
28012 /**
28013  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
28014  * returns `CreationError::DescriptionTooLong` otherwise
28015  *
28016  * Please note that single characters may use more than one byte due to UTF8 encoding.
28017  */
28018 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
28019
28020 /**
28021  * Returns the underlying description `String`
28022  */
28023 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
28024
28025 /**
28026  * Construct an `ExpiryTime` from seconds.
28027  */
28028 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
28029
28030 /**
28031  * Construct an `ExpiryTime` from a `Duration`.
28032  */
28033 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
28034
28035 /**
28036  * Returns the expiry time in seconds
28037  */
28038 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
28039
28040 /**
28041  * Returns a reference to the underlying `Duration` (=expiry time)
28042  */
28043 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
28044
28045 /**
28046  * Creates a new (partial) route from a list of hops
28047  */
28048 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
28049
28050 /**
28051  * Returns the underlying list of hops
28052  */
28053 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
28054
28055 /**
28056  * Creates a copy of the CreationError
28057  */
28058 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
28059
28060 /**
28061  * Utility method to constructs a new DescriptionTooLong-variant CreationError
28062  */
28063 enum LDKCreationError CreationError_description_too_long(void);
28064
28065 /**
28066  * Utility method to constructs a new RouteTooLong-variant CreationError
28067  */
28068 enum LDKCreationError CreationError_route_too_long(void);
28069
28070 /**
28071  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
28072  */
28073 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
28074
28075 /**
28076  * Utility method to constructs a new InvalidAmount-variant CreationError
28077  */
28078 enum LDKCreationError CreationError_invalid_amount(void);
28079
28080 /**
28081  * Utility method to constructs a new MissingRouteHints-variant CreationError
28082  */
28083 enum LDKCreationError CreationError_missing_route_hints(void);
28084
28085 /**
28086  * Checks if two CreationErrors contain equal inner contents.
28087  * This ignores pointers and is_owned flags and looks at the values in fields.
28088  */
28089 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
28090
28091 /**
28092  * Get the string representation of a CreationError object
28093  */
28094 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
28095
28096 /**
28097  * Creates a copy of the SemanticError
28098  */
28099 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
28100
28101 /**
28102  * Utility method to constructs a new NoPaymentHash-variant SemanticError
28103  */
28104 enum LDKSemanticError SemanticError_no_payment_hash(void);
28105
28106 /**
28107  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
28108  */
28109 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
28110
28111 /**
28112  * Utility method to constructs a new NoDescription-variant SemanticError
28113  */
28114 enum LDKSemanticError SemanticError_no_description(void);
28115
28116 /**
28117  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
28118  */
28119 enum LDKSemanticError SemanticError_multiple_descriptions(void);
28120
28121 /**
28122  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
28123  */
28124 enum LDKSemanticError SemanticError_no_payment_secret(void);
28125
28126 /**
28127  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
28128  */
28129 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
28130
28131 /**
28132  * Utility method to constructs a new InvalidFeatures-variant SemanticError
28133  */
28134 enum LDKSemanticError SemanticError_invalid_features(void);
28135
28136 /**
28137  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
28138  */
28139 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
28140
28141 /**
28142  * Utility method to constructs a new InvalidSignature-variant SemanticError
28143  */
28144 enum LDKSemanticError SemanticError_invalid_signature(void);
28145
28146 /**
28147  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
28148  */
28149 enum LDKSemanticError SemanticError_imprecise_amount(void);
28150
28151 /**
28152  * Checks if two SemanticErrors contain equal inner contents.
28153  * This ignores pointers and is_owned flags and looks at the values in fields.
28154  */
28155 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
28156
28157 /**
28158  * Get the string representation of a SemanticError object
28159  */
28160 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
28161
28162 /**
28163  * Frees any resources used by the SignOrCreationError
28164  */
28165 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
28166
28167 /**
28168  * Creates a copy of the SignOrCreationError
28169  */
28170 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
28171
28172 /**
28173  * Utility method to constructs a new SignError-variant SignOrCreationError
28174  */
28175 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
28176
28177 /**
28178  * Utility method to constructs a new CreationError-variant SignOrCreationError
28179  */
28180 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
28181
28182 /**
28183  * Checks if two SignOrCreationErrors contain equal inner contents.
28184  * This ignores pointers and is_owned flags and looks at the values in fields.
28185  */
28186 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
28187
28188 /**
28189  * Get the string representation of a SignOrCreationError object
28190  */
28191 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
28192
28193 /**
28194  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
28195  */
28196 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
28197
28198 /**
28199  * Calls the free function if one is set
28200  */
28201 void Payer_free(struct LDKPayer this_ptr);
28202
28203 /**
28204  * Calls the free function if one is set
28205  */
28206 void Router_free(struct LDKRouter this_ptr);
28207
28208 /**
28209  * Frees any resources used by the Retry
28210  */
28211 void Retry_free(struct LDKRetry this_ptr);
28212
28213 /**
28214  * Creates a copy of the Retry
28215  */
28216 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
28217
28218 /**
28219  * Utility method to constructs a new Attempts-variant Retry
28220  */
28221 struct LDKRetry Retry_attempts(uintptr_t a);
28222
28223 /**
28224  * Utility method to constructs a new Timeout-variant Retry
28225  */
28226 struct LDKRetry Retry_timeout(uint64_t a);
28227
28228 /**
28229  * Checks if two Retrys contain equal inner contents.
28230  * This ignores pointers and is_owned flags and looks at the values in fields.
28231  */
28232 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
28233
28234 /**
28235  * Checks if two Retrys contain equal inner contents.
28236  */
28237 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
28238
28239 /**
28240  * Frees any resources used by the PaymentError
28241  */
28242 void PaymentError_free(struct LDKPaymentError this_ptr);
28243
28244 /**
28245  * Creates a copy of the PaymentError
28246  */
28247 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
28248
28249 /**
28250  * Utility method to constructs a new Invoice-variant PaymentError
28251  */
28252 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
28253
28254 /**
28255  * Utility method to constructs a new Routing-variant PaymentError
28256  */
28257 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
28258
28259 /**
28260  * Utility method to constructs a new Sending-variant PaymentError
28261  */
28262 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
28263
28264 /**
28265  * Creates an invoice payer that retries failed payment paths.
28266  *
28267  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
28268  * `retry` has been exceeded for a given [`Invoice`].
28269  */
28270 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);
28271
28272 /**
28273  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
28274  *
28275  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
28276  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
28277  * for you.
28278  */
28279 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
28280
28281 /**
28282  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
28283  * case a retry is needed.
28284  *
28285  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
28286  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
28287  * for you.
28288  */
28289 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);
28290
28291 /**
28292  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
28293  * case a retry is needed.
28294  *
28295  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
28296  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
28297  */
28298 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);
28299
28300 /**
28301  * Removes the payment cached by the given payment hash.
28302  *
28303  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
28304  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
28305  */
28306 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
28307
28308 /**
28309  * Constructs a new EventHandler which calls the relevant methods on this_arg.
28310  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
28311  */
28312 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
28313
28314 /**
28315  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
28316  * See [`PhantomKeysManager`] for more information on phantom node payments.
28317  *
28318  * `phantom_route_hints` parameter:
28319  * * Contains channel info for all nodes participating in the phantom invoice
28320  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
28321  *   participating node
28322  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
28323  *   updated when a channel becomes disabled or closes
28324  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
28325  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
28326  *   down
28327  *
28328  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
28329  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
28330  * If `None` is provided for `payment_hash`, then one will be created.
28331  *
28332  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28333  * in excess of the current time.
28334  *
28335  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
28336  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
28337  * requirement).
28338  *
28339  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
28340  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
28341  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
28342  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
28343  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
28344  *
28345  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
28346  */
28347 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);
28348
28349 /**
28350  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
28351  * See [`PhantomKeysManager`] for more information on phantom node payments.
28352  *
28353  * `phantom_route_hints` parameter:
28354  * * Contains channel info for all nodes participating in the phantom invoice
28355  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
28356  *   participating node
28357  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
28358  *   updated when a channel becomes disabled or closes
28359  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
28360  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
28361  *   down
28362  *
28363  * `description_hash` is a SHA-256 hash of the description text
28364  *
28365  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
28366  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
28367  * If `None` is provided for `payment_hash`, then one will be created.
28368  *
28369  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28370  * in excess of the current time.
28371  *
28372  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
28373  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
28374  * requirement).
28375  *
28376  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
28377  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
28378  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
28379  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
28380  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
28381  *
28382  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
28383  */
28384 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);
28385
28386 /**
28387  * Utility to construct an invoice. Generally, unless you want to do something like a custom
28388  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
28389  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
28390  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
28391  * that the payment secret is valid when the invoice is paid.
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 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);
28397
28398 /**
28399  * Utility to construct an invoice. Generally, unless you want to do something like a custom
28400  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
28401  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
28402  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
28403  * that the payment secret is valid when the invoice is paid.
28404  * Use this variant if you want to pass the `description_hash` to the invoice.
28405  *
28406  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
28407  * in excess of the current time.
28408  */
28409 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);
28410
28411 /**
28412  * See [`create_invoice_from_channelmanager_with_description_hash`]
28413  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
28414  * available and the current time is supplied by the caller.
28415  */
28416 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);
28417
28418 /**
28419  * See [`create_invoice_from_channelmanager`]
28420  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
28421  * available and the current time is supplied by the caller.
28422  */
28423 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);
28424
28425 /**
28426  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
28427  */
28428 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
28429
28430 /**
28431  * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source
28432  * `random_seed_bytes`.
28433  */
28434 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes);
28435
28436 /**
28437  * Constructs a new Router which calls the relevant methods on this_arg.
28438  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
28439  */
28440 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
28441
28442 /**
28443  * Constructs a new Payer which calls the relevant methods on this_arg.
28444  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
28445  */
28446 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
28447
28448 /**
28449  * Read a SiPrefix object from a string
28450  */
28451 struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
28452
28453 /**
28454  * Read a Invoice object from a string
28455  */
28456 struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
28457
28458 /**
28459  * Read a SignedRawInvoice object from a string
28460  */
28461 struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
28462
28463 /**
28464  * Get the string representation of a ParseError object
28465  */
28466 struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
28467
28468 /**
28469  * Get the string representation of a ParseOrSemanticError object
28470  */
28471 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
28472
28473 /**
28474  * Get the string representation of a Invoice object
28475  */
28476 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
28477
28478 /**
28479  * Get the string representation of a SignedRawInvoice object
28480  */
28481 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
28482
28483 /**
28484  * Get the string representation of a Currency object
28485  */
28486 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
28487
28488 /**
28489  * Get the string representation of a SiPrefix object
28490  */
28491 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
28492
28493 /**
28494  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
28495  */
28496 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
28497
28498 /**
28499  * Instantiate a new [`RapidGossipSync`] instance
28500  */
28501 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph);
28502
28503 /**
28504  * Sync gossip data from a file
28505  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
28506  *
28507  * `network_graph`: The network graph to apply the updates to
28508  *
28509  * `sync_path`: Path to the file where the gossip update data is located
28510  *
28511  */
28512 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path);
28513
28514 /**
28515  * Returns whether a rapid gossip sync has completed at least once
28516  */
28517 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
28518
28519 /**
28520  * Frees any resources used by the GraphSyncError
28521  */
28522 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
28523
28524 /**
28525  * Creates a copy of the GraphSyncError
28526  */
28527 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
28528
28529 /**
28530  * Utility method to constructs a new DecodeError-variant GraphSyncError
28531  */
28532 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
28533
28534 /**
28535  * Utility method to constructs a new LightningError-variant GraphSyncError
28536  */
28537 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
28538
28539 /**
28540  * Update network graph from binary data.
28541  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
28542  *
28543  * `network_graph`: network graph to be updated
28544  *
28545  * `update_data`: `&[u8]` binary stream that comprises the update data
28546  */
28547 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
28548
28549 #endif /* LDK_C_BINDINGS_H */
28550
28551 #include "ldk_ver.h"