Update auto-generated bindings to LDK 0.0.110
[ldk-c-bindings] / lightning-c-bindings / include / lightning.h
1 #ifndef LDK_C_BINDINGS_H
2 #define LDK_C_BINDINGS_H
3
4 /* Generated with cbindgen:0.24.3 */
5
6 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
7
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11 #include "ldk_rust_types.h"
12
13 /**
14  * An error when accessing the chain via [`Access`].
15  */
16 typedef enum LDKAccessError {
17    /**
18     * The requested chain is unknown.
19     */
20    LDKAccessError_UnknownChain,
21    /**
22     * The requested transaction doesn't exist or hasn't confirmed.
23     */
24    LDKAccessError_UnknownTx,
25    /**
26     * Must be last for serialization purposes
27     */
28    LDKAccessError_Sentinel,
29 } LDKAccessError;
30
31 /**
32  * An enum which can either contain a  or not
33  */
34 typedef enum LDKCOption_NoneZ {
35    /**
36     * When we're in this state, this COption_NoneZ contains a
37     */
38    LDKCOption_NoneZ_Some,
39    /**
40     * When we're in this state, this COption_NoneZ contains nothing
41     */
42    LDKCOption_NoneZ_None,
43    /**
44     * Must be last for serialization purposes
45     */
46    LDKCOption_NoneZ_Sentinel,
47 } LDKCOption_NoneZ;
48
49 /**
50  * An error enum representing a failure to persist a channel monitor update.
51  */
52 typedef enum LDKChannelMonitorUpdateErr {
53    /**
54     * Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
55     * our state failed, but is expected to succeed at some point in the future).
56     *
57     * Such a failure will \"freeze\" a channel, preventing us from revoking old states or
58     * submitting new commitment transactions to the counterparty. Once the update(s) that failed
59     * have been successfully applied, a [`MonitorEvent::UpdateCompleted`] event should be returned
60     * via [`Watch::release_pending_monitor_events`] which will then restore the channel to an
61     * operational state.
62     *
63     * Note that a given ChannelManager will *never* re-generate a given ChannelMonitorUpdate. If
64     * you return a TemporaryFailure you must ensure that it is written to disk safely before
65     * writing out the latest ChannelManager state.
66     *
67     * Even when a channel has been \"frozen\" updates to the ChannelMonitor can continue to occur
68     * (eg if an inbound HTLC which we forwarded was claimed upstream resulting in us attempting
69     * to claim it on this channel) and those updates must be applied wherever they can be. At
70     * least one such updated ChannelMonitor must be persisted otherwise PermanentFailure should
71     * be returned to get things on-chain ASAP using only the in-memory copy. Obviously updates to
72     * the channel which would invalidate previous ChannelMonitors are not made when a channel has
73     * been \"frozen\".
74     *
75     * Note that even if updates made after TemporaryFailure succeed you must still provide a
76     * [`MonitorEvent::UpdateCompleted`] to ensure you have the latest monitor and re-enable
77     * normal channel operation. Note that this is normally generated through a call to
78     * [`ChainMonitor::channel_monitor_updated`].
79     *
80     * Note that the update being processed here will not be replayed for you when you return a
81     * [`MonitorEvent::UpdateCompleted`] event via [`Watch::release_pending_monitor_events`], so
82     * you must store the update itself on your own local disk prior to returning a
83     * TemporaryFailure. You may, of course, employ a journaling approach, storing only the
84     * ChannelMonitorUpdate on disk without updating the monitor itself, replaying the journal at
85     * reload-time.
86     *
87     * For deployments where a copy of ChannelMonitors and other local state are backed up in a
88     * remote location (with local copies persisted immediately), it is anticipated that all
89     * updates will return TemporaryFailure until the remote copies could be updated.
90     *
91     * [`ChainMonitor::channel_monitor_updated`]: chainmonitor::ChainMonitor::channel_monitor_updated
92     */
93    LDKChannelMonitorUpdateErr_TemporaryFailure,
94    /**
95     * Used to indicate no further channel monitor updates will be allowed (eg we've moved on to a
96     * different watchtower and cannot update with all watchtowers that were previously informed
97     * of this channel).
98     *
99     * At reception of this error, ChannelManager will force-close the channel and return at
100     * least a final ChannelMonitorUpdate::ChannelForceClosed which must be delivered to at
101     * least one ChannelMonitor copy. Revocation secret MUST NOT be released and offchain channel
102     * update must be rejected.
103     *
104     * This failure may also signal a failure to update the local persisted copy of one of
105     * the channel monitor instance.
106     *
107     * Note that even when you fail a holder commitment transaction update, you must store the
108     * update to ensure you can claim from it in case of a duplicate copy of this ChannelMonitor
109     * broadcasts it (e.g distributed channel-monitor deployment)
110     *
111     * In case of distributed watchtowers deployment, the new version must be written to disk, as
112     * state may have been stored but rejected due to a block forcing a commitment broadcast. This
113     * storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
114     * lagging behind on block processing.
115     */
116    LDKChannelMonitorUpdateErr_PermanentFailure,
117    /**
118     * Must be last for serialization purposes
119     */
120    LDKChannelMonitorUpdateErr_Sentinel,
121 } LDKChannelMonitorUpdateErr;
122
123 /**
124  * An enum that represents the speed at which we want a transaction to confirm used for feerate
125  * estimation.
126  */
127 typedef enum LDKConfirmationTarget {
128    /**
129     * We are happy with this transaction confirming slowly when feerate drops some.
130     */
131    LDKConfirmationTarget_Background,
132    /**
133     * We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
134     */
135    LDKConfirmationTarget_Normal,
136    /**
137     * We'd like this transaction to confirm in the next few blocks.
138     */
139    LDKConfirmationTarget_HighPriority,
140    /**
141     * Must be last for serialization purposes
142     */
143    LDKConfirmationTarget_Sentinel,
144 } LDKConfirmationTarget;
145
146 /**
147  * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
148  */
149 typedef enum LDKCreationError {
150    /**
151     * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
152     */
153    LDKCreationError_DescriptionTooLong,
154    /**
155     * The specified route has too many hops and can't be encoded
156     */
157    LDKCreationError_RouteTooLong,
158    /**
159     * The Unix timestamp of the supplied date is less than zero or greater than 35-bits
160     */
161    LDKCreationError_TimestampOutOfBounds,
162    /**
163     * The supplied millisatoshi amount was greater than the total bitcoin supply.
164     */
165    LDKCreationError_InvalidAmount,
166    /**
167     * Route hints were required for this invoice and were missing. Applies to
168     * [phantom invoices].
169     *
170     * [phantom invoices]: crate::utils::create_phantom_invoice
171     */
172    LDKCreationError_MissingRouteHints,
173    /**
174     * Must be last for serialization purposes
175     */
176    LDKCreationError_Sentinel,
177 } LDKCreationError;
178
179 /**
180  * Enum representing the crypto currencies (or networks) supported by this library
181  */
182 typedef enum LDKCurrency {
183    /**
184     * Bitcoin mainnet
185     */
186    LDKCurrency_Bitcoin,
187    /**
188     * Bitcoin testnet
189     */
190    LDKCurrency_BitcoinTestnet,
191    /**
192     * Bitcoin regtest
193     */
194    LDKCurrency_Regtest,
195    /**
196     * Bitcoin simnet
197     */
198    LDKCurrency_Simnet,
199    /**
200     * Bitcoin signet
201     */
202    LDKCurrency_Signet,
203    /**
204     * Must be last for serialization purposes
205     */
206    LDKCurrency_Sentinel,
207 } LDKCurrency;
208
209 /**
210  * Represents an IO Error. Note that some information is lost in the conversion from Rust.
211  */
212 typedef enum LDKIOError {
213    LDKIOError_NotFound,
214    LDKIOError_PermissionDenied,
215    LDKIOError_ConnectionRefused,
216    LDKIOError_ConnectionReset,
217    LDKIOError_ConnectionAborted,
218    LDKIOError_NotConnected,
219    LDKIOError_AddrInUse,
220    LDKIOError_AddrNotAvailable,
221    LDKIOError_BrokenPipe,
222    LDKIOError_AlreadyExists,
223    LDKIOError_WouldBlock,
224    LDKIOError_InvalidInput,
225    LDKIOError_InvalidData,
226    LDKIOError_TimedOut,
227    LDKIOError_WriteZero,
228    LDKIOError_Interrupted,
229    LDKIOError_Other,
230    LDKIOError_UnexpectedEof,
231    /**
232     * Must be last for serialization purposes
233     */
234    LDKIOError_Sentinel,
235 } LDKIOError;
236
237 /**
238  * An enum representing the available verbosity levels of the logger.
239  */
240 typedef enum LDKLevel {
241    /**
242     * Designates extremely verbose information, including gossip-induced messages
243     */
244    LDKLevel_Gossip,
245    /**
246     * Designates very low priority, often extremely verbose, information
247     */
248    LDKLevel_Trace,
249    /**
250     * Designates lower priority information
251     */
252    LDKLevel_Debug,
253    /**
254     * Designates useful information
255     */
256    LDKLevel_Info,
257    /**
258     * Designates hazardous situations
259     */
260    LDKLevel_Warn,
261    /**
262     * Designates very serious errors
263     */
264    LDKLevel_Error,
265    /**
266     * Must be last for serialization purposes
267     */
268    LDKLevel_Sentinel,
269 } LDKLevel;
270
271 /**
272  * An enum representing the possible Bitcoin or test networks which we can run on
273  */
274 typedef enum LDKNetwork {
275    /**
276     * The main Bitcoin blockchain.
277     */
278    LDKNetwork_Bitcoin,
279    /**
280     * The testnet3 blockchain.
281     */
282    LDKNetwork_Testnet,
283    /**
284     * A local test blockchain.
285     */
286    LDKNetwork_Regtest,
287    /**
288     * A blockchain on which blocks are signed instead of mined.
289     */
290    LDKNetwork_Signet,
291    /**
292     * Must be last for serialization purposes
293     */
294    LDKNetwork_Sentinel,
295 } LDKNetwork;
296
297 /**
298  * Specifies the recipient of an invoice, to indicate to [`KeysInterface::sign_invoice`] what node
299  * secret key should be used to sign the invoice.
300  */
301 typedef enum LDKRecipient {
302    /**
303     * The invoice should be signed with the local node secret key.
304     */
305    LDKRecipient_Node,
306    /**
307     * The invoice should be signed with the phantom node secret key. This secret key must be the
308     * same for all nodes participating in the [phantom node payment].
309     *
310     * [phantom node payment]: PhantomKeysManager
311     */
312    LDKRecipient_PhantomNode,
313    /**
314     * Must be last for serialization purposes
315     */
316    LDKRecipient_Sentinel,
317 } LDKRecipient;
318
319 /**
320  * Represents an error returned from libsecp256k1 during validation of some secp256k1 data
321  */
322 typedef enum LDKSecp256k1Error {
323    /**
324     * Signature failed verification
325     */
326    LDKSecp256k1Error_IncorrectSignature,
327    /**
328     * Badly sized message ("messages" are actually fixed-sized digests; see the MESSAGE_SIZE constant)
329     */
330    LDKSecp256k1Error_InvalidMessage,
331    /**
332     * Bad public key
333     */
334    LDKSecp256k1Error_InvalidPublicKey,
335    /**
336     * Bad signature
337     */
338    LDKSecp256k1Error_InvalidSignature,
339    /**
340     * Bad secret key
341     */
342    LDKSecp256k1Error_InvalidSecretKey,
343    /**
344     * Bad shared secret.
345     */
346    LDKSecp256k1Error_InvalidSharedSecret,
347    /**
348     * Bad recovery id
349     */
350    LDKSecp256k1Error_InvalidRecoveryId,
351    /**
352     * Invalid tweak for add_assign or mul_assign
353     */
354    LDKSecp256k1Error_InvalidTweak,
355    /**
356     * Didn't pass enough memory to context creation with preallocated memory
357     */
358    LDKSecp256k1Error_NotEnoughMemory,
359    /**
360     * Bad set of public keys.
361     */
362    LDKSecp256k1Error_InvalidPublicKeySum,
363    /**
364     * The only valid parity values are 0 or 1.
365     */
366    LDKSecp256k1Error_InvalidParityValue,
367    /**
368     * Must be last for serialization purposes
369     */
370    LDKSecp256k1Error_Sentinel,
371 } LDKSecp256k1Error;
372
373 /**
374  * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
375  * requirements sections in BOLT #11
376  */
377 typedef enum LDKSemanticError {
378    /**
379     * The invoice is missing the mandatory payment hash
380     */
381    LDKSemanticError_NoPaymentHash,
382    /**
383     * The invoice has multiple payment hashes which isn't allowed
384     */
385    LDKSemanticError_MultiplePaymentHashes,
386    /**
387     * No description or description hash are part of the invoice
388     */
389    LDKSemanticError_NoDescription,
390    /**
391     * The invoice contains multiple descriptions and/or description hashes which isn't allowed
392     */
393    LDKSemanticError_MultipleDescriptions,
394    /**
395     * The invoice is missing the mandatory payment secret, which all modern lightning nodes
396     * should provide.
397     */
398    LDKSemanticError_NoPaymentSecret,
399    /**
400     * The invoice contains multiple payment secrets
401     */
402    LDKSemanticError_MultiplePaymentSecrets,
403    /**
404     * The invoice's features are invalid
405     */
406    LDKSemanticError_InvalidFeatures,
407    /**
408     * The recovery id doesn't fit the signature/pub key
409     */
410    LDKSemanticError_InvalidRecoveryId,
411    /**
412     * The invoice's signature is invalid
413     */
414    LDKSemanticError_InvalidSignature,
415    /**
416     * The invoice's amount was not a whole number of millisatoshis
417     */
418    LDKSemanticError_ImpreciseAmount,
419    /**
420     * Must be last for serialization purposes
421     */
422    LDKSemanticError_Sentinel,
423 } LDKSemanticError;
424
425 /**
426  * SI prefixes for the human readable part
427  */
428 typedef enum LDKSiPrefix {
429    /**
430     * 10^-3
431     */
432    LDKSiPrefix_Milli,
433    /**
434     * 10^-6
435     */
436    LDKSiPrefix_Micro,
437    /**
438     * 10^-9
439     */
440    LDKSiPrefix_Nano,
441    /**
442     * 10^-12
443     */
444    LDKSiPrefix_Pico,
445    /**
446     * Must be last for serialization purposes
447     */
448    LDKSiPrefix_Sentinel,
449 } LDKSiPrefix;
450
451 /**
452  * A Rust str object, ie a reference to a UTF8-valid string.
453  * This is *not* null-terminated so cannot be used directly as a C string!
454  */
455 typedef struct LDKStr {
456    /**
457     * A pointer to the string's bytes, in UTF8 encoding
458     */
459    const uint8_t *chars;
460    /**
461     * The number of bytes (not characters!) pointed to by `chars`
462     */
463    uintptr_t len;
464    /**
465     * Whether the data pointed to by `chars` should be freed or not.
466     */
467    bool chars_is_owned;
468 } LDKStr;
469
470 /**
471  * Represents an error returned from the bech32 library during validation of some bech32 data
472  */
473 typedef enum LDKBech32Error_Tag {
474    /**
475     * String does not contain the separator character
476     */
477    LDKBech32Error_MissingSeparator,
478    /**
479     * The checksum does not match the rest of the data
480     */
481    LDKBech32Error_InvalidChecksum,
482    /**
483     * The data or human-readable part is too long or too short
484     */
485    LDKBech32Error_InvalidLength,
486    /**
487     * Some part of the string contains an invalid character
488     */
489    LDKBech32Error_InvalidChar,
490    /**
491     * Some part of the data has an invalid value
492     */
493    LDKBech32Error_InvalidData,
494    /**
495     * The bit conversion failed due to a padding issue
496     */
497    LDKBech32Error_InvalidPadding,
498    /**
499     * The whole string must be of one case
500     */
501    LDKBech32Error_MixedCase,
502    /**
503     * Must be last for serialization purposes
504     */
505    LDKBech32Error_Sentinel,
506 } LDKBech32Error_Tag;
507
508 typedef struct LDKBech32Error {
509    LDKBech32Error_Tag tag;
510    union {
511       struct {
512          uint32_t invalid_char;
513       };
514       struct {
515          uint8_t invalid_data;
516       };
517    };
518 } LDKBech32Error;
519
520 /**
521  * A serialized transaction, in (pointer, length) form.
522  *
523  * This type optionally owns its own memory, and thus the semantics around access change based on
524  * the `data_is_owned` flag. If `data_is_owned` is set, you must call `Transaction_free` to free
525  * the underlying buffer before the object goes out of scope. If `data_is_owned` is not set, any
526  * access to the buffer after the scope in which the object was provided to you is invalid. eg,
527  * access after you return from the call in which a `!data_is_owned` `Transaction` is provided to
528  * you would be invalid.
529  *
530  * Note that, while it may change in the future, because transactions on the Rust side are stored
531  * in a deserialized form, all `Transaction`s generated on the Rust side will have `data_is_owned`
532  * set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have
533  * `data_is_owned` either set or unset at your discretion.
534  */
535 typedef struct LDKTransaction {
536    /**
537     * The serialized transaction data.
538     *
539     * This is non-const for your convenience, an object passed to Rust is never written to.
540     */
541    uint8_t *data;
542    /**
543     * The length of the serialized transaction
544     */
545    uintptr_t datalen;
546    /**
547     * Whether the data pointed to by `data` should be freed or not.
548     */
549    bool data_is_owned;
550 } LDKTransaction;
551
552 /**
553  * A dynamically-allocated array of u8s of arbitrary size.
554  * This corresponds to std::vector in C++
555  */
556 typedef struct LDKCVec_u8Z {
557    /**
558     * The elements in the array.
559     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
560     */
561    uint8_t *data;
562    /**
563     * The number of elements pointed to by `data`.
564     */
565    uintptr_t datalen;
566 } LDKCVec_u8Z;
567
568 /**
569  * A transaction output including a scriptPubKey and value.
570  * This type *does* own its own memory, so must be free'd appropriately.
571  */
572 typedef struct LDKTxOut {
573    /**
574     * The script_pubkey in this output
575     */
576    struct LDKCVec_u8Z script_pubkey;
577    /**
578     * The value, in satoshis, of this output
579     */
580    uint64_t value;
581 } LDKTxOut;
582
583 /**
584  * The contents of CResult_NoneNoneZ
585  */
586 typedef union LDKCResult_NoneNoneZPtr {
587    /**
588     * Note that this value is always NULL, as there are no contents in the OK variant
589     */
590    void *result;
591    /**
592     * Note that this value is always NULL, as there are no contents in the Err variant
593     */
594    void *err;
595 } LDKCResult_NoneNoneZPtr;
596
597 /**
598  * A CResult_NoneNoneZ represents the result of a fallible operation,
599  * containing a () on success and a () on failure.
600  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
601  */
602 typedef struct LDKCResult_NoneNoneZ {
603    /**
604     * The contents of this CResult_NoneNoneZ, accessible via either
605     * `err` or `result` depending on the state of `result_ok`.
606     */
607    union LDKCResult_NoneNoneZPtr contents;
608    /**
609     * Whether this CResult_NoneNoneZ represents a success state.
610     */
611    bool result_ok;
612 } LDKCResult_NoneNoneZ;
613
614
615
616 /**
617  * Implements the per-commitment secret storage scheme from
618  * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
619  *
620  * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
621  * or so.
622  */
623 typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
624    /**
625     * A pointer to the opaque Rust object.
626     * Nearly everywhere, inner must be non-null, however in places where
627     * the Rust equivalent takes an Option, it may be set to null to indicate None.
628     */
629    LDKnativeCounterpartyCommitmentSecrets *inner;
630    /**
631     * Indicates that this is the only struct which contains the same pointer.
632     * Rust functions which take ownership of an object provided via an argument require
633     * this to be true and invalidate the object pointed to by inner.
634     */
635    bool is_owned;
636 } LDKCounterpartyCommitmentSecrets;
637
638
639
640 /**
641  * An error in decoding a message or struct.
642  */
643 typedef struct MUST_USE_STRUCT LDKDecodeError {
644    /**
645     * A pointer to the opaque Rust object.
646     * Nearly everywhere, inner must be non-null, however in places where
647     * the Rust equivalent takes an Option, it may be set to null to indicate None.
648     */
649    LDKnativeDecodeError *inner;
650    /**
651     * Indicates that this is the only struct which contains the same pointer.
652     * Rust functions which take ownership of an object provided via an argument require
653     * this to be true and invalidate the object pointed to by inner.
654     */
655    bool is_owned;
656 } LDKDecodeError;
657
658 /**
659  * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
660  */
661 typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr {
662    /**
663     * A pointer to the contents in the success state.
664     * Reading from this pointer when `result_ok` is not set is undefined.
665     */
666    struct LDKCounterpartyCommitmentSecrets *result;
667    /**
668     * A pointer to the contents in the error state.
669     * Reading from this pointer when `result_ok` is set is undefined.
670     */
671    struct LDKDecodeError *err;
672 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr;
673
674 /**
675  * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation,
676  * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure.
677  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
678  */
679 typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ {
680    /**
681     * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either
682     * `err` or `result` depending on the state of `result_ok`.
683     */
684    union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents;
685    /**
686     * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state.
687     */
688    bool result_ok;
689 } LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ;
690
691 /**
692  * Represents a valid secp256k1 secret key serialized as a 32 byte array.
693  */
694 typedef struct LDKSecretKey {
695    /**
696     * The bytes of the secret key
697     */
698    uint8_t bytes[32];
699 } LDKSecretKey;
700
701 /**
702  * The contents of CResult_SecretKeyErrorZ
703  */
704 typedef union LDKCResult_SecretKeyErrorZPtr {
705    /**
706     * A pointer to the contents in the success state.
707     * Reading from this pointer when `result_ok` is not set is undefined.
708     */
709    struct LDKSecretKey *result;
710    /**
711     * A pointer to the contents in the error state.
712     * Reading from this pointer when `result_ok` is set is undefined.
713     */
714    enum LDKSecp256k1Error *err;
715 } LDKCResult_SecretKeyErrorZPtr;
716
717 /**
718  * A CResult_SecretKeyErrorZ represents the result of a fallible operation,
719  * containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure.
720  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
721  */
722 typedef struct LDKCResult_SecretKeyErrorZ {
723    /**
724     * The contents of this CResult_SecretKeyErrorZ, accessible via either
725     * `err` or `result` depending on the state of `result_ok`.
726     */
727    union LDKCResult_SecretKeyErrorZPtr contents;
728    /**
729     * Whether this CResult_SecretKeyErrorZ represents a success state.
730     */
731    bool result_ok;
732 } LDKCResult_SecretKeyErrorZ;
733
734 /**
735  * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
736  */
737 typedef struct LDKPublicKey {
738    /**
739     * The bytes of the public key
740     */
741    uint8_t compressed_form[33];
742 } LDKPublicKey;
743
744 /**
745  * The contents of CResult_PublicKeyErrorZ
746  */
747 typedef union LDKCResult_PublicKeyErrorZPtr {
748    /**
749     * A pointer to the contents in the success state.
750     * Reading from this pointer when `result_ok` is not set is undefined.
751     */
752    struct LDKPublicKey *result;
753    /**
754     * A pointer to the contents in the error state.
755     * Reading from this pointer when `result_ok` is set is undefined.
756     */
757    enum LDKSecp256k1Error *err;
758 } LDKCResult_PublicKeyErrorZPtr;
759
760 /**
761  * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
762  * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure.
763  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
764  */
765 typedef struct LDKCResult_PublicKeyErrorZ {
766    /**
767     * The contents of this CResult_PublicKeyErrorZ, accessible via either
768     * `err` or `result` depending on the state of `result_ok`.
769     */
770    union LDKCResult_PublicKeyErrorZPtr contents;
771    /**
772     * Whether this CResult_PublicKeyErrorZ represents a success state.
773     */
774    bool result_ok;
775 } LDKCResult_PublicKeyErrorZ;
776
777
778
779 /**
780  * The set of public keys which are used in the creation of one commitment transaction.
781  * These are derived from the channel base keys and per-commitment data.
782  *
783  * A broadcaster key is provided from potential broadcaster of the computed transaction.
784  * A countersignatory key is coming from a protocol participant unable to broadcast the
785  * transaction.
786  *
787  * These keys are assumed to be good, either because the code derived them from
788  * channel basepoints via the new function, or they were obtained via
789  * CommitmentTransaction.trust().keys() because we trusted the source of the
790  * pre-calculated keys.
791  */
792 typedef struct MUST_USE_STRUCT LDKTxCreationKeys {
793    /**
794     * A pointer to the opaque Rust object.
795     * Nearly everywhere, inner must be non-null, however in places where
796     * the Rust equivalent takes an Option, it may be set to null to indicate None.
797     */
798    LDKnativeTxCreationKeys *inner;
799    /**
800     * Indicates that this is the only struct which contains the same pointer.
801     * Rust functions which take ownership of an object provided via an argument require
802     * this to be true and invalidate the object pointed to by inner.
803     */
804    bool is_owned;
805 } LDKTxCreationKeys;
806
807 /**
808  * The contents of CResult_TxCreationKeysDecodeErrorZ
809  */
810 typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr {
811    /**
812     * A pointer to the contents in the success state.
813     * Reading from this pointer when `result_ok` is not set is undefined.
814     */
815    struct LDKTxCreationKeys *result;
816    /**
817     * A pointer to the contents in the error state.
818     * Reading from this pointer when `result_ok` is set is undefined.
819     */
820    struct LDKDecodeError *err;
821 } LDKCResult_TxCreationKeysDecodeErrorZPtr;
822
823 /**
824  * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation,
825  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
826  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
827  */
828 typedef struct LDKCResult_TxCreationKeysDecodeErrorZ {
829    /**
830     * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either
831     * `err` or `result` depending on the state of `result_ok`.
832     */
833    union LDKCResult_TxCreationKeysDecodeErrorZPtr contents;
834    /**
835     * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state.
836     */
837    bool result_ok;
838 } LDKCResult_TxCreationKeysDecodeErrorZ;
839
840
841
842 /**
843  * One counterparty's public keys which do not change over the life of a channel.
844  */
845 typedef struct MUST_USE_STRUCT LDKChannelPublicKeys {
846    /**
847     * A pointer to the opaque Rust object.
848     * Nearly everywhere, inner must be non-null, however in places where
849     * the Rust equivalent takes an Option, it may be set to null to indicate None.
850     */
851    LDKnativeChannelPublicKeys *inner;
852    /**
853     * Indicates that this is the only struct which contains the same pointer.
854     * Rust functions which take ownership of an object provided via an argument require
855     * this to be true and invalidate the object pointed to by inner.
856     */
857    bool is_owned;
858 } LDKChannelPublicKeys;
859
860 /**
861  * The contents of CResult_ChannelPublicKeysDecodeErrorZ
862  */
863 typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr {
864    /**
865     * A pointer to the contents in the success state.
866     * Reading from this pointer when `result_ok` is not set is undefined.
867     */
868    struct LDKChannelPublicKeys *result;
869    /**
870     * A pointer to the contents in the error state.
871     * Reading from this pointer when `result_ok` is set is undefined.
872     */
873    struct LDKDecodeError *err;
874 } LDKCResult_ChannelPublicKeysDecodeErrorZPtr;
875
876 /**
877  * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation,
878  * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure.
879  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
880  */
881 typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ {
882    /**
883     * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either
884     * `err` or `result` depending on the state of `result_ok`.
885     */
886    union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents;
887    /**
888     * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state.
889     */
890    bool result_ok;
891 } LDKCResult_ChannelPublicKeysDecodeErrorZ;
892
893 /**
894  * The contents of CResult_TxCreationKeysErrorZ
895  */
896 typedef union LDKCResult_TxCreationKeysErrorZPtr {
897    /**
898     * A pointer to the contents in the success state.
899     * Reading from this pointer when `result_ok` is not set is undefined.
900     */
901    struct LDKTxCreationKeys *result;
902    /**
903     * A pointer to the contents in the error state.
904     * Reading from this pointer when `result_ok` is set is undefined.
905     */
906    enum LDKSecp256k1Error *err;
907 } LDKCResult_TxCreationKeysErrorZPtr;
908
909 /**
910  * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation,
911  * containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure.
912  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
913  */
914 typedef struct LDKCResult_TxCreationKeysErrorZ {
915    /**
916     * The contents of this CResult_TxCreationKeysErrorZ, accessible via either
917     * `err` or `result` depending on the state of `result_ok`.
918     */
919    union LDKCResult_TxCreationKeysErrorZPtr contents;
920    /**
921     * Whether this CResult_TxCreationKeysErrorZ represents a success state.
922     */
923    bool result_ok;
924 } LDKCResult_TxCreationKeysErrorZ;
925
926 /**
927  * An enum which can either contain a u32 or not
928  */
929 typedef enum LDKCOption_u32Z_Tag {
930    /**
931     * When we're in this state, this COption_u32Z contains a u32
932     */
933    LDKCOption_u32Z_Some,
934    /**
935     * When we're in this state, this COption_u32Z contains nothing
936     */
937    LDKCOption_u32Z_None,
938    /**
939     * Must be last for serialization purposes
940     */
941    LDKCOption_u32Z_Sentinel,
942 } LDKCOption_u32Z_Tag;
943
944 typedef struct LDKCOption_u32Z {
945    LDKCOption_u32Z_Tag tag;
946    union {
947       struct {
948          uint32_t some;
949       };
950    };
951 } LDKCOption_u32Z;
952
953
954
955 /**
956  * Information about an HTLC as it appears in a commitment transaction
957  */
958 typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment {
959    /**
960     * A pointer to the opaque Rust object.
961     * Nearly everywhere, inner must be non-null, however in places where
962     * the Rust equivalent takes an Option, it may be set to null to indicate None.
963     */
964    LDKnativeHTLCOutputInCommitment *inner;
965    /**
966     * Indicates that this is the only struct which contains the same pointer.
967     * Rust functions which take ownership of an object provided via an argument require
968     * this to be true and invalidate the object pointed to by inner.
969     */
970    bool is_owned;
971 } LDKHTLCOutputInCommitment;
972
973 /**
974  * The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ
975  */
976 typedef union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr {
977    /**
978     * A pointer to the contents in the success state.
979     * Reading from this pointer when `result_ok` is not set is undefined.
980     */
981    struct LDKHTLCOutputInCommitment *result;
982    /**
983     * A pointer to the contents in the error state.
984     * Reading from this pointer when `result_ok` is set is undefined.
985     */
986    struct LDKDecodeError *err;
987 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr;
988
989 /**
990  * A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation,
991  * containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure.
992  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
993  */
994 typedef struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ {
995    /**
996     * The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either
997     * `err` or `result` depending on the state of `result_ok`.
998     */
999    union LDKCResult_HTLCOutputInCommitmentDecodeErrorZPtr contents;
1000    /**
1001     * Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state.
1002     */
1003    bool result_ok;
1004 } LDKCResult_HTLCOutputInCommitmentDecodeErrorZ;
1005
1006
1007
1008 /**
1009  * Late-bound per-channel counterparty data used to build transactions.
1010  */
1011 typedef struct MUST_USE_STRUCT LDKCounterpartyChannelTransactionParameters {
1012    /**
1013     * A pointer to the opaque Rust object.
1014     * Nearly everywhere, inner must be non-null, however in places where
1015     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1016     */
1017    LDKnativeCounterpartyChannelTransactionParameters *inner;
1018    /**
1019     * Indicates that this is the only struct which contains the same pointer.
1020     * Rust functions which take ownership of an object provided via an argument require
1021     * this to be true and invalidate the object pointed to by inner.
1022     */
1023    bool is_owned;
1024 } LDKCounterpartyChannelTransactionParameters;
1025
1026 /**
1027  * The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ
1028  */
1029 typedef union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr {
1030    /**
1031     * A pointer to the contents in the success state.
1032     * Reading from this pointer when `result_ok` is not set is undefined.
1033     */
1034    struct LDKCounterpartyChannelTransactionParameters *result;
1035    /**
1036     * A pointer to the contents in the error state.
1037     * Reading from this pointer when `result_ok` is set is undefined.
1038     */
1039    struct LDKDecodeError *err;
1040 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr;
1041
1042 /**
1043  * A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1044  * containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1045  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1046  */
1047 typedef struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
1048    /**
1049     * The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either
1050     * `err` or `result` depending on the state of `result_ok`.
1051     */
1052    union LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr contents;
1053    /**
1054     * Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state.
1055     */
1056    bool result_ok;
1057 } LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ;
1058
1059
1060
1061 /**
1062  * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
1063  * The fields are organized by holder/counterparty.
1064  *
1065  * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
1066  * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
1067  */
1068 typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters {
1069    /**
1070     * A pointer to the opaque Rust object.
1071     * Nearly everywhere, inner must be non-null, however in places where
1072     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1073     */
1074    LDKnativeChannelTransactionParameters *inner;
1075    /**
1076     * Indicates that this is the only struct which contains the same pointer.
1077     * Rust functions which take ownership of an object provided via an argument require
1078     * this to be true and invalidate the object pointed to by inner.
1079     */
1080    bool is_owned;
1081 } LDKChannelTransactionParameters;
1082
1083 /**
1084  * The contents of CResult_ChannelTransactionParametersDecodeErrorZ
1085  */
1086 typedef union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr {
1087    /**
1088     * A pointer to the contents in the success state.
1089     * Reading from this pointer when `result_ok` is not set is undefined.
1090     */
1091    struct LDKChannelTransactionParameters *result;
1092    /**
1093     * A pointer to the contents in the error state.
1094     * Reading from this pointer when `result_ok` is set is undefined.
1095     */
1096    struct LDKDecodeError *err;
1097 } LDKCResult_ChannelTransactionParametersDecodeErrorZPtr;
1098
1099 /**
1100  * A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation,
1101  * containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1102  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1103  */
1104 typedef struct LDKCResult_ChannelTransactionParametersDecodeErrorZ {
1105    /**
1106     * The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either
1107     * `err` or `result` depending on the state of `result_ok`.
1108     */
1109    union LDKCResult_ChannelTransactionParametersDecodeErrorZPtr contents;
1110    /**
1111     * Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state.
1112     */
1113    bool result_ok;
1114 } LDKCResult_ChannelTransactionParametersDecodeErrorZ;
1115
1116 /**
1117  * Represents a secp256k1 signature serialized as two 32-byte numbers
1118  */
1119 typedef struct LDKSignature {
1120    /**
1121     * The bytes of the signature in "compact" form
1122     */
1123    uint8_t compact_form[64];
1124 } LDKSignature;
1125
1126 /**
1127  * A dynamically-allocated array of crate::c_types::Signatures of arbitrary size.
1128  * This corresponds to std::vector in C++
1129  */
1130 typedef struct LDKCVec_SignatureZ {
1131    /**
1132     * The elements in the array.
1133     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1134     */
1135    struct LDKSignature *data;
1136    /**
1137     * The number of elements pointed to by `data`.
1138     */
1139    uintptr_t datalen;
1140 } LDKCVec_SignatureZ;
1141
1142
1143
1144 /**
1145  * Information needed to build and sign a holder's commitment transaction.
1146  *
1147  * The transaction is only signed once we are ready to broadcast.
1148  */
1149 typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction {
1150    /**
1151     * A pointer to the opaque Rust object.
1152     * Nearly everywhere, inner must be non-null, however in places where
1153     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1154     */
1155    LDKnativeHolderCommitmentTransaction *inner;
1156    /**
1157     * Indicates that this is the only struct which contains the same pointer.
1158     * Rust functions which take ownership of an object provided via an argument require
1159     * this to be true and invalidate the object pointed to by inner.
1160     */
1161    bool is_owned;
1162 } LDKHolderCommitmentTransaction;
1163
1164 /**
1165  * The contents of CResult_HolderCommitmentTransactionDecodeErrorZ
1166  */
1167 typedef union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr {
1168    /**
1169     * A pointer to the contents in the success state.
1170     * Reading from this pointer when `result_ok` is not set is undefined.
1171     */
1172    struct LDKHolderCommitmentTransaction *result;
1173    /**
1174     * A pointer to the contents in the error state.
1175     * Reading from this pointer when `result_ok` is set is undefined.
1176     */
1177    struct LDKDecodeError *err;
1178 } LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr;
1179
1180 /**
1181  * A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1182  * containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1183  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1184  */
1185 typedef struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ {
1186    /**
1187     * The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either
1188     * `err` or `result` depending on the state of `result_ok`.
1189     */
1190    union LDKCResult_HolderCommitmentTransactionDecodeErrorZPtr contents;
1191    /**
1192     * Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state.
1193     */
1194    bool result_ok;
1195 } LDKCResult_HolderCommitmentTransactionDecodeErrorZ;
1196
1197
1198
1199 /**
1200  * A pre-built Bitcoin commitment transaction and its txid.
1201  */
1202 typedef struct MUST_USE_STRUCT LDKBuiltCommitmentTransaction {
1203    /**
1204     * A pointer to the opaque Rust object.
1205     * Nearly everywhere, inner must be non-null, however in places where
1206     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1207     */
1208    LDKnativeBuiltCommitmentTransaction *inner;
1209    /**
1210     * Indicates that this is the only struct which contains the same pointer.
1211     * Rust functions which take ownership of an object provided via an argument require
1212     * this to be true and invalidate the object pointed to by inner.
1213     */
1214    bool is_owned;
1215 } LDKBuiltCommitmentTransaction;
1216
1217 /**
1218  * The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ
1219  */
1220 typedef union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr {
1221    /**
1222     * A pointer to the contents in the success state.
1223     * Reading from this pointer when `result_ok` is not set is undefined.
1224     */
1225    struct LDKBuiltCommitmentTransaction *result;
1226    /**
1227     * A pointer to the contents in the error state.
1228     * Reading from this pointer when `result_ok` is set is undefined.
1229     */
1230    struct LDKDecodeError *err;
1231 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr;
1232
1233 /**
1234  * A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1235  * containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1236  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1237  */
1238 typedef struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ {
1239    /**
1240     * The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either
1241     * `err` or `result` depending on the state of `result_ok`.
1242     */
1243    union LDKCResult_BuiltCommitmentTransactionDecodeErrorZPtr contents;
1244    /**
1245     * Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state.
1246     */
1247    bool result_ok;
1248 } LDKCResult_BuiltCommitmentTransactionDecodeErrorZ;
1249
1250
1251
1252 /**
1253  * A wrapper on ClosingTransaction indicating that the built bitcoin
1254  * transaction is trusted.
1255  *
1256  * See trust() and verify() functions on CommitmentTransaction.
1257  *
1258  * This structure implements Deref.
1259  */
1260 typedef struct MUST_USE_STRUCT LDKTrustedClosingTransaction {
1261    /**
1262     * A pointer to the opaque Rust object.
1263     * Nearly everywhere, inner must be non-null, however in places where
1264     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1265     */
1266    LDKnativeTrustedClosingTransaction *inner;
1267    /**
1268     * Indicates that this is the only struct which contains the same pointer.
1269     * Rust functions which take ownership of an object provided via an argument require
1270     * this to be true and invalidate the object pointed to by inner.
1271     */
1272    bool is_owned;
1273 } LDKTrustedClosingTransaction;
1274
1275 /**
1276  * The contents of CResult_TrustedClosingTransactionNoneZ
1277  */
1278 typedef union LDKCResult_TrustedClosingTransactionNoneZPtr {
1279    /**
1280     * A pointer to the contents in the success state.
1281     * Reading from this pointer when `result_ok` is not set is undefined.
1282     */
1283    struct LDKTrustedClosingTransaction *result;
1284    /**
1285     * Note that this value is always NULL, as there are no contents in the Err variant
1286     */
1287    void *err;
1288 } LDKCResult_TrustedClosingTransactionNoneZPtr;
1289
1290 /**
1291  * A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation,
1292  * containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure.
1293  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1294  */
1295 typedef struct LDKCResult_TrustedClosingTransactionNoneZ {
1296    /**
1297     * The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either
1298     * `err` or `result` depending on the state of `result_ok`.
1299     */
1300    union LDKCResult_TrustedClosingTransactionNoneZPtr contents;
1301    /**
1302     * Whether this CResult_TrustedClosingTransactionNoneZ represents a success state.
1303     */
1304    bool result_ok;
1305 } LDKCResult_TrustedClosingTransactionNoneZ;
1306
1307
1308
1309 /**
1310  * This class tracks the per-transaction information needed to build a commitment transaction and will
1311  * actually build it and sign.  It is used for holder transactions that we sign only when needed
1312  * and for transactions we sign for the counterparty.
1313  *
1314  * This class can be used inside a signer implementation to generate a signature given the relevant
1315  * secret key.
1316  */
1317 typedef struct MUST_USE_STRUCT LDKCommitmentTransaction {
1318    /**
1319     * A pointer to the opaque Rust object.
1320     * Nearly everywhere, inner must be non-null, however in places where
1321     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1322     */
1323    LDKnativeCommitmentTransaction *inner;
1324    /**
1325     * Indicates that this is the only struct which contains the same pointer.
1326     * Rust functions which take ownership of an object provided via an argument require
1327     * this to be true and invalidate the object pointed to by inner.
1328     */
1329    bool is_owned;
1330 } LDKCommitmentTransaction;
1331
1332 /**
1333  * The contents of CResult_CommitmentTransactionDecodeErrorZ
1334  */
1335 typedef union LDKCResult_CommitmentTransactionDecodeErrorZPtr {
1336    /**
1337     * A pointer to the contents in the success state.
1338     * Reading from this pointer when `result_ok` is not set is undefined.
1339     */
1340    struct LDKCommitmentTransaction *result;
1341    /**
1342     * A pointer to the contents in the error state.
1343     * Reading from this pointer when `result_ok` is set is undefined.
1344     */
1345    struct LDKDecodeError *err;
1346 } LDKCResult_CommitmentTransactionDecodeErrorZPtr;
1347
1348 /**
1349  * A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation,
1350  * containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure.
1351  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1352  */
1353 typedef struct LDKCResult_CommitmentTransactionDecodeErrorZ {
1354    /**
1355     * The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either
1356     * `err` or `result` depending on the state of `result_ok`.
1357     */
1358    union LDKCResult_CommitmentTransactionDecodeErrorZPtr contents;
1359    /**
1360     * Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state.
1361     */
1362    bool result_ok;
1363 } LDKCResult_CommitmentTransactionDecodeErrorZ;
1364
1365
1366
1367 /**
1368  * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin
1369  * transaction and the transaction creation keys) are trusted.
1370  *
1371  * See trust() and verify() functions on CommitmentTransaction.
1372  *
1373  * This structure implements Deref.
1374  */
1375 typedef struct MUST_USE_STRUCT LDKTrustedCommitmentTransaction {
1376    /**
1377     * A pointer to the opaque Rust object.
1378     * Nearly everywhere, inner must be non-null, however in places where
1379     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1380     */
1381    LDKnativeTrustedCommitmentTransaction *inner;
1382    /**
1383     * Indicates that this is the only struct which contains the same pointer.
1384     * Rust functions which take ownership of an object provided via an argument require
1385     * this to be true and invalidate the object pointed to by inner.
1386     */
1387    bool is_owned;
1388 } LDKTrustedCommitmentTransaction;
1389
1390 /**
1391  * The contents of CResult_TrustedCommitmentTransactionNoneZ
1392  */
1393 typedef union LDKCResult_TrustedCommitmentTransactionNoneZPtr {
1394    /**
1395     * A pointer to the contents in the success state.
1396     * Reading from this pointer when `result_ok` is not set is undefined.
1397     */
1398    struct LDKTrustedCommitmentTransaction *result;
1399    /**
1400     * Note that this value is always NULL, as there are no contents in the Err variant
1401     */
1402    void *err;
1403 } LDKCResult_TrustedCommitmentTransactionNoneZPtr;
1404
1405 /**
1406  * A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation,
1407  * containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure.
1408  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1409  */
1410 typedef struct LDKCResult_TrustedCommitmentTransactionNoneZ {
1411    /**
1412     * The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either
1413     * `err` or `result` depending on the state of `result_ok`.
1414     */
1415    union LDKCResult_TrustedCommitmentTransactionNoneZPtr contents;
1416    /**
1417     * Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state.
1418     */
1419    bool result_ok;
1420 } LDKCResult_TrustedCommitmentTransactionNoneZ;
1421
1422 /**
1423  * The contents of CResult_CVec_SignatureZNoneZ
1424  */
1425 typedef union LDKCResult_CVec_SignatureZNoneZPtr {
1426    /**
1427     * A pointer to the contents in the success state.
1428     * Reading from this pointer when `result_ok` is not set is undefined.
1429     */
1430    struct LDKCVec_SignatureZ *result;
1431    /**
1432     * Note that this value is always NULL, as there are no contents in the Err variant
1433     */
1434    void *err;
1435 } LDKCResult_CVec_SignatureZNoneZPtr;
1436
1437 /**
1438  * A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation,
1439  * containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure.
1440  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1441  */
1442 typedef struct LDKCResult_CVec_SignatureZNoneZ {
1443    /**
1444     * The contents of this CResult_CVec_SignatureZNoneZ, accessible via either
1445     * `err` or `result` depending on the state of `result_ok`.
1446     */
1447    union LDKCResult_CVec_SignatureZNoneZPtr contents;
1448    /**
1449     * Whether this CResult_CVec_SignatureZNoneZ represents a success state.
1450     */
1451    bool result_ok;
1452 } LDKCResult_CVec_SignatureZNoneZ;
1453
1454
1455
1456 /**
1457  * A script pubkey for shutting down a channel as defined by [BOLT #2].
1458  *
1459  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
1460  */
1461 typedef struct MUST_USE_STRUCT LDKShutdownScript {
1462    /**
1463     * A pointer to the opaque Rust object.
1464     * Nearly everywhere, inner must be non-null, however in places where
1465     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1466     */
1467    LDKnativeShutdownScript *inner;
1468    /**
1469     * Indicates that this is the only struct which contains the same pointer.
1470     * Rust functions which take ownership of an object provided via an argument require
1471     * this to be true and invalidate the object pointed to by inner.
1472     */
1473    bool is_owned;
1474 } LDKShutdownScript;
1475
1476 /**
1477  * The contents of CResult_ShutdownScriptDecodeErrorZ
1478  */
1479 typedef union LDKCResult_ShutdownScriptDecodeErrorZPtr {
1480    /**
1481     * A pointer to the contents in the success state.
1482     * Reading from this pointer when `result_ok` is not set is undefined.
1483     */
1484    struct LDKShutdownScript *result;
1485    /**
1486     * A pointer to the contents in the error state.
1487     * Reading from this pointer when `result_ok` is set is undefined.
1488     */
1489    struct LDKDecodeError *err;
1490 } LDKCResult_ShutdownScriptDecodeErrorZPtr;
1491
1492 /**
1493  * A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation,
1494  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure.
1495  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1496  */
1497 typedef struct LDKCResult_ShutdownScriptDecodeErrorZ {
1498    /**
1499     * The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either
1500     * `err` or `result` depending on the state of `result_ok`.
1501     */
1502    union LDKCResult_ShutdownScriptDecodeErrorZPtr contents;
1503    /**
1504     * Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state.
1505     */
1506    bool result_ok;
1507 } LDKCResult_ShutdownScriptDecodeErrorZ;
1508
1509
1510
1511 /**
1512  * An error occurring when converting from [`Script`] to [`ShutdownScript`].
1513  */
1514 typedef struct MUST_USE_STRUCT LDKInvalidShutdownScript {
1515    /**
1516     * A pointer to the opaque Rust object.
1517     * Nearly everywhere, inner must be non-null, however in places where
1518     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1519     */
1520    LDKnativeInvalidShutdownScript *inner;
1521    /**
1522     * Indicates that this is the only struct which contains the same pointer.
1523     * Rust functions which take ownership of an object provided via an argument require
1524     * this to be true and invalidate the object pointed to by inner.
1525     */
1526    bool is_owned;
1527 } LDKInvalidShutdownScript;
1528
1529 /**
1530  * The contents of CResult_ShutdownScriptInvalidShutdownScriptZ
1531  */
1532 typedef union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr {
1533    /**
1534     * A pointer to the contents in the success state.
1535     * Reading from this pointer when `result_ok` is not set is undefined.
1536     */
1537    struct LDKShutdownScript *result;
1538    /**
1539     * A pointer to the contents in the error state.
1540     * Reading from this pointer when `result_ok` is set is undefined.
1541     */
1542    struct LDKInvalidShutdownScript *err;
1543 } LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr;
1544
1545 /**
1546  * A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation,
1547  * containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure.
1548  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1549  */
1550 typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ {
1551    /**
1552     * The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either
1553     * `err` or `result` depending on the state of `result_ok`.
1554     */
1555    union LDKCResult_ShutdownScriptInvalidShutdownScriptZPtr contents;
1556    /**
1557     * Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state.
1558     */
1559    bool result_ok;
1560 } LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
1561
1562 /**
1563  * The contents of CResult_NoneErrorZ
1564  */
1565 typedef union LDKCResult_NoneErrorZPtr {
1566    /**
1567     * Note that this value is always NULL, as there are no contents in the OK variant
1568     */
1569    void *result;
1570    /**
1571     * A pointer to the contents in the error state.
1572     * Reading from this pointer when `result_ok` is set is undefined.
1573     */
1574    enum LDKIOError *err;
1575 } LDKCResult_NoneErrorZPtr;
1576
1577 /**
1578  * A CResult_NoneErrorZ represents the result of a fallible operation,
1579  * containing a () on success and a crate::c_types::IOError on failure.
1580  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1581  */
1582 typedef struct LDKCResult_NoneErrorZ {
1583    /**
1584     * The contents of this CResult_NoneErrorZ, accessible via either
1585     * `err` or `result` depending on the state of `result_ok`.
1586     */
1587    union LDKCResult_NoneErrorZPtr contents;
1588    /**
1589     * Whether this CResult_NoneErrorZ represents a success state.
1590     */
1591    bool result_ok;
1592 } LDKCResult_NoneErrorZ;
1593
1594
1595
1596 /**
1597  * A hop in a route
1598  */
1599 typedef struct MUST_USE_STRUCT LDKRouteHop {
1600    /**
1601     * A pointer to the opaque Rust object.
1602     * Nearly everywhere, inner must be non-null, however in places where
1603     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1604     */
1605    LDKnativeRouteHop *inner;
1606    /**
1607     * Indicates that this is the only struct which contains the same pointer.
1608     * Rust functions which take ownership of an object provided via an argument require
1609     * this to be true and invalidate the object pointed to by inner.
1610     */
1611    bool is_owned;
1612 } LDKRouteHop;
1613
1614 /**
1615  * The contents of CResult_RouteHopDecodeErrorZ
1616  */
1617 typedef union LDKCResult_RouteHopDecodeErrorZPtr {
1618    /**
1619     * A pointer to the contents in the success state.
1620     * Reading from this pointer when `result_ok` is not set is undefined.
1621     */
1622    struct LDKRouteHop *result;
1623    /**
1624     * A pointer to the contents in the error state.
1625     * Reading from this pointer when `result_ok` is set is undefined.
1626     */
1627    struct LDKDecodeError *err;
1628 } LDKCResult_RouteHopDecodeErrorZPtr;
1629
1630 /**
1631  * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation,
1632  * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
1633  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1634  */
1635 typedef struct LDKCResult_RouteHopDecodeErrorZ {
1636    /**
1637     * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either
1638     * `err` or `result` depending on the state of `result_ok`.
1639     */
1640    union LDKCResult_RouteHopDecodeErrorZPtr contents;
1641    /**
1642     * Whether this CResult_RouteHopDecodeErrorZ represents a success state.
1643     */
1644    bool result_ok;
1645 } LDKCResult_RouteHopDecodeErrorZ;
1646
1647 /**
1648  * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
1649  * This corresponds to std::vector in C++
1650  */
1651 typedef struct LDKCVec_RouteHopZ {
1652    /**
1653     * The elements in the array.
1654     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1655     */
1656    struct LDKRouteHop *data;
1657    /**
1658     * The number of elements pointed to by `data`.
1659     */
1660    uintptr_t datalen;
1661 } LDKCVec_RouteHopZ;
1662
1663 /**
1664  * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
1665  * This corresponds to std::vector in C++
1666  */
1667 typedef struct LDKCVec_CVec_RouteHopZZ {
1668    /**
1669     * The elements in the array.
1670     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1671     */
1672    struct LDKCVec_RouteHopZ *data;
1673    /**
1674     * The number of elements pointed to by `data`.
1675     */
1676    uintptr_t datalen;
1677 } LDKCVec_CVec_RouteHopZZ;
1678
1679
1680
1681 /**
1682  * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
1683  * it can take multiple paths. Each path is composed of one or more hops through the network.
1684  */
1685 typedef struct MUST_USE_STRUCT LDKRoute {
1686    /**
1687     * A pointer to the opaque Rust object.
1688     * Nearly everywhere, inner must be non-null, however in places where
1689     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1690     */
1691    LDKnativeRoute *inner;
1692    /**
1693     * Indicates that this is the only struct which contains the same pointer.
1694     * Rust functions which take ownership of an object provided via an argument require
1695     * this to be true and invalidate the object pointed to by inner.
1696     */
1697    bool is_owned;
1698 } LDKRoute;
1699
1700 /**
1701  * The contents of CResult_RouteDecodeErrorZ
1702  */
1703 typedef union LDKCResult_RouteDecodeErrorZPtr {
1704    /**
1705     * A pointer to the contents in the success state.
1706     * Reading from this pointer when `result_ok` is not set is undefined.
1707     */
1708    struct LDKRoute *result;
1709    /**
1710     * A pointer to the contents in the error state.
1711     * Reading from this pointer when `result_ok` is set is undefined.
1712     */
1713    struct LDKDecodeError *err;
1714 } LDKCResult_RouteDecodeErrorZPtr;
1715
1716 /**
1717  * A CResult_RouteDecodeErrorZ represents the result of a fallible operation,
1718  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure.
1719  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1720  */
1721 typedef struct LDKCResult_RouteDecodeErrorZ {
1722    /**
1723     * The contents of this CResult_RouteDecodeErrorZ, accessible via either
1724     * `err` or `result` depending on the state of `result_ok`.
1725     */
1726    union LDKCResult_RouteDecodeErrorZPtr contents;
1727    /**
1728     * Whether this CResult_RouteDecodeErrorZ represents a success state.
1729     */
1730    bool result_ok;
1731 } LDKCResult_RouteDecodeErrorZ;
1732
1733
1734
1735 /**
1736  * Parameters needed to find a [`Route`].
1737  *
1738  * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
1739  * [`Event::PaymentPathFailed`] for retrying a failed payment path.
1740  *
1741  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
1742  */
1743 typedef struct MUST_USE_STRUCT LDKRouteParameters {
1744    /**
1745     * A pointer to the opaque Rust object.
1746     * Nearly everywhere, inner must be non-null, however in places where
1747     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1748     */
1749    LDKnativeRouteParameters *inner;
1750    /**
1751     * Indicates that this is the only struct which contains the same pointer.
1752     * Rust functions which take ownership of an object provided via an argument require
1753     * this to be true and invalidate the object pointed to by inner.
1754     */
1755    bool is_owned;
1756 } LDKRouteParameters;
1757
1758 /**
1759  * The contents of CResult_RouteParametersDecodeErrorZ
1760  */
1761 typedef union LDKCResult_RouteParametersDecodeErrorZPtr {
1762    /**
1763     * A pointer to the contents in the success state.
1764     * Reading from this pointer when `result_ok` is not set is undefined.
1765     */
1766    struct LDKRouteParameters *result;
1767    /**
1768     * A pointer to the contents in the error state.
1769     * Reading from this pointer when `result_ok` is set is undefined.
1770     */
1771    struct LDKDecodeError *err;
1772 } LDKCResult_RouteParametersDecodeErrorZPtr;
1773
1774 /**
1775  * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation,
1776  * containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1777  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1778  */
1779 typedef struct LDKCResult_RouteParametersDecodeErrorZ {
1780    /**
1781     * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either
1782     * `err` or `result` depending on the state of `result_ok`.
1783     */
1784    union LDKCResult_RouteParametersDecodeErrorZPtr contents;
1785    /**
1786     * Whether this CResult_RouteParametersDecodeErrorZ represents a success state.
1787     */
1788    bool result_ok;
1789 } LDKCResult_RouteParametersDecodeErrorZ;
1790
1791
1792
1793 /**
1794  * A list of hops along a payment path terminating with a channel to the recipient.
1795  */
1796 typedef struct MUST_USE_STRUCT LDKRouteHint {
1797    /**
1798     * A pointer to the opaque Rust object.
1799     * Nearly everywhere, inner must be non-null, however in places where
1800     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1801     */
1802    LDKnativeRouteHint *inner;
1803    /**
1804     * Indicates that this is the only struct which contains the same pointer.
1805     * Rust functions which take ownership of an object provided via an argument require
1806     * this to be true and invalidate the object pointed to by inner.
1807     */
1808    bool is_owned;
1809 } LDKRouteHint;
1810
1811 /**
1812  * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
1813  * This corresponds to std::vector in C++
1814  */
1815 typedef struct LDKCVec_RouteHintZ {
1816    /**
1817     * The elements in the array.
1818     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1819     */
1820    struct LDKRouteHint *data;
1821    /**
1822     * The number of elements pointed to by `data`.
1823     */
1824    uintptr_t datalen;
1825 } LDKCVec_RouteHintZ;
1826
1827 /**
1828  * An enum which can either contain a u64 or not
1829  */
1830 typedef enum LDKCOption_u64Z_Tag {
1831    /**
1832     * When we're in this state, this COption_u64Z contains a u64
1833     */
1834    LDKCOption_u64Z_Some,
1835    /**
1836     * When we're in this state, this COption_u64Z contains nothing
1837     */
1838    LDKCOption_u64Z_None,
1839    /**
1840     * Must be last for serialization purposes
1841     */
1842    LDKCOption_u64Z_Sentinel,
1843 } LDKCOption_u64Z_Tag;
1844
1845 typedef struct LDKCOption_u64Z {
1846    LDKCOption_u64Z_Tag tag;
1847    union {
1848       struct {
1849          uint64_t some;
1850       };
1851    };
1852 } LDKCOption_u64Z;
1853
1854 /**
1855  * A dynamically-allocated array of u64s of arbitrary size.
1856  * This corresponds to std::vector in C++
1857  */
1858 typedef struct LDKCVec_u64Z {
1859    /**
1860     * The elements in the array.
1861     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1862     */
1863    uint64_t *data;
1864    /**
1865     * The number of elements pointed to by `data`.
1866     */
1867    uintptr_t datalen;
1868 } LDKCVec_u64Z;
1869
1870
1871
1872 /**
1873  * The recipient of a payment.
1874  */
1875 typedef struct MUST_USE_STRUCT LDKPaymentParameters {
1876    /**
1877     * A pointer to the opaque Rust object.
1878     * Nearly everywhere, inner must be non-null, however in places where
1879     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1880     */
1881    LDKnativePaymentParameters *inner;
1882    /**
1883     * Indicates that this is the only struct which contains the same pointer.
1884     * Rust functions which take ownership of an object provided via an argument require
1885     * this to be true and invalidate the object pointed to by inner.
1886     */
1887    bool is_owned;
1888 } LDKPaymentParameters;
1889
1890 /**
1891  * The contents of CResult_PaymentParametersDecodeErrorZ
1892  */
1893 typedef union LDKCResult_PaymentParametersDecodeErrorZPtr {
1894    /**
1895     * A pointer to the contents in the success state.
1896     * Reading from this pointer when `result_ok` is not set is undefined.
1897     */
1898    struct LDKPaymentParameters *result;
1899    /**
1900     * A pointer to the contents in the error state.
1901     * Reading from this pointer when `result_ok` is set is undefined.
1902     */
1903    struct LDKDecodeError *err;
1904 } LDKCResult_PaymentParametersDecodeErrorZPtr;
1905
1906 /**
1907  * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation,
1908  * containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure.
1909  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1910  */
1911 typedef struct LDKCResult_PaymentParametersDecodeErrorZ {
1912    /**
1913     * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either
1914     * `err` or `result` depending on the state of `result_ok`.
1915     */
1916    union LDKCResult_PaymentParametersDecodeErrorZPtr contents;
1917    /**
1918     * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state.
1919     */
1920    bool result_ok;
1921 } LDKCResult_PaymentParametersDecodeErrorZ;
1922
1923
1924
1925 /**
1926  * A channel descriptor for a hop along a payment path.
1927  */
1928 typedef struct MUST_USE_STRUCT LDKRouteHintHop {
1929    /**
1930     * A pointer to the opaque Rust object.
1931     * Nearly everywhere, inner must be non-null, however in places where
1932     * the Rust equivalent takes an Option, it may be set to null to indicate None.
1933     */
1934    LDKnativeRouteHintHop *inner;
1935    /**
1936     * Indicates that this is the only struct which contains the same pointer.
1937     * Rust functions which take ownership of an object provided via an argument require
1938     * this to be true and invalidate the object pointed to by inner.
1939     */
1940    bool is_owned;
1941 } LDKRouteHintHop;
1942
1943 /**
1944  * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
1945  * This corresponds to std::vector in C++
1946  */
1947 typedef struct LDKCVec_RouteHintHopZ {
1948    /**
1949     * The elements in the array.
1950     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
1951     */
1952    struct LDKRouteHintHop *data;
1953    /**
1954     * The number of elements pointed to by `data`.
1955     */
1956    uintptr_t datalen;
1957 } LDKCVec_RouteHintHopZ;
1958
1959 /**
1960  * The contents of CResult_RouteHintDecodeErrorZ
1961  */
1962 typedef union LDKCResult_RouteHintDecodeErrorZPtr {
1963    /**
1964     * A pointer to the contents in the success state.
1965     * Reading from this pointer when `result_ok` is not set is undefined.
1966     */
1967    struct LDKRouteHint *result;
1968    /**
1969     * A pointer to the contents in the error state.
1970     * Reading from this pointer when `result_ok` is set is undefined.
1971     */
1972    struct LDKDecodeError *err;
1973 } LDKCResult_RouteHintDecodeErrorZPtr;
1974
1975 /**
1976  * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation,
1977  * containing a crate::lightning::routing::router::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure.
1978  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
1979  */
1980 typedef struct LDKCResult_RouteHintDecodeErrorZ {
1981    /**
1982     * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either
1983     * `err` or `result` depending on the state of `result_ok`.
1984     */
1985    union LDKCResult_RouteHintDecodeErrorZPtr contents;
1986    /**
1987     * Whether this CResult_RouteHintDecodeErrorZ represents a success state.
1988     */
1989    bool result_ok;
1990 } LDKCResult_RouteHintDecodeErrorZ;
1991
1992 /**
1993  * The contents of CResult_RouteHintHopDecodeErrorZ
1994  */
1995 typedef union LDKCResult_RouteHintHopDecodeErrorZPtr {
1996    /**
1997     * A pointer to the contents in the success state.
1998     * Reading from this pointer when `result_ok` is not set is undefined.
1999     */
2000    struct LDKRouteHintHop *result;
2001    /**
2002     * A pointer to the contents in the error state.
2003     * Reading from this pointer when `result_ok` is set is undefined.
2004     */
2005    struct LDKDecodeError *err;
2006 } LDKCResult_RouteHintHopDecodeErrorZPtr;
2007
2008 /**
2009  * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation,
2010  * containing a crate::lightning::routing::router::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
2011  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2012  */
2013 typedef struct LDKCResult_RouteHintHopDecodeErrorZ {
2014    /**
2015     * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either
2016     * `err` or `result` depending on the state of `result_ok`.
2017     */
2018    union LDKCResult_RouteHintHopDecodeErrorZPtr contents;
2019    /**
2020     * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state.
2021     */
2022    bool result_ok;
2023 } LDKCResult_RouteHintHopDecodeErrorZ;
2024
2025
2026
2027 /**
2028  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
2029  */
2030 typedef struct MUST_USE_STRUCT LDKChannelDetails {
2031    /**
2032     * A pointer to the opaque Rust object.
2033     * Nearly everywhere, inner must be non-null, however in places where
2034     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2035     */
2036    LDKnativeChannelDetails *inner;
2037    /**
2038     * Indicates that this is the only struct which contains the same pointer.
2039     * Rust functions which take ownership of an object provided via an argument require
2040     * this to be true and invalidate the object pointed to by inner.
2041     */
2042    bool is_owned;
2043 } LDKChannelDetails;
2044
2045 /**
2046  * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size.
2047  * This corresponds to std::vector in C++
2048  */
2049 typedef struct LDKCVec_ChannelDetailsZ {
2050    /**
2051     * The elements in the array.
2052     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2053     */
2054    struct LDKChannelDetails *data;
2055    /**
2056     * The number of elements pointed to by `data`.
2057     */
2058    uintptr_t datalen;
2059 } LDKCVec_ChannelDetailsZ;
2060
2061
2062
2063 /**
2064  * An Err type for failure to process messages.
2065  */
2066 typedef struct MUST_USE_STRUCT LDKLightningError {
2067    /**
2068     * A pointer to the opaque Rust object.
2069     * Nearly everywhere, inner must be non-null, however in places where
2070     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2071     */
2072    LDKnativeLightningError *inner;
2073    /**
2074     * Indicates that this is the only struct which contains the same pointer.
2075     * Rust functions which take ownership of an object provided via an argument require
2076     * this to be true and invalidate the object pointed to by inner.
2077     */
2078    bool is_owned;
2079 } LDKLightningError;
2080
2081 /**
2082  * The contents of CResult_RouteLightningErrorZ
2083  */
2084 typedef union LDKCResult_RouteLightningErrorZPtr {
2085    /**
2086     * A pointer to the contents in the success state.
2087     * Reading from this pointer when `result_ok` is not set is undefined.
2088     */
2089    struct LDKRoute *result;
2090    /**
2091     * A pointer to the contents in the error state.
2092     * Reading from this pointer when `result_ok` is set is undefined.
2093     */
2094    struct LDKLightningError *err;
2095 } LDKCResult_RouteLightningErrorZPtr;
2096
2097 /**
2098  * A CResult_RouteLightningErrorZ represents the result of a fallible operation,
2099  * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure.
2100  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2101  */
2102 typedef struct LDKCResult_RouteLightningErrorZ {
2103    /**
2104     * The contents of this CResult_RouteLightningErrorZ, accessible via either
2105     * `err` or `result` depending on the state of `result_ok`.
2106     */
2107    union LDKCResult_RouteLightningErrorZPtr contents;
2108    /**
2109     * Whether this CResult_RouteLightningErrorZ represents a success state.
2110     */
2111    bool result_ok;
2112 } LDKCResult_RouteLightningErrorZ;
2113
2114 /**
2115  * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
2116  * This corresponds to std::vector in C++
2117  */
2118 typedef struct LDKCVec_PublicKeyZ {
2119    /**
2120     * The elements in the array.
2121     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2122     */
2123    struct LDKPublicKey *data;
2124    /**
2125     * The number of elements pointed to by `data`.
2126     */
2127    uintptr_t datalen;
2128 } LDKCVec_PublicKeyZ;
2129
2130 /**
2131  * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to
2132  * look up the corresponding function in rust-lightning's docs.
2133  */
2134 typedef struct LDKThirtyTwoBytes {
2135    /**
2136     * The thirty-two bytes
2137     */
2138    uint8_t data[32];
2139 } LDKThirtyTwoBytes;
2140
2141 /**
2142  * Some information provided on receipt of payment depends on whether the payment received is a
2143  * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
2144  */
2145 typedef enum LDKPaymentPurpose_Tag {
2146    /**
2147     * Information for receiving a payment that we generated an invoice for.
2148     */
2149    LDKPaymentPurpose_InvoicePayment,
2150    /**
2151     * Because this is a spontaneous payment, the payer generated their own preimage rather than us
2152     * (the payee) providing a preimage.
2153     */
2154    LDKPaymentPurpose_SpontaneousPayment,
2155    /**
2156     * Must be last for serialization purposes
2157     */
2158    LDKPaymentPurpose_Sentinel,
2159 } LDKPaymentPurpose_Tag;
2160
2161 typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
2162    /**
2163     * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
2164     * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
2165     * [`ChannelManager::claim_funds`].
2166     *
2167     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2168     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2169     *
2170     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2171     */
2172    struct LDKThirtyTwoBytes payment_preimage;
2173    /**
2174     * The \"payment secret\". This authenticates the sender to the recipient, preventing a
2175     * number of deanonymization attacks during the routing process.
2176     * It is provided here for your reference, however its accuracy is enforced directly by
2177     * [`ChannelManager`] using the values you previously provided to
2178     * [`ChannelManager::create_inbound_payment`] or
2179     * [`ChannelManager::create_inbound_payment_for_hash`].
2180     *
2181     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2182     * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
2183     * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
2184     */
2185    struct LDKThirtyTwoBytes payment_secret;
2186 } LDKPaymentPurpose_LDKInvoicePayment_Body;
2187
2188 typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
2189    LDKPaymentPurpose_Tag tag;
2190    union {
2191       LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
2192       struct {
2193          struct LDKThirtyTwoBytes spontaneous_payment;
2194       };
2195    };
2196 } LDKPaymentPurpose;
2197
2198 /**
2199  * The contents of CResult_PaymentPurposeDecodeErrorZ
2200  */
2201 typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
2202    /**
2203     * A pointer to the contents in the success state.
2204     * Reading from this pointer when `result_ok` is not set is undefined.
2205     */
2206    struct LDKPaymentPurpose *result;
2207    /**
2208     * A pointer to the contents in the error state.
2209     * Reading from this pointer when `result_ok` is set is undefined.
2210     */
2211    struct LDKDecodeError *err;
2212 } LDKCResult_PaymentPurposeDecodeErrorZPtr;
2213
2214 /**
2215  * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
2216  * containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
2217  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2218  */
2219 typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
2220    /**
2221     * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
2222     * `err` or `result` depending on the state of `result_ok`.
2223     */
2224    union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
2225    /**
2226     * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
2227     */
2228    bool result_ok;
2229 } LDKCResult_PaymentPurposeDecodeErrorZ;
2230
2231 /**
2232  * The reason the channel was closed. See individual variants more details.
2233  */
2234 typedef enum LDKClosureReason_Tag {
2235    /**
2236     * Closure generated from receiving a peer error message.
2237     *
2238     * Our counterparty may have broadcasted their latest commitment state, and we have
2239     * as well.
2240     */
2241    LDKClosureReason_CounterpartyForceClosed,
2242    /**
2243     * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
2244     *
2245     * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
2246     */
2247    LDKClosureReason_HolderForceClosed,
2248    /**
2249     * The channel was closed after negotiating a cooperative close and we've now broadcasted
2250     * the cooperative close transaction. Note the shutdown may have been initiated by us.
2251     */
2252    LDKClosureReason_CooperativeClosure,
2253    /**
2254     * A commitment transaction was confirmed on chain, closing the channel. Most likely this
2255     * commitment transaction came from our counterparty, but it may also have come from
2256     * a copy of our own `ChannelMonitor`.
2257     */
2258    LDKClosureReason_CommitmentTxConfirmed,
2259    /**
2260     * The funding transaction failed to confirm in a timely manner on an inbound channel.
2261     */
2262    LDKClosureReason_FundingTimedOut,
2263    /**
2264     * Closure generated from processing an event, likely a HTLC forward/relay/reception.
2265     */
2266    LDKClosureReason_ProcessingError,
2267    /**
2268     * The peer disconnected prior to funding completing. In this case the spec mandates that we
2269     * forget the channel entirely - we can attempt again if the peer reconnects.
2270     *
2271     * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
2272     * peer because of mutual incompatibility between us and our channel counterparty.
2273     */
2274    LDKClosureReason_DisconnectedPeer,
2275    /**
2276     * Closure generated from `ChannelManager::read` if the ChannelMonitor is newer than
2277     * the ChannelManager deserialized.
2278     */
2279    LDKClosureReason_OutdatedChannelManager,
2280    /**
2281     * Must be last for serialization purposes
2282     */
2283    LDKClosureReason_Sentinel,
2284 } LDKClosureReason_Tag;
2285
2286 typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
2287    /**
2288     * The error which the peer sent us.
2289     *
2290     * The string should be sanitized before it is used (e.g emitted to logs
2291     * or printed to stdout). Otherwise, a well crafted error message may exploit
2292     * a security vulnerability in the terminal emulator or the logging subsystem.
2293     */
2294    struct LDKStr peer_msg;
2295 } LDKClosureReason_LDKCounterpartyForceClosed_Body;
2296
2297 typedef struct LDKClosureReason_LDKProcessingError_Body {
2298    /**
2299     * A developer-readable error message which we generated.
2300     */
2301    struct LDKStr err;
2302 } LDKClosureReason_LDKProcessingError_Body;
2303
2304 typedef struct MUST_USE_STRUCT LDKClosureReason {
2305    LDKClosureReason_Tag tag;
2306    union {
2307       LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
2308       LDKClosureReason_LDKProcessingError_Body processing_error;
2309    };
2310 } LDKClosureReason;
2311
2312 /**
2313  * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
2314  */
2315 typedef enum LDKCOption_ClosureReasonZ_Tag {
2316    /**
2317     * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
2318     */
2319    LDKCOption_ClosureReasonZ_Some,
2320    /**
2321     * When we're in this state, this COption_ClosureReasonZ contains nothing
2322     */
2323    LDKCOption_ClosureReasonZ_None,
2324    /**
2325     * Must be last for serialization purposes
2326     */
2327    LDKCOption_ClosureReasonZ_Sentinel,
2328 } LDKCOption_ClosureReasonZ_Tag;
2329
2330 typedef struct LDKCOption_ClosureReasonZ {
2331    LDKCOption_ClosureReasonZ_Tag tag;
2332    union {
2333       struct {
2334          struct LDKClosureReason some;
2335       };
2336    };
2337 } LDKCOption_ClosureReasonZ;
2338
2339 /**
2340  * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
2341  */
2342 typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
2343    /**
2344     * A pointer to the contents in the success state.
2345     * Reading from this pointer when `result_ok` is not set is undefined.
2346     */
2347    struct LDKCOption_ClosureReasonZ *result;
2348    /**
2349     * A pointer to the contents in the error state.
2350     * Reading from this pointer when `result_ok` is set is undefined.
2351     */
2352    struct LDKDecodeError *err;
2353 } LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
2354
2355 /**
2356  * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
2357  * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2358  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2359  */
2360 typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
2361    /**
2362     * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
2363     * `err` or `result` depending on the state of `result_ok`.
2364     */
2365    union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
2366    /**
2367     * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
2368     */
2369    bool result_ok;
2370 } LDKCResult_COption_ClosureReasonZDecodeErrorZ;
2371
2372 /**
2373  * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
2374  */
2375 typedef enum LDKHTLCDestination_Tag {
2376    /**
2377     * We tried forwarding to a channel but failed to do so. An example of such an instance is when
2378     * there is insufficient capacity in our outbound channel.
2379     */
2380    LDKHTLCDestination_NextHopChannel,
2381    /**
2382     * Scenario where we are unsure of the next node to forward the HTLC to.
2383     */
2384    LDKHTLCDestination_UnknownNextHop,
2385    /**
2386     * Failure scenario where an HTLC may have been forwarded to be intended for us,
2387     * but is invalid for some reason, so we reject it.
2388     *
2389     * Some of the reasons may include:
2390     * * HTLC Timeouts
2391     * * Expected MPP amount to claim does not equal HTLC total
2392     * * Claimable amount does not match expected amount
2393     */
2394    LDKHTLCDestination_FailedPayment,
2395    /**
2396     * Must be last for serialization purposes
2397     */
2398    LDKHTLCDestination_Sentinel,
2399 } LDKHTLCDestination_Tag;
2400
2401 typedef struct LDKHTLCDestination_LDKNextHopChannel_Body {
2402    /**
2403     * The `node_id` of the next node. For backwards compatibility, this field is
2404     * marked as optional, versions prior to 0.0.110 may not always be able to provide
2405     * counterparty node information.
2406     *
2407     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
2408     */
2409    struct LDKPublicKey node_id;
2410    /**
2411     * The outgoing `channel_id` between us and the next node.
2412     */
2413    struct LDKThirtyTwoBytes channel_id;
2414 } LDKHTLCDestination_LDKNextHopChannel_Body;
2415
2416 typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body {
2417    /**
2418     * Short channel id we are requesting to forward an HTLC to.
2419     */
2420    uint64_t requested_forward_scid;
2421 } LDKHTLCDestination_LDKUnknownNextHop_Body;
2422
2423 typedef struct LDKHTLCDestination_LDKFailedPayment_Body {
2424    /**
2425     * The payment hash of the payment we attempted to process.
2426     */
2427    struct LDKThirtyTwoBytes payment_hash;
2428 } LDKHTLCDestination_LDKFailedPayment_Body;
2429
2430 typedef struct MUST_USE_STRUCT LDKHTLCDestination {
2431    LDKHTLCDestination_Tag tag;
2432    union {
2433       LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel;
2434       LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop;
2435       LDKHTLCDestination_LDKFailedPayment_Body failed_payment;
2436    };
2437 } LDKHTLCDestination;
2438
2439 /**
2440  * An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
2441  */
2442 typedef enum LDKCOption_HTLCDestinationZ_Tag {
2443    /**
2444     * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
2445     */
2446    LDKCOption_HTLCDestinationZ_Some,
2447    /**
2448     * When we're in this state, this COption_HTLCDestinationZ contains nothing
2449     */
2450    LDKCOption_HTLCDestinationZ_None,
2451    /**
2452     * Must be last for serialization purposes
2453     */
2454    LDKCOption_HTLCDestinationZ_Sentinel,
2455 } LDKCOption_HTLCDestinationZ_Tag;
2456
2457 typedef struct LDKCOption_HTLCDestinationZ {
2458    LDKCOption_HTLCDestinationZ_Tag tag;
2459    union {
2460       struct {
2461          struct LDKHTLCDestination some;
2462       };
2463    };
2464 } LDKCOption_HTLCDestinationZ;
2465
2466 /**
2467  * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
2468  */
2469 typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr {
2470    /**
2471     * A pointer to the contents in the success state.
2472     * Reading from this pointer when `result_ok` is not set is undefined.
2473     */
2474    struct LDKCOption_HTLCDestinationZ *result;
2475    /**
2476     * A pointer to the contents in the error state.
2477     * Reading from this pointer when `result_ok` is set is undefined.
2478     */
2479    struct LDKDecodeError *err;
2480 } LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr;
2481
2482 /**
2483  * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
2484  * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
2485  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
2486  */
2487 typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ {
2488    /**
2489     * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
2490     * `err` or `result` depending on the state of `result_ok`.
2491     */
2492    union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents;
2493    /**
2494     * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
2495     */
2496    bool result_ok;
2497 } LDKCResult_COption_HTLCDestinationZDecodeErrorZ;
2498
2499
2500
2501 /**
2502  * A channel_update message to be sent or received from a peer
2503  */
2504 typedef struct MUST_USE_STRUCT LDKChannelUpdate {
2505    /**
2506     * A pointer to the opaque Rust object.
2507     * Nearly everywhere, inner must be non-null, however in places where
2508     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2509     */
2510    LDKnativeChannelUpdate *inner;
2511    /**
2512     * Indicates that this is the only struct which contains the same pointer.
2513     * Rust functions which take ownership of an object provided via an argument require
2514     * this to be true and invalidate the object pointed to by inner.
2515     */
2516    bool is_owned;
2517 } LDKChannelUpdate;
2518
2519 /**
2520  * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
2521  * return packet by a node along the route. See [BOLT #4] for details.
2522  *
2523  * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
2524  */
2525 typedef enum LDKNetworkUpdate_Tag {
2526    /**
2527     * An error indicating a `channel_update` messages should be applied via
2528     * [`NetworkGraph::update_channel`].
2529     */
2530    LDKNetworkUpdate_ChannelUpdateMessage,
2531    /**
2532     * An error indicating that a channel failed to route a payment, which should be applied via
2533     * [`NetworkGraph::channel_failed`].
2534     */
2535    LDKNetworkUpdate_ChannelFailure,
2536    /**
2537     * An error indicating that a node failed to route a payment, which should be applied via
2538     * [`NetworkGraph::node_failed`].
2539     */
2540    LDKNetworkUpdate_NodeFailure,
2541    /**
2542     * Must be last for serialization purposes
2543     */
2544    LDKNetworkUpdate_Sentinel,
2545 } LDKNetworkUpdate_Tag;
2546
2547 typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
2548    /**
2549     * The update to apply via [`NetworkGraph::update_channel`].
2550     */
2551    struct LDKChannelUpdate msg;
2552 } LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
2553
2554 typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
2555    /**
2556     * The short channel id of the closed channel.
2557     */
2558    uint64_t short_channel_id;
2559    /**
2560     * Whether the channel should be permanently removed or temporarily disabled until a new
2561     * `channel_update` message is received.
2562     */
2563    bool is_permanent;
2564 } LDKNetworkUpdate_LDKChannelFailure_Body;
2565
2566 typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
2567    /**
2568     * The node id of the failed node.
2569     */
2570    struct LDKPublicKey node_id;
2571    /**
2572     * Whether the node should be permanently removed from consideration or can be restored
2573     * when a new `channel_update` message is received.
2574     */
2575    bool is_permanent;
2576 } LDKNetworkUpdate_LDKNodeFailure_Body;
2577
2578 typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
2579    LDKNetworkUpdate_Tag tag;
2580    union {
2581       LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
2582       LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
2583       LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
2584    };
2585 } LDKNetworkUpdate;
2586
2587 /**
2588  * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
2589  */
2590 typedef enum LDKCOption_NetworkUpdateZ_Tag {
2591    /**
2592     * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
2593     */
2594    LDKCOption_NetworkUpdateZ_Some,
2595    /**
2596     * When we're in this state, this COption_NetworkUpdateZ contains nothing
2597     */
2598    LDKCOption_NetworkUpdateZ_None,
2599    /**
2600     * Must be last for serialization purposes
2601     */
2602    LDKCOption_NetworkUpdateZ_Sentinel,
2603 } LDKCOption_NetworkUpdateZ_Tag;
2604
2605 typedef struct LDKCOption_NetworkUpdateZ {
2606    LDKCOption_NetworkUpdateZ_Tag tag;
2607    union {
2608       struct {
2609          struct LDKNetworkUpdate some;
2610       };
2611    };
2612 } LDKCOption_NetworkUpdateZ;
2613
2614
2615
2616 /**
2617  * A reference to a transaction output.
2618  *
2619  * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
2620  * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
2621  */
2622 typedef struct MUST_USE_STRUCT LDKOutPoint {
2623    /**
2624     * A pointer to the opaque Rust object.
2625     * Nearly everywhere, inner must be non-null, however in places where
2626     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2627     */
2628    LDKnativeOutPoint *inner;
2629    /**
2630     * Indicates that this is the only struct which contains the same pointer.
2631     * Rust functions which take ownership of an object provided via an argument require
2632     * this to be true and invalidate the object pointed to by inner.
2633     */
2634    bool is_owned;
2635 } LDKOutPoint;
2636
2637
2638
2639 /**
2640  * Information about a spendable output to a P2WSH script. See
2641  * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
2642  */
2643 typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
2644    /**
2645     * A pointer to the opaque Rust object.
2646     * Nearly everywhere, inner must be non-null, however in places where
2647     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2648     */
2649    LDKnativeDelayedPaymentOutputDescriptor *inner;
2650    /**
2651     * Indicates that this is the only struct which contains the same pointer.
2652     * Rust functions which take ownership of an object provided via an argument require
2653     * this to be true and invalidate the object pointed to by inner.
2654     */
2655    bool is_owned;
2656 } LDKDelayedPaymentOutputDescriptor;
2657
2658
2659
2660 /**
2661  * Information about a spendable output to our \"payment key\". See
2662  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
2663  */
2664 typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
2665    /**
2666     * A pointer to the opaque Rust object.
2667     * Nearly everywhere, inner must be non-null, however in places where
2668     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2669     */
2670    LDKnativeStaticPaymentOutputDescriptor *inner;
2671    /**
2672     * Indicates that this is the only struct which contains the same pointer.
2673     * Rust functions which take ownership of an object provided via an argument require
2674     * this to be true and invalidate the object pointed to by inner.
2675     */
2676    bool is_owned;
2677 } LDKStaticPaymentOutputDescriptor;
2678
2679 /**
2680  * When on-chain outputs are created by rust-lightning (which our counterparty is not able to
2681  * claim at any point in the future) an event is generated which you must track and be able to
2682  * spend on-chain. The information needed to do this is provided in this enum, including the
2683  * outpoint describing which txid and output index is available, the full output which exists at
2684  * that txid/index, and any keys or other information required to sign.
2685  */
2686 typedef enum LDKSpendableOutputDescriptor_Tag {
2687    /**
2688     * An output to a script which was provided via KeysInterface directly, either from
2689     * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know
2690     * how to spend it. No secret keys are provided as rust-lightning was never given any key.
2691     * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
2692     * on-chain using the payment preimage or after it has timed out.
2693     */
2694    LDKSpendableOutputDescriptor_StaticOutput,
2695    /**
2696     * An output to a P2WSH script which can be spent with a single signature after a CSV delay.
2697     *
2698     * The witness in the spending input should be:
2699     * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
2700     *
2701     * Note that the nSequence field in the spending input must be set to to_self_delay
2702     * (which means the transaction is not broadcastable until at least to_self_delay
2703     * blocks after the outpoint confirms).
2704     *
2705     * These are generally the result of a \"revocable\" output to us, spendable only by us unless
2706     * it is an output from an old state which we broadcast (which should never happen).
2707     *
2708     * To derive the delayed_payment key which is used to sign for this input, you must pass the
2709     * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in
2710     * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to
2711     * chan_utils::derive_private_key. The public key can be generated without the secret key
2712     * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in
2713     * Sign::pubkeys().
2714     *
2715     * To derive the revocation_pubkey provided here (which is used in the witness
2716     * script generation), you must pass the counterparty revocation_basepoint (which appears in the
2717     * call to Sign::ready_channel) and the provided per_commitment point
2718     * to chan_utils::derive_public_revocation_key.
2719     *
2720     * The witness script which is hashed and included in the output script_pubkey may be
2721     * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey
2722     * (derived as above), and the to_self_delay contained here to
2723     * chan_utils::get_revokeable_redeemscript.
2724     */
2725    LDKSpendableOutputDescriptor_DelayedPaymentOutput,
2726    /**
2727     * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which
2728     * corresponds to the public key in Sign::pubkeys().payment_point).
2729     * The witness in the spending input, is, thus, simply:
2730     * <BIP 143 signature> <payment key>
2731     *
2732     * These are generally the result of our counterparty having broadcast the current state,
2733     * allowing us to claim the non-HTLC-encumbered outputs immediately.
2734     */
2735    LDKSpendableOutputDescriptor_StaticPaymentOutput,
2736    /**
2737     * Must be last for serialization purposes
2738     */
2739    LDKSpendableOutputDescriptor_Sentinel,
2740 } LDKSpendableOutputDescriptor_Tag;
2741
2742 typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
2743    /**
2744     * The outpoint which is spendable
2745     */
2746    struct LDKOutPoint outpoint;
2747    /**
2748     * The output which is referenced by the given outpoint.
2749     */
2750    struct LDKTxOut output;
2751 } LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
2752
2753 typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
2754    LDKSpendableOutputDescriptor_Tag tag;
2755    union {
2756       LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
2757       struct {
2758          struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
2759       };
2760       struct {
2761          struct LDKStaticPaymentOutputDescriptor static_payment_output;
2762       };
2763    };
2764 } LDKSpendableOutputDescriptor;
2765
2766 /**
2767  * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
2768  * This corresponds to std::vector in C++
2769  */
2770 typedef struct LDKCVec_SpendableOutputDescriptorZ {
2771    /**
2772     * The elements in the array.
2773     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
2774     */
2775    struct LDKSpendableOutputDescriptor *data;
2776    /**
2777     * The number of elements pointed to by `data`.
2778     */
2779    uintptr_t datalen;
2780 } LDKCVec_SpendableOutputDescriptorZ;
2781
2782
2783
2784 /**
2785  * Features used within the channel_type field in an OpenChannel message.
2786  *
2787  * A channel is always of some known \"type\", describing the transaction formats used and the exact
2788  * semantics of our interaction with our peer.
2789  *
2790  * Note that because a channel is a specific type which is proposed by the opener and accepted by
2791  * the counterparty, only required features are allowed here.
2792  *
2793  * This is serialized differently from other feature types - it is not prefixed by a length, and
2794  * thus must only appear inside a TLV where its length is known in advance.
2795  */
2796 typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
2797    /**
2798     * A pointer to the opaque Rust object.
2799     * Nearly everywhere, inner must be non-null, however in places where
2800     * the Rust equivalent takes an Option, it may be set to null to indicate None.
2801     */
2802    LDKnativeChannelTypeFeatures *inner;
2803    /**
2804     * Indicates that this is the only struct which contains the same pointer.
2805     * Rust functions which take ownership of an object provided via an argument require
2806     * this to be true and invalidate the object pointed to by inner.
2807     */
2808    bool is_owned;
2809 } LDKChannelTypeFeatures;
2810
2811 /**
2812  * An Event which you should probably take some action in response to.
2813  *
2814  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
2815  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
2816  * written as it makes no sense to respond to it after reconnecting to peers).
2817  */
2818 typedef enum LDKEvent_Tag {
2819    /**
2820     * Used to indicate that the client should generate a funding transaction with the given
2821     * parameters and then call [`ChannelManager::funding_transaction_generated`].
2822     * Generated in [`ChannelManager`] message handling.
2823     * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
2824     * counterparty can steal your funds!
2825     *
2826     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
2827     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2828     */
2829    LDKEvent_FundingGenerationReady,
2830    /**
2831     * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and
2832     * feed it to [`ChannelManager::claim_funds`] to get it....
2833     *
2834     * Note that if the preimage is not known, you should call
2835     * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid
2836     * network congestion.
2837     * If you fail to call either [`ChannelManager::claim_funds`] or
2838     * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be
2839     * automatically failed.
2840     *
2841     * # Note
2842     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2843     * `PaymentReceived` events may be generated for the same payment.
2844     *
2845     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2846     * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
2847     */
2848    LDKEvent_PaymentReceived,
2849    /**
2850     * Indicates a payment has been claimed and we've received money!
2851     *
2852     * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
2853     * to an [`Event::PaymentReceived`]. However, if we previously crashed during a
2854     * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
2855     * [`Event::PaymentReceived`] event.
2856     *
2857     * # Note
2858     * LDK will not stop an inbound payment from being paid multiple times, so multiple
2859     * `PaymentReceived` events may be generated for the same payment. If you then call
2860     * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get
2861     * multiple `PaymentClaimed` events.
2862     *
2863     * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
2864     */
2865    LDKEvent_PaymentClaimed,
2866    /**
2867     * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
2868     * and we got back the payment preimage for it).
2869     *
2870     * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
2871     * event. In this situation, you SHOULD treat this payment as having succeeded.
2872     */
2873    LDKEvent_PaymentSent,
2874    /**
2875     * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
2876     * provide failure information for each MPP part in the payment.
2877     *
2878     * This event is provided once there are no further pending HTLCs for the payment and the
2879     * payment is no longer retryable, either due to a several-block timeout or because
2880     * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
2881     *
2882     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
2883     */
2884    LDKEvent_PaymentFailed,
2885    /**
2886     * Indicates that a path for an outbound payment was successful.
2887     *
2888     * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
2889     * [`Event::PaymentSent`] for obtaining the payment preimage.
2890     */
2891    LDKEvent_PaymentPathSuccessful,
2892    /**
2893     * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
2894     * something. You may wish to retry with a different route.
2895     *
2896     * Note that this does *not* indicate that all paths for an MPP payment have failed, see
2897     * [`Event::PaymentFailed`] and [`all_paths_failed`].
2898     *
2899     * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed
2900     */
2901    LDKEvent_PaymentPathFailed,
2902    /**
2903     * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
2904     */
2905    LDKEvent_ProbeSuccessful,
2906    /**
2907     * Indicates that a probe payment we sent failed at an intermediary node on the path.
2908     */
2909    LDKEvent_ProbeFailed,
2910    /**
2911     * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
2912     * a time in the future.
2913     *
2914     * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
2915     */
2916    LDKEvent_PendingHTLCsForwardable,
2917    /**
2918     * Used to indicate that an output which you should know how to spend was confirmed on chain
2919     * and is now spendable.
2920     * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
2921     * counterparty spending them due to some kind of timeout. Thus, you need to store them
2922     * somewhere and spend them when you create on-chain transactions.
2923     */
2924    LDKEvent_SpendableOutputs,
2925    /**
2926     * This event is generated when a payment has been successfully forwarded through us and a
2927     * forwarding fee earned.
2928     */
2929    LDKEvent_PaymentForwarded,
2930    /**
2931     * Used to indicate that a previously opened channel with the given `channel_id` is in the
2932     * process of closure.
2933     */
2934    LDKEvent_ChannelClosed,
2935    /**
2936     * Used to indicate to the user that they can abandon the funding transaction and recycle the
2937     * inputs for another purpose.
2938     */
2939    LDKEvent_DiscardFunding,
2940    /**
2941     * Indicates a request to open a new channel by a peer.
2942     *
2943     * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
2944     * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
2945     *
2946     * The event is only triggered when a new open channel request is received and the
2947     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
2948     *
2949     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
2950     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
2951     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
2952     */
2953    LDKEvent_OpenChannelRequest,
2954    /**
2955     * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
2956     * forward it.
2957     *
2958     * Some scenarios where this event may be sent include:
2959     * * Insufficient capacity in the outbound channel
2960     * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
2961     * * When an unknown SCID is requested for forwarding a payment.
2962     * * Claiming an amount for an MPP payment that exceeds the HTLC total
2963     * * The HTLC has timed out
2964     *
2965     * This event, however, does not get generated if an HTLC fails to meet the forwarding
2966     * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
2967     */
2968    LDKEvent_HTLCHandlingFailed,
2969    /**
2970     * Must be last for serialization purposes
2971     */
2972    LDKEvent_Sentinel,
2973 } LDKEvent_Tag;
2974
2975 typedef struct LDKEvent_LDKFundingGenerationReady_Body {
2976    /**
2977     * The random channel_id we picked which you'll need to pass into
2978     * [`ChannelManager::funding_transaction_generated`].
2979     *
2980     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2981     */
2982    struct LDKThirtyTwoBytes temporary_channel_id;
2983    /**
2984     * The counterparty's node_id, which you'll need to pass back into
2985     * [`ChannelManager::funding_transaction_generated`].
2986     *
2987     * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
2988     */
2989    struct LDKPublicKey counterparty_node_id;
2990    /**
2991     * The value, in satoshis, that the output should have.
2992     */
2993    uint64_t channel_value_satoshis;
2994    /**
2995     * The script which should be used in the transaction output.
2996     */
2997    struct LDKCVec_u8Z output_script;
2998    /**
2999     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for
3000     * an inbound channel.
3001     *
3002     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3003     */
3004    uint64_t user_channel_id;
3005 } LDKEvent_LDKFundingGenerationReady_Body;
3006
3007 typedef struct LDKEvent_LDKPaymentReceived_Body {
3008    /**
3009     * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
3010     * not stop you from registering duplicate payment hashes for inbound payments.
3011     */
3012    struct LDKThirtyTwoBytes payment_hash;
3013    /**
3014     * The value, in thousandths of a satoshi, that this payment is for.
3015     */
3016    uint64_t amount_msat;
3017    /**
3018     * Information for claiming this received payment, based on whether the purpose of the
3019     * payment is to pay an invoice or to send a spontaneous payment.
3020     */
3021    struct LDKPaymentPurpose purpose;
3022 } LDKEvent_LDKPaymentReceived_Body;
3023
3024 typedef struct LDKEvent_LDKPaymentClaimed_Body {
3025    /**
3026     * The payment hash of the claimed payment. Note that LDK will not stop you from
3027     * registering duplicate payment hashes for inbound payments.
3028     */
3029    struct LDKThirtyTwoBytes payment_hash;
3030    /**
3031     * The value, in thousandths of a satoshi, that this payment is for.
3032     */
3033    uint64_t amount_msat;
3034    /**
3035     * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a
3036     * spontaneous payment.
3037     */
3038    struct LDKPaymentPurpose purpose;
3039 } LDKEvent_LDKPaymentClaimed_Body;
3040
3041 typedef struct LDKEvent_LDKPaymentSent_Body {
3042    /**
3043     * The id returned by [`ChannelManager::send_payment`] and used with
3044     * [`ChannelManager::retry_payment`].
3045     *
3046     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3047     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3048     *
3049     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3050     */
3051    struct LDKThirtyTwoBytes payment_id;
3052    /**
3053     * The preimage to the hash given to ChannelManager::send_payment.
3054     * Note that this serves as a payment receipt, if you wish to have such a thing, you must
3055     * store it somehow!
3056     */
3057    struct LDKThirtyTwoBytes payment_preimage;
3058    /**
3059     * The hash that was given to [`ChannelManager::send_payment`].
3060     *
3061     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3062     */
3063    struct LDKThirtyTwoBytes payment_hash;
3064    /**
3065     * The total fee which was spent at intermediate hops in this payment, across all paths.
3066     *
3067     * Note that, like [`Route::get_total_fees`] this does *not* include any potential
3068     * overpayment to the recipient node.
3069     *
3070     * If the recipient or an intermediate node misbehaves and gives us free money, this may
3071     * overstate the amount paid, though this is unlikely.
3072     *
3073     * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
3074     */
3075    struct LDKCOption_u64Z fee_paid_msat;
3076 } LDKEvent_LDKPaymentSent_Body;
3077
3078 typedef struct LDKEvent_LDKPaymentFailed_Body {
3079    /**
3080     * The id returned by [`ChannelManager::send_payment`] and used with
3081     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3082     *
3083     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3084     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3085     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3086     */
3087    struct LDKThirtyTwoBytes payment_id;
3088    /**
3089     * The hash that was given to [`ChannelManager::send_payment`].
3090     *
3091     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3092     */
3093    struct LDKThirtyTwoBytes payment_hash;
3094 } LDKEvent_LDKPaymentFailed_Body;
3095
3096 typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
3097    /**
3098     * The id returned by [`ChannelManager::send_payment`] and used with
3099     * [`ChannelManager::retry_payment`].
3100     *
3101     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3102     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3103     */
3104    struct LDKThirtyTwoBytes payment_id;
3105    /**
3106     * The hash that was given to [`ChannelManager::send_payment`].
3107     *
3108     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3109     *
3110     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3111     */
3112    struct LDKThirtyTwoBytes payment_hash;
3113    /**
3114     * The payment path that was successful.
3115     *
3116     * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
3117     */
3118    struct LDKCVec_RouteHopZ path;
3119 } LDKEvent_LDKPaymentPathSuccessful_Body;
3120
3121 typedef struct LDKEvent_LDKPaymentPathFailed_Body {
3122    /**
3123     * The id returned by [`ChannelManager::send_payment`] and used with
3124     * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
3125     *
3126     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3127     * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
3128     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3129     *
3130     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3131     */
3132    struct LDKThirtyTwoBytes payment_id;
3133    /**
3134     * The hash that was given to [`ChannelManager::send_payment`].
3135     *
3136     * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
3137     */
3138    struct LDKThirtyTwoBytes payment_hash;
3139    /**
3140     * Indicates the payment was rejected for some reason by the recipient. This implies that
3141     * the payment has failed, not just the route in question. If this is not set, you may
3142     * retry the payment via a different route.
3143     */
3144    bool rejected_by_dest;
3145    /**
3146     * Any failure information conveyed via the Onion return packet by a node along the failed
3147     * payment route.
3148     *
3149     * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
3150     * account the update.
3151     *
3152     * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
3153     */
3154    struct LDKCOption_NetworkUpdateZ network_update;
3155    /**
3156     * For both single-path and multi-path payments, this is set if all paths of the payment have
3157     * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
3158     * larger MPP payment were still in flight when this event was generated.
3159     *
3160     * Note that if you are retrying individual MPP parts, using this value to determine if a
3161     * payment has fully failed is race-y. Because multiple failures can happen prior to events
3162     * being processed, you may retry in response to a first failure, with a second failure
3163     * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
3164     * you will see `all_paths_failed` set even though the retry of the first failure still
3165     * has an associated in-flight HTLC. See (1) for an example of such a failure.
3166     *
3167     * If you wish to retry individual MPP parts and learn when a payment has failed, you must
3168     * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
3169     *
3170     * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
3171     *
3172     * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
3173     */
3174    bool all_paths_failed;
3175    /**
3176     * The payment path that failed.
3177     */
3178    struct LDKCVec_RouteHopZ path;
3179    /**
3180     * The channel responsible for the failed payment path.
3181     *
3182     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3183     * may not refer to a channel in the public network graph. These aliases may also collide
3184     * with channels in the public network graph.
3185     *
3186     * If this is `Some`, then the corresponding channel should be avoided when the payment is
3187     * retried. May be `None` for older [`Event`] serializations.
3188     */
3189    struct LDKCOption_u64Z short_channel_id;
3190    /**
3191     * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
3192     *
3193     * See [`find_route`] for details.
3194     *
3195     * [`Route`]: crate::routing::router::Route
3196     * [`find_route`]: crate::routing::router::find_route
3197     *
3198     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3199     */
3200    struct LDKRouteParameters retry;
3201 } LDKEvent_LDKPaymentPathFailed_Body;
3202
3203 typedef struct LDKEvent_LDKProbeSuccessful_Body {
3204    /**
3205     * The id returned by [`ChannelManager::send_probe`].
3206     *
3207     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3208     */
3209    struct LDKThirtyTwoBytes payment_id;
3210    /**
3211     * The hash generated by [`ChannelManager::send_probe`].
3212     *
3213     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3214     */
3215    struct LDKThirtyTwoBytes payment_hash;
3216    /**
3217     * The payment path that was successful.
3218     */
3219    struct LDKCVec_RouteHopZ path;
3220 } LDKEvent_LDKProbeSuccessful_Body;
3221
3222 typedef struct LDKEvent_LDKProbeFailed_Body {
3223    /**
3224     * The id returned by [`ChannelManager::send_probe`].
3225     *
3226     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3227     */
3228    struct LDKThirtyTwoBytes payment_id;
3229    /**
3230     * The hash generated by [`ChannelManager::send_probe`].
3231     *
3232     * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
3233     */
3234    struct LDKThirtyTwoBytes payment_hash;
3235    /**
3236     * The payment path that failed.
3237     */
3238    struct LDKCVec_RouteHopZ path;
3239    /**
3240     * The channel responsible for the failed probe.
3241     *
3242     * Note that for route hints or for the first hop in a path this may be an SCID alias and
3243     * may not refer to a channel in the public network graph. These aliases may also collide
3244     * with channels in the public network graph.
3245     */
3246    struct LDKCOption_u64Z short_channel_id;
3247 } LDKEvent_LDKProbeFailed_Body;
3248
3249 typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
3250    /**
3251     * The minimum amount of time that should be waited prior to calling
3252     * process_pending_htlc_forwards. To increase the effort required to correlate payments,
3253     * you should wait a random amount of time in roughly the range (now + time_forwardable,
3254     * now + 5*time_forwardable).
3255     */
3256    uint64_t time_forwardable;
3257 } LDKEvent_LDKPendingHTLCsForwardable_Body;
3258
3259 typedef struct LDKEvent_LDKSpendableOutputs_Body {
3260    /**
3261     * The outputs which you should store as spendable by you.
3262     */
3263    struct LDKCVec_SpendableOutputDescriptorZ outputs;
3264 } LDKEvent_LDKSpendableOutputs_Body;
3265
3266 typedef struct LDKEvent_LDKPaymentForwarded_Body {
3267    /**
3268     * The incoming channel between the previous node and us. This is only `None` for events
3269     * generated or serialized by versions prior to 0.0.107.
3270     *
3271     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3272     */
3273    struct LDKThirtyTwoBytes prev_channel_id;
3274    /**
3275     * The outgoing channel between the next node and us. This is only `None` for events
3276     * generated or serialized by versions prior to 0.0.107.
3277     *
3278     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3279     */
3280    struct LDKThirtyTwoBytes next_channel_id;
3281    /**
3282     * The fee, in milli-satoshis, which was earned as a result of the payment.
3283     *
3284     * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
3285     * was pending, the amount the next hop claimed will have been rounded down to the nearest
3286     * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
3287     * claimed the full value in millisatoshis from the source. In this case,
3288     * `claim_from_onchain_tx` will be set.
3289     *
3290     * If the channel which sent us the payment has been force-closed, we will claim the funds
3291     * via an on-chain transaction. In that case we do not yet know the on-chain transaction
3292     * fees which we will spend and will instead set this to `None`. It is possible duplicate
3293     * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
3294     * `None`.
3295     */
3296    struct LDKCOption_u64Z fee_earned_msat;
3297    /**
3298     * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
3299     * transaction.
3300     */
3301    bool claim_from_onchain_tx;
3302 } LDKEvent_LDKPaymentForwarded_Body;
3303
3304 typedef struct LDKEvent_LDKChannelClosed_Body {
3305    /**
3306     * The channel_id of the channel which has been closed. Note that on-chain transactions
3307     * resolving the channel are likely still awaiting confirmation.
3308     */
3309    struct LDKThirtyTwoBytes channel_id;
3310    /**
3311     * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
3312     * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
3313     * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
3314     * `user_channel_id` will be 0 for an inbound channel.
3315     * This will always be zero for objects serialized with LDK versions prior to 0.0.102.
3316     *
3317     * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
3318     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3319     * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
3320     */
3321    uint64_t user_channel_id;
3322    /**
3323     * The reason the channel was closed.
3324     */
3325    struct LDKClosureReason reason;
3326 } LDKEvent_LDKChannelClosed_Body;
3327
3328 typedef struct LDKEvent_LDKDiscardFunding_Body {
3329    /**
3330     * The channel_id of the channel which has been closed.
3331     */
3332    struct LDKThirtyTwoBytes channel_id;
3333    /**
3334     * The full transaction received from the user
3335     */
3336    struct LDKTransaction transaction;
3337 } LDKEvent_LDKDiscardFunding_Body;
3338
3339 typedef struct LDKEvent_LDKOpenChannelRequest_Body {
3340    /**
3341     * The temporary channel ID of the channel requested to be opened.
3342     *
3343     * When responding to the request, the `temporary_channel_id` should be passed
3344     * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
3345     * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
3346     *
3347     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3348     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3349     */
3350    struct LDKThirtyTwoBytes temporary_channel_id;
3351    /**
3352     * The node_id of the counterparty requesting to open the channel.
3353     *
3354     * When responding to the request, the `counterparty_node_id` should be passed
3355     * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
3356     * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
3357     * request.
3358     *
3359     * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
3360     * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
3361     */
3362    struct LDKPublicKey counterparty_node_id;
3363    /**
3364     * The channel value of the requested channel.
3365     */
3366    uint64_t funding_satoshis;
3367    /**
3368     * Our starting balance in the channel if the request is accepted, in milli-satoshi.
3369     */
3370    uint64_t push_msat;
3371    /**
3372     * The features that this channel will operate with. If you reject the channel, a
3373     * well-behaved counterparty may automatically re-attempt the channel with a new set of
3374     * feature flags.
3375     *
3376     * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
3377     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3378     * 0.0.106.
3379     *
3380     * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
3381     * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
3382     * 0.0.107. Channels setting this type also need to get manually accepted via
3383     * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
3384     * or will be rejected otherwise.
3385     *
3386     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
3387     */
3388    struct LDKChannelTypeFeatures channel_type;
3389 } LDKEvent_LDKOpenChannelRequest_Body;
3390
3391 typedef struct LDKEvent_LDKHTLCHandlingFailed_Body {
3392    /**
3393     * The channel over which the HTLC was received.
3394     */
3395    struct LDKThirtyTwoBytes prev_channel_id;
3396    /**
3397     * Destination of the HTLC that failed to be processed.
3398     */
3399    struct LDKHTLCDestination failed_next_destination;
3400 } LDKEvent_LDKHTLCHandlingFailed_Body;
3401
3402 typedef struct MUST_USE_STRUCT LDKEvent {
3403    LDKEvent_Tag tag;
3404    union {
3405       LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
3406       LDKEvent_LDKPaymentReceived_Body payment_received;
3407       LDKEvent_LDKPaymentClaimed_Body payment_claimed;
3408       LDKEvent_LDKPaymentSent_Body payment_sent;
3409       LDKEvent_LDKPaymentFailed_Body payment_failed;
3410       LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
3411       LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
3412       LDKEvent_LDKProbeSuccessful_Body probe_successful;
3413       LDKEvent_LDKProbeFailed_Body probe_failed;
3414       LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
3415       LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
3416       LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
3417       LDKEvent_LDKChannelClosed_Body channel_closed;
3418       LDKEvent_LDKDiscardFunding_Body discard_funding;
3419       LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
3420       LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed;
3421    };
3422 } LDKEvent;
3423
3424 /**
3425  * An enum which can either contain a crate::lightning::util::events::Event or not
3426  */
3427 typedef enum LDKCOption_EventZ_Tag {
3428    /**
3429     * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
3430     */
3431    LDKCOption_EventZ_Some,
3432    /**
3433     * When we're in this state, this COption_EventZ contains nothing
3434     */
3435    LDKCOption_EventZ_None,
3436    /**
3437     * Must be last for serialization purposes
3438     */
3439    LDKCOption_EventZ_Sentinel,
3440 } LDKCOption_EventZ_Tag;
3441
3442 typedef struct LDKCOption_EventZ {
3443    LDKCOption_EventZ_Tag tag;
3444    union {
3445       struct {
3446          struct LDKEvent some;
3447       };
3448    };
3449 } LDKCOption_EventZ;
3450
3451 /**
3452  * The contents of CResult_COption_EventZDecodeErrorZ
3453  */
3454 typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
3455    /**
3456     * A pointer to the contents in the success state.
3457     * Reading from this pointer when `result_ok` is not set is undefined.
3458     */
3459    struct LDKCOption_EventZ *result;
3460    /**
3461     * A pointer to the contents in the error state.
3462     * Reading from this pointer when `result_ok` is set is undefined.
3463     */
3464    struct LDKDecodeError *err;
3465 } LDKCResult_COption_EventZDecodeErrorZPtr;
3466
3467 /**
3468  * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
3469  * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
3470  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
3471  */
3472 typedef struct LDKCResult_COption_EventZDecodeErrorZ {
3473    /**
3474     * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
3475     * `err` or `result` depending on the state of `result_ok`.
3476     */
3477    union LDKCResult_COption_EventZDecodeErrorZPtr contents;
3478    /**
3479     * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
3480     */
3481    bool result_ok;
3482 } LDKCResult_COption_EventZDecodeErrorZ;
3483
3484
3485
3486 /**
3487  * An accept_channel message to be sent or received from a peer
3488  */
3489 typedef struct MUST_USE_STRUCT LDKAcceptChannel {
3490    /**
3491     * A pointer to the opaque Rust object.
3492     * Nearly everywhere, inner must be non-null, however in places where
3493     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3494     */
3495    LDKnativeAcceptChannel *inner;
3496    /**
3497     * Indicates that this is the only struct which contains the same pointer.
3498     * Rust functions which take ownership of an object provided via an argument require
3499     * this to be true and invalidate the object pointed to by inner.
3500     */
3501    bool is_owned;
3502 } LDKAcceptChannel;
3503
3504
3505
3506 /**
3507  * An open_channel message to be sent or received from a peer
3508  */
3509 typedef struct MUST_USE_STRUCT LDKOpenChannel {
3510    /**
3511     * A pointer to the opaque Rust object.
3512     * Nearly everywhere, inner must be non-null, however in places where
3513     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3514     */
3515    LDKnativeOpenChannel *inner;
3516    /**
3517     * Indicates that this is the only struct which contains the same pointer.
3518     * Rust functions which take ownership of an object provided via an argument require
3519     * this to be true and invalidate the object pointed to by inner.
3520     */
3521    bool is_owned;
3522 } LDKOpenChannel;
3523
3524
3525
3526 /**
3527  * A funding_created message to be sent or received from a peer
3528  */
3529 typedef struct MUST_USE_STRUCT LDKFundingCreated {
3530    /**
3531     * A pointer to the opaque Rust object.
3532     * Nearly everywhere, inner must be non-null, however in places where
3533     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3534     */
3535    LDKnativeFundingCreated *inner;
3536    /**
3537     * Indicates that this is the only struct which contains the same pointer.
3538     * Rust functions which take ownership of an object provided via an argument require
3539     * this to be true and invalidate the object pointed to by inner.
3540     */
3541    bool is_owned;
3542 } LDKFundingCreated;
3543
3544
3545
3546 /**
3547  * A funding_signed message to be sent or received from a peer
3548  */
3549 typedef struct MUST_USE_STRUCT LDKFundingSigned {
3550    /**
3551     * A pointer to the opaque Rust object.
3552     * Nearly everywhere, inner must be non-null, however in places where
3553     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3554     */
3555    LDKnativeFundingSigned *inner;
3556    /**
3557     * Indicates that this is the only struct which contains the same pointer.
3558     * Rust functions which take ownership of an object provided via an argument require
3559     * this to be true and invalidate the object pointed to by inner.
3560     */
3561    bool is_owned;
3562 } LDKFundingSigned;
3563
3564
3565
3566 /**
3567  * A channel_ready message to be sent or received from a peer
3568  */
3569 typedef struct MUST_USE_STRUCT LDKChannelReady {
3570    /**
3571     * A pointer to the opaque Rust object.
3572     * Nearly everywhere, inner must be non-null, however in places where
3573     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3574     */
3575    LDKnativeChannelReady *inner;
3576    /**
3577     * Indicates that this is the only struct which contains the same pointer.
3578     * Rust functions which take ownership of an object provided via an argument require
3579     * this to be true and invalidate the object pointed to by inner.
3580     */
3581    bool is_owned;
3582 } LDKChannelReady;
3583
3584
3585
3586 /**
3587  * An announcement_signatures message to be sent or received from a peer
3588  */
3589 typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
3590    /**
3591     * A pointer to the opaque Rust object.
3592     * Nearly everywhere, inner must be non-null, however in places where
3593     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3594     */
3595    LDKnativeAnnouncementSignatures *inner;
3596    /**
3597     * Indicates that this is the only struct which contains the same pointer.
3598     * Rust functions which take ownership of an object provided via an argument require
3599     * this to be true and invalidate the object pointed to by inner.
3600     */
3601    bool is_owned;
3602 } LDKAnnouncementSignatures;
3603
3604
3605
3606 /**
3607  * Struct used to return values from revoke_and_ack messages, containing a bunch of commitment
3608  * transaction updates if they were pending.
3609  */
3610 typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
3611    /**
3612     * A pointer to the opaque Rust object.
3613     * Nearly everywhere, inner must be non-null, however in places where
3614     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3615     */
3616    LDKnativeCommitmentUpdate *inner;
3617    /**
3618     * Indicates that this is the only struct which contains the same pointer.
3619     * Rust functions which take ownership of an object provided via an argument require
3620     * this to be true and invalidate the object pointed to by inner.
3621     */
3622    bool is_owned;
3623 } LDKCommitmentUpdate;
3624
3625
3626
3627 /**
3628  * A revoke_and_ack message to be sent or received from a peer
3629  */
3630 typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
3631    /**
3632     * A pointer to the opaque Rust object.
3633     * Nearly everywhere, inner must be non-null, however in places where
3634     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3635     */
3636    LDKnativeRevokeAndACK *inner;
3637    /**
3638     * Indicates that this is the only struct which contains the same pointer.
3639     * Rust functions which take ownership of an object provided via an argument require
3640     * this to be true and invalidate the object pointed to by inner.
3641     */
3642    bool is_owned;
3643 } LDKRevokeAndACK;
3644
3645
3646
3647 /**
3648  * A closing_signed message to be sent or received from a peer
3649  */
3650 typedef struct MUST_USE_STRUCT LDKClosingSigned {
3651    /**
3652     * A pointer to the opaque Rust object.
3653     * Nearly everywhere, inner must be non-null, however in places where
3654     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3655     */
3656    LDKnativeClosingSigned *inner;
3657    /**
3658     * Indicates that this is the only struct which contains the same pointer.
3659     * Rust functions which take ownership of an object provided via an argument require
3660     * this to be true and invalidate the object pointed to by inner.
3661     */
3662    bool is_owned;
3663 } LDKClosingSigned;
3664
3665
3666
3667 /**
3668  * A shutdown message to be sent or received from a peer
3669  */
3670 typedef struct MUST_USE_STRUCT LDKShutdown {
3671    /**
3672     * A pointer to the opaque Rust object.
3673     * Nearly everywhere, inner must be non-null, however in places where
3674     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3675     */
3676    LDKnativeShutdown *inner;
3677    /**
3678     * Indicates that this is the only struct which contains the same pointer.
3679     * Rust functions which take ownership of an object provided via an argument require
3680     * this to be true and invalidate the object pointed to by inner.
3681     */
3682    bool is_owned;
3683 } LDKShutdown;
3684
3685
3686
3687 /**
3688  * A channel_reestablish message to be sent or received from a peer
3689  */
3690 typedef struct MUST_USE_STRUCT LDKChannelReestablish {
3691    /**
3692     * A pointer to the opaque Rust object.
3693     * Nearly everywhere, inner must be non-null, however in places where
3694     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3695     */
3696    LDKnativeChannelReestablish *inner;
3697    /**
3698     * Indicates that this is the only struct which contains the same pointer.
3699     * Rust functions which take ownership of an object provided via an argument require
3700     * this to be true and invalidate the object pointed to by inner.
3701     */
3702    bool is_owned;
3703 } LDKChannelReestablish;
3704
3705
3706
3707 /**
3708  * A channel_announcement message to be sent or received from a peer
3709  */
3710 typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
3711    /**
3712     * A pointer to the opaque Rust object.
3713     * Nearly everywhere, inner must be non-null, however in places where
3714     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3715     */
3716    LDKnativeChannelAnnouncement *inner;
3717    /**
3718     * Indicates that this is the only struct which contains the same pointer.
3719     * Rust functions which take ownership of an object provided via an argument require
3720     * this to be true and invalidate the object pointed to by inner.
3721     */
3722    bool is_owned;
3723 } LDKChannelAnnouncement;
3724
3725
3726
3727 /**
3728  * A node_announcement message to be sent or received from a peer
3729  */
3730 typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
3731    /**
3732     * A pointer to the opaque Rust object.
3733     * Nearly everywhere, inner must be non-null, however in places where
3734     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3735     */
3736    LDKnativeNodeAnnouncement *inner;
3737    /**
3738     * Indicates that this is the only struct which contains the same pointer.
3739     * Rust functions which take ownership of an object provided via an argument require
3740     * this to be true and invalidate the object pointed to by inner.
3741     */
3742    bool is_owned;
3743 } LDKNodeAnnouncement;
3744
3745
3746
3747 /**
3748  * An error message to be sent or received from a peer
3749  */
3750 typedef struct MUST_USE_STRUCT LDKErrorMessage {
3751    /**
3752     * A pointer to the opaque Rust object.
3753     * Nearly everywhere, inner must be non-null, however in places where
3754     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3755     */
3756    LDKnativeErrorMessage *inner;
3757    /**
3758     * Indicates that this is the only struct which contains the same pointer.
3759     * Rust functions which take ownership of an object provided via an argument require
3760     * this to be true and invalidate the object pointed to by inner.
3761     */
3762    bool is_owned;
3763 } LDKErrorMessage;
3764
3765
3766
3767 /**
3768  * A warning message to be sent or received from a peer
3769  */
3770 typedef struct MUST_USE_STRUCT LDKWarningMessage {
3771    /**
3772     * A pointer to the opaque Rust object.
3773     * Nearly everywhere, inner must be non-null, however in places where
3774     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3775     */
3776    LDKnativeWarningMessage *inner;
3777    /**
3778     * Indicates that this is the only struct which contains the same pointer.
3779     * Rust functions which take ownership of an object provided via an argument require
3780     * this to be true and invalidate the object pointed to by inner.
3781     */
3782    bool is_owned;
3783 } LDKWarningMessage;
3784
3785 /**
3786  * Used to put an error message in a LightningError
3787  */
3788 typedef enum LDKErrorAction_Tag {
3789    /**
3790     * The peer took some action which made us think they were useless. Disconnect them.
3791     */
3792    LDKErrorAction_DisconnectPeer,
3793    /**
3794     * The peer did something harmless that we weren't able to process, just log and ignore
3795     */
3796    LDKErrorAction_IgnoreError,
3797    /**
3798     * The peer did something harmless that we weren't able to meaningfully process.
3799     * If the error is logged, log it at the given level.
3800     */
3801    LDKErrorAction_IgnoreAndLog,
3802    /**
3803     * The peer provided us with a gossip message which we'd already seen. In most cases this
3804     * should be ignored, but it may result in the message being forwarded if it is a duplicate of
3805     * our own channel announcements.
3806     */
3807    LDKErrorAction_IgnoreDuplicateGossip,
3808    /**
3809     * The peer did something incorrect. Tell them.
3810     */
3811    LDKErrorAction_SendErrorMessage,
3812    /**
3813     * The peer did something incorrect. Tell them without closing any channels.
3814     */
3815    LDKErrorAction_SendWarningMessage,
3816    /**
3817     * Must be last for serialization purposes
3818     */
3819    LDKErrorAction_Sentinel,
3820 } LDKErrorAction_Tag;
3821
3822 typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
3823    /**
3824     * An error message which we should make an effort to send before we disconnect.
3825     *
3826     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
3827     */
3828    struct LDKErrorMessage msg;
3829 } LDKErrorAction_LDKDisconnectPeer_Body;
3830
3831 typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
3832    /**
3833     * The message to send.
3834     */
3835    struct LDKErrorMessage msg;
3836 } LDKErrorAction_LDKSendErrorMessage_Body;
3837
3838 typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
3839    /**
3840     * The message to send.
3841     */
3842    struct LDKWarningMessage msg;
3843    /**
3844     * The peer may have done something harmless that we weren't able to meaningfully process,
3845     * though we should still tell them about it.
3846     * If this event is logged, log it at the given level.
3847     */
3848    enum LDKLevel log_level;
3849 } LDKErrorAction_LDKSendWarningMessage_Body;
3850
3851 typedef struct MUST_USE_STRUCT LDKErrorAction {
3852    LDKErrorAction_Tag tag;
3853    union {
3854       LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
3855       struct {
3856          enum LDKLevel ignore_and_log;
3857       };
3858       LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
3859       LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
3860    };
3861 } LDKErrorAction;
3862
3863
3864
3865 /**
3866  * A query_channel_range message is used to query a peer for channel
3867  * UTXOs in a range of blocks. The recipient of a query makes a best
3868  * effort to reply to the query using one or more reply_channel_range
3869  * messages.
3870  */
3871 typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
3872    /**
3873     * A pointer to the opaque Rust object.
3874     * Nearly everywhere, inner must be non-null, however in places where
3875     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3876     */
3877    LDKnativeQueryChannelRange *inner;
3878    /**
3879     * Indicates that this is the only struct which contains the same pointer.
3880     * Rust functions which take ownership of an object provided via an argument require
3881     * this to be true and invalidate the object pointed to by inner.
3882     */
3883    bool is_owned;
3884 } LDKQueryChannelRange;
3885
3886
3887
3888 /**
3889  * A query_short_channel_ids message is used to query a peer for
3890  * routing gossip messages related to one or more short_channel_ids.
3891  * The query recipient will reply with the latest, if available,
3892  * channel_announcement, channel_update and node_announcement messages
3893  * it maintains for the requested short_channel_ids followed by a
3894  * reply_short_channel_ids_end message. The short_channel_ids sent in
3895  * this query are encoded. We only support encoding_type=0 uncompressed
3896  * serialization and do not support encoding_type=1 zlib serialization.
3897  */
3898 typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
3899    /**
3900     * A pointer to the opaque Rust object.
3901     * Nearly everywhere, inner must be non-null, however in places where
3902     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3903     */
3904    LDKnativeQueryShortChannelIds *inner;
3905    /**
3906     * Indicates that this is the only struct which contains the same pointer.
3907     * Rust functions which take ownership of an object provided via an argument require
3908     * this to be true and invalidate the object pointed to by inner.
3909     */
3910    bool is_owned;
3911 } LDKQueryShortChannelIds;
3912
3913
3914
3915 /**
3916  * A reply_channel_range message is a reply to a query_channel_range
3917  * message. Multiple reply_channel_range messages can be sent in reply
3918  * to a single query_channel_range message. The query recipient makes a
3919  * best effort to respond based on their local network view which may
3920  * not be a perfect view of the network. The short_channel_ids in the
3921  * reply are encoded. We only support encoding_type=0 uncompressed
3922  * serialization and do not support encoding_type=1 zlib serialization.
3923  */
3924 typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
3925    /**
3926     * A pointer to the opaque Rust object.
3927     * Nearly everywhere, inner must be non-null, however in places where
3928     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3929     */
3930    LDKnativeReplyChannelRange *inner;
3931    /**
3932     * Indicates that this is the only struct which contains the same pointer.
3933     * Rust functions which take ownership of an object provided via an argument require
3934     * this to be true and invalidate the object pointed to by inner.
3935     */
3936    bool is_owned;
3937 } LDKReplyChannelRange;
3938
3939
3940
3941 /**
3942  * A gossip_timestamp_filter message is used by a node to request
3943  * gossip relay for messages in the requested time range when the
3944  * gossip_queries feature has been negotiated.
3945  */
3946 typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
3947    /**
3948     * A pointer to the opaque Rust object.
3949     * Nearly everywhere, inner must be non-null, however in places where
3950     * the Rust equivalent takes an Option, it may be set to null to indicate None.
3951     */
3952    LDKnativeGossipTimestampFilter *inner;
3953    /**
3954     * Indicates that this is the only struct which contains the same pointer.
3955     * Rust functions which take ownership of an object provided via an argument require
3956     * this to be true and invalidate the object pointed to by inner.
3957     */
3958    bool is_owned;
3959 } LDKGossipTimestampFilter;
3960
3961 /**
3962  * An event generated by ChannelManager which indicates a message should be sent to a peer (or
3963  * broadcast to most peers).
3964  * These events are handled by PeerManager::process_events if you are using a PeerManager.
3965  */
3966 typedef enum LDKMessageSendEvent_Tag {
3967    /**
3968     * Used to indicate that we've accepted a channel open and should send the accept_channel
3969     * message provided to the given peer.
3970     */
3971    LDKMessageSendEvent_SendAcceptChannel,
3972    /**
3973     * Used to indicate that we've initiated a channel open and should send the open_channel
3974     * message provided to the given peer.
3975     */
3976    LDKMessageSendEvent_SendOpenChannel,
3977    /**
3978     * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
3979     */
3980    LDKMessageSendEvent_SendFundingCreated,
3981    /**
3982     * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
3983     */
3984    LDKMessageSendEvent_SendFundingSigned,
3985    /**
3986     * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
3987     */
3988    LDKMessageSendEvent_SendChannelReady,
3989    /**
3990     * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
3991     */
3992    LDKMessageSendEvent_SendAnnouncementSignatures,
3993    /**
3994     * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
3995     * message should be sent to the peer with the given node_id.
3996     */
3997    LDKMessageSendEvent_UpdateHTLCs,
3998    /**
3999     * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
4000     */
4001    LDKMessageSendEvent_SendRevokeAndACK,
4002    /**
4003     * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
4004     */
4005    LDKMessageSendEvent_SendClosingSigned,
4006    /**
4007     * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
4008     */
4009    LDKMessageSendEvent_SendShutdown,
4010    /**
4011     * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
4012     */
4013    LDKMessageSendEvent_SendChannelReestablish,
4014    /**
4015     * Used to indicate that a channel_announcement and channel_update should be broadcast to all
4016     * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
4017     *
4018     * Note that after doing so, you very likely (unless you did so very recently) want to call
4019     * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event.
4020     * This ensures that any nodes which see our channel_announcement also have a relevant
4021     * node_announcement, including relevant feature flags which may be important for routing
4022     * through or to us.
4023     */
4024    LDKMessageSendEvent_BroadcastChannelAnnouncement,
4025    /**
4026     * Used to indicate that a node_announcement should be broadcast to all peers.
4027     */
4028    LDKMessageSendEvent_BroadcastNodeAnnouncement,
4029    /**
4030     * Used to indicate that a channel_update should be broadcast to all peers.
4031     */
4032    LDKMessageSendEvent_BroadcastChannelUpdate,
4033    /**
4034     * Used to indicate that a channel_update should be sent to a single peer.
4035     * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
4036     * private channel and we shouldn't be informing all of our peers of channel parameters.
4037     */
4038    LDKMessageSendEvent_SendChannelUpdate,
4039    /**
4040     * Broadcast an error downstream to be handled
4041     */
4042    LDKMessageSendEvent_HandleError,
4043    /**
4044     * Query a peer for channels with funding transaction UTXOs in a block range.
4045     */
4046    LDKMessageSendEvent_SendChannelRangeQuery,
4047    /**
4048     * Request routing gossip messages from a peer for a list of channels identified by
4049     * their short_channel_ids.
4050     */
4051    LDKMessageSendEvent_SendShortIdsQuery,
4052    /**
4053     * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
4054     * emitted during processing of the query.
4055     */
4056    LDKMessageSendEvent_SendReplyChannelRange,
4057    /**
4058     * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
4059     * enable receiving gossip messages from the peer.
4060     */
4061    LDKMessageSendEvent_SendGossipTimestampFilter,
4062    /**
4063     * Must be last for serialization purposes
4064     */
4065    LDKMessageSendEvent_Sentinel,
4066 } LDKMessageSendEvent_Tag;
4067
4068 typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
4069    /**
4070     * The node_id of the node which should receive this message
4071     */
4072    struct LDKPublicKey node_id;
4073    /**
4074     * The message which should be sent.
4075     */
4076    struct LDKAcceptChannel msg;
4077 } LDKMessageSendEvent_LDKSendAcceptChannel_Body;
4078
4079 typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
4080    /**
4081     * The node_id of the node which should receive this message
4082     */
4083    struct LDKPublicKey node_id;
4084    /**
4085     * The message which should be sent.
4086     */
4087    struct LDKOpenChannel msg;
4088 } LDKMessageSendEvent_LDKSendOpenChannel_Body;
4089
4090 typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
4091    /**
4092     * The node_id of the node which should receive this message
4093     */
4094    struct LDKPublicKey node_id;
4095    /**
4096     * The message which should be sent.
4097     */
4098    struct LDKFundingCreated msg;
4099 } LDKMessageSendEvent_LDKSendFundingCreated_Body;
4100
4101 typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
4102    /**
4103     * The node_id of the node which should receive this message
4104     */
4105    struct LDKPublicKey node_id;
4106    /**
4107     * The message which should be sent.
4108     */
4109    struct LDKFundingSigned msg;
4110 } LDKMessageSendEvent_LDKSendFundingSigned_Body;
4111
4112 typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
4113    /**
4114     * The node_id of the node which should receive these message(s)
4115     */
4116    struct LDKPublicKey node_id;
4117    /**
4118     * The channel_ready message which should be sent.
4119     */
4120    struct LDKChannelReady msg;
4121 } LDKMessageSendEvent_LDKSendChannelReady_Body;
4122
4123 typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
4124    /**
4125     * The node_id of the node which should receive these message(s)
4126     */
4127    struct LDKPublicKey node_id;
4128    /**
4129     * The announcement_signatures message which should be sent.
4130     */
4131    struct LDKAnnouncementSignatures msg;
4132 } LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
4133
4134 typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
4135    /**
4136     * The node_id of the node which should receive these message(s)
4137     */
4138    struct LDKPublicKey node_id;
4139    /**
4140     * The update messages which should be sent. ALL messages in the struct should be sent!
4141     */
4142    struct LDKCommitmentUpdate updates;
4143 } LDKMessageSendEvent_LDKUpdateHTLCs_Body;
4144
4145 typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
4146    /**
4147     * The node_id of the node which should receive this message
4148     */
4149    struct LDKPublicKey node_id;
4150    /**
4151     * The message which should be sent.
4152     */
4153    struct LDKRevokeAndACK msg;
4154 } LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
4155
4156 typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
4157    /**
4158     * The node_id of the node which should receive this message
4159     */
4160    struct LDKPublicKey node_id;
4161    /**
4162     * The message which should be sent.
4163     */
4164    struct LDKClosingSigned msg;
4165 } LDKMessageSendEvent_LDKSendClosingSigned_Body;
4166
4167 typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
4168    /**
4169     * The node_id of the node which should receive this message
4170     */
4171    struct LDKPublicKey node_id;
4172    /**
4173     * The message which should be sent.
4174     */
4175    struct LDKShutdown msg;
4176 } LDKMessageSendEvent_LDKSendShutdown_Body;
4177
4178 typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
4179    /**
4180     * The node_id of the node which should receive this message
4181     */
4182    struct LDKPublicKey node_id;
4183    /**
4184     * The message which should be sent.
4185     */
4186    struct LDKChannelReestablish msg;
4187 } LDKMessageSendEvent_LDKSendChannelReestablish_Body;
4188
4189 typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
4190    /**
4191     * The channel_announcement which should be sent.
4192     */
4193    struct LDKChannelAnnouncement msg;
4194    /**
4195     * The followup channel_update which should be sent.
4196     */
4197    struct LDKChannelUpdate update_msg;
4198 } LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
4199
4200 typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
4201    /**
4202     * The node_announcement which should be sent.
4203     */
4204    struct LDKNodeAnnouncement msg;
4205 } LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
4206
4207 typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
4208    /**
4209     * The channel_update which should be sent.
4210     */
4211    struct LDKChannelUpdate msg;
4212 } LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
4213
4214 typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
4215    /**
4216     * The node_id of the node which should receive this message
4217     */
4218    struct LDKPublicKey node_id;
4219    /**
4220     * The channel_update which should be sent.
4221     */
4222    struct LDKChannelUpdate msg;
4223 } LDKMessageSendEvent_LDKSendChannelUpdate_Body;
4224
4225 typedef struct LDKMessageSendEvent_LDKHandleError_Body {
4226    /**
4227     * The node_id of the node which should receive this message
4228     */
4229    struct LDKPublicKey node_id;
4230    /**
4231     * The action which should be taken.
4232     */
4233    struct LDKErrorAction action;
4234 } LDKMessageSendEvent_LDKHandleError_Body;
4235
4236 typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
4237    /**
4238     * The node_id of this message recipient
4239     */
4240    struct LDKPublicKey node_id;
4241    /**
4242     * The query_channel_range which should be sent.
4243     */
4244    struct LDKQueryChannelRange msg;
4245 } LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
4246
4247 typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
4248    /**
4249     * The node_id of this message recipient
4250     */
4251    struct LDKPublicKey node_id;
4252    /**
4253     * The query_short_channel_ids which should be sent.
4254     */
4255    struct LDKQueryShortChannelIds msg;
4256 } LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
4257
4258 typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
4259    /**
4260     * The node_id of this message recipient
4261     */
4262    struct LDKPublicKey node_id;
4263    /**
4264     * The reply_channel_range which should be sent.
4265     */
4266    struct LDKReplyChannelRange msg;
4267 } LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
4268
4269 typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
4270    /**
4271     * The node_id of this message recipient
4272     */
4273    struct LDKPublicKey node_id;
4274    /**
4275     * The gossip_timestamp_filter which should be sent.
4276     */
4277    struct LDKGossipTimestampFilter msg;
4278 } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
4279
4280 typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
4281    LDKMessageSendEvent_Tag tag;
4282    union {
4283       LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
4284       LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
4285       LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
4286       LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
4287       LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
4288       LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
4289       LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
4290       LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
4291       LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
4292       LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
4293       LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
4294       LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
4295       LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
4296       LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
4297       LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
4298       LDKMessageSendEvent_LDKHandleError_Body handle_error;
4299       LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
4300       LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
4301       LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
4302       LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
4303    };
4304 } LDKMessageSendEvent;
4305
4306 /**
4307  * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
4308  * This corresponds to std::vector in C++
4309  */
4310 typedef struct LDKCVec_MessageSendEventZ {
4311    /**
4312     * The elements in the array.
4313     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4314     */
4315    struct LDKMessageSendEvent *data;
4316    /**
4317     * The number of elements pointed to by `data`.
4318     */
4319    uintptr_t datalen;
4320 } LDKCVec_MessageSendEventZ;
4321
4322 /**
4323  * The contents of CResult_TxOutAccessErrorZ
4324  */
4325 typedef union LDKCResult_TxOutAccessErrorZPtr {
4326    /**
4327     * A pointer to the contents in the success state.
4328     * Reading from this pointer when `result_ok` is not set is undefined.
4329     */
4330    struct LDKTxOut *result;
4331    /**
4332     * A pointer to the contents in the error state.
4333     * Reading from this pointer when `result_ok` is set is undefined.
4334     */
4335    enum LDKAccessError *err;
4336 } LDKCResult_TxOutAccessErrorZPtr;
4337
4338 /**
4339  * A CResult_TxOutAccessErrorZ represents the result of a fallible operation,
4340  * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure.
4341  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4342  */
4343 typedef struct LDKCResult_TxOutAccessErrorZ {
4344    /**
4345     * The contents of this CResult_TxOutAccessErrorZ, accessible via either
4346     * `err` or `result` depending on the state of `result_ok`.
4347     */
4348    union LDKCResult_TxOutAccessErrorZPtr contents;
4349    /**
4350     * Whether this CResult_TxOutAccessErrorZ represents a success state.
4351     */
4352    bool result_ok;
4353 } LDKCResult_TxOutAccessErrorZ;
4354
4355 /**
4356  * A tuple of 2 elements. See the individual fields for the types contained.
4357  */
4358 typedef struct LDKC2Tuple_usizeTransactionZ {
4359    /**
4360     * The element at position 0
4361     */
4362    uintptr_t a;
4363    /**
4364     * The element at position 1
4365     */
4366    struct LDKTransaction b;
4367 } LDKC2Tuple_usizeTransactionZ;
4368
4369 /**
4370  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
4371  * This corresponds to std::vector in C++
4372  */
4373 typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
4374    /**
4375     * The elements in the array.
4376     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4377     */
4378    struct LDKC2Tuple_usizeTransactionZ *data;
4379    /**
4380     * The number of elements pointed to by `data`.
4381     */
4382    uintptr_t datalen;
4383 } LDKCVec_C2Tuple_usizeTransactionZZ;
4384
4385 /**
4386  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
4387  * This corresponds to std::vector in C++
4388  */
4389 typedef struct LDKCVec_TxidZ {
4390    /**
4391     * The elements in the array.
4392     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4393     */
4394    struct LDKThirtyTwoBytes *data;
4395    /**
4396     * The number of elements pointed to by `data`.
4397     */
4398    uintptr_t datalen;
4399 } LDKCVec_TxidZ;
4400
4401 /**
4402  * The contents of CResult_NoneChannelMonitorUpdateErrZ
4403  */
4404 typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr {
4405    /**
4406     * Note that this value is always NULL, as there are no contents in the OK variant
4407     */
4408    void *result;
4409    /**
4410     * A pointer to the contents in the error state.
4411     * Reading from this pointer when `result_ok` is set is undefined.
4412     */
4413    enum LDKChannelMonitorUpdateErr *err;
4414 } LDKCResult_NoneChannelMonitorUpdateErrZPtr;
4415
4416 /**
4417  * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation,
4418  * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure.
4419  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4420  */
4421 typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ {
4422    /**
4423     * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either
4424     * `err` or `result` depending on the state of `result_ok`.
4425     */
4426    union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents;
4427    /**
4428     * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state.
4429     */
4430    bool result_ok;
4431 } LDKCResult_NoneChannelMonitorUpdateErrZ;
4432
4433
4434
4435 /**
4436  * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
4437  * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
4438  * preimage claim backward will lead to loss of funds.
4439  */
4440 typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
4441    /**
4442     * A pointer to the opaque Rust object.
4443     * Nearly everywhere, inner must be non-null, however in places where
4444     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4445     */
4446    LDKnativeHTLCUpdate *inner;
4447    /**
4448     * Indicates that this is the only struct which contains the same pointer.
4449     * Rust functions which take ownership of an object provided via an argument require
4450     * this to be true and invalidate the object pointed to by inner.
4451     */
4452    bool is_owned;
4453 } LDKHTLCUpdate;
4454
4455 /**
4456  * An event to be processed by the ChannelManager.
4457  */
4458 typedef enum LDKMonitorEvent_Tag {
4459    /**
4460     * A monitor event containing an HTLCUpdate.
4461     */
4462    LDKMonitorEvent_HTLCEvent,
4463    /**
4464     * A monitor event that the Channel's commitment transaction was confirmed.
4465     */
4466    LDKMonitorEvent_CommitmentTxConfirmed,
4467    /**
4468     * Indicates a [`ChannelMonitor`] update has completed. See
4469     * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used.
4470     *
4471     * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure
4472     */
4473    LDKMonitorEvent_UpdateCompleted,
4474    /**
4475     * Indicates a [`ChannelMonitor`] update has failed. See
4476     * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used.
4477     *
4478     * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure
4479     */
4480    LDKMonitorEvent_UpdateFailed,
4481    /**
4482     * Must be last for serialization purposes
4483     */
4484    LDKMonitorEvent_Sentinel,
4485 } LDKMonitorEvent_Tag;
4486
4487 typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body {
4488    /**
4489     * The funding outpoint of the [`ChannelMonitor`] that was updated
4490     */
4491    struct LDKOutPoint funding_txo;
4492    /**
4493     * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
4494     * [`ChannelMonitor::get_latest_update_id`].
4495     *
4496     * Note that this should only be set to a given update's ID if all previous updates for the
4497     * same [`ChannelMonitor`] have been applied and persisted.
4498     */
4499    uint64_t monitor_update_id;
4500 } LDKMonitorEvent_LDKUpdateCompleted_Body;
4501
4502 typedef struct MUST_USE_STRUCT LDKMonitorEvent {
4503    LDKMonitorEvent_Tag tag;
4504    union {
4505       struct {
4506          struct LDKHTLCUpdate htlc_event;
4507       };
4508       struct {
4509          struct LDKOutPoint commitment_tx_confirmed;
4510       };
4511       LDKMonitorEvent_LDKUpdateCompleted_Body update_completed;
4512       struct {
4513          struct LDKOutPoint update_failed;
4514       };
4515    };
4516 } LDKMonitorEvent;
4517
4518 /**
4519  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
4520  * This corresponds to std::vector in C++
4521  */
4522 typedef struct LDKCVec_MonitorEventZ {
4523    /**
4524     * The elements in the array.
4525     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4526     */
4527    struct LDKMonitorEvent *data;
4528    /**
4529     * The number of elements pointed to by `data`.
4530     */
4531    uintptr_t datalen;
4532 } LDKCVec_MonitorEventZ;
4533
4534 /**
4535  * A tuple of 3 elements. See the individual fields for the types contained.
4536  */
4537 typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
4538    /**
4539     * The element at position 0
4540     */
4541    struct LDKOutPoint a;
4542    /**
4543     * The element at position 1
4544     */
4545    struct LDKCVec_MonitorEventZ b;
4546    /**
4547     * The element at position 2
4548     */
4549    struct LDKPublicKey c;
4550 } LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ;
4551
4552 /**
4553  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
4554  * This corresponds to std::vector in C++
4555  */
4556 typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
4557    /**
4558     * The elements in the array.
4559     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4560     */
4561    struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data;
4562    /**
4563     * The number of elements pointed to by `data`.
4564     */
4565    uintptr_t datalen;
4566 } LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ;
4567
4568 /**
4569  * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not
4570  */
4571 typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag {
4572    /**
4573     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ
4574     */
4575    LDKCOption_C2Tuple_usizeTransactionZZ_Some,
4576    /**
4577     * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing
4578     */
4579    LDKCOption_C2Tuple_usizeTransactionZZ_None,
4580    /**
4581     * Must be last for serialization purposes
4582     */
4583    LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel,
4584 } LDKCOption_C2Tuple_usizeTransactionZZ_Tag;
4585
4586 typedef struct LDKCOption_C2Tuple_usizeTransactionZZ {
4587    LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag;
4588    union {
4589       struct {
4590          struct LDKC2Tuple_usizeTransactionZ some;
4591       };
4592    };
4593 } LDKCOption_C2Tuple_usizeTransactionZZ;
4594
4595
4596
4597 /**
4598  * [`Score`] implementation that uses a fixed penalty.
4599  */
4600 typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
4601    /**
4602     * A pointer to the opaque Rust object.
4603     * Nearly everywhere, inner must be non-null, however in places where
4604     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4605     */
4606    LDKnativeFixedPenaltyScorer *inner;
4607    /**
4608     * Indicates that this is the only struct which contains the same pointer.
4609     * Rust functions which take ownership of an object provided via an argument require
4610     * this to be true and invalidate the object pointed to by inner.
4611     */
4612    bool is_owned;
4613 } LDKFixedPenaltyScorer;
4614
4615 /**
4616  * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
4617  */
4618 typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
4619    /**
4620     * A pointer to the contents in the success state.
4621     * Reading from this pointer when `result_ok` is not set is undefined.
4622     */
4623    struct LDKFixedPenaltyScorer *result;
4624    /**
4625     * A pointer to the contents in the error state.
4626     * Reading from this pointer when `result_ok` is set is undefined.
4627     */
4628    struct LDKDecodeError *err;
4629 } LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
4630
4631 /**
4632  * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
4633  * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4634  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4635  */
4636 typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
4637    /**
4638     * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
4639     * `err` or `result` depending on the state of `result_ok`.
4640     */
4641    union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
4642    /**
4643     * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
4644     */
4645    bool result_ok;
4646 } LDKCResult_FixedPenaltyScorerDecodeErrorZ;
4647
4648 /**
4649  * A tuple of 2 elements. See the individual fields for the types contained.
4650  */
4651 typedef struct LDKC2Tuple_u64u64Z {
4652    /**
4653     * The element at position 0
4654     */
4655    uint64_t a;
4656    /**
4657     * The element at position 1
4658     */
4659    uint64_t b;
4660 } LDKC2Tuple_u64u64Z;
4661
4662 /**
4663  * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
4664  */
4665 typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
4666    /**
4667     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
4668     */
4669    LDKCOption_C2Tuple_u64u64ZZ_Some,
4670    /**
4671     * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
4672     */
4673    LDKCOption_C2Tuple_u64u64ZZ_None,
4674    /**
4675     * Must be last for serialization purposes
4676     */
4677    LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
4678 } LDKCOption_C2Tuple_u64u64ZZ_Tag;
4679
4680 typedef struct LDKCOption_C2Tuple_u64u64ZZ {
4681    LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
4682    union {
4683       struct {
4684          struct LDKC2Tuple_u64u64Z some;
4685       };
4686    };
4687 } LDKCOption_C2Tuple_u64u64ZZ;
4688
4689
4690
4691 /**
4692  * Represents the compressed public key of a node
4693  */
4694 typedef struct MUST_USE_STRUCT LDKNodeId {
4695    /**
4696     * A pointer to the opaque Rust object.
4697     * Nearly everywhere, inner must be non-null, however in places where
4698     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4699     */
4700    LDKnativeNodeId *inner;
4701    /**
4702     * Indicates that this is the only struct which contains the same pointer.
4703     * Rust functions which take ownership of an object provided via an argument require
4704     * this to be true and invalidate the object pointed to by inner.
4705     */
4706    bool is_owned;
4707 } LDKNodeId;
4708
4709 /**
4710  * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
4711  * This corresponds to std::vector in C++
4712  */
4713 typedef struct LDKCVec_NodeIdZ {
4714    /**
4715     * The elements in the array.
4716     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
4717     */
4718    struct LDKNodeId *data;
4719    /**
4720     * The number of elements pointed to by `data`.
4721     */
4722    uintptr_t datalen;
4723 } LDKCVec_NodeIdZ;
4724
4725
4726
4727 /**
4728  * A Record, unit of logging output with Metadata to enable filtering
4729  * Module_path, file, line to inform on log's source
4730  */
4731 typedef struct MUST_USE_STRUCT LDKRecord {
4732    /**
4733     * A pointer to the opaque Rust object.
4734     * Nearly everywhere, inner must be non-null, however in places where
4735     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4736     */
4737    LDKnativeRecord *inner;
4738    /**
4739     * Indicates that this is the only struct which contains the same pointer.
4740     * Rust functions which take ownership of an object provided via an argument require
4741     * this to be true and invalidate the object pointed to by inner.
4742     */
4743    bool is_owned;
4744 } LDKRecord;
4745
4746 /**
4747  * A trait encapsulating the operations required of a logger
4748  */
4749 typedef struct LDKLogger {
4750    /**
4751     * An opaque pointer which is passed to your function implementations as an argument.
4752     * This has no meaning in the LDK, and can be NULL or any other value.
4753     */
4754    void *this_arg;
4755    /**
4756     * Logs the `Record`
4757     */
4758    void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
4759    /**
4760     * Frees any resources associated with this object given its this_arg pointer.
4761     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
4762     */
4763    void (*free)(void *this_arg);
4764 } LDKLogger;
4765
4766
4767
4768 /**
4769  * Represents the network as nodes and channels between them
4770  */
4771 typedef struct MUST_USE_STRUCT LDKNetworkGraph {
4772    /**
4773     * A pointer to the opaque Rust object.
4774     * Nearly everywhere, inner must be non-null, however in places where
4775     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4776     */
4777    LDKnativeNetworkGraph *inner;
4778    /**
4779     * Indicates that this is the only struct which contains the same pointer.
4780     * Rust functions which take ownership of an object provided via an argument require
4781     * this to be true and invalidate the object pointed to by inner.
4782     */
4783    bool is_owned;
4784 } LDKNetworkGraph;
4785
4786
4787
4788 /**
4789  * [`Score`] implementation using channel success probability distributions.
4790  *
4791  * Based on *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
4792  * and Stefan Richter [[1]]. Given the uncertainty of channel liquidity balances, probability
4793  * distributions are defined based on knowledge learned from successful and unsuccessful attempts.
4794  * Then the negative `log10` of the success probability is used to determine the cost of routing a
4795  * specific HTLC amount through a channel.
4796  *
4797  * Knowledge about channel liquidity balances takes the form of upper and lower bounds on the
4798  * possible liquidity. Certainty of the bounds is decreased over time using a decay function. See
4799  * [`ProbabilisticScoringParameters`] for details.
4800  *
4801  * Since the scorer aims to learn the current channel liquidity balances, it works best for nodes
4802  * with high payment volume or that actively probe the [`NetworkGraph`]. Nodes with low payment
4803  * volume are more likely to experience failed payment paths, which would need to be retried.
4804  *
4805  * # Note
4806  *
4807  * Mixing the `no-std` feature between serialization and deserialization results in undefined
4808  * behavior.
4809  *
4810  * [1]: https://arxiv.org/abs/2107.05322
4811  */
4812 typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
4813    /**
4814     * A pointer to the opaque Rust object.
4815     * Nearly everywhere, inner must be non-null, however in places where
4816     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4817     */
4818    LDKnativeProbabilisticScorer *inner;
4819    /**
4820     * Indicates that this is the only struct which contains the same pointer.
4821     * Rust functions which take ownership of an object provided via an argument require
4822     * this to be true and invalidate the object pointed to by inner.
4823     */
4824    bool is_owned;
4825 } LDKProbabilisticScorer;
4826
4827 /**
4828  * The contents of CResult_ProbabilisticScorerDecodeErrorZ
4829  */
4830 typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
4831    /**
4832     * A pointer to the contents in the success state.
4833     * Reading from this pointer when `result_ok` is not set is undefined.
4834     */
4835    struct LDKProbabilisticScorer *result;
4836    /**
4837     * A pointer to the contents in the error state.
4838     * Reading from this pointer when `result_ok` is set is undefined.
4839     */
4840    struct LDKDecodeError *err;
4841 } LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
4842
4843 /**
4844  * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
4845  * containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
4846  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4847  */
4848 typedef struct LDKCResult_ProbabilisticScorerDecodeErrorZ {
4849    /**
4850     * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
4851     * `err` or `result` depending on the state of `result_ok`.
4852     */
4853    union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
4854    /**
4855     * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
4856     */
4857    bool result_ok;
4858 } LDKCResult_ProbabilisticScorerDecodeErrorZ;
4859
4860
4861
4862 /**
4863  * Features used within an `init` message.
4864  */
4865 typedef struct MUST_USE_STRUCT LDKInitFeatures {
4866    /**
4867     * A pointer to the opaque Rust object.
4868     * Nearly everywhere, inner must be non-null, however in places where
4869     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4870     */
4871    LDKnativeInitFeatures *inner;
4872    /**
4873     * Indicates that this is the only struct which contains the same pointer.
4874     * Rust functions which take ownership of an object provided via an argument require
4875     * this to be true and invalidate the object pointed to by inner.
4876     */
4877    bool is_owned;
4878 } LDKInitFeatures;
4879
4880 /**
4881  * The contents of CResult_InitFeaturesDecodeErrorZ
4882  */
4883 typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
4884    /**
4885     * A pointer to the contents in the success state.
4886     * Reading from this pointer when `result_ok` is not set is undefined.
4887     */
4888    struct LDKInitFeatures *result;
4889    /**
4890     * A pointer to the contents in the error state.
4891     * Reading from this pointer when `result_ok` is set is undefined.
4892     */
4893    struct LDKDecodeError *err;
4894 } LDKCResult_InitFeaturesDecodeErrorZPtr;
4895
4896 /**
4897  * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
4898  * containing a crate::lightning::ln::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4899  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4900  */
4901 typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
4902    /**
4903     * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
4904     * `err` or `result` depending on the state of `result_ok`.
4905     */
4906    union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
4907    /**
4908     * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
4909     */
4910    bool result_ok;
4911 } LDKCResult_InitFeaturesDecodeErrorZ;
4912
4913
4914
4915 /**
4916  * Features used within a `channel_announcement` message.
4917  */
4918 typedef struct MUST_USE_STRUCT LDKChannelFeatures {
4919    /**
4920     * A pointer to the opaque Rust object.
4921     * Nearly everywhere, inner must be non-null, however in places where
4922     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4923     */
4924    LDKnativeChannelFeatures *inner;
4925    /**
4926     * Indicates that this is the only struct which contains the same pointer.
4927     * Rust functions which take ownership of an object provided via an argument require
4928     * this to be true and invalidate the object pointed to by inner.
4929     */
4930    bool is_owned;
4931 } LDKChannelFeatures;
4932
4933 /**
4934  * The contents of CResult_ChannelFeaturesDecodeErrorZ
4935  */
4936 typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
4937    /**
4938     * A pointer to the contents in the success state.
4939     * Reading from this pointer when `result_ok` is not set is undefined.
4940     */
4941    struct LDKChannelFeatures *result;
4942    /**
4943     * A pointer to the contents in the error state.
4944     * Reading from this pointer when `result_ok` is set is undefined.
4945     */
4946    struct LDKDecodeError *err;
4947 } LDKCResult_ChannelFeaturesDecodeErrorZPtr;
4948
4949 /**
4950  * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
4951  * containing a crate::lightning::ln::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
4952  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
4953  */
4954 typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
4955    /**
4956     * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
4957     * `err` or `result` depending on the state of `result_ok`.
4958     */
4959    union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
4960    /**
4961     * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
4962     */
4963    bool result_ok;
4964 } LDKCResult_ChannelFeaturesDecodeErrorZ;
4965
4966
4967
4968 /**
4969  * Features used within a `node_announcement` message.
4970  */
4971 typedef struct MUST_USE_STRUCT LDKNodeFeatures {
4972    /**
4973     * A pointer to the opaque Rust object.
4974     * Nearly everywhere, inner must be non-null, however in places where
4975     * the Rust equivalent takes an Option, it may be set to null to indicate None.
4976     */
4977    LDKnativeNodeFeatures *inner;
4978    /**
4979     * Indicates that this is the only struct which contains the same pointer.
4980     * Rust functions which take ownership of an object provided via an argument require
4981     * this to be true and invalidate the object pointed to by inner.
4982     */
4983    bool is_owned;
4984 } LDKNodeFeatures;
4985
4986 /**
4987  * The contents of CResult_NodeFeaturesDecodeErrorZ
4988  */
4989 typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
4990    /**
4991     * A pointer to the contents in the success state.
4992     * Reading from this pointer when `result_ok` is not set is undefined.
4993     */
4994    struct LDKNodeFeatures *result;
4995    /**
4996     * A pointer to the contents in the error state.
4997     * Reading from this pointer when `result_ok` is set is undefined.
4998     */
4999    struct LDKDecodeError *err;
5000 } LDKCResult_NodeFeaturesDecodeErrorZPtr;
5001
5002 /**
5003  * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
5004  * containing a crate::lightning::ln::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5005  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5006  */
5007 typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
5008    /**
5009     * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
5010     * `err` or `result` depending on the state of `result_ok`.
5011     */
5012    union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
5013    /**
5014     * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
5015     */
5016    bool result_ok;
5017 } LDKCResult_NodeFeaturesDecodeErrorZ;
5018
5019
5020
5021 /**
5022  * Features used within an invoice.
5023  */
5024 typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
5025    /**
5026     * A pointer to the opaque Rust object.
5027     * Nearly everywhere, inner must be non-null, however in places where
5028     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5029     */
5030    LDKnativeInvoiceFeatures *inner;
5031    /**
5032     * Indicates that this is the only struct which contains the same pointer.
5033     * Rust functions which take ownership of an object provided via an argument require
5034     * this to be true and invalidate the object pointed to by inner.
5035     */
5036    bool is_owned;
5037 } LDKInvoiceFeatures;
5038
5039 /**
5040  * The contents of CResult_InvoiceFeaturesDecodeErrorZ
5041  */
5042 typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
5043    /**
5044     * A pointer to the contents in the success state.
5045     * Reading from this pointer when `result_ok` is not set is undefined.
5046     */
5047    struct LDKInvoiceFeatures *result;
5048    /**
5049     * A pointer to the contents in the error state.
5050     * Reading from this pointer when `result_ok` is set is undefined.
5051     */
5052    struct LDKDecodeError *err;
5053 } LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
5054
5055 /**
5056  * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
5057  * containing a crate::lightning::ln::features::InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5058  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5059  */
5060 typedef struct LDKCResult_InvoiceFeaturesDecodeErrorZ {
5061    /**
5062     * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
5063     * `err` or `result` depending on the state of `result_ok`.
5064     */
5065    union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
5066    /**
5067     * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
5068     */
5069    bool result_ok;
5070 } LDKCResult_InvoiceFeaturesDecodeErrorZ;
5071
5072 /**
5073  * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
5074  */
5075 typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
5076    /**
5077     * A pointer to the contents in the success state.
5078     * Reading from this pointer when `result_ok` is not set is undefined.
5079     */
5080    struct LDKChannelTypeFeatures *result;
5081    /**
5082     * A pointer to the contents in the error state.
5083     * Reading from this pointer when `result_ok` is set is undefined.
5084     */
5085    struct LDKDecodeError *err;
5086 } LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
5087
5088 /**
5089  * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
5090  * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
5091  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5092  */
5093 typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ {
5094    /**
5095     * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
5096     * `err` or `result` depending on the state of `result_ok`.
5097     */
5098    union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
5099    /**
5100     * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
5101     */
5102    bool result_ok;
5103 } LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
5104
5105 /**
5106  * The contents of CResult_NodeIdDecodeErrorZ
5107  */
5108 typedef union LDKCResult_NodeIdDecodeErrorZPtr {
5109    /**
5110     * A pointer to the contents in the success state.
5111     * Reading from this pointer when `result_ok` is not set is undefined.
5112     */
5113    struct LDKNodeId *result;
5114    /**
5115     * A pointer to the contents in the error state.
5116     * Reading from this pointer when `result_ok` is set is undefined.
5117     */
5118    struct LDKDecodeError *err;
5119 } LDKCResult_NodeIdDecodeErrorZPtr;
5120
5121 /**
5122  * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
5123  * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure.
5124  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5125  */
5126 typedef struct LDKCResult_NodeIdDecodeErrorZ {
5127    /**
5128     * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
5129     * `err` or `result` depending on the state of `result_ok`.
5130     */
5131    union LDKCResult_NodeIdDecodeErrorZPtr contents;
5132    /**
5133     * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
5134     */
5135    bool result_ok;
5136 } LDKCResult_NodeIdDecodeErrorZ;
5137
5138 /**
5139  * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
5140  */
5141 typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
5142    /**
5143     * A pointer to the contents in the success state.
5144     * Reading from this pointer when `result_ok` is not set is undefined.
5145     */
5146    struct LDKCOption_NetworkUpdateZ *result;
5147    /**
5148     * A pointer to the contents in the error state.
5149     * Reading from this pointer when `result_ok` is set is undefined.
5150     */
5151    struct LDKDecodeError *err;
5152 } LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr;
5153
5154 /**
5155  * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
5156  * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
5157  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5158  */
5159 typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ {
5160    /**
5161     * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
5162     * `err` or `result` depending on the state of `result_ok`.
5163     */
5164    union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
5165    /**
5166     * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
5167     */
5168    bool result_ok;
5169 } LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
5170
5171 /**
5172  * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
5173  * UTXOs.
5174  */
5175 typedef struct LDKAccess {
5176    /**
5177     * An opaque pointer which is passed to your function implementations as an argument.
5178     * This has no meaning in the LDK, and can be NULL or any other value.
5179     */
5180    void *this_arg;
5181    /**
5182     * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
5183     * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
5184     * is unknown.
5185     *
5186     * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id
5187     */
5188    struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
5189    /**
5190     * Frees any resources associated with this object given its this_arg pointer.
5191     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
5192     */
5193    void (*free)(void *this_arg);
5194 } LDKAccess;
5195
5196 /**
5197  * An enum which can either contain a crate::lightning::chain::Access or not
5198  */
5199 typedef enum LDKCOption_AccessZ_Tag {
5200    /**
5201     * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
5202     */
5203    LDKCOption_AccessZ_Some,
5204    /**
5205     * When we're in this state, this COption_AccessZ contains nothing
5206     */
5207    LDKCOption_AccessZ_None,
5208    /**
5209     * Must be last for serialization purposes
5210     */
5211    LDKCOption_AccessZ_Sentinel,
5212 } LDKCOption_AccessZ_Tag;
5213
5214 typedef struct LDKCOption_AccessZ {
5215    LDKCOption_AccessZ_Tag tag;
5216    union {
5217       struct {
5218          struct LDKAccess some;
5219       };
5220    };
5221 } LDKCOption_AccessZ;
5222
5223 /**
5224  * The contents of CResult_boolLightningErrorZ
5225  */
5226 typedef union LDKCResult_boolLightningErrorZPtr {
5227    /**
5228     * A pointer to the contents in the success state.
5229     * Reading from this pointer when `result_ok` is not set is undefined.
5230     */
5231    bool *result;
5232    /**
5233     * A pointer to the contents in the error state.
5234     * Reading from this pointer when `result_ok` is set is undefined.
5235     */
5236    struct LDKLightningError *err;
5237 } LDKCResult_boolLightningErrorZPtr;
5238
5239 /**
5240  * A CResult_boolLightningErrorZ represents the result of a fallible operation,
5241  * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
5242  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5243  */
5244 typedef struct LDKCResult_boolLightningErrorZ {
5245    /**
5246     * The contents of this CResult_boolLightningErrorZ, accessible via either
5247     * `err` or `result` depending on the state of `result_ok`.
5248     */
5249    union LDKCResult_boolLightningErrorZPtr contents;
5250    /**
5251     * Whether this CResult_boolLightningErrorZ represents a success state.
5252     */
5253    bool result_ok;
5254 } LDKCResult_boolLightningErrorZ;
5255
5256 /**
5257  * A tuple of 3 elements. See the individual fields for the types contained.
5258  */
5259 typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
5260    /**
5261     * The element at position 0
5262     */
5263    struct LDKChannelAnnouncement a;
5264    /**
5265     * The element at position 1
5266     */
5267    struct LDKChannelUpdate b;
5268    /**
5269     * The element at position 2
5270     */
5271    struct LDKChannelUpdate c;
5272 } LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
5273
5274 /**
5275  * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
5276  * This corresponds to std::vector in C++
5277  */
5278 typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
5279    /**
5280     * The elements in the array.
5281     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5282     */
5283    struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
5284    /**
5285     * The number of elements pointed to by `data`.
5286     */
5287    uintptr_t datalen;
5288 } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
5289
5290 /**
5291  * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
5292  * This corresponds to std::vector in C++
5293  */
5294 typedef struct LDKCVec_NodeAnnouncementZ {
5295    /**
5296     * The elements in the array.
5297     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5298     */
5299    struct LDKNodeAnnouncement *data;
5300    /**
5301     * The number of elements pointed to by `data`.
5302     */
5303    uintptr_t datalen;
5304 } LDKCVec_NodeAnnouncementZ;
5305
5306 /**
5307  * The contents of CResult_NoneLightningErrorZ
5308  */
5309 typedef union LDKCResult_NoneLightningErrorZPtr {
5310    /**
5311     * Note that this value is always NULL, as there are no contents in the OK variant
5312     */
5313    void *result;
5314    /**
5315     * A pointer to the contents in the error state.
5316     * Reading from this pointer when `result_ok` is set is undefined.
5317     */
5318    struct LDKLightningError *err;
5319 } LDKCResult_NoneLightningErrorZPtr;
5320
5321 /**
5322  * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
5323  * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
5324  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5325  */
5326 typedef struct LDKCResult_NoneLightningErrorZ {
5327    /**
5328     * The contents of this CResult_NoneLightningErrorZ, accessible via either
5329     * `err` or `result` depending on the state of `result_ok`.
5330     */
5331    union LDKCResult_NoneLightningErrorZPtr contents;
5332    /**
5333     * Whether this CResult_NoneLightningErrorZ represents a success state.
5334     */
5335    bool result_ok;
5336 } LDKCResult_NoneLightningErrorZ;
5337
5338
5339
5340 /**
5341  * Details about one direction of a channel as received within a [`ChannelUpdate`].
5342  */
5343 typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
5344    /**
5345     * A pointer to the opaque Rust object.
5346     * Nearly everywhere, inner must be non-null, however in places where
5347     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5348     */
5349    LDKnativeChannelUpdateInfo *inner;
5350    /**
5351     * Indicates that this is the only struct which contains the same pointer.
5352     * Rust functions which take ownership of an object provided via an argument require
5353     * this to be true and invalidate the object pointed to by inner.
5354     */
5355    bool is_owned;
5356 } LDKChannelUpdateInfo;
5357
5358 /**
5359  * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
5360  */
5361 typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
5362    /**
5363     * A pointer to the contents in the success state.
5364     * Reading from this pointer when `result_ok` is not set is undefined.
5365     */
5366    struct LDKChannelUpdateInfo *result;
5367    /**
5368     * A pointer to the contents in the error state.
5369     * Reading from this pointer when `result_ok` is set is undefined.
5370     */
5371    struct LDKDecodeError *err;
5372 } LDKCResult_ChannelUpdateInfoDecodeErrorZPtr;
5373
5374 /**
5375  * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
5376  * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5377  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5378  */
5379 typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ {
5380    /**
5381     * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
5382     * `err` or `result` depending on the state of `result_ok`.
5383     */
5384    union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
5385    /**
5386     * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
5387     */
5388    bool result_ok;
5389 } LDKCResult_ChannelUpdateInfoDecodeErrorZ;
5390
5391
5392
5393 /**
5394  * Details about a channel (both directions).
5395  * Received within a channel announcement.
5396  */
5397 typedef struct MUST_USE_STRUCT LDKChannelInfo {
5398    /**
5399     * A pointer to the opaque Rust object.
5400     * Nearly everywhere, inner must be non-null, however in places where
5401     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5402     */
5403    LDKnativeChannelInfo *inner;
5404    /**
5405     * Indicates that this is the only struct which contains the same pointer.
5406     * Rust functions which take ownership of an object provided via an argument require
5407     * this to be true and invalidate the object pointed to by inner.
5408     */
5409    bool is_owned;
5410 } LDKChannelInfo;
5411
5412 /**
5413  * The contents of CResult_ChannelInfoDecodeErrorZ
5414  */
5415 typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
5416    /**
5417     * A pointer to the contents in the success state.
5418     * Reading from this pointer when `result_ok` is not set is undefined.
5419     */
5420    struct LDKChannelInfo *result;
5421    /**
5422     * A pointer to the contents in the error state.
5423     * Reading from this pointer when `result_ok` is set is undefined.
5424     */
5425    struct LDKDecodeError *err;
5426 } LDKCResult_ChannelInfoDecodeErrorZPtr;
5427
5428 /**
5429  * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
5430  * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5431  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5432  */
5433 typedef struct LDKCResult_ChannelInfoDecodeErrorZ {
5434    /**
5435     * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
5436     * `err` or `result` depending on the state of `result_ok`.
5437     */
5438    union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
5439    /**
5440     * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
5441     */
5442    bool result_ok;
5443 } LDKCResult_ChannelInfoDecodeErrorZ;
5444
5445
5446
5447 /**
5448  * Fees for routing via a given channel or a node
5449  */
5450 typedef struct MUST_USE_STRUCT LDKRoutingFees {
5451    /**
5452     * A pointer to the opaque Rust object.
5453     * Nearly everywhere, inner must be non-null, however in places where
5454     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5455     */
5456    LDKnativeRoutingFees *inner;
5457    /**
5458     * Indicates that this is the only struct which contains the same pointer.
5459     * Rust functions which take ownership of an object provided via an argument require
5460     * this to be true and invalidate the object pointed to by inner.
5461     */
5462    bool is_owned;
5463 } LDKRoutingFees;
5464
5465 /**
5466  * The contents of CResult_RoutingFeesDecodeErrorZ
5467  */
5468 typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
5469    /**
5470     * A pointer to the contents in the success state.
5471     * Reading from this pointer when `result_ok` is not set is undefined.
5472     */
5473    struct LDKRoutingFees *result;
5474    /**
5475     * A pointer to the contents in the error state.
5476     * Reading from this pointer when `result_ok` is set is undefined.
5477     */
5478    struct LDKDecodeError *err;
5479 } LDKCResult_RoutingFeesDecodeErrorZPtr;
5480
5481 /**
5482  * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
5483  * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure.
5484  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5485  */
5486 typedef struct LDKCResult_RoutingFeesDecodeErrorZ {
5487    /**
5488     * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
5489     * `err` or `result` depending on the state of `result_ok`.
5490     */
5491    union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
5492    /**
5493     * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
5494     */
5495    bool result_ok;
5496 } LDKCResult_RoutingFeesDecodeErrorZ;
5497
5498 /**
5499  * A 4-byte byte array.
5500  */
5501 typedef struct LDKFourBytes {
5502    /**
5503     * The four bytes
5504     */
5505    uint8_t data[4];
5506 } LDKFourBytes;
5507
5508 /**
5509  * A 16-byte byte array.
5510  */
5511 typedef struct LDKSixteenBytes {
5512    /**
5513     * The sixteen bytes
5514     */
5515    uint8_t data[16];
5516 } LDKSixteenBytes;
5517
5518 /**
5519  * A 12-byte byte array.
5520  */
5521 typedef struct LDKTwelveBytes {
5522    /**
5523     * The twelve bytes
5524     */
5525    uint8_t data[12];
5526 } LDKTwelveBytes;
5527
5528
5529
5530 /**
5531  * Represents a hostname for serialization purposes.
5532  * Only the character set and length will be validated.
5533  * The character set consists of ASCII alphanumeric characters, hyphens, and periods.
5534  * Its length is guaranteed to be representable by a single byte.
5535  * This serialization is used by BOLT 7 hostnames.
5536  */
5537 typedef struct MUST_USE_STRUCT LDKHostname {
5538    /**
5539     * A pointer to the opaque Rust object.
5540     * Nearly everywhere, inner must be non-null, however in places where
5541     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5542     */
5543    LDKnativeHostname *inner;
5544    /**
5545     * Indicates that this is the only struct which contains the same pointer.
5546     * Rust functions which take ownership of an object provided via an argument require
5547     * this to be true and invalidate the object pointed to by inner.
5548     */
5549    bool is_owned;
5550 } LDKHostname;
5551
5552 /**
5553  * An address which can be used to connect to a remote peer
5554  */
5555 typedef enum LDKNetAddress_Tag {
5556    /**
5557     * An IPv4 address/port on which the peer is listening.
5558     */
5559    LDKNetAddress_IPv4,
5560    /**
5561     * An IPv6 address/port on which the peer is listening.
5562     */
5563    LDKNetAddress_IPv6,
5564    /**
5565     * An old-style Tor onion address/port on which the peer is listening.
5566     *
5567     * This field is deprecated and the Tor network generally no longer supports V2 Onion
5568     * addresses. Thus, the details are not parsed here.
5569     */
5570    LDKNetAddress_OnionV2,
5571    /**
5572     * A new-style Tor onion address/port on which the peer is listening.
5573     * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
5574     * wrap as base32 and append \".onion\".
5575     */
5576    LDKNetAddress_OnionV3,
5577    /**
5578     * A hostname/port on which the peer is listening.
5579     */
5580    LDKNetAddress_Hostname,
5581    /**
5582     * Must be last for serialization purposes
5583     */
5584    LDKNetAddress_Sentinel,
5585 } LDKNetAddress_Tag;
5586
5587 typedef struct LDKNetAddress_LDKIPv4_Body {
5588    /**
5589     * The 4-byte IPv4 address
5590     */
5591    struct LDKFourBytes addr;
5592    /**
5593     * The port on which the node is listening
5594     */
5595    uint16_t port;
5596 } LDKNetAddress_LDKIPv4_Body;
5597
5598 typedef struct LDKNetAddress_LDKIPv6_Body {
5599    /**
5600     * The 16-byte IPv6 address
5601     */
5602    struct LDKSixteenBytes addr;
5603    /**
5604     * The port on which the node is listening
5605     */
5606    uint16_t port;
5607 } LDKNetAddress_LDKIPv6_Body;
5608
5609 typedef struct LDKNetAddress_LDKOnionV3_Body {
5610    /**
5611     * The ed25519 long-term public key of the peer
5612     */
5613    struct LDKThirtyTwoBytes ed25519_pubkey;
5614    /**
5615     * The checksum of the pubkey and version, as included in the onion address
5616     */
5617    uint16_t checksum;
5618    /**
5619     * The version byte, as defined by the Tor Onion v3 spec.
5620     */
5621    uint8_t version;
5622    /**
5623     * The port on which the node is listening
5624     */
5625    uint16_t port;
5626 } LDKNetAddress_LDKOnionV3_Body;
5627
5628 typedef struct LDKNetAddress_LDKHostname_Body {
5629    /**
5630     * The hostname on which the node is listening.
5631     */
5632    struct LDKHostname hostname;
5633    /**
5634     * The port on which the node is listening.
5635     */
5636    uint16_t port;
5637 } LDKNetAddress_LDKHostname_Body;
5638
5639 typedef struct MUST_USE_STRUCT LDKNetAddress {
5640    LDKNetAddress_Tag tag;
5641    union {
5642       LDKNetAddress_LDKIPv4_Body i_pv4;
5643       LDKNetAddress_LDKIPv6_Body i_pv6;
5644       struct {
5645          struct LDKTwelveBytes onion_v2;
5646       };
5647       LDKNetAddress_LDKOnionV3_Body onion_v3;
5648       LDKNetAddress_LDKHostname_Body hostname;
5649    };
5650 } LDKNetAddress;
5651
5652 /**
5653  * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
5654  * This corresponds to std::vector in C++
5655  */
5656 typedef struct LDKCVec_NetAddressZ {
5657    /**
5658     * The elements in the array.
5659     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5660     */
5661    struct LDKNetAddress *data;
5662    /**
5663     * The number of elements pointed to by `data`.
5664     */
5665    uintptr_t datalen;
5666 } LDKCVec_NetAddressZ;
5667
5668
5669
5670 /**
5671  * Information received in the latest node_announcement from this node.
5672  */
5673 typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
5674    /**
5675     * A pointer to the opaque Rust object.
5676     * Nearly everywhere, inner must be non-null, however in places where
5677     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5678     */
5679    LDKnativeNodeAnnouncementInfo *inner;
5680    /**
5681     * Indicates that this is the only struct which contains the same pointer.
5682     * Rust functions which take ownership of an object provided via an argument require
5683     * this to be true and invalidate the object pointed to by inner.
5684     */
5685    bool is_owned;
5686 } LDKNodeAnnouncementInfo;
5687
5688 /**
5689  * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
5690  */
5691 typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
5692    /**
5693     * A pointer to the contents in the success state.
5694     * Reading from this pointer when `result_ok` is not set is undefined.
5695     */
5696    struct LDKNodeAnnouncementInfo *result;
5697    /**
5698     * A pointer to the contents in the error state.
5699     * Reading from this pointer when `result_ok` is set is undefined.
5700     */
5701    struct LDKDecodeError *err;
5702 } LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr;
5703
5704 /**
5705  * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
5706  * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5707  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5708  */
5709 typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ {
5710    /**
5711     * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
5712     * `err` or `result` depending on the state of `result_ok`.
5713     */
5714    union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
5715    /**
5716     * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
5717     */
5718    bool result_ok;
5719 } LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
5720
5721
5722
5723 /**
5724  * A user-defined name for a node, which may be used when displaying the node in a graph.
5725  *
5726  * Since node aliases are provided by third parties, they are a potential avenue for injection
5727  * attacks. Care must be taken when processing.
5728  */
5729 typedef struct MUST_USE_STRUCT LDKNodeAlias {
5730    /**
5731     * A pointer to the opaque Rust object.
5732     * Nearly everywhere, inner must be non-null, however in places where
5733     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5734     */
5735    LDKnativeNodeAlias *inner;
5736    /**
5737     * Indicates that this is the only struct which contains the same pointer.
5738     * Rust functions which take ownership of an object provided via an argument require
5739     * this to be true and invalidate the object pointed to by inner.
5740     */
5741    bool is_owned;
5742 } LDKNodeAlias;
5743
5744 /**
5745  * The contents of CResult_NodeAliasDecodeErrorZ
5746  */
5747 typedef union LDKCResult_NodeAliasDecodeErrorZPtr {
5748    /**
5749     * A pointer to the contents in the success state.
5750     * Reading from this pointer when `result_ok` is not set is undefined.
5751     */
5752    struct LDKNodeAlias *result;
5753    /**
5754     * A pointer to the contents in the error state.
5755     * Reading from this pointer when `result_ok` is set is undefined.
5756     */
5757    struct LDKDecodeError *err;
5758 } LDKCResult_NodeAliasDecodeErrorZPtr;
5759
5760 /**
5761  * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation,
5762  * containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure.
5763  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5764  */
5765 typedef struct LDKCResult_NodeAliasDecodeErrorZ {
5766    /**
5767     * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either
5768     * `err` or `result` depending on the state of `result_ok`.
5769     */
5770    union LDKCResult_NodeAliasDecodeErrorZPtr contents;
5771    /**
5772     * Whether this CResult_NodeAliasDecodeErrorZ represents a success state.
5773     */
5774    bool result_ok;
5775 } LDKCResult_NodeAliasDecodeErrorZ;
5776
5777
5778
5779 /**
5780  * Details about a node in the network, known from the network announcement.
5781  */
5782 typedef struct MUST_USE_STRUCT LDKNodeInfo {
5783    /**
5784     * A pointer to the opaque Rust object.
5785     * Nearly everywhere, inner must be non-null, however in places where
5786     * the Rust equivalent takes an Option, it may be set to null to indicate None.
5787     */
5788    LDKnativeNodeInfo *inner;
5789    /**
5790     * Indicates that this is the only struct which contains the same pointer.
5791     * Rust functions which take ownership of an object provided via an argument require
5792     * this to be true and invalidate the object pointed to by inner.
5793     */
5794    bool is_owned;
5795 } LDKNodeInfo;
5796
5797 /**
5798  * The contents of CResult_NodeInfoDecodeErrorZ
5799  */
5800 typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
5801    /**
5802     * A pointer to the contents in the success state.
5803     * Reading from this pointer when `result_ok` is not set is undefined.
5804     */
5805    struct LDKNodeInfo *result;
5806    /**
5807     * A pointer to the contents in the error state.
5808     * Reading from this pointer when `result_ok` is set is undefined.
5809     */
5810    struct LDKDecodeError *err;
5811 } LDKCResult_NodeInfoDecodeErrorZPtr;
5812
5813 /**
5814  * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
5815  * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
5816  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5817  */
5818 typedef struct LDKCResult_NodeInfoDecodeErrorZ {
5819    /**
5820     * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
5821     * `err` or `result` depending on the state of `result_ok`.
5822     */
5823    union LDKCResult_NodeInfoDecodeErrorZPtr contents;
5824    /**
5825     * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
5826     */
5827    bool result_ok;
5828 } LDKCResult_NodeInfoDecodeErrorZ;
5829
5830 /**
5831  * The contents of CResult_NetworkGraphDecodeErrorZ
5832  */
5833 typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
5834    /**
5835     * A pointer to the contents in the success state.
5836     * Reading from this pointer when `result_ok` is not set is undefined.
5837     */
5838    struct LDKNetworkGraph *result;
5839    /**
5840     * A pointer to the contents in the error state.
5841     * Reading from this pointer when `result_ok` is set is undefined.
5842     */
5843    struct LDKDecodeError *err;
5844 } LDKCResult_NetworkGraphDecodeErrorZPtr;
5845
5846 /**
5847  * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
5848  * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure.
5849  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5850  */
5851 typedef struct LDKCResult_NetworkGraphDecodeErrorZ {
5852    /**
5853     * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
5854     * `err` or `result` depending on the state of `result_ok`.
5855     */
5856    union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
5857    /**
5858     * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
5859     */
5860    bool result_ok;
5861 } LDKCResult_NetworkGraphDecodeErrorZ;
5862
5863 /**
5864  * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
5865  */
5866 typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
5867    /**
5868     * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
5869     */
5870    LDKCOption_CVec_NetAddressZZ_Some,
5871    /**
5872     * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
5873     */
5874    LDKCOption_CVec_NetAddressZZ_None,
5875    /**
5876     * Must be last for serialization purposes
5877     */
5878    LDKCOption_CVec_NetAddressZZ_Sentinel,
5879 } LDKCOption_CVec_NetAddressZZ_Tag;
5880
5881 typedef struct LDKCOption_CVec_NetAddressZZ {
5882    LDKCOption_CVec_NetAddressZZ_Tag tag;
5883    union {
5884       struct {
5885          struct LDKCVec_NetAddressZ some;
5886       };
5887    };
5888 } LDKCOption_CVec_NetAddressZZ;
5889
5890 /**
5891  * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ
5892  */
5893 typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr {
5894    /**
5895     * A pointer to the contents in the success state.
5896     * Reading from this pointer when `result_ok` is not set is undefined.
5897     */
5898    struct LDKDelayedPaymentOutputDescriptor *result;
5899    /**
5900     * A pointer to the contents in the error state.
5901     * Reading from this pointer when `result_ok` is set is undefined.
5902     */
5903    struct LDKDecodeError *err;
5904 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr;
5905
5906 /**
5907  * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5908  * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5909  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5910  */
5911 typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ {
5912    /**
5913     * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either
5914     * `err` or `result` depending on the state of `result_ok`.
5915     */
5916    union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents;
5917    /**
5918     * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state.
5919     */
5920    bool result_ok;
5921 } LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ;
5922
5923 /**
5924  * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ
5925  */
5926 typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr {
5927    /**
5928     * A pointer to the contents in the success state.
5929     * Reading from this pointer when `result_ok` is not set is undefined.
5930     */
5931    struct LDKStaticPaymentOutputDescriptor *result;
5932    /**
5933     * A pointer to the contents in the error state.
5934     * Reading from this pointer when `result_ok` is set is undefined.
5935     */
5936    struct LDKDecodeError *err;
5937 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr;
5938
5939 /**
5940  * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5941  * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5942  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5943  */
5944 typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ {
5945    /**
5946     * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either
5947     * `err` or `result` depending on the state of `result_ok`.
5948     */
5949    union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents;
5950    /**
5951     * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state.
5952     */
5953    bool result_ok;
5954 } LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ;
5955
5956 /**
5957  * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ
5958  */
5959 typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr {
5960    /**
5961     * A pointer to the contents in the success state.
5962     * Reading from this pointer when `result_ok` is not set is undefined.
5963     */
5964    struct LDKSpendableOutputDescriptor *result;
5965    /**
5966     * A pointer to the contents in the error state.
5967     * Reading from this pointer when `result_ok` is set is undefined.
5968     */
5969    struct LDKDecodeError *err;
5970 } LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr;
5971
5972 /**
5973  * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation,
5974  * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure.
5975  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
5976  */
5977 typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ {
5978    /**
5979     * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either
5980     * `err` or `result` depending on the state of `result_ok`.
5981     */
5982    union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents;
5983    /**
5984     * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state.
5985     */
5986    bool result_ok;
5987 } LDKCResult_SpendableOutputDescriptorDecodeErrorZ;
5988
5989 /**
5990  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
5991  * This corresponds to std::vector in C++
5992  */
5993 typedef struct LDKCVec_PaymentPreimageZ {
5994    /**
5995     * The elements in the array.
5996     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
5997     */
5998    struct LDKThirtyTwoBytes *data;
5999    /**
6000     * The number of elements pointed to by `data`.
6001     */
6002    uintptr_t datalen;
6003 } LDKCVec_PaymentPreimageZ;
6004
6005 /**
6006  * A tuple of 2 elements. See the individual fields for the types contained.
6007  */
6008 typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ {
6009    /**
6010     * The element at position 0
6011     */
6012    struct LDKSignature a;
6013    /**
6014     * The element at position 1
6015     */
6016    struct LDKCVec_SignatureZ b;
6017 } LDKC2Tuple_SignatureCVec_SignatureZZ;
6018
6019 /**
6020  * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ
6021  */
6022 typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr {
6023    /**
6024     * A pointer to the contents in the success state.
6025     * Reading from this pointer when `result_ok` is not set is undefined.
6026     */
6027    struct LDKC2Tuple_SignatureCVec_SignatureZZ *result;
6028    /**
6029     * Note that this value is always NULL, as there are no contents in the Err variant
6030     */
6031    void *err;
6032 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr;
6033
6034 /**
6035  * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation,
6036  * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure.
6037  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6038  */
6039 typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ {
6040    /**
6041     * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either
6042     * `err` or `result` depending on the state of `result_ok`.
6043     */
6044    union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents;
6045    /**
6046     * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state.
6047     */
6048    bool result_ok;
6049 } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ;
6050
6051 /**
6052  * The contents of CResult_SignatureNoneZ
6053  */
6054 typedef union LDKCResult_SignatureNoneZPtr {
6055    /**
6056     * A pointer to the contents in the success state.
6057     * Reading from this pointer when `result_ok` is not set is undefined.
6058     */
6059    struct LDKSignature *result;
6060    /**
6061     * Note that this value is always NULL, as there are no contents in the Err variant
6062     */
6063    void *err;
6064 } LDKCResult_SignatureNoneZPtr;
6065
6066 /**
6067  * A CResult_SignatureNoneZ represents the result of a fallible operation,
6068  * containing a crate::c_types::Signature on success and a () on failure.
6069  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6070  */
6071 typedef struct LDKCResult_SignatureNoneZ {
6072    /**
6073     * The contents of this CResult_SignatureNoneZ, accessible via either
6074     * `err` or `result` depending on the state of `result_ok`.
6075     */
6076    union LDKCResult_SignatureNoneZPtr contents;
6077    /**
6078     * Whether this CResult_SignatureNoneZ represents a success state.
6079     */
6080    bool result_ok;
6081 } LDKCResult_SignatureNoneZ;
6082
6083 /**
6084  * A tuple of 2 elements. See the individual fields for the types contained.
6085  */
6086 typedef struct LDKC2Tuple_SignatureSignatureZ {
6087    /**
6088     * The element at position 0
6089     */
6090    struct LDKSignature a;
6091    /**
6092     * The element at position 1
6093     */
6094    struct LDKSignature b;
6095 } LDKC2Tuple_SignatureSignatureZ;
6096
6097 /**
6098  * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ
6099  */
6100 typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr {
6101    /**
6102     * A pointer to the contents in the success state.
6103     * Reading from this pointer when `result_ok` is not set is undefined.
6104     */
6105    struct LDKC2Tuple_SignatureSignatureZ *result;
6106    /**
6107     * Note that this value is always NULL, as there are no contents in the Err variant
6108     */
6109    void *err;
6110 } LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr;
6111
6112 /**
6113  * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation,
6114  * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure.
6115  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6116  */
6117 typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ {
6118    /**
6119     * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either
6120     * `err` or `result` depending on the state of `result_ok`.
6121     */
6122    union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents;
6123    /**
6124     * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state.
6125     */
6126    bool result_ok;
6127 } LDKCResult_C2Tuple_SignatureSignatureZNoneZ;
6128
6129 /**
6130  * The contents of CResult_SecretKeyNoneZ
6131  */
6132 typedef union LDKCResult_SecretKeyNoneZPtr {
6133    /**
6134     * A pointer to the contents in the success state.
6135     * Reading from this pointer when `result_ok` is not set is undefined.
6136     */
6137    struct LDKSecretKey *result;
6138    /**
6139     * Note that this value is always NULL, as there are no contents in the Err variant
6140     */
6141    void *err;
6142 } LDKCResult_SecretKeyNoneZPtr;
6143
6144 /**
6145  * A CResult_SecretKeyNoneZ represents the result of a fallible operation,
6146  * containing a crate::c_types::SecretKey on success and a () on failure.
6147  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6148  */
6149 typedef struct LDKCResult_SecretKeyNoneZ {
6150    /**
6151     * The contents of this CResult_SecretKeyNoneZ, accessible via either
6152     * `err` or `result` depending on the state of `result_ok`.
6153     */
6154    union LDKCResult_SecretKeyNoneZPtr contents;
6155    /**
6156     * Whether this CResult_SecretKeyNoneZ represents a success state.
6157     */
6158    bool result_ok;
6159 } LDKCResult_SecretKeyNoneZ;
6160
6161
6162
6163 /**
6164  * This class tracks the per-transaction information needed to build a closing transaction and will
6165  * actually build it and sign.
6166  *
6167  * This class can be used inside a signer implementation to generate a signature given the relevant
6168  * secret key.
6169  */
6170 typedef struct MUST_USE_STRUCT LDKClosingTransaction {
6171    /**
6172     * A pointer to the opaque Rust object.
6173     * Nearly everywhere, inner must be non-null, however in places where
6174     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6175     */
6176    LDKnativeClosingTransaction *inner;
6177    /**
6178     * Indicates that this is the only struct which contains the same pointer.
6179     * Rust functions which take ownership of an object provided via an argument require
6180     * this to be true and invalidate the object pointed to by inner.
6181     */
6182    bool is_owned;
6183 } LDKClosingTransaction;
6184
6185
6186
6187 /**
6188  * The unsigned part of a channel_announcement
6189  */
6190 typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement {
6191    /**
6192     * A pointer to the opaque Rust object.
6193     * Nearly everywhere, inner must be non-null, however in places where
6194     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6195     */
6196    LDKnativeUnsignedChannelAnnouncement *inner;
6197    /**
6198     * Indicates that this is the only struct which contains the same pointer.
6199     * Rust functions which take ownership of an object provided via an argument require
6200     * this to be true and invalidate the object pointed to by inner.
6201     */
6202    bool is_owned;
6203 } LDKUnsignedChannelAnnouncement;
6204
6205 /**
6206  * A trait to sign lightning channel transactions as described in BOLT 3.
6207  *
6208  * Signing services could be implemented on a hardware wallet. In this case,
6209  * the current Sign would be a front-end on top of a communication
6210  * channel connected to your secure device and lightning key material wouldn't
6211  * reside on a hot server. Nevertheless, a this deployment would still need
6212  * to trust the ChannelManager to avoid loss of funds as this latest component
6213  * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys.
6214  *
6215  * A more secure iteration would be to use hashlock (or payment points) to pair
6216  * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager
6217  * at the price of more state and computation on the hardware wallet side. In the future,
6218  * we are looking forward to design such interface.
6219  *
6220  * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted
6221  * to act, as liveness and breach reply correctness are always going to be hard requirements
6222  * of LN security model, orthogonal of key management issues.
6223  */
6224 typedef struct LDKBaseSign {
6225    /**
6226     * An opaque pointer which is passed to your function implementations as an argument.
6227     * This has no meaning in the LDK, and can be NULL or any other value.
6228     */
6229    void *this_arg;
6230    /**
6231     * Gets the per-commitment point for a specific commitment number
6232     *
6233     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
6234     */
6235    struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx);
6236    /**
6237     * Gets the commitment secret for a specific commitment number as part of the revocation process
6238     *
6239     * An external signer implementation should error here if the commitment was already signed
6240     * and should refuse to sign it in the future.
6241     *
6242     * May be called more than once for the same index.
6243     *
6244     * Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
6245     */
6246    struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx);
6247    /**
6248     * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
6249     *
6250     * This is required in order for the signer to make sure that releasing a commitment
6251     * secret won't leave us without a broadcastable holder transaction.
6252     * Policy checks should be implemented in this function, including checking the amount
6253     * sent to us and checking the HTLCs.
6254     *
6255     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6256     * A validating signer should ensure that an HTLC output is removed only when the matching
6257     * preimage is provided, or when the value to holder is restored.
6258     *
6259     * NOTE: all the relevant preimages will be provided, but there may also be additional
6260     * irrelevant or duplicate preimages.
6261     */
6262    struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages);
6263    /**
6264     * Gets the holder's channel public keys and basepoints
6265     */
6266    struct LDKChannelPublicKeys pubkeys;
6267    /**
6268     * Fill in the pubkeys field as a reference to it will be given to Rust after this returns
6269     * Note that this takes a pointer to this object, not the this_ptr like other methods do
6270     * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
6271     */
6272    void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR );
6273    /**
6274     * Gets an arbitrary identifier describing the set of keys which are provided back to you in
6275     * some SpendableOutputDescriptor types. This should be sufficient to identify this
6276     * Sign object uniquely and lookup or re-derive its keys.
6277     */
6278    struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg);
6279    /**
6280     * Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
6281     *
6282     * Note that if signing fails or is rejected, the channel will be force-closed.
6283     *
6284     * Policy checks should be implemented in this function, including checking the amount
6285     * sent to us and checking the HTLCs.
6286     *
6287     * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided.
6288     * A validating signer should ensure that an HTLC output is removed only when the matching
6289     * preimage is provided, or when the value to holder is restored.
6290     *
6291     * NOTE: all the relevant preimages will be provided, but there may also be additional
6292     * irrelevant or duplicate preimages.
6293     */
6294    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages);
6295    /**
6296     * Validate the counterparty's revocation.
6297     *
6298     * This is required in order for the signer to make sure that the state has moved
6299     * forward and it is safe to sign the next counterparty commitment.
6300     */
6301    struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]);
6302    /**
6303     * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
6304     * This will only ever be called with a non-revoked commitment_tx.  This will be called with the
6305     * latest commitment_tx when we initiate a force-close.
6306     * This will be called with the previous latest, just to get claiming HTLC signatures, if we are
6307     * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to
6308     * the latest.
6309     * This may be called multiple times for the same transaction.
6310     *
6311     * An external signer implementation should check that the commitment has not been revoked.
6312     *
6313     * May return Err if key derivation fails.  Callers, such as ChannelMonitor, will panic in such a case.
6314     */
6315    struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx);
6316    /**
6317     * Create a signature for the given input in a transaction spending an HTLC transaction output
6318     * or a commitment transaction `to_local` output when our counterparty broadcasts an old state.
6319     *
6320     * A justice transaction may claim multiple outputs at the same time if timelocks are
6321     * similar, but only a signature for the input at index `input` should be signed for here.
6322     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
6323     * to an upcoming timelock expiration.
6324     *
6325     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6326     *
6327     * per_commitment_key is revocation secret which was provided by our counterparty when they
6328     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
6329     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
6330     * so).
6331     */
6332    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]);
6333    /**
6334     * Create a signature for the given input in a transaction spending a commitment transaction
6335     * HTLC output when our counterparty broadcasts an old state.
6336     *
6337     * A justice transaction may claim multiple outputs at the same time if timelocks are
6338     * similar, but only a signature for the input at index `input` should be signed for here.
6339     * It may be called multiple times for same output(s) if a fee-bump is needed with regards
6340     * to an upcoming timelock expiration.
6341     *
6342     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6343     *
6344     * per_commitment_key is revocation secret which was provided by our counterparty when they
6345     * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does
6346     * not allow the spending of any funds by itself (you need our holder revocation_secret to do
6347     * so).
6348     *
6349     * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script
6350     * (which is committed to in the BIP 143 signatures).
6351     */
6352    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);
6353    /**
6354     * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment
6355     * transaction, either offered or received.
6356     *
6357     * Such a transaction may claim multiples offered outputs at same time if we know the
6358     * preimage for each when we create it, but only the input at index `input` should be
6359     * signed for here. It may be called multiple times for same output(s) if a fee-bump is
6360     * needed with regards to an upcoming timelock expiration.
6361     *
6362     * Witness_script is either a offered or received script as defined in BOLT3 for HTLC
6363     * outputs.
6364     *
6365     * Amount is value of the output spent by this input, committed to in the BIP 143 signature.
6366     *
6367     * Per_commitment_point is the dynamic point corresponding to the channel state
6368     * detected onchain. It has been generated by our counterparty and is used to derive
6369     * channel state keys, which are then included in the witness script and committed to in the
6370     * BIP 143 signature.
6371     */
6372    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);
6373    /**
6374     * Create a signature for a (proposed) closing transaction.
6375     *
6376     * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
6377     * chosen to forgo their output as dust.
6378     */
6379    struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx);
6380    /**
6381     * Signs a channel announcement message with our funding key and our node secret key (aka
6382     * node_id or network_key), proving it comes from one of the channel participants.
6383     *
6384     * The first returned signature should be from our node secret key, the second from our
6385     * funding key.
6386     *
6387     * Note that if this fails or is rejected, the channel will not be publicly announced and
6388     * our counterparty may (though likely will not) close the channel on us for violating the
6389     * protocol.
6390     */
6391    struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg);
6392    /**
6393     * Set the counterparty static channel data, including basepoints,
6394     * counterparty_selected/holder_selected_contest_delay and funding outpoint.
6395     * This is done as soon as the funding outpoint is known.  Since these are static channel data,
6396     * they MUST NOT be allowed to change to different values once set.
6397     *
6398     * channel_parameters.is_populated() MUST be true.
6399     *
6400     * We bind holder_selected_contest_delay late here for API convenience.
6401     *
6402     * Will be called before any signatures are applied.
6403     */
6404    void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters);
6405    /**
6406     * Frees any resources associated with this object given its this_arg pointer.
6407     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6408     */
6409    void (*free)(void *this_arg);
6410 } LDKBaseSign;
6411
6412 /**
6413  * A cloneable signer.
6414  *
6415  * Although we require signers to be cloneable, it may be useful for developers to be able to use
6416  * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait,
6417  * which implies Sized, into this derived trait.
6418  */
6419 typedef struct LDKSign {
6420    /**
6421     * An opaque pointer which is passed to your function implementations as an argument.
6422     * This has no meaning in the LDK, and can be NULL or any other value.
6423     */
6424    void *this_arg;
6425    /**
6426     * Implementation of BaseSign for this object.
6427     */
6428    struct LDKBaseSign BaseSign;
6429    /**
6430     * Serialize the object into a byte array
6431     */
6432    struct LDKCVec_u8Z (*write)(const void *this_arg);
6433    /**
6434     * Called, if set, after this Sign has been cloned into a duplicate object.
6435     * The new Sign is provided, and should be mutated as needed to perform a
6436     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
6437     */
6438    void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign);
6439    /**
6440     * Frees any resources associated with this object given its this_arg pointer.
6441     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
6442     */
6443    void (*free)(void *this_arg);
6444 } LDKSign;
6445
6446 /**
6447  * The contents of CResult_SignDecodeErrorZ
6448  */
6449 typedef union LDKCResult_SignDecodeErrorZPtr {
6450    /**
6451     * A pointer to the contents in the success state.
6452     * Reading from this pointer when `result_ok` is not set is undefined.
6453     */
6454    struct LDKSign *result;
6455    /**
6456     * A pointer to the contents in the error state.
6457     * Reading from this pointer when `result_ok` is set is undefined.
6458     */
6459    struct LDKDecodeError *err;
6460 } LDKCResult_SignDecodeErrorZPtr;
6461
6462 /**
6463  * A CResult_SignDecodeErrorZ represents the result of a fallible operation,
6464  * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure.
6465  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6466  */
6467 typedef struct LDKCResult_SignDecodeErrorZ {
6468    /**
6469     * The contents of this CResult_SignDecodeErrorZ, accessible via either
6470     * `err` or `result` depending on the state of `result_ok`.
6471     */
6472    union LDKCResult_SignDecodeErrorZPtr contents;
6473    /**
6474     * Whether this CResult_SignDecodeErrorZ represents a success state.
6475     */
6476    bool result_ok;
6477 } LDKCResult_SignDecodeErrorZ;
6478
6479 /**
6480  * Integer in the range `0..32`
6481  */
6482 typedef struct LDKu5 {
6483    uint8_t _0;
6484 } LDKu5;
6485
6486 /**
6487  * A dynamically-allocated array of crate::c_types::u5s of arbitrary size.
6488  * This corresponds to std::vector in C++
6489  */
6490 typedef struct LDKCVec_u5Z {
6491    /**
6492     * The elements in the array.
6493     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6494     */
6495    struct LDKu5 *data;
6496    /**
6497     * The number of elements pointed to by `data`.
6498     */
6499    uintptr_t datalen;
6500 } LDKCVec_u5Z;
6501
6502 /**
6503  * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which
6504  * allows recovering the exact public key which created the signature given the message.
6505  */
6506 typedef struct LDKRecoverableSignature {
6507    /**
6508     * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for
6509     * recovery.
6510     */
6511    uint8_t serialized_form[68];
6512 } LDKRecoverableSignature;
6513
6514 /**
6515  * The contents of CResult_RecoverableSignatureNoneZ
6516  */
6517 typedef union LDKCResult_RecoverableSignatureNoneZPtr {
6518    /**
6519     * A pointer to the contents in the success state.
6520     * Reading from this pointer when `result_ok` is not set is undefined.
6521     */
6522    struct LDKRecoverableSignature *result;
6523    /**
6524     * Note that this value is always NULL, as there are no contents in the Err variant
6525     */
6526    void *err;
6527 } LDKCResult_RecoverableSignatureNoneZPtr;
6528
6529 /**
6530  * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation,
6531  * containing a crate::c_types::RecoverableSignature on success and a () on failure.
6532  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6533  */
6534 typedef struct LDKCResult_RecoverableSignatureNoneZ {
6535    /**
6536     * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either
6537     * `err` or `result` depending on the state of `result_ok`.
6538     */
6539    union LDKCResult_RecoverableSignatureNoneZPtr contents;
6540    /**
6541     * Whether this CResult_RecoverableSignatureNoneZ represents a success state.
6542     */
6543    bool result_ok;
6544 } LDKCResult_RecoverableSignatureNoneZ;
6545
6546 /**
6547  * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
6548  * This corresponds to std::vector in C++
6549  */
6550 typedef struct LDKCVec_CVec_u8ZZ {
6551    /**
6552     * The elements in the array.
6553     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6554     */
6555    struct LDKCVec_u8Z *data;
6556    /**
6557     * The number of elements pointed to by `data`.
6558     */
6559    uintptr_t datalen;
6560 } LDKCVec_CVec_u8ZZ;
6561
6562 /**
6563  * The contents of CResult_CVec_CVec_u8ZZNoneZ
6564  */
6565 typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
6566    /**
6567     * A pointer to the contents in the success state.
6568     * Reading from this pointer when `result_ok` is not set is undefined.
6569     */
6570    struct LDKCVec_CVec_u8ZZ *result;
6571    /**
6572     * Note that this value is always NULL, as there are no contents in the Err variant
6573     */
6574    void *err;
6575 } LDKCResult_CVec_CVec_u8ZZNoneZPtr;
6576
6577 /**
6578  * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
6579  * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
6580  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6581  */
6582 typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
6583    /**
6584     * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
6585     * `err` or `result` depending on the state of `result_ok`.
6586     */
6587    union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
6588    /**
6589     * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
6590     */
6591    bool result_ok;
6592 } LDKCResult_CVec_CVec_u8ZZNoneZ;
6593
6594
6595
6596 /**
6597  * A simple implementation of Sign that just keeps the private keys in memory.
6598  *
6599  * This implementation performs no policy checks and is insufficient by itself as
6600  * a secure external signer.
6601  */
6602 typedef struct MUST_USE_STRUCT LDKInMemorySigner {
6603    /**
6604     * A pointer to the opaque Rust object.
6605     * Nearly everywhere, inner must be non-null, however in places where
6606     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6607     */
6608    LDKnativeInMemorySigner *inner;
6609    /**
6610     * Indicates that this is the only struct which contains the same pointer.
6611     * Rust functions which take ownership of an object provided via an argument require
6612     * this to be true and invalidate the object pointed to by inner.
6613     */
6614    bool is_owned;
6615 } LDKInMemorySigner;
6616
6617 /**
6618  * The contents of CResult_InMemorySignerDecodeErrorZ
6619  */
6620 typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
6621    /**
6622     * A pointer to the contents in the success state.
6623     * Reading from this pointer when `result_ok` is not set is undefined.
6624     */
6625    struct LDKInMemorySigner *result;
6626    /**
6627     * A pointer to the contents in the error state.
6628     * Reading from this pointer when `result_ok` is set is undefined.
6629     */
6630    struct LDKDecodeError *err;
6631 } LDKCResult_InMemorySignerDecodeErrorZPtr;
6632
6633 /**
6634  * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
6635  * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure.
6636  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6637  */
6638 typedef struct LDKCResult_InMemorySignerDecodeErrorZ {
6639    /**
6640     * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
6641     * `err` or `result` depending on the state of `result_ok`.
6642     */
6643    union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
6644    /**
6645     * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
6646     */
6647    bool result_ok;
6648 } LDKCResult_InMemorySignerDecodeErrorZ;
6649
6650 /**
6651  * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
6652  * This corresponds to std::vector in C++
6653  */
6654 typedef struct LDKCVec_TxOutZ {
6655    /**
6656     * The elements in the array.
6657     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6658     */
6659    struct LDKTxOut *data;
6660    /**
6661     * The number of elements pointed to by `data`.
6662     */
6663    uintptr_t datalen;
6664 } LDKCVec_TxOutZ;
6665
6666 /**
6667  * The contents of CResult_TransactionNoneZ
6668  */
6669 typedef union LDKCResult_TransactionNoneZPtr {
6670    /**
6671     * A pointer to the contents in the success state.
6672     * Reading from this pointer when `result_ok` is not set is undefined.
6673     */
6674    struct LDKTransaction *result;
6675    /**
6676     * Note that this value is always NULL, as there are no contents in the Err variant
6677     */
6678    void *err;
6679 } LDKCResult_TransactionNoneZPtr;
6680
6681 /**
6682  * A CResult_TransactionNoneZ represents the result of a fallible operation,
6683  * containing a crate::c_types::Transaction on success and a () on failure.
6684  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6685  */
6686 typedef struct LDKCResult_TransactionNoneZ {
6687    /**
6688     * The contents of this CResult_TransactionNoneZ, accessible via either
6689     * `err` or `result` depending on the state of `result_ok`.
6690     */
6691    union LDKCResult_TransactionNoneZPtr contents;
6692    /**
6693     * Whether this CResult_TransactionNoneZ represents a success state.
6694     */
6695    bool result_ok;
6696 } LDKCResult_TransactionNoneZ;
6697
6698
6699
6700 /**
6701  * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
6702  * on-chain transactions to ensure no loss of funds occurs.
6703  *
6704  * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
6705  * information and are actively monitoring the chain.
6706  *
6707  * Pending Events or updated HTLCs which have not yet been read out by
6708  * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
6709  * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
6710  * gotten are fully handled before re-serializing the new state.
6711  *
6712  * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
6713  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
6714  * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
6715  * returned block hash and the the current chain and then reconnecting blocks to get to the
6716  * best chain) upon deserializing the object!
6717  */
6718 typedef struct MUST_USE_STRUCT LDKChannelMonitor {
6719    /**
6720     * A pointer to the opaque Rust object.
6721     * Nearly everywhere, inner must be non-null, however in places where
6722     * the Rust equivalent takes an Option, it may be set to null to indicate None.
6723     */
6724    LDKnativeChannelMonitor *inner;
6725    /**
6726     * Indicates that this is the only struct which contains the same pointer.
6727     * Rust functions which take ownership of an object provided via an argument require
6728     * this to be true and invalidate the object pointed to by inner.
6729     */
6730    bool is_owned;
6731 } LDKChannelMonitor;
6732
6733 /**
6734  * A tuple of 2 elements. See the individual fields for the types contained.
6735  */
6736 typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
6737    /**
6738     * The element at position 0
6739     */
6740    struct LDKThirtyTwoBytes a;
6741    /**
6742     * The element at position 1
6743     */
6744    struct LDKChannelMonitor b;
6745 } LDKC2Tuple_BlockHashChannelMonitorZ;
6746
6747 /**
6748  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
6749  * This corresponds to std::vector in C++
6750  */
6751 typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
6752    /**
6753     * The elements in the array.
6754     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6755     */
6756    struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
6757    /**
6758     * The number of elements pointed to by `data`.
6759     */
6760    uintptr_t datalen;
6761 } LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
6762
6763 /**
6764  * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
6765  */
6766 typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
6767    /**
6768     * A pointer to the contents in the success state.
6769     * Reading from this pointer when `result_ok` is not set is undefined.
6770     */
6771    struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
6772    /**
6773     * A pointer to the contents in the error state.
6774     * Reading from this pointer when `result_ok` is set is undefined.
6775     */
6776    enum LDKIOError *err;
6777 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
6778
6779 /**
6780  * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
6781  * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
6782  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6783  */
6784 typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
6785    /**
6786     * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
6787     * `err` or `result` depending on the state of `result_ok`.
6788     */
6789    union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
6790    /**
6791     * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
6792     */
6793    bool result_ok;
6794 } LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
6795
6796 /**
6797  * An enum which can either contain a u16 or not
6798  */
6799 typedef enum LDKCOption_u16Z_Tag {
6800    /**
6801     * When we're in this state, this COption_u16Z contains a u16
6802     */
6803    LDKCOption_u16Z_Some,
6804    /**
6805     * When we're in this state, this COption_u16Z contains nothing
6806     */
6807    LDKCOption_u16Z_None,
6808    /**
6809     * Must be last for serialization purposes
6810     */
6811    LDKCOption_u16Z_Sentinel,
6812 } LDKCOption_u16Z_Tag;
6813
6814 typedef struct LDKCOption_u16Z {
6815    LDKCOption_u16Z_Tag tag;
6816    union {
6817       struct {
6818          uint16_t some;
6819       };
6820    };
6821 } LDKCOption_u16Z;
6822
6823 /**
6824  * Indicates an error on the client's part (usually some variant of attempting to use too-low or
6825  * too-high values)
6826  */
6827 typedef enum LDKAPIError_Tag {
6828    /**
6829     * Indicates the API was wholly misused (see err for more). Cases where these can be returned
6830     * are documented, but generally indicates some precondition of a function was violated.
6831     */
6832    LDKAPIError_APIMisuseError,
6833    /**
6834     * Due to a high feerate, we were unable to complete the request.
6835     * For example, this may be returned if the feerate implies we cannot open a channel at the
6836     * requested value, but opening a larger channel would succeed.
6837     */
6838    LDKAPIError_FeeRateTooHigh,
6839    /**
6840     * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
6841     * too-many-hops, etc).
6842     */
6843    LDKAPIError_RouteError,
6844    /**
6845     * We were unable to complete the request as the Channel required to do so is unable to
6846     * complete the request (or was not found). This can take many forms, including disconnected
6847     * peer, channel at capacity, channel shutting down, etc.
6848     */
6849    LDKAPIError_ChannelUnavailable,
6850    /**
6851     * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
6852     * attempted action to fail.
6853     */
6854    LDKAPIError_MonitorUpdateFailed,
6855    /**
6856     * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
6857     * with the channel counterparty as negotiated in [`InitFeatures`].
6858     *
6859     * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
6860     * a channel or cooperatively close one with this peer (and will have to force-close instead).
6861     *
6862     * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
6863     * [`InitFeatures`]: crate::ln::features::InitFeatures
6864     */
6865    LDKAPIError_IncompatibleShutdownScript,
6866    /**
6867     * Must be last for serialization purposes
6868     */
6869    LDKAPIError_Sentinel,
6870 } LDKAPIError_Tag;
6871
6872 typedef struct LDKAPIError_LDKAPIMisuseError_Body {
6873    /**
6874     * A human-readable error message
6875     */
6876    struct LDKStr err;
6877 } LDKAPIError_LDKAPIMisuseError_Body;
6878
6879 typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
6880    /**
6881     * A human-readable error message
6882     */
6883    struct LDKStr err;
6884    /**
6885     * The feerate which was too high.
6886     */
6887    uint32_t feerate;
6888 } LDKAPIError_LDKFeeRateTooHigh_Body;
6889
6890 typedef struct LDKAPIError_LDKRouteError_Body {
6891    /**
6892     * A human-readable error message
6893     */
6894    struct LDKStr err;
6895 } LDKAPIError_LDKRouteError_Body;
6896
6897 typedef struct LDKAPIError_LDKChannelUnavailable_Body {
6898    /**
6899     * A human-readable error message
6900     */
6901    struct LDKStr err;
6902 } LDKAPIError_LDKChannelUnavailable_Body;
6903
6904 typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
6905    /**
6906     * The incompatible shutdown script.
6907     */
6908    struct LDKShutdownScript script;
6909 } LDKAPIError_LDKIncompatibleShutdownScript_Body;
6910
6911 typedef struct MUST_USE_STRUCT LDKAPIError {
6912    LDKAPIError_Tag tag;
6913    union {
6914       LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
6915       LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
6916       LDKAPIError_LDKRouteError_Body route_error;
6917       LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
6918       LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
6919    };
6920 } LDKAPIError;
6921
6922 /**
6923  * The contents of CResult_NoneAPIErrorZ
6924  */
6925 typedef union LDKCResult_NoneAPIErrorZPtr {
6926    /**
6927     * Note that this value is always NULL, as there are no contents in the OK variant
6928     */
6929    void *result;
6930    /**
6931     * A pointer to the contents in the error state.
6932     * Reading from this pointer when `result_ok` is set is undefined.
6933     */
6934    struct LDKAPIError *err;
6935 } LDKCResult_NoneAPIErrorZPtr;
6936
6937 /**
6938  * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
6939  * containing a () on success and a crate::lightning::util::errors::APIError on failure.
6940  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
6941  */
6942 typedef struct LDKCResult_NoneAPIErrorZ {
6943    /**
6944     * The contents of this CResult_NoneAPIErrorZ, accessible via either
6945     * `err` or `result` depending on the state of `result_ok`.
6946     */
6947    union LDKCResult_NoneAPIErrorZPtr contents;
6948    /**
6949     * Whether this CResult_NoneAPIErrorZ represents a success state.
6950     */
6951    bool result_ok;
6952 } LDKCResult_NoneAPIErrorZ;
6953
6954 /**
6955  * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
6956  * This corresponds to std::vector in C++
6957  */
6958 typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
6959    /**
6960     * The elements in the array.
6961     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6962     */
6963    struct LDKCResult_NoneAPIErrorZ *data;
6964    /**
6965     * The number of elements pointed to by `data`.
6966     */
6967    uintptr_t datalen;
6968 } LDKCVec_CResult_NoneAPIErrorZZ;
6969
6970 /**
6971  * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
6972  * This corresponds to std::vector in C++
6973  */
6974 typedef struct LDKCVec_APIErrorZ {
6975    /**
6976     * The elements in the array.
6977     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
6978     */
6979    struct LDKAPIError *data;
6980    /**
6981     * The number of elements pointed to by `data`.
6982     */
6983    uintptr_t datalen;
6984 } LDKCVec_APIErrorZ;
6985
6986 /**
6987  * The contents of CResult__u832APIErrorZ
6988  */
6989 typedef union LDKCResult__u832APIErrorZPtr {
6990    /**
6991     * A pointer to the contents in the success state.
6992     * Reading from this pointer when `result_ok` is not set is undefined.
6993     */
6994    struct LDKThirtyTwoBytes *result;
6995    /**
6996     * A pointer to the contents in the error state.
6997     * Reading from this pointer when `result_ok` is set is undefined.
6998     */
6999    struct LDKAPIError *err;
7000 } LDKCResult__u832APIErrorZPtr;
7001
7002 /**
7003  * A CResult__u832APIErrorZ represents the result of a fallible operation,
7004  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7005  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7006  */
7007 typedef struct LDKCResult__u832APIErrorZ {
7008    /**
7009     * The contents of this CResult__u832APIErrorZ, accessible via either
7010     * `err` or `result` depending on the state of `result_ok`.
7011     */
7012    union LDKCResult__u832APIErrorZPtr contents;
7013    /**
7014     * Whether this CResult__u832APIErrorZ represents a success state.
7015     */
7016    bool result_ok;
7017 } LDKCResult__u832APIErrorZ;
7018
7019 /**
7020  * If a payment fails to send, it can be in one of several states. This enum is returned as the
7021  * Err() type describing which state the payment is in, see the description of individual enum
7022  * states for more.
7023  */
7024 typedef enum LDKPaymentSendFailure_Tag {
7025    /**
7026     * A parameter which was passed to send_payment was invalid, preventing us from attempting to
7027     * send the payment at all. No channel state has been changed or messages sent to peers, and
7028     * once you've changed the parameter at error, you can freely retry the payment in full.
7029     */
7030    LDKPaymentSendFailure_ParameterError,
7031    /**
7032     * A parameter in a single path which was passed to send_payment was invalid, preventing us
7033     * from attempting to send the payment at all. No channel state has been changed or messages
7034     * sent to peers, and once you've changed the parameter at error, you can freely retry the
7035     * payment in full.
7036     *
7037     * The results here are ordered the same as the paths in the route object which was passed to
7038     * send_payment.
7039     */
7040    LDKPaymentSendFailure_PathParameterError,
7041    /**
7042     * All paths which were attempted failed to send, with no channel state change taking place.
7043     * You can freely retry the payment in full (though you probably want to do so over different
7044     * paths than the ones selected).
7045     */
7046    LDKPaymentSendFailure_AllFailedRetrySafe,
7047    /**
7048     * Some paths which were attempted failed to send, though possibly not all. At least some
7049     * paths have irrevocably committed to the HTLC and retrying the payment in full would result
7050     * in over-/re-payment.
7051     *
7052     * The results here are ordered the same as the paths in the route object which was passed to
7053     * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
7054     * retried (though there is currently no API with which to do so).
7055     *
7056     * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
7057     * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
7058     * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
7059     * with the latest update_id.
7060     */
7061    LDKPaymentSendFailure_PartialFailure,
7062    /**
7063     * Must be last for serialization purposes
7064     */
7065    LDKPaymentSendFailure_Sentinel,
7066 } LDKPaymentSendFailure_Tag;
7067
7068 typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
7069    /**
7070     * The errors themselves, in the same order as the route hops.
7071     */
7072    struct LDKCVec_CResult_NoneAPIErrorZZ results;
7073    /**
7074     * If some paths failed without irrevocably committing to the new HTLC(s), this will
7075     * contain a [`RouteParameters`] object which can be used to calculate a new route that
7076     * will pay all remaining unpaid balance.
7077     *
7078     * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
7079     */
7080    struct LDKRouteParameters failed_paths_retry;
7081    /**
7082     * The payment id for the payment, which is now at least partially pending.
7083     */
7084    struct LDKThirtyTwoBytes payment_id;
7085 } LDKPaymentSendFailure_LDKPartialFailure_Body;
7086
7087 typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
7088    LDKPaymentSendFailure_Tag tag;
7089    union {
7090       struct {
7091          struct LDKAPIError parameter_error;
7092       };
7093       struct {
7094          struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
7095       };
7096       struct {
7097          struct LDKCVec_APIErrorZ all_failed_retry_safe;
7098       };
7099       LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
7100    };
7101 } LDKPaymentSendFailure;
7102
7103 /**
7104  * The contents of CResult_PaymentIdPaymentSendFailureZ
7105  */
7106 typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
7107    /**
7108     * A pointer to the contents in the success state.
7109     * Reading from this pointer when `result_ok` is not set is undefined.
7110     */
7111    struct LDKThirtyTwoBytes *result;
7112    /**
7113     * A pointer to the contents in the error state.
7114     * Reading from this pointer when `result_ok` is set is undefined.
7115     */
7116    struct LDKPaymentSendFailure *err;
7117 } LDKCResult_PaymentIdPaymentSendFailureZPtr;
7118
7119 /**
7120  * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
7121  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7122  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7123  */
7124 typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
7125    /**
7126     * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
7127     * `err` or `result` depending on the state of `result_ok`.
7128     */
7129    union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
7130    /**
7131     * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
7132     */
7133    bool result_ok;
7134 } LDKCResult_PaymentIdPaymentSendFailureZ;
7135
7136 /**
7137  * The contents of CResult_NonePaymentSendFailureZ
7138  */
7139 typedef union LDKCResult_NonePaymentSendFailureZPtr {
7140    /**
7141     * Note that this value is always NULL, as there are no contents in the OK variant
7142     */
7143    void *result;
7144    /**
7145     * A pointer to the contents in the error state.
7146     * Reading from this pointer when `result_ok` is set is undefined.
7147     */
7148    struct LDKPaymentSendFailure *err;
7149 } LDKCResult_NonePaymentSendFailureZPtr;
7150
7151 /**
7152  * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
7153  * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7154  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7155  */
7156 typedef struct LDKCResult_NonePaymentSendFailureZ {
7157    /**
7158     * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
7159     * `err` or `result` depending on the state of `result_ok`.
7160     */
7161    union LDKCResult_NonePaymentSendFailureZPtr contents;
7162    /**
7163     * Whether this CResult_NonePaymentSendFailureZ represents a success state.
7164     */
7165    bool result_ok;
7166 } LDKCResult_NonePaymentSendFailureZ;
7167
7168 /**
7169  * A tuple of 2 elements. See the individual fields for the types contained.
7170  */
7171 typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
7172    /**
7173     * The element at position 0
7174     */
7175    struct LDKThirtyTwoBytes a;
7176    /**
7177     * The element at position 1
7178     */
7179    struct LDKThirtyTwoBytes b;
7180 } LDKC2Tuple_PaymentHashPaymentIdZ;
7181
7182 /**
7183  * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
7184  */
7185 typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
7186    /**
7187     * A pointer to the contents in the success state.
7188     * Reading from this pointer when `result_ok` is not set is undefined.
7189     */
7190    struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
7191    /**
7192     * A pointer to the contents in the error state.
7193     * Reading from this pointer when `result_ok` is set is undefined.
7194     */
7195    struct LDKPaymentSendFailure *err;
7196 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
7197
7198 /**
7199  * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
7200  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
7201  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7202  */
7203 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
7204    /**
7205     * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
7206     * `err` or `result` depending on the state of `result_ok`.
7207     */
7208    union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
7209    /**
7210     * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
7211     */
7212    bool result_ok;
7213 } LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
7214
7215 /**
7216  * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
7217  * This corresponds to std::vector in C++
7218  */
7219 typedef struct LDKCVec_ThirtyTwoBytesZ {
7220    /**
7221     * The elements in the array.
7222     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7223     */
7224    struct LDKThirtyTwoBytes *data;
7225    /**
7226     * The number of elements pointed to by `data`.
7227     */
7228    uintptr_t datalen;
7229 } LDKCVec_ThirtyTwoBytesZ;
7230
7231 /**
7232  * A tuple of 2 elements. See the individual fields for the types contained.
7233  */
7234 typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
7235    /**
7236     * The element at position 0
7237     */
7238    struct LDKThirtyTwoBytes a;
7239    /**
7240     * The element at position 1
7241     */
7242    struct LDKThirtyTwoBytes b;
7243 } LDKC2Tuple_PaymentHashPaymentSecretZ;
7244
7245 /**
7246  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
7247  */
7248 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
7249    /**
7250     * A pointer to the contents in the success state.
7251     * Reading from this pointer when `result_ok` is not set is undefined.
7252     */
7253    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
7254    /**
7255     * Note that this value is always NULL, as there are no contents in the Err variant
7256     */
7257    void *err;
7258 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
7259
7260 /**
7261  * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
7262  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
7263  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7264  */
7265 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
7266    /**
7267     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
7268     * `err` or `result` depending on the state of `result_ok`.
7269     */
7270    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
7271    /**
7272     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
7273     */
7274    bool result_ok;
7275 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
7276
7277 /**
7278  * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
7279  */
7280 typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
7281    /**
7282     * A pointer to the contents in the success state.
7283     * Reading from this pointer when `result_ok` is not set is undefined.
7284     */
7285    struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
7286    /**
7287     * A pointer to the contents in the error state.
7288     * Reading from this pointer when `result_ok` is set is undefined.
7289     */
7290    struct LDKAPIError *err;
7291 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
7292
7293 /**
7294  * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
7295  * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
7296  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7297  */
7298 typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
7299    /**
7300     * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
7301     * `err` or `result` depending on the state of `result_ok`.
7302     */
7303    union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
7304    /**
7305     * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
7306     */
7307    bool result_ok;
7308 } LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
7309
7310 /**
7311  * The contents of CResult_PaymentSecretNoneZ
7312  */
7313 typedef union LDKCResult_PaymentSecretNoneZPtr {
7314    /**
7315     * A pointer to the contents in the success state.
7316     * Reading from this pointer when `result_ok` is not set is undefined.
7317     */
7318    struct LDKThirtyTwoBytes *result;
7319    /**
7320     * Note that this value is always NULL, as there are no contents in the Err variant
7321     */
7322    void *err;
7323 } LDKCResult_PaymentSecretNoneZPtr;
7324
7325 /**
7326  * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
7327  * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
7328  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7329  */
7330 typedef struct LDKCResult_PaymentSecretNoneZ {
7331    /**
7332     * The contents of this CResult_PaymentSecretNoneZ, accessible via either
7333     * `err` or `result` depending on the state of `result_ok`.
7334     */
7335    union LDKCResult_PaymentSecretNoneZPtr contents;
7336    /**
7337     * Whether this CResult_PaymentSecretNoneZ represents a success state.
7338     */
7339    bool result_ok;
7340 } LDKCResult_PaymentSecretNoneZ;
7341
7342 /**
7343  * The contents of CResult_PaymentSecretAPIErrorZ
7344  */
7345 typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
7346    /**
7347     * A pointer to the contents in the success state.
7348     * Reading from this pointer when `result_ok` is not set is undefined.
7349     */
7350    struct LDKThirtyTwoBytes *result;
7351    /**
7352     * A pointer to the contents in the error state.
7353     * Reading from this pointer when `result_ok` is set is undefined.
7354     */
7355    struct LDKAPIError *err;
7356 } LDKCResult_PaymentSecretAPIErrorZPtr;
7357
7358 /**
7359  * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
7360  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7361  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7362  */
7363 typedef struct LDKCResult_PaymentSecretAPIErrorZ {
7364    /**
7365     * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
7366     * `err` or `result` depending on the state of `result_ok`.
7367     */
7368    union LDKCResult_PaymentSecretAPIErrorZPtr contents;
7369    /**
7370     * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
7371     */
7372    bool result_ok;
7373 } LDKCResult_PaymentSecretAPIErrorZ;
7374
7375 /**
7376  * The contents of CResult_PaymentPreimageAPIErrorZ
7377  */
7378 typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
7379    /**
7380     * A pointer to the contents in the success state.
7381     * Reading from this pointer when `result_ok` is not set is undefined.
7382     */
7383    struct LDKThirtyTwoBytes *result;
7384    /**
7385     * A pointer to the contents in the error state.
7386     * Reading from this pointer when `result_ok` is set is undefined.
7387     */
7388    struct LDKAPIError *err;
7389 } LDKCResult_PaymentPreimageAPIErrorZPtr;
7390
7391 /**
7392  * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
7393  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
7394  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7395  */
7396 typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
7397    /**
7398     * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
7399     * `err` or `result` depending on the state of `result_ok`.
7400     */
7401    union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
7402    /**
7403     * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
7404     */
7405    bool result_ok;
7406 } LDKCResult_PaymentPreimageAPIErrorZ;
7407
7408
7409
7410 /**
7411  * Information needed for constructing an invoice route hint for this channel.
7412  */
7413 typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
7414    /**
7415     * A pointer to the opaque Rust object.
7416     * Nearly everywhere, inner must be non-null, however in places where
7417     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7418     */
7419    LDKnativeCounterpartyForwardingInfo *inner;
7420    /**
7421     * Indicates that this is the only struct which contains the same pointer.
7422     * Rust functions which take ownership of an object provided via an argument require
7423     * this to be true and invalidate the object pointed to by inner.
7424     */
7425    bool is_owned;
7426 } LDKCounterpartyForwardingInfo;
7427
7428 /**
7429  * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
7430  */
7431 typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
7432    /**
7433     * A pointer to the contents in the success state.
7434     * Reading from this pointer when `result_ok` is not set is undefined.
7435     */
7436    struct LDKCounterpartyForwardingInfo *result;
7437    /**
7438     * A pointer to the contents in the error state.
7439     * Reading from this pointer when `result_ok` is set is undefined.
7440     */
7441    struct LDKDecodeError *err;
7442 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr;
7443
7444 /**
7445  * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
7446  * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure.
7447  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7448  */
7449 typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ {
7450    /**
7451     * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
7452     * `err` or `result` depending on the state of `result_ok`.
7453     */
7454    union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
7455    /**
7456     * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
7457     */
7458    bool result_ok;
7459 } LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
7460
7461
7462
7463 /**
7464  * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
7465  * to better separate parameters.
7466  */
7467 typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
7468    /**
7469     * A pointer to the opaque Rust object.
7470     * Nearly everywhere, inner must be non-null, however in places where
7471     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7472     */
7473    LDKnativeChannelCounterparty *inner;
7474    /**
7475     * Indicates that this is the only struct which contains the same pointer.
7476     * Rust functions which take ownership of an object provided via an argument require
7477     * this to be true and invalidate the object pointed to by inner.
7478     */
7479    bool is_owned;
7480 } LDKChannelCounterparty;
7481
7482 /**
7483  * The contents of CResult_ChannelCounterpartyDecodeErrorZ
7484  */
7485 typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
7486    /**
7487     * A pointer to the contents in the success state.
7488     * Reading from this pointer when `result_ok` is not set is undefined.
7489     */
7490    struct LDKChannelCounterparty *result;
7491    /**
7492     * A pointer to the contents in the error state.
7493     * Reading from this pointer when `result_ok` is set is undefined.
7494     */
7495    struct LDKDecodeError *err;
7496 } LDKCResult_ChannelCounterpartyDecodeErrorZPtr;
7497
7498 /**
7499  * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
7500  * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure.
7501  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7502  */
7503 typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ {
7504    /**
7505     * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
7506     * `err` or `result` depending on the state of `result_ok`.
7507     */
7508    union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
7509    /**
7510     * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
7511     */
7512    bool result_ok;
7513 } LDKCResult_ChannelCounterpartyDecodeErrorZ;
7514
7515 /**
7516  * The contents of CResult_ChannelDetailsDecodeErrorZ
7517  */
7518 typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
7519    /**
7520     * A pointer to the contents in the success state.
7521     * Reading from this pointer when `result_ok` is not set is undefined.
7522     */
7523    struct LDKChannelDetails *result;
7524    /**
7525     * A pointer to the contents in the error state.
7526     * Reading from this pointer when `result_ok` is set is undefined.
7527     */
7528    struct LDKDecodeError *err;
7529 } LDKCResult_ChannelDetailsDecodeErrorZPtr;
7530
7531 /**
7532  * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
7533  * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure.
7534  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7535  */
7536 typedef struct LDKCResult_ChannelDetailsDecodeErrorZ {
7537    /**
7538     * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
7539     * `err` or `result` depending on the state of `result_ok`.
7540     */
7541    union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
7542    /**
7543     * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
7544     */
7545    bool result_ok;
7546 } LDKCResult_ChannelDetailsDecodeErrorZ;
7547
7548
7549
7550 /**
7551  * Route hints used in constructing invoices for [phantom node payents].
7552  *
7553  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
7554  */
7555 typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
7556    /**
7557     * A pointer to the opaque Rust object.
7558     * Nearly everywhere, inner must be non-null, however in places where
7559     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7560     */
7561    LDKnativePhantomRouteHints *inner;
7562    /**
7563     * Indicates that this is the only struct which contains the same pointer.
7564     * Rust functions which take ownership of an object provided via an argument require
7565     * this to be true and invalidate the object pointed to by inner.
7566     */
7567    bool is_owned;
7568 } LDKPhantomRouteHints;
7569
7570 /**
7571  * The contents of CResult_PhantomRouteHintsDecodeErrorZ
7572  */
7573 typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
7574    /**
7575     * A pointer to the contents in the success state.
7576     * Reading from this pointer when `result_ok` is not set is undefined.
7577     */
7578    struct LDKPhantomRouteHints *result;
7579    /**
7580     * A pointer to the contents in the error state.
7581     * Reading from this pointer when `result_ok` is set is undefined.
7582     */
7583    struct LDKDecodeError *err;
7584 } LDKCResult_PhantomRouteHintsDecodeErrorZPtr;
7585
7586 /**
7587  * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
7588  * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure.
7589  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7590  */
7591 typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ {
7592    /**
7593     * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
7594     * `err` or `result` depending on the state of `result_ok`.
7595     */
7596    union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
7597    /**
7598     * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
7599     */
7600    bool result_ok;
7601 } LDKCResult_PhantomRouteHintsDecodeErrorZ;
7602
7603 /**
7604  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
7605  * This corresponds to std::vector in C++
7606  */
7607 typedef struct LDKCVec_ChannelMonitorZ {
7608    /**
7609     * The elements in the array.
7610     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
7611     */
7612    struct LDKChannelMonitor *data;
7613    /**
7614     * The number of elements pointed to by `data`.
7615     */
7616    uintptr_t datalen;
7617 } LDKCVec_ChannelMonitorZ;
7618
7619
7620
7621 /**
7622  * An update generated by the underlying Channel itself which contains some new information the
7623  * ChannelMonitor should be made aware of.
7624  */
7625 typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
7626    /**
7627     * A pointer to the opaque Rust object.
7628     * Nearly everywhere, inner must be non-null, however in places where
7629     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7630     */
7631    LDKnativeChannelMonitorUpdate *inner;
7632    /**
7633     * Indicates that this is the only struct which contains the same pointer.
7634     * Rust functions which take ownership of an object provided via an argument require
7635     * this to be true and invalidate the object pointed to by inner.
7636     */
7637    bool is_owned;
7638 } LDKChannelMonitorUpdate;
7639
7640 /**
7641  * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
7642  * blocks are connected and disconnected.
7643  *
7644  * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
7645  * responsible for maintaining a set of monitors such that they can be updated accordingly as
7646  * channel state changes and HTLCs are resolved. See method documentation for specific
7647  * requirements.
7648  *
7649  * Implementations **must** ensure that updates are successfully applied and persisted upon method
7650  * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
7651  * without taking any further action such as persisting the current state.
7652  *
7653  * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
7654  * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
7655  * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
7656  * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
7657  * multiple instances.
7658  *
7659  * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
7660  */
7661 typedef struct LDKWatch {
7662    /**
7663     * An opaque pointer which is passed to your function implementations as an argument.
7664     * This has no meaning in the LDK, and can be NULL or any other value.
7665     */
7666    void *this_arg;
7667    /**
7668     * Watches a channel identified by `funding_txo` using `monitor`.
7669     *
7670     * Implementations are responsible for watching the chain for the funding transaction along
7671     * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
7672     * calling [`block_connected`] and [`block_disconnected`] on the monitor.
7673     *
7674     * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
7675     * the given `funding_txo` has previously been registered via `watch_channel`.
7676     *
7677     * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
7678     * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
7679     * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
7680     */
7681    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
7682    /**
7683     * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
7684     *
7685     * Implementations must call [`update_monitor`] with the given update. See
7686     * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
7687     *
7688     * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
7689     */
7690    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
7691    /**
7692     * Returns any monitor events since the last call. Subsequent calls must only return new
7693     * events.
7694     *
7695     * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
7696     * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
7697     * to disk.
7698     *
7699     * For details on asynchronous [`ChannelMonitor`] updating and returning
7700     * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
7701     */
7702    struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg);
7703    /**
7704     * Frees any resources associated with this object given its this_arg pointer.
7705     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7706     */
7707    void (*free)(void *this_arg);
7708 } LDKWatch;
7709
7710 /**
7711  * An interface to send a transaction to the Bitcoin network.
7712  */
7713 typedef struct LDKBroadcasterInterface {
7714    /**
7715     * An opaque pointer which is passed to your function implementations as an argument.
7716     * This has no meaning in the LDK, and can be NULL or any other value.
7717     */
7718    void *this_arg;
7719    /**
7720     * Sends a transaction out to (hopefully) be mined.
7721     */
7722    void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
7723    /**
7724     * Frees any resources associated with this object given its this_arg pointer.
7725     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7726     */
7727    void (*free)(void *this_arg);
7728 } LDKBroadcasterInterface;
7729
7730 /**
7731  * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
7732  * own the memory pointed to by data.
7733  */
7734 typedef struct LDKu8slice {
7735    /**
7736     * A pointer to the byte buffer
7737     */
7738    const uint8_t *data;
7739    /**
7740     * The number of bytes pointed to by `data`.
7741     */
7742    uintptr_t datalen;
7743 } LDKu8slice;
7744
7745 /**
7746  * A trait to describe an object which can get user secrets and key material.
7747  */
7748 typedef struct LDKKeysInterface {
7749    /**
7750     * An opaque pointer which is passed to your function implementations as an argument.
7751     * This has no meaning in the LDK, and can be NULL or any other value.
7752     */
7753    void *this_arg;
7754    /**
7755     * Get node secret key based on the provided [`Recipient`].
7756     *
7757     * The node_id/network_key is the public key that corresponds to this secret key.
7758     *
7759     * This method must return the same value each time it is called with a given `Recipient`
7760     * parameter.
7761     */
7762    struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
7763    /**
7764     * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
7765     *
7766     * This method should return a different value each time it is called, to avoid linking
7767     * on-chain funds across channels as controlled to the same user.
7768     */
7769    struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
7770    /**
7771     * Get a script pubkey which we will send funds to when closing a channel.
7772     *
7773     * This method should return a different value each time it is called, to avoid linking
7774     * on-chain funds across channels as controlled to the same user.
7775     */
7776    struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
7777    /**
7778     * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
7779     * restarted with some stale data!
7780     *
7781     * This method must return a different value each time it is called.
7782     */
7783    struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
7784    /**
7785     * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
7786     * onion packets and for temporary channel IDs. There is no requirement that these be
7787     * persisted anywhere, though they must be unique across restarts.
7788     *
7789     * This method must return a different value each time it is called.
7790     */
7791    struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
7792    /**
7793     * Reads a `Signer` for this `KeysInterface` from the given input stream.
7794     * This is only called during deserialization of other objects which contain
7795     * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
7796     * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
7797     * contain no versioning scheme. You may wish to include your own version prefix and ensure
7798     * you've read all of the provided bytes to ensure no corruption occurred.
7799     */
7800    struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
7801    /**
7802     * Sign an invoice.
7803     * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
7804     * this trait to parse the invoice and make sure they're signing what they expect, rather than
7805     * blindly signing the hash.
7806     * The hrp is ascii bytes, while the invoice data is base32.
7807     *
7808     * The secret key used to sign the invoice is dependent on the [`Recipient`].
7809     */
7810    struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
7811    /**
7812     * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
7813     *
7814     * If the implementor of this trait supports [phantom node payments], then every node that is
7815     * intended to be included in the phantom invoice route hints must return the same value from
7816     * this method.
7817     *
7818     * This method must return the same value each time it is called.
7819     *
7820     * [phantom node payments]: PhantomKeysManager
7821     */
7822    struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
7823    /**
7824     * Frees any resources associated with this object given its this_arg pointer.
7825     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7826     */
7827    void (*free)(void *this_arg);
7828 } LDKKeysInterface;
7829
7830 /**
7831  * A trait which should be implemented to provide feerate information on a number of time
7832  * horizons.
7833  *
7834  * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
7835  * called from inside the library in response to chain events, P2P events, or timer events).
7836  */
7837 typedef struct LDKFeeEstimator {
7838    /**
7839     * An opaque pointer which is passed to your function implementations as an argument.
7840     * This has no meaning in the LDK, and can be NULL or any other value.
7841     */
7842    void *this_arg;
7843    /**
7844     * Gets estimated satoshis of fee required per 1000 Weight-Units.
7845     *
7846     * LDK will wrap this method and ensure that the value returned is no smaller than 253
7847     * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte).
7848     *
7849     * The following unit conversions can be used to convert to sats/KW:
7850     *  * satoshis-per-byte * 250
7851     *  * satoshis-per-kbyte / 4
7852     */
7853    uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
7854    /**
7855     * Frees any resources associated with this object given its this_arg pointer.
7856     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
7857     */
7858    void (*free)(void *this_arg);
7859 } LDKFeeEstimator;
7860
7861
7862
7863 /**
7864  * Manager which keeps track of a number of channels and sends messages to the appropriate
7865  * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
7866  *
7867  * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
7868  * to individual Channels.
7869  *
7870  * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
7871  * all peers during write/read (though does not modify this instance, only the instance being
7872  * serialized). This will result in any channels which have not yet exchanged funding_created (ie
7873  * called funding_transaction_generated for outbound channels).
7874  *
7875  * Note that you can be a bit lazier about writing out ChannelManager than you can be with
7876  * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
7877  * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
7878  * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
7879  * the serialization process). If the deserialized version is out-of-date compared to the
7880  * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
7881  * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
7882  *
7883  * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
7884  * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
7885  * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
7886  * block_connected() to step towards your best block) upon deserialization before using the
7887  * object!
7888  *
7889  * Note that ChannelManager is responsible for tracking liveness of its channels and generating
7890  * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
7891  * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
7892  * offline for a full minute. In order to track this, you must call
7893  * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
7894  *
7895  * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
7896  * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
7897  * essentially you should default to using a SimpleRefChannelManager, and use a
7898  * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
7899  * you're using lightning-net-tokio.
7900  */
7901 typedef struct MUST_USE_STRUCT LDKChannelManager {
7902    /**
7903     * A pointer to the opaque Rust object.
7904     * Nearly everywhere, inner must be non-null, however in places where
7905     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7906     */
7907    LDKnativeChannelManager *inner;
7908    /**
7909     * Indicates that this is the only struct which contains the same pointer.
7910     * Rust functions which take ownership of an object provided via an argument require
7911     * this to be true and invalidate the object pointed to by inner.
7912     */
7913    bool is_owned;
7914 } LDKChannelManager;
7915
7916 /**
7917  * A tuple of 2 elements. See the individual fields for the types contained.
7918  */
7919 typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
7920    /**
7921     * The element at position 0
7922     */
7923    struct LDKThirtyTwoBytes a;
7924    /**
7925     * The element at position 1
7926     */
7927    struct LDKChannelManager b;
7928 } LDKC2Tuple_BlockHashChannelManagerZ;
7929
7930 /**
7931  * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
7932  */
7933 typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
7934    /**
7935     * A pointer to the contents in the success state.
7936     * Reading from this pointer when `result_ok` is not set is undefined.
7937     */
7938    struct LDKC2Tuple_BlockHashChannelManagerZ *result;
7939    /**
7940     * A pointer to the contents in the error state.
7941     * Reading from this pointer when `result_ok` is set is undefined.
7942     */
7943    struct LDKDecodeError *err;
7944 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
7945
7946 /**
7947  * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
7948  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
7949  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
7950  */
7951 typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
7952    /**
7953     * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
7954     * `err` or `result` depending on the state of `result_ok`.
7955     */
7956    union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
7957    /**
7958     * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
7959     */
7960    bool result_ok;
7961 } LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
7962
7963
7964
7965 /**
7966  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
7967  * with our counterparty.
7968  */
7969 typedef struct MUST_USE_STRUCT LDKChannelConfig {
7970    /**
7971     * A pointer to the opaque Rust object.
7972     * Nearly everywhere, inner must be non-null, however in places where
7973     * the Rust equivalent takes an Option, it may be set to null to indicate None.
7974     */
7975    LDKnativeChannelConfig *inner;
7976    /**
7977     * Indicates that this is the only struct which contains the same pointer.
7978     * Rust functions which take ownership of an object provided via an argument require
7979     * this to be true and invalidate the object pointed to by inner.
7980     */
7981    bool is_owned;
7982 } LDKChannelConfig;
7983
7984 /**
7985  * The contents of CResult_ChannelConfigDecodeErrorZ
7986  */
7987 typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
7988    /**
7989     * A pointer to the contents in the success state.
7990     * Reading from this pointer when `result_ok` is not set is undefined.
7991     */
7992    struct LDKChannelConfig *result;
7993    /**
7994     * A pointer to the contents in the error state.
7995     * Reading from this pointer when `result_ok` is set is undefined.
7996     */
7997    struct LDKDecodeError *err;
7998 } LDKCResult_ChannelConfigDecodeErrorZPtr;
7999
8000 /**
8001  * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
8002  * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure.
8003  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8004  */
8005 typedef struct LDKCResult_ChannelConfigDecodeErrorZ {
8006    /**
8007     * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
8008     * `err` or `result` depending on the state of `result_ok`.
8009     */
8010    union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
8011    /**
8012     * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
8013     */
8014    bool result_ok;
8015 } LDKCResult_ChannelConfigDecodeErrorZ;
8016
8017 /**
8018  * The contents of CResult_OutPointDecodeErrorZ
8019  */
8020 typedef union LDKCResult_OutPointDecodeErrorZPtr {
8021    /**
8022     * A pointer to the contents in the success state.
8023     * Reading from this pointer when `result_ok` is not set is undefined.
8024     */
8025    struct LDKOutPoint *result;
8026    /**
8027     * A pointer to the contents in the error state.
8028     * Reading from this pointer when `result_ok` is set is undefined.
8029     */
8030    struct LDKDecodeError *err;
8031 } LDKCResult_OutPointDecodeErrorZPtr;
8032
8033 /**
8034  * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
8035  * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure.
8036  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8037  */
8038 typedef struct LDKCResult_OutPointDecodeErrorZ {
8039    /**
8040     * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
8041     * `err` or `result` depending on the state of `result_ok`.
8042     */
8043    union LDKCResult_OutPointDecodeErrorZPtr contents;
8044    /**
8045     * Whether this CResult_OutPointDecodeErrorZ represents a success state.
8046     */
8047    bool result_ok;
8048 } LDKCResult_OutPointDecodeErrorZ;
8049
8050 /**
8051  * Defines a type identifier for sending messages over the wire.
8052  *
8053  * Messages implementing this trait specify a type and must be [`Writeable`].
8054  */
8055 typedef struct LDKType {
8056    /**
8057     * An opaque pointer which is passed to your function implementations as an argument.
8058     * This has no meaning in the LDK, and can be NULL or any other value.
8059     */
8060    void *this_arg;
8061    /**
8062     * Returns the type identifying the message payload.
8063     */
8064    uint16_t (*type_id)(const void *this_arg);
8065    /**
8066     * Return a human-readable "debug" string describing this object
8067     */
8068    struct LDKStr (*debug_str)(const void *this_arg);
8069    /**
8070     * Serialize the object into a byte array
8071     */
8072    struct LDKCVec_u8Z (*write)(const void *this_arg);
8073    /**
8074     * Frees any resources associated with this object given its this_arg pointer.
8075     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
8076     */
8077    void (*free)(void *this_arg);
8078 } LDKType;
8079
8080 /**
8081  * An enum which can either contain a crate::lightning::ln::wire::Type or not
8082  */
8083 typedef enum LDKCOption_TypeZ_Tag {
8084    /**
8085     * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
8086     */
8087    LDKCOption_TypeZ_Some,
8088    /**
8089     * When we're in this state, this COption_TypeZ contains nothing
8090     */
8091    LDKCOption_TypeZ_None,
8092    /**
8093     * Must be last for serialization purposes
8094     */
8095    LDKCOption_TypeZ_Sentinel,
8096 } LDKCOption_TypeZ_Tag;
8097
8098 typedef struct LDKCOption_TypeZ {
8099    LDKCOption_TypeZ_Tag tag;
8100    union {
8101       struct {
8102          struct LDKType some;
8103       };
8104    };
8105 } LDKCOption_TypeZ;
8106
8107 /**
8108  * The contents of CResult_COption_TypeZDecodeErrorZ
8109  */
8110 typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
8111    /**
8112     * A pointer to the contents in the success state.
8113     * Reading from this pointer when `result_ok` is not set is undefined.
8114     */
8115    struct LDKCOption_TypeZ *result;
8116    /**
8117     * A pointer to the contents in the error state.
8118     * Reading from this pointer when `result_ok` is set is undefined.
8119     */
8120    struct LDKDecodeError *err;
8121 } LDKCResult_COption_TypeZDecodeErrorZPtr;
8122
8123 /**
8124  * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
8125  * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8126  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8127  */
8128 typedef struct LDKCResult_COption_TypeZDecodeErrorZ {
8129    /**
8130     * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
8131     * `err` or `result` depending on the state of `result_ok`.
8132     */
8133    union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
8134    /**
8135     * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
8136     */
8137    bool result_ok;
8138 } LDKCResult_COption_TypeZDecodeErrorZ;
8139
8140 /**
8141  * An error that may occur when making a payment.
8142  */
8143 typedef enum LDKPaymentError_Tag {
8144    /**
8145     * An error resulting from the provided [`Invoice`] or payment hash.
8146     */
8147    LDKPaymentError_Invoice,
8148    /**
8149     * An error occurring when finding a route.
8150     */
8151    LDKPaymentError_Routing,
8152    /**
8153     * An error occurring when sending a payment.
8154     */
8155    LDKPaymentError_Sending,
8156    /**
8157     * Must be last for serialization purposes
8158     */
8159    LDKPaymentError_Sentinel,
8160 } LDKPaymentError_Tag;
8161
8162 typedef struct MUST_USE_STRUCT LDKPaymentError {
8163    LDKPaymentError_Tag tag;
8164    union {
8165       struct {
8166          struct LDKStr invoice;
8167       };
8168       struct {
8169          struct LDKLightningError routing;
8170       };
8171       struct {
8172          struct LDKPaymentSendFailure sending;
8173       };
8174    };
8175 } LDKPaymentError;
8176
8177 /**
8178  * The contents of CResult_PaymentIdPaymentErrorZ
8179  */
8180 typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
8181    /**
8182     * A pointer to the contents in the success state.
8183     * Reading from this pointer when `result_ok` is not set is undefined.
8184     */
8185    struct LDKThirtyTwoBytes *result;
8186    /**
8187     * A pointer to the contents in the error state.
8188     * Reading from this pointer when `result_ok` is set is undefined.
8189     */
8190    struct LDKPaymentError *err;
8191 } LDKCResult_PaymentIdPaymentErrorZPtr;
8192
8193 /**
8194  * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
8195  * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
8196  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8197  */
8198 typedef struct LDKCResult_PaymentIdPaymentErrorZ {
8199    /**
8200     * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
8201     * `err` or `result` depending on the state of `result_ok`.
8202     */
8203    union LDKCResult_PaymentIdPaymentErrorZPtr contents;
8204    /**
8205     * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
8206     */
8207    bool result_ok;
8208 } LDKCResult_PaymentIdPaymentErrorZ;
8209
8210 /**
8211  * Sub-errors which don't have specific information in them use this type.
8212  */
8213 typedef struct LDKError {
8214    /**
8215     * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
8216     */
8217    uint8_t _dummy;
8218 } LDKError;
8219
8220 /**
8221  * Errors that indicate what is wrong with the invoice. They have some granularity for debug
8222  * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
8223  */
8224 typedef enum LDKParseError_Tag {
8225    LDKParseError_Bech32Error,
8226    LDKParseError_ParseAmountError,
8227    LDKParseError_MalformedSignature,
8228    LDKParseError_BadPrefix,
8229    LDKParseError_UnknownCurrency,
8230    LDKParseError_UnknownSiPrefix,
8231    LDKParseError_MalformedHRP,
8232    LDKParseError_TooShortDataPart,
8233    LDKParseError_UnexpectedEndOfTaggedFields,
8234    LDKParseError_DescriptionDecodeError,
8235    LDKParseError_PaddingError,
8236    LDKParseError_IntegerOverflowError,
8237    LDKParseError_InvalidSegWitProgramLength,
8238    LDKParseError_InvalidPubKeyHashLength,
8239    LDKParseError_InvalidScriptHashLength,
8240    LDKParseError_InvalidRecoveryId,
8241    LDKParseError_InvalidSliceLength,
8242    /**
8243     * Not an error, but used internally to signal that a part of the invoice should be ignored
8244     * according to BOLT11
8245     */
8246    LDKParseError_Skip,
8247    /**
8248     * Must be last for serialization purposes
8249     */
8250    LDKParseError_Sentinel,
8251 } LDKParseError_Tag;
8252
8253 typedef struct MUST_USE_STRUCT LDKParseError {
8254    LDKParseError_Tag tag;
8255    union {
8256       struct {
8257          struct LDKBech32Error bech32_error;
8258       };
8259       struct {
8260          struct LDKError parse_amount_error;
8261       };
8262       struct {
8263          enum LDKSecp256k1Error malformed_signature;
8264       };
8265       struct {
8266          struct LDKError description_decode_error;
8267       };
8268       struct {
8269          struct LDKStr invalid_slice_length;
8270       };
8271    };
8272 } LDKParseError;
8273
8274 /**
8275  * The contents of CResult_SiPrefixParseErrorZ
8276  */
8277 typedef union LDKCResult_SiPrefixParseErrorZPtr {
8278    /**
8279     * A pointer to the contents in the success state.
8280     * Reading from this pointer when `result_ok` is not set is undefined.
8281     */
8282    enum LDKSiPrefix *result;
8283    /**
8284     * A pointer to the contents in the error state.
8285     * Reading from this pointer when `result_ok` is set is undefined.
8286     */
8287    struct LDKParseError *err;
8288 } LDKCResult_SiPrefixParseErrorZPtr;
8289
8290 /**
8291  * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
8292  * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
8293  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8294  */
8295 typedef struct LDKCResult_SiPrefixParseErrorZ {
8296    /**
8297     * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
8298     * `err` or `result` depending on the state of `result_ok`.
8299     */
8300    union LDKCResult_SiPrefixParseErrorZPtr contents;
8301    /**
8302     * Whether this CResult_SiPrefixParseErrorZ represents a success state.
8303     */
8304    bool result_ok;
8305 } LDKCResult_SiPrefixParseErrorZ;
8306
8307
8308
8309 /**
8310  * Represents a syntactically and semantically correct lightning BOLT11 invoice.
8311  *
8312  * There are three ways to construct an `Invoice`:
8313  *  1. using `InvoiceBuilder`
8314  *  2. using `Invoice::from_signed(SignedRawInvoice)`
8315  *  3. using `str::parse::<Invoice>(&str)`
8316  */
8317 typedef struct MUST_USE_STRUCT LDKInvoice {
8318    /**
8319     * A pointer to the opaque Rust object.
8320     * Nearly everywhere, inner must be non-null, however in places where
8321     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8322     */
8323    LDKnativeInvoice *inner;
8324    /**
8325     * Indicates that this is the only struct which contains the same pointer.
8326     * Rust functions which take ownership of an object provided via an argument require
8327     * this to be true and invalidate the object pointed to by inner.
8328     */
8329    bool is_owned;
8330 } LDKInvoice;
8331
8332 /**
8333  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
8334  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
8335  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
8336  */
8337 typedef enum LDKParseOrSemanticError_Tag {
8338    /**
8339     * The invoice couldn't be decoded
8340     */
8341    LDKParseOrSemanticError_ParseError,
8342    /**
8343     * The invoice could be decoded but violates the BOLT11 standard
8344     */
8345    LDKParseOrSemanticError_SemanticError,
8346    /**
8347     * Must be last for serialization purposes
8348     */
8349    LDKParseOrSemanticError_Sentinel,
8350 } LDKParseOrSemanticError_Tag;
8351
8352 typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
8353    LDKParseOrSemanticError_Tag tag;
8354    union {
8355       struct {
8356          struct LDKParseError parse_error;
8357       };
8358       struct {
8359          enum LDKSemanticError semantic_error;
8360       };
8361    };
8362 } LDKParseOrSemanticError;
8363
8364 /**
8365  * The contents of CResult_InvoiceParseOrSemanticErrorZ
8366  */
8367 typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
8368    /**
8369     * A pointer to the contents in the success state.
8370     * Reading from this pointer when `result_ok` is not set is undefined.
8371     */
8372    struct LDKInvoice *result;
8373    /**
8374     * A pointer to the contents in the error state.
8375     * Reading from this pointer when `result_ok` is set is undefined.
8376     */
8377    struct LDKParseOrSemanticError *err;
8378 } LDKCResult_InvoiceParseOrSemanticErrorZPtr;
8379
8380 /**
8381  * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
8382  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
8383  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8384  */
8385 typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
8386    /**
8387     * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
8388     * `err` or `result` depending on the state of `result_ok`.
8389     */
8390    union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
8391    /**
8392     * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
8393     */
8394    bool result_ok;
8395 } LDKCResult_InvoiceParseOrSemanticErrorZ;
8396
8397
8398
8399 /**
8400  * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
8401  * invalid.
8402  *
8403  * # Invariants
8404  * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
8405  */
8406 typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
8407    /**
8408     * A pointer to the opaque Rust object.
8409     * Nearly everywhere, inner must be non-null, however in places where
8410     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8411     */
8412    LDKnativeSignedRawInvoice *inner;
8413    /**
8414     * Indicates that this is the only struct which contains the same pointer.
8415     * Rust functions which take ownership of an object provided via an argument require
8416     * this to be true and invalidate the object pointed to by inner.
8417     */
8418    bool is_owned;
8419 } LDKSignedRawInvoice;
8420
8421 /**
8422  * The contents of CResult_SignedRawInvoiceParseErrorZ
8423  */
8424 typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
8425    /**
8426     * A pointer to the contents in the success state.
8427     * Reading from this pointer when `result_ok` is not set is undefined.
8428     */
8429    struct LDKSignedRawInvoice *result;
8430    /**
8431     * A pointer to the contents in the error state.
8432     * Reading from this pointer when `result_ok` is set is undefined.
8433     */
8434    struct LDKParseError *err;
8435 } LDKCResult_SignedRawInvoiceParseErrorZPtr;
8436
8437 /**
8438  * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
8439  * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
8440  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8441  */
8442 typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
8443    /**
8444     * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
8445     * `err` or `result` depending on the state of `result_ok`.
8446     */
8447    union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
8448    /**
8449     * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
8450     */
8451    bool result_ok;
8452 } LDKCResult_SignedRawInvoiceParseErrorZ;
8453
8454
8455
8456 /**
8457  * Represents an syntactically correct Invoice for a payment on the lightning network,
8458  * but without the signature information.
8459  * De- and encoding should not lead to information loss but may lead to different hashes.
8460  *
8461  * For methods without docs see the corresponding methods in `Invoice`.
8462  */
8463 typedef struct MUST_USE_STRUCT LDKRawInvoice {
8464    /**
8465     * A pointer to the opaque Rust object.
8466     * Nearly everywhere, inner must be non-null, however in places where
8467     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8468     */
8469    LDKnativeRawInvoice *inner;
8470    /**
8471     * Indicates that this is the only struct which contains the same pointer.
8472     * Rust functions which take ownership of an object provided via an argument require
8473     * this to be true and invalidate the object pointed to by inner.
8474     */
8475    bool is_owned;
8476 } LDKRawInvoice;
8477
8478
8479
8480 /**
8481  * Recoverable signature
8482  */
8483 typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
8484    /**
8485     * A pointer to the opaque Rust object.
8486     * Nearly everywhere, inner must be non-null, however in places where
8487     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8488     */
8489    LDKnativeInvoiceSignature *inner;
8490    /**
8491     * Indicates that this is the only struct which contains the same pointer.
8492     * Rust functions which take ownership of an object provided via an argument require
8493     * this to be true and invalidate the object pointed to by inner.
8494     */
8495    bool is_owned;
8496 } LDKInvoiceSignature;
8497
8498 /**
8499  * A tuple of 3 elements. See the individual fields for the types contained.
8500  */
8501 typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
8502    /**
8503     * The element at position 0
8504     */
8505    struct LDKRawInvoice a;
8506    /**
8507     * The element at position 1
8508     */
8509    struct LDKThirtyTwoBytes b;
8510    /**
8511     * The element at position 2
8512     */
8513    struct LDKInvoiceSignature c;
8514 } LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
8515
8516
8517
8518 /**
8519  * Payee public key
8520  */
8521 typedef struct MUST_USE_STRUCT LDKPayeePubKey {
8522    /**
8523     * A pointer to the opaque Rust object.
8524     * Nearly everywhere, inner must be non-null, however in places where
8525     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8526     */
8527    LDKnativePayeePubKey *inner;
8528    /**
8529     * Indicates that this is the only struct which contains the same pointer.
8530     * Rust functions which take ownership of an object provided via an argument require
8531     * this to be true and invalidate the object pointed to by inner.
8532     */
8533    bool is_owned;
8534 } LDKPayeePubKey;
8535
8536 /**
8537  * The contents of CResult_PayeePubKeyErrorZ
8538  */
8539 typedef union LDKCResult_PayeePubKeyErrorZPtr {
8540    /**
8541     * A pointer to the contents in the success state.
8542     * Reading from this pointer when `result_ok` is not set is undefined.
8543     */
8544    struct LDKPayeePubKey *result;
8545    /**
8546     * A pointer to the contents in the error state.
8547     * Reading from this pointer when `result_ok` is set is undefined.
8548     */
8549    enum LDKSecp256k1Error *err;
8550 } LDKCResult_PayeePubKeyErrorZPtr;
8551
8552 /**
8553  * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
8554  * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
8555  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8556  */
8557 typedef struct LDKCResult_PayeePubKeyErrorZ {
8558    /**
8559     * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
8560     * `err` or `result` depending on the state of `result_ok`.
8561     */
8562    union LDKCResult_PayeePubKeyErrorZPtr contents;
8563    /**
8564     * Whether this CResult_PayeePubKeyErrorZ represents a success state.
8565     */
8566    bool result_ok;
8567 } LDKCResult_PayeePubKeyErrorZ;
8568
8569
8570
8571 /**
8572  * Private routing information
8573  *
8574  * # Invariants
8575  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
8576  *
8577  */
8578 typedef struct MUST_USE_STRUCT LDKPrivateRoute {
8579    /**
8580     * A pointer to the opaque Rust object.
8581     * Nearly everywhere, inner must be non-null, however in places where
8582     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8583     */
8584    LDKnativePrivateRoute *inner;
8585    /**
8586     * Indicates that this is the only struct which contains the same pointer.
8587     * Rust functions which take ownership of an object provided via an argument require
8588     * this to be true and invalidate the object pointed to by inner.
8589     */
8590    bool is_owned;
8591 } LDKPrivateRoute;
8592
8593 /**
8594  * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
8595  * This corresponds to std::vector in C++
8596  */
8597 typedef struct LDKCVec_PrivateRouteZ {
8598    /**
8599     * The elements in the array.
8600     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
8601     */
8602    struct LDKPrivateRoute *data;
8603    /**
8604     * The number of elements pointed to by `data`.
8605     */
8606    uintptr_t datalen;
8607 } LDKCVec_PrivateRouteZ;
8608
8609
8610
8611 /**
8612  * A timestamp that refers to a date after 1 January 1970.
8613  *
8614  * # Invariants
8615  *
8616  * The Unix timestamp representing the stored time has to be positive and no greater than
8617  * [`MAX_TIMESTAMP`].
8618  */
8619 typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
8620    /**
8621     * A pointer to the opaque Rust object.
8622     * Nearly everywhere, inner must be non-null, however in places where
8623     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8624     */
8625    LDKnativePositiveTimestamp *inner;
8626    /**
8627     * Indicates that this is the only struct which contains the same pointer.
8628     * Rust functions which take ownership of an object provided via an argument require
8629     * this to be true and invalidate the object pointed to by inner.
8630     */
8631    bool is_owned;
8632 } LDKPositiveTimestamp;
8633
8634 /**
8635  * The contents of CResult_PositiveTimestampCreationErrorZ
8636  */
8637 typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
8638    /**
8639     * A pointer to the contents in the success state.
8640     * Reading from this pointer when `result_ok` is not set is undefined.
8641     */
8642    struct LDKPositiveTimestamp *result;
8643    /**
8644     * A pointer to the contents in the error state.
8645     * Reading from this pointer when `result_ok` is set is undefined.
8646     */
8647    enum LDKCreationError *err;
8648 } LDKCResult_PositiveTimestampCreationErrorZPtr;
8649
8650 /**
8651  * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
8652  * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
8653  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8654  */
8655 typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
8656    /**
8657     * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
8658     * `err` or `result` depending on the state of `result_ok`.
8659     */
8660    union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
8661    /**
8662     * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
8663     */
8664    bool result_ok;
8665 } LDKCResult_PositiveTimestampCreationErrorZ;
8666
8667 /**
8668  * The contents of CResult_NoneSemanticErrorZ
8669  */
8670 typedef union LDKCResult_NoneSemanticErrorZPtr {
8671    /**
8672     * Note that this value is always NULL, as there are no contents in the OK variant
8673     */
8674    void *result;
8675    /**
8676     * A pointer to the contents in the error state.
8677     * Reading from this pointer when `result_ok` is set is undefined.
8678     */
8679    enum LDKSemanticError *err;
8680 } LDKCResult_NoneSemanticErrorZPtr;
8681
8682 /**
8683  * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
8684  * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
8685  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8686  */
8687 typedef struct LDKCResult_NoneSemanticErrorZ {
8688    /**
8689     * The contents of this CResult_NoneSemanticErrorZ, accessible via either
8690     * `err` or `result` depending on the state of `result_ok`.
8691     */
8692    union LDKCResult_NoneSemanticErrorZPtr contents;
8693    /**
8694     * Whether this CResult_NoneSemanticErrorZ represents a success state.
8695     */
8696    bool result_ok;
8697 } LDKCResult_NoneSemanticErrorZ;
8698
8699 /**
8700  * The contents of CResult_InvoiceSemanticErrorZ
8701  */
8702 typedef union LDKCResult_InvoiceSemanticErrorZPtr {
8703    /**
8704     * A pointer to the contents in the success state.
8705     * Reading from this pointer when `result_ok` is not set is undefined.
8706     */
8707    struct LDKInvoice *result;
8708    /**
8709     * A pointer to the contents in the error state.
8710     * Reading from this pointer when `result_ok` is set is undefined.
8711     */
8712    enum LDKSemanticError *err;
8713 } LDKCResult_InvoiceSemanticErrorZPtr;
8714
8715 /**
8716  * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
8717  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
8718  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8719  */
8720 typedef struct LDKCResult_InvoiceSemanticErrorZ {
8721    /**
8722     * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
8723     * `err` or `result` depending on the state of `result_ok`.
8724     */
8725    union LDKCResult_InvoiceSemanticErrorZPtr contents;
8726    /**
8727     * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
8728     */
8729    bool result_ok;
8730 } LDKCResult_InvoiceSemanticErrorZ;
8731
8732
8733
8734 /**
8735  * Description string
8736  *
8737  * # Invariants
8738  * The description can be at most 639 __bytes__ long
8739  */
8740 typedef struct MUST_USE_STRUCT LDKDescription {
8741    /**
8742     * A pointer to the opaque Rust object.
8743     * Nearly everywhere, inner must be non-null, however in places where
8744     * the Rust equivalent takes an Option, it may be set to null to indicate None.
8745     */
8746    LDKnativeDescription *inner;
8747    /**
8748     * Indicates that this is the only struct which contains the same pointer.
8749     * Rust functions which take ownership of an object provided via an argument require
8750     * this to be true and invalidate the object pointed to by inner.
8751     */
8752    bool is_owned;
8753 } LDKDescription;
8754
8755 /**
8756  * The contents of CResult_DescriptionCreationErrorZ
8757  */
8758 typedef union LDKCResult_DescriptionCreationErrorZPtr {
8759    /**
8760     * A pointer to the contents in the success state.
8761     * Reading from this pointer when `result_ok` is not set is undefined.
8762     */
8763    struct LDKDescription *result;
8764    /**
8765     * A pointer to the contents in the error state.
8766     * Reading from this pointer when `result_ok` is set is undefined.
8767     */
8768    enum LDKCreationError *err;
8769 } LDKCResult_DescriptionCreationErrorZPtr;
8770
8771 /**
8772  * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
8773  * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
8774  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8775  */
8776 typedef struct LDKCResult_DescriptionCreationErrorZ {
8777    /**
8778     * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
8779     * `err` or `result` depending on the state of `result_ok`.
8780     */
8781    union LDKCResult_DescriptionCreationErrorZPtr contents;
8782    /**
8783     * Whether this CResult_DescriptionCreationErrorZ represents a success state.
8784     */
8785    bool result_ok;
8786 } LDKCResult_DescriptionCreationErrorZ;
8787
8788 /**
8789  * The contents of CResult_PrivateRouteCreationErrorZ
8790  */
8791 typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
8792    /**
8793     * A pointer to the contents in the success state.
8794     * Reading from this pointer when `result_ok` is not set is undefined.
8795     */
8796    struct LDKPrivateRoute *result;
8797    /**
8798     * A pointer to the contents in the error state.
8799     * Reading from this pointer when `result_ok` is set is undefined.
8800     */
8801    enum LDKCreationError *err;
8802 } LDKCResult_PrivateRouteCreationErrorZPtr;
8803
8804 /**
8805  * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
8806  * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
8807  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8808  */
8809 typedef struct LDKCResult_PrivateRouteCreationErrorZ {
8810    /**
8811     * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
8812     * `err` or `result` depending on the state of `result_ok`.
8813     */
8814    union LDKCResult_PrivateRouteCreationErrorZPtr contents;
8815    /**
8816     * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
8817     */
8818    bool result_ok;
8819 } LDKCResult_PrivateRouteCreationErrorZ;
8820
8821 /**
8822  * The contents of CResult_StringErrorZ
8823  */
8824 typedef union LDKCResult_StringErrorZPtr {
8825    /**
8826     * A pointer to the contents in the success state.
8827     * Reading from this pointer when `result_ok` is not set is undefined.
8828     */
8829    struct LDKStr *result;
8830    /**
8831     * A pointer to the contents in the error state.
8832     * Reading from this pointer when `result_ok` is set is undefined.
8833     */
8834    enum LDKSecp256k1Error *err;
8835 } LDKCResult_StringErrorZPtr;
8836
8837 /**
8838  * A CResult_StringErrorZ represents the result of a fallible operation,
8839  * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
8840  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8841  */
8842 typedef struct LDKCResult_StringErrorZ {
8843    /**
8844     * The contents of this CResult_StringErrorZ, accessible via either
8845     * `err` or `result` depending on the state of `result_ok`.
8846     */
8847    union LDKCResult_StringErrorZPtr contents;
8848    /**
8849     * Whether this CResult_StringErrorZ represents a success state.
8850     */
8851    bool result_ok;
8852 } LDKCResult_StringErrorZ;
8853
8854 /**
8855  * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
8856  */
8857 typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
8858    /**
8859     * A pointer to the contents in the success state.
8860     * Reading from this pointer when `result_ok` is not set is undefined.
8861     */
8862    struct LDKChannelMonitorUpdate *result;
8863    /**
8864     * A pointer to the contents in the error state.
8865     * Reading from this pointer when `result_ok` is set is undefined.
8866     */
8867    struct LDKDecodeError *err;
8868 } LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr;
8869
8870 /**
8871  * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
8872  * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8873  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8874  */
8875 typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ {
8876    /**
8877     * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
8878     * `err` or `result` depending on the state of `result_ok`.
8879     */
8880    union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
8881    /**
8882     * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
8883     */
8884    bool result_ok;
8885 } LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
8886
8887 /**
8888  * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
8889  */
8890 typedef enum LDKCOption_MonitorEventZ_Tag {
8891    /**
8892     * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
8893     */
8894    LDKCOption_MonitorEventZ_Some,
8895    /**
8896     * When we're in this state, this COption_MonitorEventZ contains nothing
8897     */
8898    LDKCOption_MonitorEventZ_None,
8899    /**
8900     * Must be last for serialization purposes
8901     */
8902    LDKCOption_MonitorEventZ_Sentinel,
8903 } LDKCOption_MonitorEventZ_Tag;
8904
8905 typedef struct LDKCOption_MonitorEventZ {
8906    LDKCOption_MonitorEventZ_Tag tag;
8907    union {
8908       struct {
8909          struct LDKMonitorEvent some;
8910       };
8911    };
8912 } LDKCOption_MonitorEventZ;
8913
8914 /**
8915  * The contents of CResult_COption_MonitorEventZDecodeErrorZ
8916  */
8917 typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
8918    /**
8919     * A pointer to the contents in the success state.
8920     * Reading from this pointer when `result_ok` is not set is undefined.
8921     */
8922    struct LDKCOption_MonitorEventZ *result;
8923    /**
8924     * A pointer to the contents in the error state.
8925     * Reading from this pointer when `result_ok` is set is undefined.
8926     */
8927    struct LDKDecodeError *err;
8928 } LDKCResult_COption_MonitorEventZDecodeErrorZPtr;
8929
8930 /**
8931  * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
8932  * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
8933  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8934  */
8935 typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ {
8936    /**
8937     * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
8938     * `err` or `result` depending on the state of `result_ok`.
8939     */
8940    union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
8941    /**
8942     * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
8943     */
8944    bool result_ok;
8945 } LDKCResult_COption_MonitorEventZDecodeErrorZ;
8946
8947 /**
8948  * The contents of CResult_HTLCUpdateDecodeErrorZ
8949  */
8950 typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
8951    /**
8952     * A pointer to the contents in the success state.
8953     * Reading from this pointer when `result_ok` is not set is undefined.
8954     */
8955    struct LDKHTLCUpdate *result;
8956    /**
8957     * A pointer to the contents in the error state.
8958     * Reading from this pointer when `result_ok` is set is undefined.
8959     */
8960    struct LDKDecodeError *err;
8961 } LDKCResult_HTLCUpdateDecodeErrorZPtr;
8962
8963 /**
8964  * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
8965  * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
8966  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
8967  */
8968 typedef struct LDKCResult_HTLCUpdateDecodeErrorZ {
8969    /**
8970     * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
8971     * `err` or `result` depending on the state of `result_ok`.
8972     */
8973    union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
8974    /**
8975     * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
8976     */
8977    bool result_ok;
8978 } LDKCResult_HTLCUpdateDecodeErrorZ;
8979
8980 /**
8981  * A tuple of 2 elements. See the individual fields for the types contained.
8982  */
8983 typedef struct LDKC2Tuple_OutPointScriptZ {
8984    /**
8985     * The element at position 0
8986     */
8987    struct LDKOutPoint a;
8988    /**
8989     * The element at position 1
8990     */
8991    struct LDKCVec_u8Z b;
8992 } LDKC2Tuple_OutPointScriptZ;
8993
8994 /**
8995  * A tuple of 2 elements. See the individual fields for the types contained.
8996  */
8997 typedef struct LDKC2Tuple_u32ScriptZ {
8998    /**
8999     * The element at position 0
9000     */
9001    uint32_t a;
9002    /**
9003     * The element at position 1
9004     */
9005    struct LDKCVec_u8Z b;
9006 } LDKC2Tuple_u32ScriptZ;
9007
9008 /**
9009  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
9010  * This corresponds to std::vector in C++
9011  */
9012 typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
9013    /**
9014     * The elements in the array.
9015     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9016     */
9017    struct LDKC2Tuple_u32ScriptZ *data;
9018    /**
9019     * The number of elements pointed to by `data`.
9020     */
9021    uintptr_t datalen;
9022 } LDKCVec_C2Tuple_u32ScriptZZ;
9023
9024 /**
9025  * A tuple of 2 elements. See the individual fields for the types contained.
9026  */
9027 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
9028    /**
9029     * The element at position 0
9030     */
9031    struct LDKThirtyTwoBytes a;
9032    /**
9033     * The element at position 1
9034     */
9035    struct LDKCVec_C2Tuple_u32ScriptZZ b;
9036 } LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
9037
9038 /**
9039  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
9040  * This corresponds to std::vector in C++
9041  */
9042 typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
9043    /**
9044     * The elements in the array.
9045     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9046     */
9047    struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
9048    /**
9049     * The number of elements pointed to by `data`.
9050     */
9051    uintptr_t datalen;
9052 } LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
9053
9054 /**
9055  * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
9056  * This corresponds to std::vector in C++
9057  */
9058 typedef struct LDKCVec_EventZ {
9059    /**
9060     * The elements in the array.
9061     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9062     */
9063    struct LDKEvent *data;
9064    /**
9065     * The number of elements pointed to by `data`.
9066     */
9067    uintptr_t datalen;
9068 } LDKCVec_EventZ;
9069
9070 /**
9071  * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
9072  * This corresponds to std::vector in C++
9073  */
9074 typedef struct LDKCVec_TransactionZ {
9075    /**
9076     * The elements in the array.
9077     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9078     */
9079    struct LDKTransaction *data;
9080    /**
9081     * The number of elements pointed to by `data`.
9082     */
9083    uintptr_t datalen;
9084 } LDKCVec_TransactionZ;
9085
9086 /**
9087  * A tuple of 2 elements. See the individual fields for the types contained.
9088  */
9089 typedef struct LDKC2Tuple_u32TxOutZ {
9090    /**
9091     * The element at position 0
9092     */
9093    uint32_t a;
9094    /**
9095     * The element at position 1
9096     */
9097    struct LDKTxOut b;
9098 } LDKC2Tuple_u32TxOutZ;
9099
9100 /**
9101  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
9102  * This corresponds to std::vector in C++
9103  */
9104 typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
9105    /**
9106     * The elements in the array.
9107     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9108     */
9109    struct LDKC2Tuple_u32TxOutZ *data;
9110    /**
9111     * The number of elements pointed to by `data`.
9112     */
9113    uintptr_t datalen;
9114 } LDKCVec_C2Tuple_u32TxOutZZ;
9115
9116 /**
9117  * A tuple of 2 elements. See the individual fields for the types contained.
9118  */
9119 typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
9120    /**
9121     * The element at position 0
9122     */
9123    struct LDKThirtyTwoBytes a;
9124    /**
9125     * The element at position 1
9126     */
9127    struct LDKCVec_C2Tuple_u32TxOutZZ b;
9128 } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
9129
9130 /**
9131  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
9132  * This corresponds to std::vector in C++
9133  */
9134 typedef struct LDKCVec_TransactionOutputsZ {
9135    /**
9136     * The elements in the array.
9137     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9138     */
9139    struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
9140    /**
9141     * The number of elements pointed to by `data`.
9142     */
9143    uintptr_t datalen;
9144 } LDKCVec_TransactionOutputsZ;
9145
9146 /**
9147  * Details about the balance(s) available for spending once the channel appears on chain.
9148  *
9149  * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
9150  * be provided.
9151  */
9152 typedef enum LDKBalance_Tag {
9153    /**
9154     * The channel is not yet closed (or the commitment or closing transaction has not yet
9155     * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
9156     * force-closed now.
9157     */
9158    LDKBalance_ClaimableOnChannelClose,
9159    /**
9160     * The channel has been closed, and the given balance is ours but awaiting confirmations until
9161     * we consider it spendable.
9162     */
9163    LDKBalance_ClaimableAwaitingConfirmations,
9164    /**
9165     * The channel has been closed, and the given balance should be ours but awaiting spending
9166     * transaction confirmation. If the spending transaction does not confirm in time, it is
9167     * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
9168     *
9169     * Once the spending transaction confirms, before it has reached enough confirmations to be
9170     * considered safe from chain reorganizations, the balance will instead be provided via
9171     * [`Balance::ClaimableAwaitingConfirmations`].
9172     */
9173    LDKBalance_ContentiousClaimable,
9174    /**
9175     * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
9176     * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
9177     * likely to be claimed by our counterparty before we do.
9178     */
9179    LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
9180    /**
9181     * Must be last for serialization purposes
9182     */
9183    LDKBalance_Sentinel,
9184 } LDKBalance_Tag;
9185
9186 typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
9187    /**
9188     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9189     * required to do so.
9190     */
9191    uint64_t claimable_amount_satoshis;
9192 } LDKBalance_LDKClaimableOnChannelClose_Body;
9193
9194 typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
9195    /**
9196     * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
9197     * were spent in broadcasting the transaction.
9198     */
9199    uint64_t claimable_amount_satoshis;
9200    /**
9201     * The height at which an [`Event::SpendableOutputs`] event will be generated for this
9202     * amount.
9203     */
9204    uint32_t confirmation_height;
9205 } LDKBalance_LDKClaimableAwaitingConfirmations_Body;
9206
9207 typedef struct LDKBalance_LDKContentiousClaimable_Body {
9208    /**
9209     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9210     * required to do so.
9211     */
9212    uint64_t claimable_amount_satoshis;
9213    /**
9214     * The height at which the counterparty may be able to claim the balance if we have not
9215     * done so.
9216     */
9217    uint32_t timeout_height;
9218 } LDKBalance_LDKContentiousClaimable_Body;
9219
9220 typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
9221    /**
9222     * The amount available to claim, in satoshis, excluding the on-chain fees which will be
9223     * required to do so.
9224     */
9225    uint64_t claimable_amount_satoshis;
9226    /**
9227     * The height at which we will be able to claim the balance if our counterparty has not
9228     * done so.
9229     */
9230    uint32_t claimable_height;
9231 } LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
9232
9233 typedef struct MUST_USE_STRUCT LDKBalance {
9234    LDKBalance_Tag tag;
9235    union {
9236       LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
9237       LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
9238       LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
9239       LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
9240    };
9241 } LDKBalance;
9242
9243 /**
9244  * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
9245  * This corresponds to std::vector in C++
9246  */
9247 typedef struct LDKCVec_BalanceZ {
9248    /**
9249     * The elements in the array.
9250     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9251     */
9252    struct LDKBalance *data;
9253    /**
9254     * The number of elements pointed to by `data`.
9255     */
9256    uintptr_t datalen;
9257 } LDKCVec_BalanceZ;
9258
9259 /**
9260  * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
9261  */
9262 typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
9263    /**
9264     * A pointer to the contents in the success state.
9265     * Reading from this pointer when `result_ok` is not set is undefined.
9266     */
9267    struct LDKC2Tuple_BlockHashChannelMonitorZ *result;
9268    /**
9269     * A pointer to the contents in the error state.
9270     * Reading from this pointer when `result_ok` is set is undefined.
9271     */
9272    struct LDKDecodeError *err;
9273 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
9274
9275 /**
9276  * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
9277  * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
9278  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9279  */
9280 typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
9281    /**
9282     * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
9283     * `err` or `result` depending on the state of `result_ok`.
9284     */
9285    union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
9286    /**
9287     * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
9288     */
9289    bool result_ok;
9290 } LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
9291
9292 /**
9293  * A tuple of 2 elements. See the individual fields for the types contained.
9294  */
9295 typedef struct LDKC2Tuple_PublicKeyTypeZ {
9296    /**
9297     * The element at position 0
9298     */
9299    struct LDKPublicKey a;
9300    /**
9301     * The element at position 1
9302     */
9303    struct LDKType b;
9304 } LDKC2Tuple_PublicKeyTypeZ;
9305
9306 /**
9307  * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
9308  * This corresponds to std::vector in C++
9309  */
9310 typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
9311    /**
9312     * The elements in the array.
9313     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9314     */
9315    struct LDKC2Tuple_PublicKeyTypeZ *data;
9316    /**
9317     * The number of elements pointed to by `data`.
9318     */
9319    uintptr_t datalen;
9320 } LDKCVec_C2Tuple_PublicKeyTypeZZ;
9321
9322 /**
9323  * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
9324  */
9325 typedef enum LDKCOption_NetAddressZ_Tag {
9326    /**
9327     * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
9328     */
9329    LDKCOption_NetAddressZ_Some,
9330    /**
9331     * When we're in this state, this COption_NetAddressZ contains nothing
9332     */
9333    LDKCOption_NetAddressZ_None,
9334    /**
9335     * Must be last for serialization purposes
9336     */
9337    LDKCOption_NetAddressZ_Sentinel,
9338 } LDKCOption_NetAddressZ_Tag;
9339
9340 typedef struct LDKCOption_NetAddressZ {
9341    LDKCOption_NetAddressZ_Tag tag;
9342    union {
9343       struct {
9344          struct LDKNetAddress some;
9345       };
9346    };
9347 } LDKCOption_NetAddressZ;
9348
9349
9350
9351 /**
9352  * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
9353  * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
9354  * descriptor.
9355  */
9356 typedef struct MUST_USE_STRUCT LDKPeerHandleError {
9357    /**
9358     * A pointer to the opaque Rust object.
9359     * Nearly everywhere, inner must be non-null, however in places where
9360     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9361     */
9362    LDKnativePeerHandleError *inner;
9363    /**
9364     * Indicates that this is the only struct which contains the same pointer.
9365     * Rust functions which take ownership of an object provided via an argument require
9366     * this to be true and invalidate the object pointed to by inner.
9367     */
9368    bool is_owned;
9369 } LDKPeerHandleError;
9370
9371 /**
9372  * The contents of CResult_CVec_u8ZPeerHandleErrorZ
9373  */
9374 typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
9375    /**
9376     * A pointer to the contents in the success state.
9377     * Reading from this pointer when `result_ok` is not set is undefined.
9378     */
9379    struct LDKCVec_u8Z *result;
9380    /**
9381     * A pointer to the contents in the error state.
9382     * Reading from this pointer when `result_ok` is set is undefined.
9383     */
9384    struct LDKPeerHandleError *err;
9385 } LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
9386
9387 /**
9388  * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
9389  * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9390  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9391  */
9392 typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
9393    /**
9394     * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
9395     * `err` or `result` depending on the state of `result_ok`.
9396     */
9397    union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
9398    /**
9399     * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
9400     */
9401    bool result_ok;
9402 } LDKCResult_CVec_u8ZPeerHandleErrorZ;
9403
9404 /**
9405  * The contents of CResult_NonePeerHandleErrorZ
9406  */
9407 typedef union LDKCResult_NonePeerHandleErrorZPtr {
9408    /**
9409     * Note that this value is always NULL, as there are no contents in the OK variant
9410     */
9411    void *result;
9412    /**
9413     * A pointer to the contents in the error state.
9414     * Reading from this pointer when `result_ok` is set is undefined.
9415     */
9416    struct LDKPeerHandleError *err;
9417 } LDKCResult_NonePeerHandleErrorZPtr;
9418
9419 /**
9420  * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
9421  * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9422  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9423  */
9424 typedef struct LDKCResult_NonePeerHandleErrorZ {
9425    /**
9426     * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
9427     * `err` or `result` depending on the state of `result_ok`.
9428     */
9429    union LDKCResult_NonePeerHandleErrorZPtr contents;
9430    /**
9431     * Whether this CResult_NonePeerHandleErrorZ represents a success state.
9432     */
9433    bool result_ok;
9434 } LDKCResult_NonePeerHandleErrorZ;
9435
9436 /**
9437  * The contents of CResult_boolPeerHandleErrorZ
9438  */
9439 typedef union LDKCResult_boolPeerHandleErrorZPtr {
9440    /**
9441     * A pointer to the contents in the success state.
9442     * Reading from this pointer when `result_ok` is not set is undefined.
9443     */
9444    bool *result;
9445    /**
9446     * A pointer to the contents in the error state.
9447     * Reading from this pointer when `result_ok` is set is undefined.
9448     */
9449    struct LDKPeerHandleError *err;
9450 } LDKCResult_boolPeerHandleErrorZPtr;
9451
9452 /**
9453  * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
9454  * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
9455  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9456  */
9457 typedef struct LDKCResult_boolPeerHandleErrorZ {
9458    /**
9459     * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
9460     * `err` or `result` depending on the state of `result_ok`.
9461     */
9462    union LDKCResult_boolPeerHandleErrorZPtr contents;
9463    /**
9464     * Whether this CResult_boolPeerHandleErrorZ represents a success state.
9465     */
9466    bool result_ok;
9467 } LDKCResult_boolPeerHandleErrorZ;
9468
9469 /**
9470  * All-encompassing standard error type that processing can return
9471  */
9472 typedef enum LDKGraphSyncError_Tag {
9473    /**
9474     * Error trying to read the update data, typically due to an erroneous data length indication
9475     * that is greater than the actual amount of data provided
9476     */
9477    LDKGraphSyncError_DecodeError,
9478    /**
9479     * Error applying the patch to the network graph, usually the result of updates that are too
9480     * old or missing prerequisite data to the application of updates out of order
9481     */
9482    LDKGraphSyncError_LightningError,
9483    /**
9484     * Must be last for serialization purposes
9485     */
9486    LDKGraphSyncError_Sentinel,
9487 } LDKGraphSyncError_Tag;
9488
9489 typedef struct MUST_USE_STRUCT LDKGraphSyncError {
9490    LDKGraphSyncError_Tag tag;
9491    union {
9492       struct {
9493          struct LDKDecodeError decode_error;
9494       };
9495       struct {
9496          struct LDKLightningError lightning_error;
9497       };
9498    };
9499 } LDKGraphSyncError;
9500
9501 /**
9502  * The contents of CResult_u32GraphSyncErrorZ
9503  */
9504 typedef union LDKCResult_u32GraphSyncErrorZPtr {
9505    /**
9506     * A pointer to the contents in the success state.
9507     * Reading from this pointer when `result_ok` is not set is undefined.
9508     */
9509    uint32_t *result;
9510    /**
9511     * A pointer to the contents in the error state.
9512     * Reading from this pointer when `result_ok` is set is undefined.
9513     */
9514    struct LDKGraphSyncError *err;
9515 } LDKCResult_u32GraphSyncErrorZPtr;
9516
9517 /**
9518  * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
9519  * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
9520  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9521  */
9522 typedef struct LDKCResult_u32GraphSyncErrorZ {
9523    /**
9524     * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
9525     * `err` or `result` depending on the state of `result_ok`.
9526     */
9527    union LDKCResult_u32GraphSyncErrorZPtr contents;
9528    /**
9529     * Whether this CResult_u32GraphSyncErrorZ represents a success state.
9530     */
9531    bool result_ok;
9532 } LDKCResult_u32GraphSyncErrorZ;
9533
9534 /**
9535  * The contents of CResult_NetAddressDecodeErrorZ
9536  */
9537 typedef union LDKCResult_NetAddressDecodeErrorZPtr {
9538    /**
9539     * A pointer to the contents in the success state.
9540     * Reading from this pointer when `result_ok` is not set is undefined.
9541     */
9542    struct LDKNetAddress *result;
9543    /**
9544     * A pointer to the contents in the error state.
9545     * Reading from this pointer when `result_ok` is set is undefined.
9546     */
9547    struct LDKDecodeError *err;
9548 } LDKCResult_NetAddressDecodeErrorZPtr;
9549
9550 /**
9551  * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
9552  * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure.
9553  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9554  */
9555 typedef struct LDKCResult_NetAddressDecodeErrorZ {
9556    /**
9557     * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
9558     * `err` or `result` depending on the state of `result_ok`.
9559     */
9560    union LDKCResult_NetAddressDecodeErrorZPtr contents;
9561    /**
9562     * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
9563     */
9564    bool result_ok;
9565 } LDKCResult_NetAddressDecodeErrorZ;
9566
9567
9568
9569 /**
9570  * An update_add_htlc message to be sent or received from a peer
9571  */
9572 typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
9573    /**
9574     * A pointer to the opaque Rust object.
9575     * Nearly everywhere, inner must be non-null, however in places where
9576     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9577     */
9578    LDKnativeUpdateAddHTLC *inner;
9579    /**
9580     * Indicates that this is the only struct which contains the same pointer.
9581     * Rust functions which take ownership of an object provided via an argument require
9582     * this to be true and invalidate the object pointed to by inner.
9583     */
9584    bool is_owned;
9585 } LDKUpdateAddHTLC;
9586
9587 /**
9588  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
9589  * This corresponds to std::vector in C++
9590  */
9591 typedef struct LDKCVec_UpdateAddHTLCZ {
9592    /**
9593     * The elements in the array.
9594     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9595     */
9596    struct LDKUpdateAddHTLC *data;
9597    /**
9598     * The number of elements pointed to by `data`.
9599     */
9600    uintptr_t datalen;
9601 } LDKCVec_UpdateAddHTLCZ;
9602
9603
9604
9605 /**
9606  * An update_fulfill_htlc message to be sent or received from a peer
9607  */
9608 typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
9609    /**
9610     * A pointer to the opaque Rust object.
9611     * Nearly everywhere, inner must be non-null, however in places where
9612     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9613     */
9614    LDKnativeUpdateFulfillHTLC *inner;
9615    /**
9616     * Indicates that this is the only struct which contains the same pointer.
9617     * Rust functions which take ownership of an object provided via an argument require
9618     * this to be true and invalidate the object pointed to by inner.
9619     */
9620    bool is_owned;
9621 } LDKUpdateFulfillHTLC;
9622
9623 /**
9624  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
9625  * This corresponds to std::vector in C++
9626  */
9627 typedef struct LDKCVec_UpdateFulfillHTLCZ {
9628    /**
9629     * The elements in the array.
9630     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9631     */
9632    struct LDKUpdateFulfillHTLC *data;
9633    /**
9634     * The number of elements pointed to by `data`.
9635     */
9636    uintptr_t datalen;
9637 } LDKCVec_UpdateFulfillHTLCZ;
9638
9639
9640
9641 /**
9642  * An update_fail_htlc message to be sent or received from a peer
9643  */
9644 typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
9645    /**
9646     * A pointer to the opaque Rust object.
9647     * Nearly everywhere, inner must be non-null, however in places where
9648     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9649     */
9650    LDKnativeUpdateFailHTLC *inner;
9651    /**
9652     * Indicates that this is the only struct which contains the same pointer.
9653     * Rust functions which take ownership of an object provided via an argument require
9654     * this to be true and invalidate the object pointed to by inner.
9655     */
9656    bool is_owned;
9657 } LDKUpdateFailHTLC;
9658
9659 /**
9660  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
9661  * This corresponds to std::vector in C++
9662  */
9663 typedef struct LDKCVec_UpdateFailHTLCZ {
9664    /**
9665     * The elements in the array.
9666     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9667     */
9668    struct LDKUpdateFailHTLC *data;
9669    /**
9670     * The number of elements pointed to by `data`.
9671     */
9672    uintptr_t datalen;
9673 } LDKCVec_UpdateFailHTLCZ;
9674
9675
9676
9677 /**
9678  * An update_fail_malformed_htlc message to be sent or received from a peer
9679  */
9680 typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
9681    /**
9682     * A pointer to the opaque Rust object.
9683     * Nearly everywhere, inner must be non-null, however in places where
9684     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9685     */
9686    LDKnativeUpdateFailMalformedHTLC *inner;
9687    /**
9688     * Indicates that this is the only struct which contains the same pointer.
9689     * Rust functions which take ownership of an object provided via an argument require
9690     * this to be true and invalidate the object pointed to by inner.
9691     */
9692    bool is_owned;
9693 } LDKUpdateFailMalformedHTLC;
9694
9695 /**
9696  * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
9697  * This corresponds to std::vector in C++
9698  */
9699 typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
9700    /**
9701     * The elements in the array.
9702     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
9703     */
9704    struct LDKUpdateFailMalformedHTLC *data;
9705    /**
9706     * The number of elements pointed to by `data`.
9707     */
9708    uintptr_t datalen;
9709 } LDKCVec_UpdateFailMalformedHTLCZ;
9710
9711 /**
9712  * The contents of CResult_AcceptChannelDecodeErrorZ
9713  */
9714 typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
9715    /**
9716     * A pointer to the contents in the success state.
9717     * Reading from this pointer when `result_ok` is not set is undefined.
9718     */
9719    struct LDKAcceptChannel *result;
9720    /**
9721     * A pointer to the contents in the error state.
9722     * Reading from this pointer when `result_ok` is set is undefined.
9723     */
9724    struct LDKDecodeError *err;
9725 } LDKCResult_AcceptChannelDecodeErrorZPtr;
9726
9727 /**
9728  * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
9729  * containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
9730  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9731  */
9732 typedef struct LDKCResult_AcceptChannelDecodeErrorZ {
9733    /**
9734     * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
9735     * `err` or `result` depending on the state of `result_ok`.
9736     */
9737    union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
9738    /**
9739     * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
9740     */
9741    bool result_ok;
9742 } LDKCResult_AcceptChannelDecodeErrorZ;
9743
9744 /**
9745  * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
9746  */
9747 typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
9748    /**
9749     * A pointer to the contents in the success state.
9750     * Reading from this pointer when `result_ok` is not set is undefined.
9751     */
9752    struct LDKAnnouncementSignatures *result;
9753    /**
9754     * A pointer to the contents in the error state.
9755     * Reading from this pointer when `result_ok` is set is undefined.
9756     */
9757    struct LDKDecodeError *err;
9758 } LDKCResult_AnnouncementSignaturesDecodeErrorZPtr;
9759
9760 /**
9761  * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
9762  * containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
9763  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9764  */
9765 typedef struct LDKCResult_AnnouncementSignaturesDecodeErrorZ {
9766    /**
9767     * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
9768     * `err` or `result` depending on the state of `result_ok`.
9769     */
9770    union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
9771    /**
9772     * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
9773     */
9774    bool result_ok;
9775 } LDKCResult_AnnouncementSignaturesDecodeErrorZ;
9776
9777 /**
9778  * The contents of CResult_ChannelReestablishDecodeErrorZ
9779  */
9780 typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
9781    /**
9782     * A pointer to the contents in the success state.
9783     * Reading from this pointer when `result_ok` is not set is undefined.
9784     */
9785    struct LDKChannelReestablish *result;
9786    /**
9787     * A pointer to the contents in the error state.
9788     * Reading from this pointer when `result_ok` is set is undefined.
9789     */
9790    struct LDKDecodeError *err;
9791 } LDKCResult_ChannelReestablishDecodeErrorZPtr;
9792
9793 /**
9794  * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
9795  * containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure.
9796  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9797  */
9798 typedef struct LDKCResult_ChannelReestablishDecodeErrorZ {
9799    /**
9800     * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
9801     * `err` or `result` depending on the state of `result_ok`.
9802     */
9803    union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
9804    /**
9805     * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
9806     */
9807    bool result_ok;
9808 } LDKCResult_ChannelReestablishDecodeErrorZ;
9809
9810 /**
9811  * The contents of CResult_ClosingSignedDecodeErrorZ
9812  */
9813 typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
9814    /**
9815     * A pointer to the contents in the success state.
9816     * Reading from this pointer when `result_ok` is not set is undefined.
9817     */
9818    struct LDKClosingSigned *result;
9819    /**
9820     * A pointer to the contents in the error state.
9821     * Reading from this pointer when `result_ok` is set is undefined.
9822     */
9823    struct LDKDecodeError *err;
9824 } LDKCResult_ClosingSignedDecodeErrorZPtr;
9825
9826 /**
9827  * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
9828  * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9829  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9830  */
9831 typedef struct LDKCResult_ClosingSignedDecodeErrorZ {
9832    /**
9833     * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
9834     * `err` or `result` depending on the state of `result_ok`.
9835     */
9836    union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
9837    /**
9838     * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
9839     */
9840    bool result_ok;
9841 } LDKCResult_ClosingSignedDecodeErrorZ;
9842
9843
9844
9845 /**
9846  * The minimum and maximum fees which the sender is willing to place on the closing transaction.
9847  * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
9848  * to use.
9849  */
9850 typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
9851    /**
9852     * A pointer to the opaque Rust object.
9853     * Nearly everywhere, inner must be non-null, however in places where
9854     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9855     */
9856    LDKnativeClosingSignedFeeRange *inner;
9857    /**
9858     * Indicates that this is the only struct which contains the same pointer.
9859     * Rust functions which take ownership of an object provided via an argument require
9860     * this to be true and invalidate the object pointed to by inner.
9861     */
9862    bool is_owned;
9863 } LDKClosingSignedFeeRange;
9864
9865 /**
9866  * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
9867  */
9868 typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
9869    /**
9870     * A pointer to the contents in the success state.
9871     * Reading from this pointer when `result_ok` is not set is undefined.
9872     */
9873    struct LDKClosingSignedFeeRange *result;
9874    /**
9875     * A pointer to the contents in the error state.
9876     * Reading from this pointer when `result_ok` is set is undefined.
9877     */
9878    struct LDKDecodeError *err;
9879 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr;
9880
9881 /**
9882  * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
9883  * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
9884  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9885  */
9886 typedef struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ {
9887    /**
9888     * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
9889     * `err` or `result` depending on the state of `result_ok`.
9890     */
9891    union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
9892    /**
9893     * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
9894     */
9895    bool result_ok;
9896 } LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
9897
9898
9899
9900 /**
9901  * A commitment_signed message to be sent or received from a peer
9902  */
9903 typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
9904    /**
9905     * A pointer to the opaque Rust object.
9906     * Nearly everywhere, inner must be non-null, however in places where
9907     * the Rust equivalent takes an Option, it may be set to null to indicate None.
9908     */
9909    LDKnativeCommitmentSigned *inner;
9910    /**
9911     * Indicates that this is the only struct which contains the same pointer.
9912     * Rust functions which take ownership of an object provided via an argument require
9913     * this to be true and invalidate the object pointed to by inner.
9914     */
9915    bool is_owned;
9916 } LDKCommitmentSigned;
9917
9918 /**
9919  * The contents of CResult_CommitmentSignedDecodeErrorZ
9920  */
9921 typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
9922    /**
9923     * A pointer to the contents in the success state.
9924     * Reading from this pointer when `result_ok` is not set is undefined.
9925     */
9926    struct LDKCommitmentSigned *result;
9927    /**
9928     * A pointer to the contents in the error state.
9929     * Reading from this pointer when `result_ok` is set is undefined.
9930     */
9931    struct LDKDecodeError *err;
9932 } LDKCResult_CommitmentSignedDecodeErrorZPtr;
9933
9934 /**
9935  * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
9936  * containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
9937  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9938  */
9939 typedef struct LDKCResult_CommitmentSignedDecodeErrorZ {
9940    /**
9941     * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
9942     * `err` or `result` depending on the state of `result_ok`.
9943     */
9944    union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
9945    /**
9946     * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
9947     */
9948    bool result_ok;
9949 } LDKCResult_CommitmentSignedDecodeErrorZ;
9950
9951 /**
9952  * The contents of CResult_FundingCreatedDecodeErrorZ
9953  */
9954 typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
9955    /**
9956     * A pointer to the contents in the success state.
9957     * Reading from this pointer when `result_ok` is not set is undefined.
9958     */
9959    struct LDKFundingCreated *result;
9960    /**
9961     * A pointer to the contents in the error state.
9962     * Reading from this pointer when `result_ok` is set is undefined.
9963     */
9964    struct LDKDecodeError *err;
9965 } LDKCResult_FundingCreatedDecodeErrorZPtr;
9966
9967 /**
9968  * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
9969  * containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure.
9970  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
9971  */
9972 typedef struct LDKCResult_FundingCreatedDecodeErrorZ {
9973    /**
9974     * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
9975     * `err` or `result` depending on the state of `result_ok`.
9976     */
9977    union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
9978    /**
9979     * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
9980     */
9981    bool result_ok;
9982 } LDKCResult_FundingCreatedDecodeErrorZ;
9983
9984 /**
9985  * The contents of CResult_FundingSignedDecodeErrorZ
9986  */
9987 typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
9988    /**
9989     * A pointer to the contents in the success state.
9990     * Reading from this pointer when `result_ok` is not set is undefined.
9991     */
9992    struct LDKFundingSigned *result;
9993    /**
9994     * A pointer to the contents in the error state.
9995     * Reading from this pointer when `result_ok` is set is undefined.
9996     */
9997    struct LDKDecodeError *err;
9998 } LDKCResult_FundingSignedDecodeErrorZPtr;
9999
10000 /**
10001  * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
10002  * containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure.
10003  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10004  */
10005 typedef struct LDKCResult_FundingSignedDecodeErrorZ {
10006    /**
10007     * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
10008     * `err` or `result` depending on the state of `result_ok`.
10009     */
10010    union LDKCResult_FundingSignedDecodeErrorZPtr contents;
10011    /**
10012     * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
10013     */
10014    bool result_ok;
10015 } LDKCResult_FundingSignedDecodeErrorZ;
10016
10017 /**
10018  * The contents of CResult_ChannelReadyDecodeErrorZ
10019  */
10020 typedef union LDKCResult_ChannelReadyDecodeErrorZPtr {
10021    /**
10022     * A pointer to the contents in the success state.
10023     * Reading from this pointer when `result_ok` is not set is undefined.
10024     */
10025    struct LDKChannelReady *result;
10026    /**
10027     * A pointer to the contents in the error state.
10028     * Reading from this pointer when `result_ok` is set is undefined.
10029     */
10030    struct LDKDecodeError *err;
10031 } LDKCResult_ChannelReadyDecodeErrorZPtr;
10032
10033 /**
10034  * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation,
10035  * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure.
10036  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10037  */
10038 typedef struct LDKCResult_ChannelReadyDecodeErrorZ {
10039    /**
10040     * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either
10041     * `err` or `result` depending on the state of `result_ok`.
10042     */
10043    union LDKCResult_ChannelReadyDecodeErrorZPtr contents;
10044    /**
10045     * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state.
10046     */
10047    bool result_ok;
10048 } LDKCResult_ChannelReadyDecodeErrorZ;
10049
10050
10051
10052 /**
10053  * An init message to be sent or received from a peer
10054  */
10055 typedef struct MUST_USE_STRUCT LDKInit {
10056    /**
10057     * A pointer to the opaque Rust object.
10058     * Nearly everywhere, inner must be non-null, however in places where
10059     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10060     */
10061    LDKnativeInit *inner;
10062    /**
10063     * Indicates that this is the only struct which contains the same pointer.
10064     * Rust functions which take ownership of an object provided via an argument require
10065     * this to be true and invalidate the object pointed to by inner.
10066     */
10067    bool is_owned;
10068 } LDKInit;
10069
10070 /**
10071  * The contents of CResult_InitDecodeErrorZ
10072  */
10073 typedef union LDKCResult_InitDecodeErrorZPtr {
10074    /**
10075     * A pointer to the contents in the success state.
10076     * Reading from this pointer when `result_ok` is not set is undefined.
10077     */
10078    struct LDKInit *result;
10079    /**
10080     * A pointer to the contents in the error state.
10081     * Reading from this pointer when `result_ok` is set is undefined.
10082     */
10083    struct LDKDecodeError *err;
10084 } LDKCResult_InitDecodeErrorZPtr;
10085
10086 /**
10087  * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
10088  * containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure.
10089  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10090  */
10091 typedef struct LDKCResult_InitDecodeErrorZ {
10092    /**
10093     * The contents of this CResult_InitDecodeErrorZ, accessible via either
10094     * `err` or `result` depending on the state of `result_ok`.
10095     */
10096    union LDKCResult_InitDecodeErrorZPtr contents;
10097    /**
10098     * Whether this CResult_InitDecodeErrorZ represents a success state.
10099     */
10100    bool result_ok;
10101 } LDKCResult_InitDecodeErrorZ;
10102
10103 /**
10104  * The contents of CResult_OpenChannelDecodeErrorZ
10105  */
10106 typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
10107    /**
10108     * A pointer to the contents in the success state.
10109     * Reading from this pointer when `result_ok` is not set is undefined.
10110     */
10111    struct LDKOpenChannel *result;
10112    /**
10113     * A pointer to the contents in the error state.
10114     * Reading from this pointer when `result_ok` is set is undefined.
10115     */
10116    struct LDKDecodeError *err;
10117 } LDKCResult_OpenChannelDecodeErrorZPtr;
10118
10119 /**
10120  * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
10121  * containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure.
10122  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10123  */
10124 typedef struct LDKCResult_OpenChannelDecodeErrorZ {
10125    /**
10126     * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
10127     * `err` or `result` depending on the state of `result_ok`.
10128     */
10129    union LDKCResult_OpenChannelDecodeErrorZPtr contents;
10130    /**
10131     * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
10132     */
10133    bool result_ok;
10134 } LDKCResult_OpenChannelDecodeErrorZ;
10135
10136 /**
10137  * The contents of CResult_RevokeAndACKDecodeErrorZ
10138  */
10139 typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
10140    /**
10141     * A pointer to the contents in the success state.
10142     * Reading from this pointer when `result_ok` is not set is undefined.
10143     */
10144    struct LDKRevokeAndACK *result;
10145    /**
10146     * A pointer to the contents in the error state.
10147     * Reading from this pointer when `result_ok` is set is undefined.
10148     */
10149    struct LDKDecodeError *err;
10150 } LDKCResult_RevokeAndACKDecodeErrorZPtr;
10151
10152 /**
10153  * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
10154  * containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure.
10155  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10156  */
10157 typedef struct LDKCResult_RevokeAndACKDecodeErrorZ {
10158    /**
10159     * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
10160     * `err` or `result` depending on the state of `result_ok`.
10161     */
10162    union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
10163    /**
10164     * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
10165     */
10166    bool result_ok;
10167 } LDKCResult_RevokeAndACKDecodeErrorZ;
10168
10169 /**
10170  * The contents of CResult_ShutdownDecodeErrorZ
10171  */
10172 typedef union LDKCResult_ShutdownDecodeErrorZPtr {
10173    /**
10174     * A pointer to the contents in the success state.
10175     * Reading from this pointer when `result_ok` is not set is undefined.
10176     */
10177    struct LDKShutdown *result;
10178    /**
10179     * A pointer to the contents in the error state.
10180     * Reading from this pointer when `result_ok` is set is undefined.
10181     */
10182    struct LDKDecodeError *err;
10183 } LDKCResult_ShutdownDecodeErrorZPtr;
10184
10185 /**
10186  * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
10187  * containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure.
10188  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10189  */
10190 typedef struct LDKCResult_ShutdownDecodeErrorZ {
10191    /**
10192     * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
10193     * `err` or `result` depending on the state of `result_ok`.
10194     */
10195    union LDKCResult_ShutdownDecodeErrorZPtr contents;
10196    /**
10197     * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
10198     */
10199    bool result_ok;
10200 } LDKCResult_ShutdownDecodeErrorZ;
10201
10202 /**
10203  * The contents of CResult_UpdateFailHTLCDecodeErrorZ
10204  */
10205 typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
10206    /**
10207     * A pointer to the contents in the success state.
10208     * Reading from this pointer when `result_ok` is not set is undefined.
10209     */
10210    struct LDKUpdateFailHTLC *result;
10211    /**
10212     * A pointer to the contents in the error state.
10213     * Reading from this pointer when `result_ok` is set is undefined.
10214     */
10215    struct LDKDecodeError *err;
10216 } LDKCResult_UpdateFailHTLCDecodeErrorZPtr;
10217
10218 /**
10219  * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
10220  * containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10221  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10222  */
10223 typedef struct LDKCResult_UpdateFailHTLCDecodeErrorZ {
10224    /**
10225     * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
10226     * `err` or `result` depending on the state of `result_ok`.
10227     */
10228    union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
10229    /**
10230     * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
10231     */
10232    bool result_ok;
10233 } LDKCResult_UpdateFailHTLCDecodeErrorZ;
10234
10235 /**
10236  * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
10237  */
10238 typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
10239    /**
10240     * A pointer to the contents in the success state.
10241     * Reading from this pointer when `result_ok` is not set is undefined.
10242     */
10243    struct LDKUpdateFailMalformedHTLC *result;
10244    /**
10245     * A pointer to the contents in the error state.
10246     * Reading from this pointer when `result_ok` is set is undefined.
10247     */
10248    struct LDKDecodeError *err;
10249 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr;
10250
10251 /**
10252  * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
10253  * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10254  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10255  */
10256 typedef struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ {
10257    /**
10258     * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
10259     * `err` or `result` depending on the state of `result_ok`.
10260     */
10261    union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
10262    /**
10263     * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
10264     */
10265    bool result_ok;
10266 } LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
10267
10268
10269
10270 /**
10271  * An update_fee message to be sent or received from a peer
10272  */
10273 typedef struct MUST_USE_STRUCT LDKUpdateFee {
10274    /**
10275     * A pointer to the opaque Rust object.
10276     * Nearly everywhere, inner must be non-null, however in places where
10277     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10278     */
10279    LDKnativeUpdateFee *inner;
10280    /**
10281     * Indicates that this is the only struct which contains the same pointer.
10282     * Rust functions which take ownership of an object provided via an argument require
10283     * this to be true and invalidate the object pointed to by inner.
10284     */
10285    bool is_owned;
10286 } LDKUpdateFee;
10287
10288 /**
10289  * The contents of CResult_UpdateFeeDecodeErrorZ
10290  */
10291 typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
10292    /**
10293     * A pointer to the contents in the success state.
10294     * Reading from this pointer when `result_ok` is not set is undefined.
10295     */
10296    struct LDKUpdateFee *result;
10297    /**
10298     * A pointer to the contents in the error state.
10299     * Reading from this pointer when `result_ok` is set is undefined.
10300     */
10301    struct LDKDecodeError *err;
10302 } LDKCResult_UpdateFeeDecodeErrorZPtr;
10303
10304 /**
10305  * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
10306  * containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure.
10307  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10308  */
10309 typedef struct LDKCResult_UpdateFeeDecodeErrorZ {
10310    /**
10311     * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
10312     * `err` or `result` depending on the state of `result_ok`.
10313     */
10314    union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
10315    /**
10316     * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
10317     */
10318    bool result_ok;
10319 } LDKCResult_UpdateFeeDecodeErrorZ;
10320
10321 /**
10322  * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
10323  */
10324 typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
10325    /**
10326     * A pointer to the contents in the success state.
10327     * Reading from this pointer when `result_ok` is not set is undefined.
10328     */
10329    struct LDKUpdateFulfillHTLC *result;
10330    /**
10331     * A pointer to the contents in the error state.
10332     * Reading from this pointer when `result_ok` is set is undefined.
10333     */
10334    struct LDKDecodeError *err;
10335 } LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr;
10336
10337 /**
10338  * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
10339  * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10340  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10341  */
10342 typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ {
10343    /**
10344     * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
10345     * `err` or `result` depending on the state of `result_ok`.
10346     */
10347    union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
10348    /**
10349     * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
10350     */
10351    bool result_ok;
10352 } LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
10353
10354 /**
10355  * The contents of CResult_UpdateAddHTLCDecodeErrorZ
10356  */
10357 typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
10358    /**
10359     * A pointer to the contents in the success state.
10360     * Reading from this pointer when `result_ok` is not set is undefined.
10361     */
10362    struct LDKUpdateAddHTLC *result;
10363    /**
10364     * A pointer to the contents in the error state.
10365     * Reading from this pointer when `result_ok` is set is undefined.
10366     */
10367    struct LDKDecodeError *err;
10368 } LDKCResult_UpdateAddHTLCDecodeErrorZPtr;
10369
10370 /**
10371  * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
10372  * containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure.
10373  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10374  */
10375 typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ {
10376    /**
10377     * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
10378     * `err` or `result` depending on the state of `result_ok`.
10379     */
10380    union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
10381    /**
10382     * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
10383     */
10384    bool result_ok;
10385 } LDKCResult_UpdateAddHTLCDecodeErrorZ;
10386
10387
10388
10389 /**
10390  * A ping message to be sent or received from a peer
10391  */
10392 typedef struct MUST_USE_STRUCT LDKPing {
10393    /**
10394     * A pointer to the opaque Rust object.
10395     * Nearly everywhere, inner must be non-null, however in places where
10396     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10397     */
10398    LDKnativePing *inner;
10399    /**
10400     * Indicates that this is the only struct which contains the same pointer.
10401     * Rust functions which take ownership of an object provided via an argument require
10402     * this to be true and invalidate the object pointed to by inner.
10403     */
10404    bool is_owned;
10405 } LDKPing;
10406
10407 /**
10408  * The contents of CResult_PingDecodeErrorZ
10409  */
10410 typedef union LDKCResult_PingDecodeErrorZPtr {
10411    /**
10412     * A pointer to the contents in the success state.
10413     * Reading from this pointer when `result_ok` is not set is undefined.
10414     */
10415    struct LDKPing *result;
10416    /**
10417     * A pointer to the contents in the error state.
10418     * Reading from this pointer when `result_ok` is set is undefined.
10419     */
10420    struct LDKDecodeError *err;
10421 } LDKCResult_PingDecodeErrorZPtr;
10422
10423 /**
10424  * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
10425  * containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure.
10426  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10427  */
10428 typedef struct LDKCResult_PingDecodeErrorZ {
10429    /**
10430     * The contents of this CResult_PingDecodeErrorZ, accessible via either
10431     * `err` or `result` depending on the state of `result_ok`.
10432     */
10433    union LDKCResult_PingDecodeErrorZPtr contents;
10434    /**
10435     * Whether this CResult_PingDecodeErrorZ represents a success state.
10436     */
10437    bool result_ok;
10438 } LDKCResult_PingDecodeErrorZ;
10439
10440
10441
10442 /**
10443  * A pong message to be sent or received from a peer
10444  */
10445 typedef struct MUST_USE_STRUCT LDKPong {
10446    /**
10447     * A pointer to the opaque Rust object.
10448     * Nearly everywhere, inner must be non-null, however in places where
10449     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10450     */
10451    LDKnativePong *inner;
10452    /**
10453     * Indicates that this is the only struct which contains the same pointer.
10454     * Rust functions which take ownership of an object provided via an argument require
10455     * this to be true and invalidate the object pointed to by inner.
10456     */
10457    bool is_owned;
10458 } LDKPong;
10459
10460 /**
10461  * The contents of CResult_PongDecodeErrorZ
10462  */
10463 typedef union LDKCResult_PongDecodeErrorZPtr {
10464    /**
10465     * A pointer to the contents in the success state.
10466     * Reading from this pointer when `result_ok` is not set is undefined.
10467     */
10468    struct LDKPong *result;
10469    /**
10470     * A pointer to the contents in the error state.
10471     * Reading from this pointer when `result_ok` is set is undefined.
10472     */
10473    struct LDKDecodeError *err;
10474 } LDKCResult_PongDecodeErrorZPtr;
10475
10476 /**
10477  * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
10478  * containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure.
10479  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10480  */
10481 typedef struct LDKCResult_PongDecodeErrorZ {
10482    /**
10483     * The contents of this CResult_PongDecodeErrorZ, accessible via either
10484     * `err` or `result` depending on the state of `result_ok`.
10485     */
10486    union LDKCResult_PongDecodeErrorZPtr contents;
10487    /**
10488     * Whether this CResult_PongDecodeErrorZ represents a success state.
10489     */
10490    bool result_ok;
10491 } LDKCResult_PongDecodeErrorZ;
10492
10493 /**
10494  * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
10495  */
10496 typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
10497    /**
10498     * A pointer to the contents in the success state.
10499     * Reading from this pointer when `result_ok` is not set is undefined.
10500     */
10501    struct LDKUnsignedChannelAnnouncement *result;
10502    /**
10503     * A pointer to the contents in the error state.
10504     * Reading from this pointer when `result_ok` is set is undefined.
10505     */
10506    struct LDKDecodeError *err;
10507 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr;
10508
10509 /**
10510  * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10511  * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10512  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10513  */
10514 typedef struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ {
10515    /**
10516     * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
10517     * `err` or `result` depending on the state of `result_ok`.
10518     */
10519    union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
10520    /**
10521     * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
10522     */
10523    bool result_ok;
10524 } LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
10525
10526 /**
10527  * The contents of CResult_ChannelAnnouncementDecodeErrorZ
10528  */
10529 typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
10530    /**
10531     * A pointer to the contents in the success state.
10532     * Reading from this pointer when `result_ok` is not set is undefined.
10533     */
10534    struct LDKChannelAnnouncement *result;
10535    /**
10536     * A pointer to the contents in the error state.
10537     * Reading from this pointer when `result_ok` is set is undefined.
10538     */
10539    struct LDKDecodeError *err;
10540 } LDKCResult_ChannelAnnouncementDecodeErrorZPtr;
10541
10542 /**
10543  * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
10544  * containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10545  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10546  */
10547 typedef struct LDKCResult_ChannelAnnouncementDecodeErrorZ {
10548    /**
10549     * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
10550     * `err` or `result` depending on the state of `result_ok`.
10551     */
10552    union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
10553    /**
10554     * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
10555     */
10556    bool result_ok;
10557 } LDKCResult_ChannelAnnouncementDecodeErrorZ;
10558
10559
10560
10561 /**
10562  * The unsigned part of a channel_update
10563  */
10564 typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
10565    /**
10566     * A pointer to the opaque Rust object.
10567     * Nearly everywhere, inner must be non-null, however in places where
10568     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10569     */
10570    LDKnativeUnsignedChannelUpdate *inner;
10571    /**
10572     * Indicates that this is the only struct which contains the same pointer.
10573     * Rust functions which take ownership of an object provided via an argument require
10574     * this to be true and invalidate the object pointed to by inner.
10575     */
10576    bool is_owned;
10577 } LDKUnsignedChannelUpdate;
10578
10579 /**
10580  * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
10581  */
10582 typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
10583    /**
10584     * A pointer to the contents in the success state.
10585     * Reading from this pointer when `result_ok` is not set is undefined.
10586     */
10587    struct LDKUnsignedChannelUpdate *result;
10588    /**
10589     * A pointer to the contents in the error state.
10590     * Reading from this pointer when `result_ok` is set is undefined.
10591     */
10592    struct LDKDecodeError *err;
10593 } LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr;
10594
10595 /**
10596  * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10597  * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10598  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10599  */
10600 typedef struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ {
10601    /**
10602     * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
10603     * `err` or `result` depending on the state of `result_ok`.
10604     */
10605    union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
10606    /**
10607     * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
10608     */
10609    bool result_ok;
10610 } LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
10611
10612 /**
10613  * The contents of CResult_ChannelUpdateDecodeErrorZ
10614  */
10615 typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
10616    /**
10617     * A pointer to the contents in the success state.
10618     * Reading from this pointer when `result_ok` is not set is undefined.
10619     */
10620    struct LDKChannelUpdate *result;
10621    /**
10622     * A pointer to the contents in the error state.
10623     * Reading from this pointer when `result_ok` is set is undefined.
10624     */
10625    struct LDKDecodeError *err;
10626 } LDKCResult_ChannelUpdateDecodeErrorZPtr;
10627
10628 /**
10629  * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
10630  * containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure.
10631  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10632  */
10633 typedef struct LDKCResult_ChannelUpdateDecodeErrorZ {
10634    /**
10635     * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
10636     * `err` or `result` depending on the state of `result_ok`.
10637     */
10638    union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
10639    /**
10640     * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
10641     */
10642    bool result_ok;
10643 } LDKCResult_ChannelUpdateDecodeErrorZ;
10644
10645 /**
10646  * The contents of CResult_ErrorMessageDecodeErrorZ
10647  */
10648 typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
10649    /**
10650     * A pointer to the contents in the success state.
10651     * Reading from this pointer when `result_ok` is not set is undefined.
10652     */
10653    struct LDKErrorMessage *result;
10654    /**
10655     * A pointer to the contents in the error state.
10656     * Reading from this pointer when `result_ok` is set is undefined.
10657     */
10658    struct LDKDecodeError *err;
10659 } LDKCResult_ErrorMessageDecodeErrorZPtr;
10660
10661 /**
10662  * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
10663  * containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10664  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10665  */
10666 typedef struct LDKCResult_ErrorMessageDecodeErrorZ {
10667    /**
10668     * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
10669     * `err` or `result` depending on the state of `result_ok`.
10670     */
10671    union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
10672    /**
10673     * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
10674     */
10675    bool result_ok;
10676 } LDKCResult_ErrorMessageDecodeErrorZ;
10677
10678 /**
10679  * The contents of CResult_WarningMessageDecodeErrorZ
10680  */
10681 typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
10682    /**
10683     * A pointer to the contents in the success state.
10684     * Reading from this pointer when `result_ok` is not set is undefined.
10685     */
10686    struct LDKWarningMessage *result;
10687    /**
10688     * A pointer to the contents in the error state.
10689     * Reading from this pointer when `result_ok` is set is undefined.
10690     */
10691    struct LDKDecodeError *err;
10692 } LDKCResult_WarningMessageDecodeErrorZPtr;
10693
10694 /**
10695  * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
10696  * containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure.
10697  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10698  */
10699 typedef struct LDKCResult_WarningMessageDecodeErrorZ {
10700    /**
10701     * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
10702     * `err` or `result` depending on the state of `result_ok`.
10703     */
10704    union LDKCResult_WarningMessageDecodeErrorZPtr contents;
10705    /**
10706     * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
10707     */
10708    bool result_ok;
10709 } LDKCResult_WarningMessageDecodeErrorZ;
10710
10711
10712
10713 /**
10714  * The unsigned part of a node_announcement
10715  */
10716 typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
10717    /**
10718     * A pointer to the opaque Rust object.
10719     * Nearly everywhere, inner must be non-null, however in places where
10720     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10721     */
10722    LDKnativeUnsignedNodeAnnouncement *inner;
10723    /**
10724     * Indicates that this is the only struct which contains the same pointer.
10725     * Rust functions which take ownership of an object provided via an argument require
10726     * this to be true and invalidate the object pointed to by inner.
10727     */
10728    bool is_owned;
10729 } LDKUnsignedNodeAnnouncement;
10730
10731 /**
10732  * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
10733  */
10734 typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
10735    /**
10736     * A pointer to the contents in the success state.
10737     * Reading from this pointer when `result_ok` is not set is undefined.
10738     */
10739    struct LDKUnsignedNodeAnnouncement *result;
10740    /**
10741     * A pointer to the contents in the error state.
10742     * Reading from this pointer when `result_ok` is set is undefined.
10743     */
10744    struct LDKDecodeError *err;
10745 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr;
10746
10747 /**
10748  * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10749  * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10750  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10751  */
10752 typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ {
10753    /**
10754     * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
10755     * `err` or `result` depending on the state of `result_ok`.
10756     */
10757    union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
10758    /**
10759     * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
10760     */
10761    bool result_ok;
10762 } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
10763
10764 /**
10765  * The contents of CResult_NodeAnnouncementDecodeErrorZ
10766  */
10767 typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
10768    /**
10769     * A pointer to the contents in the success state.
10770     * Reading from this pointer when `result_ok` is not set is undefined.
10771     */
10772    struct LDKNodeAnnouncement *result;
10773    /**
10774     * A pointer to the contents in the error state.
10775     * Reading from this pointer when `result_ok` is set is undefined.
10776     */
10777    struct LDKDecodeError *err;
10778 } LDKCResult_NodeAnnouncementDecodeErrorZPtr;
10779
10780 /**
10781  * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
10782  * containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure.
10783  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10784  */
10785 typedef struct LDKCResult_NodeAnnouncementDecodeErrorZ {
10786    /**
10787     * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
10788     * `err` or `result` depending on the state of `result_ok`.
10789     */
10790    union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
10791    /**
10792     * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
10793     */
10794    bool result_ok;
10795 } LDKCResult_NodeAnnouncementDecodeErrorZ;
10796
10797 /**
10798  * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
10799  */
10800 typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
10801    /**
10802     * A pointer to the contents in the success state.
10803     * Reading from this pointer when `result_ok` is not set is undefined.
10804     */
10805    struct LDKQueryShortChannelIds *result;
10806    /**
10807     * A pointer to the contents in the error state.
10808     * Reading from this pointer when `result_ok` is set is undefined.
10809     */
10810    struct LDKDecodeError *err;
10811 } LDKCResult_QueryShortChannelIdsDecodeErrorZPtr;
10812
10813 /**
10814  * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
10815  * containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure.
10816  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10817  */
10818 typedef struct LDKCResult_QueryShortChannelIdsDecodeErrorZ {
10819    /**
10820     * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
10821     * `err` or `result` depending on the state of `result_ok`.
10822     */
10823    union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
10824    /**
10825     * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
10826     */
10827    bool result_ok;
10828 } LDKCResult_QueryShortChannelIdsDecodeErrorZ;
10829
10830
10831
10832 /**
10833  * A reply_short_channel_ids_end message is sent as a reply to a
10834  * query_short_channel_ids message. The query recipient makes a best
10835  * effort to respond based on their local network view which may not be
10836  * a perfect view of the network.
10837  */
10838 typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
10839    /**
10840     * A pointer to the opaque Rust object.
10841     * Nearly everywhere, inner must be non-null, however in places where
10842     * the Rust equivalent takes an Option, it may be set to null to indicate None.
10843     */
10844    LDKnativeReplyShortChannelIdsEnd *inner;
10845    /**
10846     * Indicates that this is the only struct which contains the same pointer.
10847     * Rust functions which take ownership of an object provided via an argument require
10848     * this to be true and invalidate the object pointed to by inner.
10849     */
10850    bool is_owned;
10851 } LDKReplyShortChannelIdsEnd;
10852
10853 /**
10854  * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
10855  */
10856 typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
10857    /**
10858     * A pointer to the contents in the success state.
10859     * Reading from this pointer when `result_ok` is not set is undefined.
10860     */
10861    struct LDKReplyShortChannelIdsEnd *result;
10862    /**
10863     * A pointer to the contents in the error state.
10864     * Reading from this pointer when `result_ok` is set is undefined.
10865     */
10866    struct LDKDecodeError *err;
10867 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr;
10868
10869 /**
10870  * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
10871  * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure.
10872  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10873  */
10874 typedef struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ {
10875    /**
10876     * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
10877     * `err` or `result` depending on the state of `result_ok`.
10878     */
10879    union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
10880    /**
10881     * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
10882     */
10883    bool result_ok;
10884 } LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
10885
10886 /**
10887  * The contents of CResult_QueryChannelRangeDecodeErrorZ
10888  */
10889 typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
10890    /**
10891     * A pointer to the contents in the success state.
10892     * Reading from this pointer when `result_ok` is not set is undefined.
10893     */
10894    struct LDKQueryChannelRange *result;
10895    /**
10896     * A pointer to the contents in the error state.
10897     * Reading from this pointer when `result_ok` is set is undefined.
10898     */
10899    struct LDKDecodeError *err;
10900 } LDKCResult_QueryChannelRangeDecodeErrorZPtr;
10901
10902 /**
10903  * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
10904  * containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10905  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10906  */
10907 typedef struct LDKCResult_QueryChannelRangeDecodeErrorZ {
10908    /**
10909     * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
10910     * `err` or `result` depending on the state of `result_ok`.
10911     */
10912    union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
10913    /**
10914     * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
10915     */
10916    bool result_ok;
10917 } LDKCResult_QueryChannelRangeDecodeErrorZ;
10918
10919 /**
10920  * The contents of CResult_ReplyChannelRangeDecodeErrorZ
10921  */
10922 typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
10923    /**
10924     * A pointer to the contents in the success state.
10925     * Reading from this pointer when `result_ok` is not set is undefined.
10926     */
10927    struct LDKReplyChannelRange *result;
10928    /**
10929     * A pointer to the contents in the error state.
10930     * Reading from this pointer when `result_ok` is set is undefined.
10931     */
10932    struct LDKDecodeError *err;
10933 } LDKCResult_ReplyChannelRangeDecodeErrorZPtr;
10934
10935 /**
10936  * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
10937  * containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure.
10938  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10939  */
10940 typedef struct LDKCResult_ReplyChannelRangeDecodeErrorZ {
10941    /**
10942     * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
10943     * `err` or `result` depending on the state of `result_ok`.
10944     */
10945    union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
10946    /**
10947     * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
10948     */
10949    bool result_ok;
10950 } LDKCResult_ReplyChannelRangeDecodeErrorZ;
10951
10952 /**
10953  * The contents of CResult_GossipTimestampFilterDecodeErrorZ
10954  */
10955 typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
10956    /**
10957     * A pointer to the contents in the success state.
10958     * Reading from this pointer when `result_ok` is not set is undefined.
10959     */
10960    struct LDKGossipTimestampFilter *result;
10961    /**
10962     * A pointer to the contents in the error state.
10963     * Reading from this pointer when `result_ok` is set is undefined.
10964     */
10965    struct LDKDecodeError *err;
10966 } LDKCResult_GossipTimestampFilterDecodeErrorZPtr;
10967
10968 /**
10969  * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
10970  * containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure.
10971  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
10972  */
10973 typedef struct LDKCResult_GossipTimestampFilterDecodeErrorZ {
10974    /**
10975     * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
10976     * `err` or `result` depending on the state of `result_ok`.
10977     */
10978    union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
10979    /**
10980     * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
10981     */
10982    bool result_ok;
10983 } LDKCResult_GossipTimestampFilterDecodeErrorZ;
10984
10985 /**
10986  * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
10987  * This corresponds to std::vector in C++
10988  */
10989 typedef struct LDKCVec_PhantomRouteHintsZ {
10990    /**
10991     * The elements in the array.
10992     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
10993     */
10994    struct LDKPhantomRouteHints *data;
10995    /**
10996     * The number of elements pointed to by `data`.
10997     */
10998    uintptr_t datalen;
10999 } LDKCVec_PhantomRouteHintsZ;
11000
11001 /**
11002  * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
11003  * may occur.
11004  */
11005 typedef enum LDKSignOrCreationError_Tag {
11006    /**
11007     * An error occurred during signing
11008     */
11009    LDKSignOrCreationError_SignError,
11010    /**
11011     * An error occurred while building the transaction
11012     */
11013    LDKSignOrCreationError_CreationError,
11014    /**
11015     * Must be last for serialization purposes
11016     */
11017    LDKSignOrCreationError_Sentinel,
11018 } LDKSignOrCreationError_Tag;
11019
11020 typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
11021    LDKSignOrCreationError_Tag tag;
11022    union {
11023       struct {
11024          enum LDKCreationError creation_error;
11025       };
11026    };
11027 } LDKSignOrCreationError;
11028
11029 /**
11030  * The contents of CResult_InvoiceSignOrCreationErrorZ
11031  */
11032 typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
11033    /**
11034     * A pointer to the contents in the success state.
11035     * Reading from this pointer when `result_ok` is not set is undefined.
11036     */
11037    struct LDKInvoice *result;
11038    /**
11039     * A pointer to the contents in the error state.
11040     * Reading from this pointer when `result_ok` is set is undefined.
11041     */
11042    struct LDKSignOrCreationError *err;
11043 } LDKCResult_InvoiceSignOrCreationErrorZPtr;
11044
11045 /**
11046  * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
11047  * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
11048  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11049  */
11050 typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
11051    /**
11052     * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
11053     * `err` or `result` depending on the state of `result_ok`.
11054     */
11055    union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
11056    /**
11057     * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
11058     */
11059    bool result_ok;
11060 } LDKCResult_InvoiceSignOrCreationErrorZ;
11061
11062
11063
11064 /**
11065  * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
11066  *
11067  * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
11068  * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
11069  * the return value of [`Filter::register_output`].
11070  *
11071  * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
11072  * may have been spent there. See [`Filter::register_output`] for details.
11073  *
11074  * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
11075  * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
11076  */
11077 typedef struct MUST_USE_STRUCT LDKWatchedOutput {
11078    /**
11079     * A pointer to the opaque Rust object.
11080     * Nearly everywhere, inner must be non-null, however in places where
11081     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11082     */
11083    LDKnativeWatchedOutput *inner;
11084    /**
11085     * Indicates that this is the only struct which contains the same pointer.
11086     * Rust functions which take ownership of an object provided via an argument require
11087     * this to be true and invalidate the object pointed to by inner.
11088     */
11089    bool is_owned;
11090 } LDKWatchedOutput;
11091
11092 /**
11093  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
11094  * channels.
11095  *
11096  * This is useful in order to have a [`Watch`] implementation convey to a chain source which
11097  * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
11098  * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
11099  * receiving full blocks from a chain source, any further filtering is unnecessary.
11100  *
11101  * After an output has been registered, subsequent block retrievals from the chain source must not
11102  * exclude any transactions matching the new criteria nor any in-block descendants of such
11103  * transactions.
11104  *
11105  * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
11106  * should not block on I/O. Implementations should instead queue the newly monitored data to be
11107  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
11108  * invocation that has called the `Filter` must return [`TemporaryFailure`].
11109  *
11110  * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
11111  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
11112  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
11113  */
11114 typedef struct LDKFilter {
11115    /**
11116     * An opaque pointer which is passed to your function implementations as an argument.
11117     * This has no meaning in the LDK, and can be NULL or any other value.
11118     */
11119    void *this_arg;
11120    /**
11121     * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
11122     * a spending condition.
11123     */
11124    void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
11125    /**
11126     * Registers interest in spends of a transaction output.
11127     *
11128     * Optionally, when `output.block_hash` is set, should return any transaction spending the
11129     * output that is found in the corresponding block along with its index.
11130     *
11131     * This return value is useful for Electrum clients in order to supply in-block descendant
11132     * transactions which otherwise were not included. This is not necessary for other clients if
11133     * such descendant transactions were already included (e.g., when a BIP 157 client provides the
11134     * full block).
11135     */
11136    struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
11137    /**
11138     * Frees any resources associated with this object given its this_arg pointer.
11139     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11140     */
11141    void (*free)(void *this_arg);
11142 } LDKFilter;
11143
11144 /**
11145  * An enum which can either contain a crate::lightning::chain::Filter or not
11146  */
11147 typedef enum LDKCOption_FilterZ_Tag {
11148    /**
11149     * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
11150     */
11151    LDKCOption_FilterZ_Some,
11152    /**
11153     * When we're in this state, this COption_FilterZ contains nothing
11154     */
11155    LDKCOption_FilterZ_None,
11156    /**
11157     * Must be last for serialization purposes
11158     */
11159    LDKCOption_FilterZ_Sentinel,
11160 } LDKCOption_FilterZ_Tag;
11161
11162 typedef struct LDKCOption_FilterZ {
11163    LDKCOption_FilterZ_Tag tag;
11164    union {
11165       struct {
11166          struct LDKFilter some;
11167       };
11168    };
11169 } LDKCOption_FilterZ;
11170
11171
11172
11173 /**
11174  * A read-only reference to a current ChannelMonitor.
11175  *
11176  * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
11177  * released.
11178  */
11179 typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
11180    /**
11181     * A pointer to the opaque Rust object.
11182     * Nearly everywhere, inner must be non-null, however in places where
11183     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11184     */
11185    LDKnativeLockedChannelMonitor *inner;
11186    /**
11187     * Indicates that this is the only struct which contains the same pointer.
11188     * Rust functions which take ownership of an object provided via an argument require
11189     * this to be true and invalidate the object pointed to by inner.
11190     */
11191    bool is_owned;
11192 } LDKLockedChannelMonitor;
11193
11194 /**
11195  * The contents of CResult_LockedChannelMonitorNoneZ
11196  */
11197 typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
11198    /**
11199     * A pointer to the contents in the success state.
11200     * Reading from this pointer when `result_ok` is not set is undefined.
11201     */
11202    struct LDKLockedChannelMonitor *result;
11203    /**
11204     * Note that this value is always NULL, as there are no contents in the Err variant
11205     */
11206    void *err;
11207 } LDKCResult_LockedChannelMonitorNoneZPtr;
11208
11209 /**
11210  * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
11211  * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
11212  * `result_ok` indicates the overall state, and the contents are provided via `contents`.
11213  */
11214 typedef struct LDKCResult_LockedChannelMonitorNoneZ {
11215    /**
11216     * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
11217     * `err` or `result` depending on the state of `result_ok`.
11218     */
11219    union LDKCResult_LockedChannelMonitorNoneZPtr contents;
11220    /**
11221     * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
11222     */
11223    bool result_ok;
11224 } LDKCResult_LockedChannelMonitorNoneZ;
11225
11226 /**
11227  * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
11228  * This corresponds to std::vector in C++
11229  */
11230 typedef struct LDKCVec_OutPointZ {
11231    /**
11232     * The elements in the array.
11233     * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
11234     */
11235    struct LDKOutPoint *data;
11236    /**
11237     * The number of elements pointed to by `data`.
11238     */
11239    uintptr_t datalen;
11240 } LDKCVec_OutPointZ;
11241
11242 /**
11243  * A trait indicating an object may generate message send events
11244  */
11245 typedef struct LDKMessageSendEventsProvider {
11246    /**
11247     * An opaque pointer which is passed to your function implementations as an argument.
11248     * This has no meaning in the LDK, and can be NULL or any other value.
11249     */
11250    void *this_arg;
11251    /**
11252     * Gets the list of pending events which were generated by previous actions, clearing the list
11253     * in the process.
11254     */
11255    struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
11256    /**
11257     * Frees any resources associated with this object given its this_arg pointer.
11258     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11259     */
11260    void (*free)(void *this_arg);
11261 } LDKMessageSendEventsProvider;
11262
11263 /**
11264  * A trait implemented for objects handling events from [`EventsProvider`].
11265  */
11266 typedef struct LDKEventHandler {
11267    /**
11268     * An opaque pointer which is passed to your function implementations as an argument.
11269     * This has no meaning in the LDK, and can be NULL or any other value.
11270     */
11271    void *this_arg;
11272    /**
11273     * Handles the given [`Event`].
11274     *
11275     * See [`EventsProvider`] for details that must be considered when implementing this method.
11276     */
11277    void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
11278    /**
11279     * Frees any resources associated with this object given its this_arg pointer.
11280     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11281     */
11282    void (*free)(void *this_arg);
11283 } LDKEventHandler;
11284
11285 /**
11286  * A trait indicating an object may generate events.
11287  *
11288  * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
11289  *
11290  * # Requirements
11291  *
11292  * See [`process_pending_events`] for requirements around event processing.
11293  *
11294  * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
11295  * event since the last invocation. The handler must either act upon the event immediately
11296  * or preserve it for later handling.
11297  *
11298  * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
11299  * consult the provider's documentation on the implication of processing events and how a handler
11300  * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
11301  * [`ChainMonitor::process_pending_events`]).
11302  *
11303  * (C-not implementable) As there is likely no reason for a user to implement this trait on their
11304  * own type(s).
11305  *
11306  * [`process_pending_events`]: Self::process_pending_events
11307  * [`handle_event`]: EventHandler::handle_event
11308  * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
11309  * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
11310  */
11311 typedef struct LDKEventsProvider {
11312    /**
11313     * An opaque pointer which is passed to your function implementations as an argument.
11314     * This has no meaning in the LDK, and can be NULL or any other value.
11315     */
11316    void *this_arg;
11317    /**
11318     * Processes any events generated since the last call using the given event handler.
11319     *
11320     * Subsequent calls must only process new events. However, handlers must be capable of handling
11321     * duplicate events across process restarts. This may occur if the provider was recovered from
11322     * an old state (i.e., it hadn't been successfully persisted after processing pending events).
11323     */
11324    void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
11325    /**
11326     * Frees any resources associated with this object given its this_arg pointer.
11327     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11328     */
11329    void (*free)(void *this_arg);
11330 } LDKEventsProvider;
11331
11332
11333
11334 /**
11335  * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's
11336  * variable-length integers except that it is serialized in big-endian instead of little-endian.
11337  *
11338  * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be
11339  * encoded in several different ways, which we must check for at deserialization-time. Thus, if
11340  * you're looking for an example of a variable-length integer to use for your own project, move
11341  * along, this is a rather poor design.
11342  */
11343 typedef struct MUST_USE_STRUCT LDKBigSize {
11344    /**
11345     * A pointer to the opaque Rust object.
11346     * Nearly everywhere, inner must be non-null, however in places where
11347     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11348     */
11349    LDKnativeBigSize *inner;
11350    /**
11351     * Indicates that this is the only struct which contains the same pointer.
11352     * Rust functions which take ownership of an object provided via an argument require
11353     * this to be true and invalidate the object pointed to by inner.
11354     */
11355    bool is_owned;
11356 } LDKBigSize;
11357
11358
11359
11360 /**
11361  * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`].
11362  */
11363 typedef struct MUST_USE_STRUCT LDKChannelUsage {
11364    /**
11365     * A pointer to the opaque Rust object.
11366     * Nearly everywhere, inner must be non-null, however in places where
11367     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11368     */
11369    LDKnativeChannelUsage *inner;
11370    /**
11371     * Indicates that this is the only struct which contains the same pointer.
11372     * Rust functions which take ownership of an object provided via an argument require
11373     * this to be true and invalidate the object pointed to by inner.
11374     */
11375    bool is_owned;
11376 } LDKChannelUsage;
11377
11378 /**
11379  * An interface used to score payment channels for path finding.
11380  *
11381  *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
11382  */
11383 typedef struct LDKScore {
11384    /**
11385     * An opaque pointer which is passed to your function implementations as an argument.
11386     * This has no meaning in the LDK, and can be NULL or any other value.
11387     */
11388    void *this_arg;
11389    /**
11390     * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
11391     * given channel in the direction from `source` to `target`.
11392     *
11393     * The channel's capacity (less any other MPP parts that are also being considered for use in
11394     * the same payment) is given by `capacity_msat`. It may be determined from various sources
11395     * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
11396     * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
11397     * Thus, implementations should be overflow-safe.
11398     */
11399    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);
11400    /**
11401     * Handles updating channel penalties after failing to route through a channel.
11402     */
11403    void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
11404    /**
11405     * Handles updating channel penalties after successfully routing along a path.
11406     */
11407    void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
11408    /**
11409     * Handles updating channel penalties after a probe over the given path failed.
11410     */
11411    void (*probe_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
11412    /**
11413     * Handles updating channel penalties after a probe over the given path succeeded.
11414     */
11415    void (*probe_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
11416    /**
11417     * Serialize the object into a byte array
11418     */
11419    struct LDKCVec_u8Z (*write)(const void *this_arg);
11420    /**
11421     * Frees any resources associated with this object given its this_arg pointer.
11422     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11423     */
11424    void (*free)(void *this_arg);
11425 } LDKScore;
11426
11427
11428
11429 /**
11430  * A concrete implementation of [`LockableScore`] which supports multi-threading.
11431  */
11432 typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
11433    /**
11434     * A pointer to the opaque Rust object.
11435     * Nearly everywhere, inner must be non-null, however in places where
11436     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11437     */
11438    LDKnativeMultiThreadedLockableScore *inner;
11439    /**
11440     * Indicates that this is the only struct which contains the same pointer.
11441     * Rust functions which take ownership of an object provided via an argument require
11442     * this to be true and invalidate the object pointed to by inner.
11443     */
11444    bool is_owned;
11445 } LDKMultiThreadedLockableScore;
11446
11447 /**
11448  * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`MultiThreadedLockableScore`] to disk.
11449  */
11450 typedef struct LDKPersister {
11451    /**
11452     * An opaque pointer which is passed to your function implementations as an argument.
11453     * This has no meaning in the LDK, and can be NULL or any other value.
11454     */
11455    void *this_arg;
11456    /**
11457     * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed.
11458     */
11459    struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
11460    /**
11461     * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
11462     */
11463    struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
11464    /**
11465     * Persist the given [`MultiThreadedLockableScore`] to disk, returning an error if persistence failed.
11466     */
11467    struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer);
11468    /**
11469     * Frees any resources associated with this object given its this_arg pointer.
11470     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11471     */
11472    void (*free)(void *this_arg);
11473 } LDKPersister;
11474
11475
11476
11477 /**
11478  * Configuration we set when applicable.
11479  *
11480  * Default::default() provides sane defaults.
11481  */
11482 typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
11483    /**
11484     * A pointer to the opaque Rust object.
11485     * Nearly everywhere, inner must be non-null, however in places where
11486     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11487     */
11488    LDKnativeChannelHandshakeConfig *inner;
11489    /**
11490     * Indicates that this is the only struct which contains the same pointer.
11491     * Rust functions which take ownership of an object provided via an argument require
11492     * this to be true and invalidate the object pointed to by inner.
11493     */
11494    bool is_owned;
11495 } LDKChannelHandshakeConfig;
11496
11497
11498
11499 /**
11500  * Optional channel limits which are applied during channel creation.
11501  *
11502  * These limits are only applied to our counterparty's limits, not our own.
11503  *
11504  * Use 0/<type>::max_value() as appropriate to skip checking.
11505  *
11506  * Provides sane defaults for most configurations.
11507  *
11508  * Most additional limits are disabled except those with which specify a default in individual
11509  * field documentation. Note that this may result in barely-usable channels, but since they
11510  * are applied mostly only to incoming channels that's not much of a problem.
11511  */
11512 typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
11513    /**
11514     * A pointer to the opaque Rust object.
11515     * Nearly everywhere, inner must be non-null, however in places where
11516     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11517     */
11518    LDKnativeChannelHandshakeLimits *inner;
11519    /**
11520     * Indicates that this is the only struct which contains the same pointer.
11521     * Rust functions which take ownership of an object provided via an argument require
11522     * this to be true and invalidate the object pointed to by inner.
11523     */
11524    bool is_owned;
11525 } LDKChannelHandshakeLimits;
11526
11527
11528
11529 /**
11530  * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
11531  *
11532  * Default::default() provides sane defaults for most configurations
11533  * (but currently with 0 relay fees!)
11534  */
11535 typedef struct MUST_USE_STRUCT LDKUserConfig {
11536    /**
11537     * A pointer to the opaque Rust object.
11538     * Nearly everywhere, inner must be non-null, however in places where
11539     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11540     */
11541    LDKnativeUserConfig *inner;
11542    /**
11543     * Indicates that this is the only struct which contains the same pointer.
11544     * Rust functions which take ownership of an object provided via an argument require
11545     * this to be true and invalidate the object pointed to by inner.
11546     */
11547    bool is_owned;
11548 } LDKUserConfig;
11549
11550
11551
11552 /**
11553  * The best known block as identified by its hash and height.
11554  */
11555 typedef struct MUST_USE_STRUCT LDKBestBlock {
11556    /**
11557     * A pointer to the opaque Rust object.
11558     * Nearly everywhere, inner must be non-null, however in places where
11559     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11560     */
11561    LDKnativeBestBlock *inner;
11562    /**
11563     * Indicates that this is the only struct which contains the same pointer.
11564     * Rust functions which take ownership of an object provided via an argument require
11565     * this to be true and invalidate the object pointed to by inner.
11566     */
11567    bool is_owned;
11568 } LDKBestBlock;
11569
11570 /**
11571  * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
11572  * chain.
11573  *
11574  * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
11575  * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
11576  * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
11577  * when needed.
11578  *
11579  * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
11580  * entire header chain and only blocks with matching transaction data using BIP 157 filters or
11581  * other similar filtering.
11582  */
11583 typedef struct LDKListen {
11584    /**
11585     * An opaque pointer which is passed to your function implementations as an argument.
11586     * This has no meaning in the LDK, and can be NULL or any other value.
11587     */
11588    void *this_arg;
11589    /**
11590     * Notifies the listener that a block was added at the given height, with the transaction data
11591     * possibly filtered.
11592     */
11593    void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
11594    /**
11595     * Notifies the listener that a block was added at the given height.
11596     */
11597    void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
11598    /**
11599     * Notifies the listener that a block was removed at the given height.
11600     */
11601    void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
11602    /**
11603     * Frees any resources associated with this object given its this_arg pointer.
11604     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11605     */
11606    void (*free)(void *this_arg);
11607 } LDKListen;
11608
11609 /**
11610  * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
11611  * unconfirmed during a chain reorganization.
11612  *
11613  * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
11614  * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
11615  * related to registered transactions and outputs. Upon notification, it would pass along the
11616  * matching transactions using this interface.
11617  *
11618  * # Use
11619  *
11620  * The intended use is as follows:
11621  * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
11622  * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
11623  *   that has been reorganized out of the chain.
11624  * - Call [`best_block_updated`] whenever a new chain tip becomes available.
11625  *
11626  * # Order
11627  *
11628  * Clients must call these methods in chain order. Specifically:
11629  * - Transactions confirmed in a block must be given before transactions confirmed in a later
11630  *   block.
11631  * - Dependent transactions within the same block must be given in topological order, possibly in
11632  *   separate calls.
11633  * - Unconfirmed transactions must be given after the original confirmations and before any
11634  *   reconfirmation.
11635  *
11636  * See individual method documentation for further details.
11637  *
11638  * [`transactions_confirmed`]: Self::transactions_confirmed
11639  * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11640  * [`best_block_updated`]: Self::best_block_updated
11641  * [`get_relevant_txids`]: Self::get_relevant_txids
11642  */
11643 typedef struct LDKConfirm {
11644    /**
11645     * An opaque pointer which is passed to your function implementations as an argument.
11646     * This has no meaning in the LDK, and can be NULL or any other value.
11647     */
11648    void *this_arg;
11649    /**
11650     * Processes transactions confirmed in a block with a given header and height.
11651     *
11652     * Should be called for any transactions registered by [`Filter::register_tx`] or any
11653     * transactions spending an output registered by [`Filter::register_output`]. Such transactions
11654     * appearing in the same block do not need to be included in the same call; instead, multiple
11655     * calls with additional transactions may be made so long as they are made in [chain order].
11656     *
11657     * May be called before or after [`best_block_updated`] for the corresponding block. However,
11658     * in the event of a chain reorganization, it must not be called with a `header` that is no
11659     * longer in the chain as of the last call to [`best_block_updated`].
11660     *
11661     * [chain order]: Confirm#Order
11662     * [`best_block_updated`]: Self::best_block_updated
11663     */
11664    void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
11665    /**
11666     * Processes a transaction that is no longer confirmed as result of a chain reorganization.
11667     *
11668     * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
11669     * reorganized out of the best chain. Once called, the given transaction should not be returned
11670     * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
11671     *
11672     * [`get_relevant_txids`]: Self::get_relevant_txids
11673     * [`transactions_confirmed`]: Self::transactions_confirmed
11674     */
11675    void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
11676    /**
11677     * Processes an update to the best header connected at the given height.
11678     *
11679     * Should be called when a new header is available but may be skipped for intermediary blocks
11680     * if they become available at the same time.
11681     */
11682    void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
11683    /**
11684     * Returns transactions that should be monitored for reorganization out of the chain.
11685     *
11686     * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
11687     * confirmations to be safe from a chain reorganization. Should not include any transactions
11688     * passed to [`transaction_unconfirmed`] unless later reconfirmed.
11689     *
11690     * May be called to determine the subset of transactions that must still be monitored for
11691     * reorganization. Will be idempotent between calls but may change as a result of calls to the
11692     * other interface methods. Thus, this is useful to determine which transactions may need to be
11693     * given to [`transaction_unconfirmed`].
11694     *
11695     * [`transactions_confirmed`]: Self::transactions_confirmed
11696     * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
11697     */
11698    struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
11699    /**
11700     * Frees any resources associated with this object given its this_arg pointer.
11701     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11702     */
11703    void (*free)(void *this_arg);
11704 } LDKConfirm;
11705
11706
11707
11708 /**
11709  * An opaque identifier describing a specific [`Persist`] method call.
11710  */
11711 typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
11712    /**
11713     * A pointer to the opaque Rust object.
11714     * Nearly everywhere, inner must be non-null, however in places where
11715     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11716     */
11717    LDKnativeMonitorUpdateId *inner;
11718    /**
11719     * Indicates that this is the only struct which contains the same pointer.
11720     * Rust functions which take ownership of an object provided via an argument require
11721     * this to be true and invalidate the object pointed to by inner.
11722     */
11723    bool is_owned;
11724 } LDKMonitorUpdateId;
11725
11726 /**
11727  * `Persist` defines behavior for persisting channel monitors: this could mean
11728  * writing once to disk, and/or uploading to one or more backup services.
11729  *
11730  * Each method can return three possible values:
11731  *  * If persistence (including any relevant `fsync()` calls) happens immediately, the
11732  *    implementation should return `Ok(())`, indicating normal channel operation should continue.
11733  *  * If persistence happens asynchronously, implementations should first ensure the
11734  *    [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
11735  *    `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
11736  *    background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
11737  *    called with the corresponding [`MonitorUpdateId`].
11738  *
11739  *    Note that unlike the direct [`chain::Watch`] interface,
11740  *    [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
11741  *
11742  *  * If persistence fails for some reason, implementations should return
11743  *    `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
11744  *    closed without broadcasting the latest state. See
11745  *    [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
11746  */
11747 typedef struct LDKPersist {
11748    /**
11749     * An opaque pointer which is passed to your function implementations as an argument.
11750     * This has no meaning in the LDK, and can be NULL or any other value.
11751     */
11752    void *this_arg;
11753    /**
11754     * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
11755     * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
11756     *
11757     * The data can be stored any way you want, but the identifier provided by LDK is the
11758     * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
11759     * and the stored channel data). Note that you **must** persist every new monitor to disk.
11760     *
11761     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11762     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11763     *
11764     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
11765     * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11766     *
11767     * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11768     * [`Writeable::write`]: crate::util::ser::Writeable::write
11769     */
11770    struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
11771    /**
11772     * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
11773     * update.
11774     *
11775     * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
11776     * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
11777     * details.
11778     *
11779     * During blockchain synchronization operations, this may be called with no
11780     * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
11781     * Note that after the full [`ChannelMonitor`] is persisted any previous
11782     * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
11783     * applied to the persisted [`ChannelMonitor`] as they were already applied.
11784     *
11785     * If an implementer chooses to persist the updates only, they need to make
11786     * sure that all the updates are applied to the `ChannelMonitors` *before*
11787     * the set of channel monitors is given to the `ChannelManager`
11788     * deserialization routine. See [`ChannelMonitor::update_monitor`] for
11789     * applying a monitor update to a monitor. If full `ChannelMonitors` are
11790     * persisted, then there is no need to persist individual updates.
11791     *
11792     * Note that there could be a performance tradeoff between persisting complete
11793     * channel monitors on every update vs. persisting only updates and applying
11794     * them in batches. The size of each monitor grows `O(number of state updates)`
11795     * whereas updates are small and `O(1)`.
11796     *
11797     * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
11798     * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
11799     *
11800     * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
11801     * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
11802     * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
11803     *
11804     * [`Writeable::write`]: crate::util::ser::Writeable::write
11805     *
11806     * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
11807     */
11808    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);
11809    /**
11810     * Frees any resources associated with this object given its this_arg pointer.
11811     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
11812     */
11813    void (*free)(void *this_arg);
11814 } LDKPersist;
11815
11816
11817
11818 /**
11819  * An implementation of [`chain::Watch`] for monitoring channels.
11820  *
11821  * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
11822  * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
11823  * or used independently to monitor channels remotely. See the [module-level documentation] for
11824  * details.
11825  *
11826  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
11827  * [module-level documentation]: crate::chain::chainmonitor
11828  */
11829 typedef struct MUST_USE_STRUCT LDKChainMonitor {
11830    /**
11831     * A pointer to the opaque Rust object.
11832     * Nearly everywhere, inner must be non-null, however in places where
11833     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11834     */
11835    LDKnativeChainMonitor *inner;
11836    /**
11837     * Indicates that this is the only struct which contains the same pointer.
11838     * Rust functions which take ownership of an object provided via an argument require
11839     * this to be true and invalidate the object pointed to by inner.
11840     */
11841    bool is_owned;
11842 } LDKChainMonitor;
11843
11844
11845
11846 /**
11847  * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
11848  * and derives keys from that.
11849  *
11850  * Your node_id is seed/0'
11851  * ChannelMonitor closes may use seed/1'
11852  * Cooperative closes may use seed/2'
11853  * The two close keys may be needed to claim on-chain funds!
11854  *
11855  * This struct cannot be used for nodes that wish to support receiving phantom payments;
11856  * [`PhantomKeysManager`] must be used instead.
11857  *
11858  * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
11859  * previously issued invoices and attempts to pay previous invoices will fail.
11860  */
11861 typedef struct MUST_USE_STRUCT LDKKeysManager {
11862    /**
11863     * A pointer to the opaque Rust object.
11864     * Nearly everywhere, inner must be non-null, however in places where
11865     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11866     */
11867    LDKnativeKeysManager *inner;
11868    /**
11869     * Indicates that this is the only struct which contains the same pointer.
11870     * Rust functions which take ownership of an object provided via an argument require
11871     * this to be true and invalidate the object pointed to by inner.
11872     */
11873    bool is_owned;
11874 } LDKKeysManager;
11875
11876
11877
11878 /**
11879  * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
11880  * payments.
11881  *
11882  * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
11883  * paid to one of multiple nodes. This works because we encode the invoice route hints such that
11884  * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
11885  * itself without ever needing to forward to this fake node.
11886  *
11887  * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
11888  * provide some fault tolerance, because payers will automatically retry paying other provided
11889  * nodes in the case that one node goes down.
11890  *
11891  * Note that multi-path payments are not supported in phantom invoices for security reasons.
11892  * Switching between this struct and [`KeysManager`] will invalidate any previously issued
11893  * invoices and attempts to pay previous invoices will fail.
11894  */
11895 typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
11896    /**
11897     * A pointer to the opaque Rust object.
11898     * Nearly everywhere, inner must be non-null, however in places where
11899     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11900     */
11901    LDKnativePhantomKeysManager *inner;
11902    /**
11903     * Indicates that this is the only struct which contains the same pointer.
11904     * Rust functions which take ownership of an object provided via an argument require
11905     * this to be true and invalidate the object pointed to by inner.
11906     */
11907    bool is_owned;
11908 } LDKPhantomKeysManager;
11909
11910
11911
11912 /**
11913  * Chain-related parameters used to construct a new `ChannelManager`.
11914  *
11915  * Typically, the block-specific parameters are derived from the best block hash for the network,
11916  * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
11917  * are not needed when deserializing a previously constructed `ChannelManager`.
11918  */
11919 typedef struct MUST_USE_STRUCT LDKChainParameters {
11920    /**
11921     * A pointer to the opaque Rust object.
11922     * Nearly everywhere, inner must be non-null, however in places where
11923     * the Rust equivalent takes an Option, it may be set to null to indicate None.
11924     */
11925    LDKnativeChainParameters *inner;
11926    /**
11927     * Indicates that this is the only struct which contains the same pointer.
11928     * Rust functions which take ownership of an object provided via an argument require
11929     * this to be true and invalidate the object pointed to by inner.
11930     */
11931    bool is_owned;
11932 } LDKChainParameters;
11933
11934 /**
11935  * A 3-byte byte array.
11936  */
11937 typedef struct LDKThreeBytes {
11938    /**
11939     * The three bytes
11940     */
11941    uint8_t data[3];
11942 } LDKThreeBytes;
11943
11944 /**
11945  * A trait to describe an object which can receive channel messages.
11946  *
11947  * Messages MAY be called in parallel when they originate from different their_node_ids, however
11948  * they MUST NOT be called in parallel when the two calls have the same their_node_id.
11949  */
11950 typedef struct LDKChannelMessageHandler {
11951    /**
11952     * An opaque pointer which is passed to your function implementations as an argument.
11953     * This has no meaning in the LDK, and can be NULL or any other value.
11954     */
11955    void *this_arg;
11956    /**
11957     * Handle an incoming open_channel message from the given peer.
11958     */
11959    void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
11960    /**
11961     * Handle an incoming accept_channel message from the given peer.
11962     */
11963    void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
11964    /**
11965     * Handle an incoming funding_created message from the given peer.
11966     */
11967    void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
11968    /**
11969     * Handle an incoming funding_signed message from the given peer.
11970     */
11971    void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
11972    /**
11973     * Handle an incoming channel_ready message from the given peer.
11974     */
11975    void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg);
11976    /**
11977     * Handle an incoming shutdown message from the given peer.
11978     */
11979    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);
11980    /**
11981     * Handle an incoming closing_signed message from the given peer.
11982     */
11983    void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
11984    /**
11985     * Handle an incoming update_add_htlc message from the given peer.
11986     */
11987    void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
11988    /**
11989     * Handle an incoming update_fulfill_htlc message from the given peer.
11990     */
11991    void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
11992    /**
11993     * Handle an incoming update_fail_htlc message from the given peer.
11994     */
11995    void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
11996    /**
11997     * Handle an incoming update_fail_malformed_htlc message from the given peer.
11998     */
11999    void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
12000    /**
12001     * Handle an incoming commitment_signed message from the given peer.
12002     */
12003    void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
12004    /**
12005     * Handle an incoming revoke_and_ack message from the given peer.
12006     */
12007    void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
12008    /**
12009     * Handle an incoming update_fee message from the given peer.
12010     */
12011    void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
12012    /**
12013     * Handle an incoming announcement_signatures message from the given peer.
12014     */
12015    void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
12016    /**
12017     * Indicates a connection to the peer failed/an existing connection was lost. If no connection
12018     * is believed to be possible in the future (eg they're sending us messages we don't
12019     * understand or indicate they require unknown feature bits), no_connection_possible is set
12020     * and any outstanding channels should be failed.
12021     */
12022    void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
12023    /**
12024     * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
12025     */
12026    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
12027    /**
12028     * Handle an incoming channel_reestablish message from the given peer.
12029     */
12030    void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
12031    /**
12032     * Handle an incoming channel update from the given peer.
12033     */
12034    void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
12035    /**
12036     * Handle an incoming error message from the given peer.
12037     */
12038    void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
12039    /**
12040     * Implementation of MessageSendEventsProvider for this object.
12041     */
12042    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
12043    /**
12044     * Frees any resources associated with this object given its this_arg pointer.
12045     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12046     */
12047    void (*free)(void *this_arg);
12048 } LDKChannelMessageHandler;
12049
12050
12051
12052 /**
12053  * Arguments for the creation of a ChannelManager that are not deserialized.
12054  *
12055  * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
12056  * is:
12057  * 1) Deserialize all stored [`ChannelMonitor`]s.
12058  * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
12059  *    `<(BlockHash, ChannelManager)>::read(reader, args)`
12060  *    This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
12061  *    [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
12062  * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
12063  *    same way you would handle a [`chain::Filter`] call using
12064  *    [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
12065  * 4) Reconnect blocks on your [`ChannelMonitor`]s.
12066  * 5) Disconnect/connect blocks on the [`ChannelManager`].
12067  * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
12068  *    Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
12069  *    will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
12070  *    the next step.
12071  * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
12072  *    [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
12073  *
12074  * Note that the ordering of #4-7 is not of importance, however all four must occur before you
12075  * call any other methods on the newly-deserialized [`ChannelManager`].
12076  *
12077  * Note that because some channels may be closed during deserialization, it is critical that you
12078  * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
12079  * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
12080  * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
12081  * not force-close the same channels but consider them live), you may end up revoking a state for
12082  * which you've already broadcasted the transaction.
12083  *
12084  * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
12085  */
12086 typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
12087    /**
12088     * A pointer to the opaque Rust object.
12089     * Nearly everywhere, inner must be non-null, however in places where
12090     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12091     */
12092    LDKnativeChannelManagerReadArgs *inner;
12093    /**
12094     * Indicates that this is the only struct which contains the same pointer.
12095     * Rust functions which take ownership of an object provided via an argument require
12096     * this to be true and invalidate the object pointed to by inner.
12097     */
12098    bool is_owned;
12099 } LDKChannelManagerReadArgs;
12100
12101
12102
12103 /**
12104  * A set of keys that were HKDF-expanded from an initial call to
12105  * [`KeysInterface::get_inbound_payment_key_material`].
12106  *
12107  * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material
12108  */
12109 typedef struct MUST_USE_STRUCT LDKExpandedKey {
12110    /**
12111     * A pointer to the opaque Rust object.
12112     * Nearly everywhere, inner must be non-null, however in places where
12113     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12114     */
12115    LDKnativeExpandedKey *inner;
12116    /**
12117     * Indicates that this is the only struct which contains the same pointer.
12118     * Rust functions which take ownership of an object provided via an argument require
12119     * this to be true and invalidate the object pointed to by inner.
12120     */
12121    bool is_owned;
12122 } LDKExpandedKey;
12123
12124
12125
12126 /**
12127  * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
12128  * This is used to convince the recipient that the channel is at a certain commitment
12129  * number even if they lost that data due to a local failure.  Of course, the peer may lie
12130  * and even later commitments may have been revoked.
12131  */
12132 typedef struct MUST_USE_STRUCT LDKDataLossProtect {
12133    /**
12134     * A pointer to the opaque Rust object.
12135     * Nearly everywhere, inner must be non-null, however in places where
12136     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12137     */
12138    LDKnativeDataLossProtect *inner;
12139    /**
12140     * Indicates that this is the only struct which contains the same pointer.
12141     * Rust functions which take ownership of an object provided via an argument require
12142     * this to be true and invalidate the object pointed to by inner.
12143     */
12144    bool is_owned;
12145 } LDKDataLossProtect;
12146
12147 /**
12148  * A trait to describe an object which can receive routing messages.
12149  *
12150  * # Implementor DoS Warnings
12151  *
12152  * For `gossip_queries` messages there are potential DoS vectors when handling
12153  * inbound queries. Implementors using an on-disk network graph should be aware of
12154  * repeated disk I/O for queries accessing different parts of the network graph.
12155  */
12156 typedef struct LDKRoutingMessageHandler {
12157    /**
12158     * An opaque pointer which is passed to your function implementations as an argument.
12159     * This has no meaning in the LDK, and can be NULL or any other value.
12160     */
12161    void *this_arg;
12162    /**
12163     * Handle an incoming node_announcement message, returning true if it should be forwarded on,
12164     * false or returning an Err otherwise.
12165     */
12166    struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
12167    /**
12168     * Handle a channel_announcement message, returning true if it should be forwarded on, false
12169     * or returning an Err otherwise.
12170     */
12171    struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
12172    /**
12173     * Handle an incoming channel_update message, returning true if it should be forwarded on,
12174     * false or returning an Err otherwise.
12175     */
12176    struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
12177    /**
12178     * Gets a subset of the channel announcements and updates required to dump our routing table
12179     * to a remote node, starting at the short_channel_id indicated by starting_point and
12180     * including the batch_amount entries immediately higher in numerical value than starting_point.
12181     */
12182    struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
12183    /**
12184     * Gets a subset of the node announcements required to dump our routing table to a remote node,
12185     * starting at the node *after* the provided publickey and including batch_amount entries
12186     * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
12187     * If None is provided for starting_point, we start at the first node.
12188     *
12189     * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
12190     */
12191    struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
12192    /**
12193     * Called when a connection is established with a peer. This can be used to
12194     * perform routing table synchronization using a strategy defined by the
12195     * implementor.
12196     */
12197    void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
12198    /**
12199     * Handles the reply of a query we initiated to learn about channels
12200     * for a given range of blocks. We can expect to receive one or more
12201     * replies to a single query.
12202     */
12203    struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
12204    /**
12205     * Handles the reply of a query we initiated asking for routing gossip
12206     * messages for a list of channels. We should receive this message when
12207     * a node has completed its best effort to send us the pertaining routing
12208     * gossip messages.
12209     */
12210    struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
12211    /**
12212     * Handles when a peer asks us to send a list of short_channel_ids
12213     * for the requested range of blocks.
12214     */
12215    struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
12216    /**
12217     * Handles when a peer asks us to send routing gossip messages for a
12218     * list of short_channel_ids.
12219     */
12220    struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
12221    /**
12222     * Implementation of MessageSendEventsProvider for this object.
12223     */
12224    struct LDKMessageSendEventsProvider MessageSendEventsProvider;
12225    /**
12226     * Frees any resources associated with this object given its this_arg pointer.
12227     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12228     */
12229    void (*free)(void *this_arg);
12230 } LDKRoutingMessageHandler;
12231
12232 /**
12233  * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
12234  * decoders.
12235  */
12236 typedef struct LDKCustomMessageReader {
12237    /**
12238     * An opaque pointer which is passed to your function implementations as an argument.
12239     * This has no meaning in the LDK, and can be NULL or any other value.
12240     */
12241    void *this_arg;
12242    /**
12243     * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
12244     * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
12245     * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
12246     * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
12247     */
12248    struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
12249    /**
12250     * Frees any resources associated with this object given its this_arg pointer.
12251     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12252     */
12253    void (*free)(void *this_arg);
12254 } LDKCustomMessageReader;
12255
12256 /**
12257  * Handler for BOLT1-compliant messages.
12258  */
12259 typedef struct LDKCustomMessageHandler {
12260    /**
12261     * An opaque pointer which is passed to your function implementations as an argument.
12262     * This has no meaning in the LDK, and can be NULL or any other value.
12263     */
12264    void *this_arg;
12265    /**
12266     * Called with the message type that was received and the buffer to be read.
12267     * Can return a `MessageHandlingError` if the message could not be handled.
12268     */
12269    struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
12270    /**
12271     * Gets the list of pending messages which were generated by the custom message
12272     * handler, clearing the list in the process. The first tuple element must
12273     * correspond to the intended recipients node ids. If no connection to one of the
12274     * specified node does not exist, the message is simply not sent to it.
12275     */
12276    struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
12277    /**
12278     * Implementation of CustomMessageReader for this object.
12279     */
12280    struct LDKCustomMessageReader CustomMessageReader;
12281    /**
12282     * Frees any resources associated with this object given its this_arg pointer.
12283     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12284     */
12285    void (*free)(void *this_arg);
12286 } LDKCustomMessageHandler;
12287
12288
12289
12290 /**
12291  * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
12292  * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
12293  */
12294 typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
12295    /**
12296     * A pointer to the opaque Rust object.
12297     * Nearly everywhere, inner must be non-null, however in places where
12298     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12299     */
12300    LDKnativeIgnoringMessageHandler *inner;
12301    /**
12302     * Indicates that this is the only struct which contains the same pointer.
12303     * Rust functions which take ownership of an object provided via an argument require
12304     * this to be true and invalidate the object pointed to by inner.
12305     */
12306    bool is_owned;
12307 } LDKIgnoringMessageHandler;
12308
12309
12310
12311 /**
12312  * A dummy struct which implements `ChannelMessageHandler` without having any channels.
12313  * You can provide one of these as the route_handler in a MessageHandler.
12314  */
12315 typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
12316    /**
12317     * A pointer to the opaque Rust object.
12318     * Nearly everywhere, inner must be non-null, however in places where
12319     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12320     */
12321    LDKnativeErroringMessageHandler *inner;
12322    /**
12323     * Indicates that this is the only struct which contains the same pointer.
12324     * Rust functions which take ownership of an object provided via an argument require
12325     * this to be true and invalidate the object pointed to by inner.
12326     */
12327    bool is_owned;
12328 } LDKErroringMessageHandler;
12329
12330
12331
12332 /**
12333  * Provides references to trait impls which handle different types of messages.
12334  */
12335 typedef struct MUST_USE_STRUCT LDKMessageHandler {
12336    /**
12337     * A pointer to the opaque Rust object.
12338     * Nearly everywhere, inner must be non-null, however in places where
12339     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12340     */
12341    LDKnativeMessageHandler *inner;
12342    /**
12343     * Indicates that this is the only struct which contains the same pointer.
12344     * Rust functions which take ownership of an object provided via an argument require
12345     * this to be true and invalidate the object pointed to by inner.
12346     */
12347    bool is_owned;
12348 } LDKMessageHandler;
12349
12350 /**
12351  * Provides an object which can be used to send data to and which uniquely identifies a connection
12352  * to a remote host. You will need to be able to generate multiple of these which meet Eq and
12353  * implement Hash to meet the PeerManager API.
12354  *
12355  * For efficiency, Clone should be relatively cheap for this type.
12356  *
12357  * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
12358  * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
12359  * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
12360  * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
12361  * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
12362  * to simply use another value which is guaranteed to be globally unique instead.
12363  */
12364 typedef struct LDKSocketDescriptor {
12365    /**
12366     * An opaque pointer which is passed to your function implementations as an argument.
12367     * This has no meaning in the LDK, and can be NULL or any other value.
12368     */
12369    void *this_arg;
12370    /**
12371     * Attempts to send some data from the given slice to the peer.
12372     *
12373     * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
12374     * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
12375     * called and further write attempts may occur until that time.
12376     *
12377     * If the returned size is smaller than `data.len()`, a
12378     * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
12379     * written. Additionally, until a `send_data` event completes fully, no further
12380     * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
12381     * prevent denial-of-service issues, you should not read or buffer any data from the socket
12382     * until then.
12383     *
12384     * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
12385     * (indicating that read events should be paused to prevent DoS in the send buffer),
12386     * `resume_read` may be set indicating that read events on this descriptor should resume. A
12387     * `resume_read` of false carries no meaning, and should not cause any action.
12388     */
12389    uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
12390    /**
12391     * Disconnect the socket pointed to by this SocketDescriptor.
12392     *
12393     * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
12394     * call (doing so is a noop).
12395     */
12396    void (*disconnect_socket)(void *this_arg);
12397    /**
12398     * Checks if two objects are equal given this object's this_arg pointer and another object.
12399     */
12400    bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
12401    /**
12402     * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
12403     * This is used, for example, for inclusion of this object in a hash map.
12404     */
12405    uint64_t (*hash)(const void *this_arg);
12406    /**
12407     * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
12408     * The new SocketDescriptor is provided, and should be mutated as needed to perform a
12409     * deep copy of the object pointed to by this_arg or avoid any double-freeing.
12410     */
12411    void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
12412    /**
12413     * Frees any resources associated with this object given its this_arg pointer.
12414     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12415     */
12416    void (*free)(void *this_arg);
12417 } LDKSocketDescriptor;
12418
12419
12420
12421 /**
12422  * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
12423  * socket events into messages which it passes on to its [`MessageHandler`].
12424  *
12425  * Locks are taken internally, so you must never assume that reentrancy from a
12426  * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
12427  *
12428  * Calls to [`read_event`] will decode relevant messages and pass them to the
12429  * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
12430  * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
12431  * [`PeerManager`] functions related to the same connection must occur only in serial, making new
12432  * calls only after previous ones have returned.
12433  *
12434  * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
12435  * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
12436  * essentially you should default to using a SimpleRefPeerManager, and use a
12437  * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
12438  * you're using lightning-net-tokio.
12439  *
12440  * [`read_event`]: PeerManager::read_event
12441  */
12442 typedef struct MUST_USE_STRUCT LDKPeerManager {
12443    /**
12444     * A pointer to the opaque Rust object.
12445     * Nearly everywhere, inner must be non-null, however in places where
12446     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12447     */
12448    LDKnativePeerManager *inner;
12449    /**
12450     * Indicates that this is the only struct which contains the same pointer.
12451     * Rust functions which take ownership of an object provided via an argument require
12452     * this to be true and invalidate the object pointed to by inner.
12453     */
12454    bool is_owned;
12455 } LDKPeerManager;
12456
12457
12458
12459 /**
12460  * Static channel fields used to build transactions given per-commitment fields, organized by
12461  * broadcaster/countersignatory.
12462  *
12463  * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
12464  * as_holder_broadcastable and as_counterparty_broadcastable functions.
12465  */
12466 typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
12467    /**
12468     * A pointer to the opaque Rust object.
12469     * Nearly everywhere, inner must be non-null, however in places where
12470     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12471     */
12472    LDKnativeDirectedChannelTransactionParameters *inner;
12473    /**
12474     * Indicates that this is the only struct which contains the same pointer.
12475     * Rust functions which take ownership of an object provided via an argument require
12476     * this to be true and invalidate the object pointed to by inner.
12477     */
12478    bool is_owned;
12479 } LDKDirectedChannelTransactionParameters;
12480
12481 /**
12482  * Integer in the range `0..=16`
12483  */
12484 typedef struct LDKWitnessVersion {
12485    uint8_t _0;
12486 } LDKWitnessVersion;
12487
12488
12489
12490 /**
12491  * A read-only view of [`NetworkGraph`].
12492  */
12493 typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
12494    /**
12495     * A pointer to the opaque Rust object.
12496     * Nearly everywhere, inner must be non-null, however in places where
12497     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12498     */
12499    LDKnativeReadOnlyNetworkGraph *inner;
12500    /**
12501     * Indicates that this is the only struct which contains the same pointer.
12502     * Rust functions which take ownership of an object provided via an argument require
12503     * this to be true and invalidate the object pointed to by inner.
12504     */
12505    bool is_owned;
12506 } LDKReadOnlyNetworkGraph;
12507
12508
12509
12510 /**
12511  * Receives and validates network updates from peers,
12512  * stores authentic and relevant data as a network graph.
12513  * This network graph is then used for routing payments.
12514  * Provides interface to help with initial routing sync by
12515  * serving historical announcements.
12516  *
12517  * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
12518  * [`NetworkGraph`].
12519  */
12520 typedef struct MUST_USE_STRUCT LDKP2PGossipSync {
12521    /**
12522     * A pointer to the opaque Rust object.
12523     * Nearly everywhere, inner must be non-null, however in places where
12524     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12525     */
12526    LDKnativeP2PGossipSync *inner;
12527    /**
12528     * Indicates that this is the only struct which contains the same pointer.
12529     * Rust functions which take ownership of an object provided via an argument require
12530     * this to be true and invalidate the object pointed to by inner.
12531     */
12532    bool is_owned;
12533 } LDKP2PGossipSync;
12534
12535
12536
12537 /**
12538  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
12539  * source node to a target node.
12540  */
12541 typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
12542    /**
12543     * A pointer to the opaque Rust object.
12544     * Nearly everywhere, inner must be non-null, however in places where
12545     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12546     */
12547    LDKnativeDirectedChannelInfo *inner;
12548    /**
12549     * Indicates that this is the only struct which contains the same pointer.
12550     * Rust functions which take ownership of an object provided via an argument require
12551     * this to be true and invalidate the object pointed to by inner.
12552     */
12553    bool is_owned;
12554 } LDKDirectedChannelInfo;
12555
12556 /**
12557  * The effective capacity of a channel for routing purposes.
12558  *
12559  * While this may be smaller than the actual channel capacity, amounts greater than
12560  * [`Self::as_msat`] should not be routed through the channel.
12561  */
12562 typedef enum LDKEffectiveCapacity_Tag {
12563    /**
12564     * The available liquidity in the channel known from being a channel counterparty, and thus a
12565     * direct hop.
12566     */
12567    LDKEffectiveCapacity_ExactLiquidity,
12568    /**
12569     * The maximum HTLC amount in one direction as advertised on the gossip network.
12570     */
12571    LDKEffectiveCapacity_MaximumHTLC,
12572    /**
12573     * The total capacity of the channel as determined by the funding transaction.
12574     */
12575    LDKEffectiveCapacity_Total,
12576    /**
12577     * A capacity sufficient to route any payment, typically used for private channels provided by
12578     * an invoice.
12579     */
12580    LDKEffectiveCapacity_Infinite,
12581    /**
12582     * A capacity that is unknown possibly because either the chain state is unavailable to know
12583     * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
12584     */
12585    LDKEffectiveCapacity_Unknown,
12586    /**
12587     * Must be last for serialization purposes
12588     */
12589    LDKEffectiveCapacity_Sentinel,
12590 } LDKEffectiveCapacity_Tag;
12591
12592 typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
12593    /**
12594     * Either the inbound or outbound liquidity depending on the direction, denominated in
12595     * millisatoshi.
12596     */
12597    uint64_t liquidity_msat;
12598 } LDKEffectiveCapacity_LDKExactLiquidity_Body;
12599
12600 typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
12601    /**
12602     * The maximum HTLC amount denominated in millisatoshi.
12603     */
12604    uint64_t amount_msat;
12605 } LDKEffectiveCapacity_LDKMaximumHTLC_Body;
12606
12607 typedef struct LDKEffectiveCapacity_LDKTotal_Body {
12608    /**
12609     * The funding amount denominated in millisatoshi.
12610     */
12611    uint64_t capacity_msat;
12612    /**
12613     * The maximum HTLC amount denominated in millisatoshi.
12614     */
12615    struct LDKCOption_u64Z htlc_maximum_msat;
12616 } LDKEffectiveCapacity_LDKTotal_Body;
12617
12618 typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
12619    LDKEffectiveCapacity_Tag tag;
12620    union {
12621       LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
12622       LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
12623       LDKEffectiveCapacity_LDKTotal_Body total;
12624    };
12625 } LDKEffectiveCapacity;
12626
12627 /**
12628  * A scorer that is accessed under a lock.
12629  *
12630  * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
12631  * having shared ownership of a scorer but without requiring internal locking in [`Score`]
12632  * implementations. Internal locking would be detrimental to route finding performance and could
12633  * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
12634  *
12635  * [`find_route`]: crate::routing::router::find_route
12636  */
12637 typedef struct LDKLockableScore {
12638    /**
12639     * An opaque pointer which is passed to your function implementations as an argument.
12640     * This has no meaning in the LDK, and can be NULL or any other value.
12641     */
12642    void *this_arg;
12643    /**
12644     * Returns the locked scorer.
12645     */
12646    struct LDKScore (*lock)(const void *this_arg);
12647    /**
12648     * Frees any resources associated with this object given its this_arg pointer.
12649     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12650     */
12651    void (*free)(void *this_arg);
12652 } LDKLockableScore;
12653
12654
12655
12656 /**
12657  * Parameters for configuring [`ProbabilisticScorer`].
12658  *
12659  * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
12660  * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
12661  *
12662  * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the
12663  * parameters here.
12664  */
12665 typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
12666    /**
12667     * A pointer to the opaque Rust object.
12668     * Nearly everywhere, inner must be non-null, however in places where
12669     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12670     */
12671    LDKnativeProbabilisticScoringParameters *inner;
12672    /**
12673     * Indicates that this is the only struct which contains the same pointer.
12674     * Rust functions which take ownership of an object provided via an argument require
12675     * this to be true and invalidate the object pointed to by inner.
12676     */
12677    bool is_owned;
12678 } LDKProbabilisticScoringParameters;
12679
12680
12681
12682 /**
12683  * FilesystemPersister persists channel data on disk, where each channel's
12684  * data is stored in a file named after its funding outpoint.
12685  *
12686  * Warning: this module does the best it can with calls to persist data, but it
12687  * can only guarantee that the data is passed to the drive. It is up to the
12688  * drive manufacturers to do the actual persistence properly, which they often
12689  * don't (especially on consumer-grade hardware). Therefore, it is up to the
12690  * user to validate their entire storage stack, to ensure the writes are
12691  * persistent.
12692  * Corollary: especially when dealing with larger amounts of money, it is best
12693  * practice to have multiple channel data backups and not rely only on one
12694  * FilesystemPersister.
12695  */
12696 typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
12697    /**
12698     * A pointer to the opaque Rust object.
12699     * Nearly everywhere, inner must be non-null, however in places where
12700     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12701     */
12702    LDKnativeFilesystemPersister *inner;
12703    /**
12704     * Indicates that this is the only struct which contains the same pointer.
12705     * Rust functions which take ownership of an object provided via an argument require
12706     * this to be true and invalidate the object pointed to by inner.
12707     */
12708    bool is_owned;
12709 } LDKFilesystemPersister;
12710
12711
12712
12713 /**
12714  * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
12715  * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
12716  * responsibilities are:
12717  * * Processing [`Event`]s with a user-provided [`EventHandler`].
12718  * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
12719  *   writing it to disk/backups by invoking the callback given to it at startup.
12720  *   [`ChannelManager`] persistence should be done in the background.
12721  * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
12722  *   at the appropriate intervals.
12723  * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
12724  *   is provided to [`BackgroundProcessor::start`]).
12725  *
12726  * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
12727  * upon as doing so may result in high latency.
12728  *
12729  * # Note
12730  *
12731  * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
12732  * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
12733  * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
12734  * unilateral chain closure fees are at risk.
12735  *
12736  * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
12737  * [`Event`]: lightning::util::events::Event
12738  *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
12739  */
12740 typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
12741    /**
12742     * A pointer to the opaque Rust object.
12743     * Nearly everywhere, inner must be non-null, however in places where
12744     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12745     */
12746    LDKnativeBackgroundProcessor *inner;
12747    /**
12748     * Indicates that this is the only struct which contains the same pointer.
12749     * Rust functions which take ownership of an object provided via an argument require
12750     * this to be true and invalidate the object pointed to by inner.
12751     */
12752    bool is_owned;
12753 } LDKBackgroundProcessor;
12754
12755
12756
12757 /**
12758  * Rapid Gossip Sync struct
12759  * See [crate-level documentation] for usage.
12760  *
12761  * [crate-level documentation]: crate
12762  */
12763 typedef struct MUST_USE_STRUCT LDKRapidGossipSync {
12764    /**
12765     * A pointer to the opaque Rust object.
12766     * Nearly everywhere, inner must be non-null, however in places where
12767     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12768     */
12769    LDKnativeRapidGossipSync *inner;
12770    /**
12771     * Indicates that this is the only struct which contains the same pointer.
12772     * Rust functions which take ownership of an object provided via an argument require
12773     * this to be true and invalidate the object pointed to by inner.
12774     */
12775    bool is_owned;
12776 } LDKRapidGossipSync;
12777
12778 /**
12779  * Either [`P2PGossipSync`] or [`RapidGossipSync`].
12780  */
12781 typedef enum LDKGossipSync_Tag {
12782    /**
12783     * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7.
12784     */
12785    LDKGossipSync_P2P,
12786    /**
12787     * Rapid gossip sync from a trusted server.
12788     */
12789    LDKGossipSync_Rapid,
12790    /**
12791     * No gossip sync.
12792     */
12793    LDKGossipSync_None,
12794    /**
12795     * Must be last for serialization purposes
12796     */
12797    LDKGossipSync_Sentinel,
12798 } LDKGossipSync_Tag;
12799
12800 typedef struct MUST_USE_STRUCT LDKGossipSync {
12801    LDKGossipSync_Tag tag;
12802    union {
12803       struct {
12804          /**
12805           * Note that this field is expected to be a reference.
12806           */
12807          struct LDKP2PGossipSync p2p;
12808       };
12809       struct {
12810          /**
12811           * Note that this field is expected to be a reference.
12812           */
12813          struct LDKRapidGossipSync rapid;
12814       };
12815    };
12816 } LDKGossipSync;
12817
12818
12819
12820 /**
12821  * Data of the `RawInvoice` that is encoded in the data part
12822  */
12823 typedef struct MUST_USE_STRUCT LDKRawDataPart {
12824    /**
12825     * A pointer to the opaque Rust object.
12826     * Nearly everywhere, inner must be non-null, however in places where
12827     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12828     */
12829    LDKnativeRawDataPart *inner;
12830    /**
12831     * Indicates that this is the only struct which contains the same pointer.
12832     * Rust functions which take ownership of an object provided via an argument require
12833     * this to be true and invalidate the object pointed to by inner.
12834     */
12835    bool is_owned;
12836 } LDKRawDataPart;
12837
12838
12839
12840 /**
12841  * SHA-256 hash
12842  */
12843 typedef struct MUST_USE_STRUCT LDKSha256 {
12844    /**
12845     * A pointer to the opaque Rust object.
12846     * Nearly everywhere, inner must be non-null, however in places where
12847     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12848     */
12849    LDKnativeSha256 *inner;
12850    /**
12851     * Indicates that this is the only struct which contains the same pointer.
12852     * Rust functions which take ownership of an object provided via an argument require
12853     * this to be true and invalidate the object pointed to by inner.
12854     */
12855    bool is_owned;
12856 } LDKSha256;
12857
12858
12859
12860 /**
12861  * Positive duration that defines when (relatively to the timestamp) in the future the invoice
12862  * expires
12863  */
12864 typedef struct MUST_USE_STRUCT LDKExpiryTime {
12865    /**
12866     * A pointer to the opaque Rust object.
12867     * Nearly everywhere, inner must be non-null, however in places where
12868     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12869     */
12870    LDKnativeExpiryTime *inner;
12871    /**
12872     * Indicates that this is the only struct which contains the same pointer.
12873     * Rust functions which take ownership of an object provided via an argument require
12874     * this to be true and invalidate the object pointed to by inner.
12875     */
12876    bool is_owned;
12877 } LDKExpiryTime;
12878
12879
12880
12881 /**
12882  * `min_final_cltv_expiry` to use for the last HTLC in the route
12883  */
12884 typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
12885    /**
12886     * A pointer to the opaque Rust object.
12887     * Nearly everywhere, inner must be non-null, however in places where
12888     * the Rust equivalent takes an Option, it may be set to null to indicate None.
12889     */
12890    LDKnativeMinFinalCltvExpiry *inner;
12891    /**
12892     * Indicates that this is the only struct which contains the same pointer.
12893     * Rust functions which take ownership of an object provided via an argument require
12894     * this to be true and invalidate the object pointed to by inner.
12895     */
12896    bool is_owned;
12897 } LDKMinFinalCltvExpiry;
12898
12899 /**
12900  * A 20-byte byte array.
12901  */
12902 typedef struct LDKTwentyBytes {
12903    /**
12904     * The twenty bytes
12905     */
12906    uint8_t data[20];
12907 } LDKTwentyBytes;
12908
12909 /**
12910  * Fallback address in case no LN payment is possible
12911  */
12912 typedef enum LDKFallback_Tag {
12913    LDKFallback_SegWitProgram,
12914    LDKFallback_PubKeyHash,
12915    LDKFallback_ScriptHash,
12916    /**
12917     * Must be last for serialization purposes
12918     */
12919    LDKFallback_Sentinel,
12920 } LDKFallback_Tag;
12921
12922 typedef struct LDKFallback_LDKSegWitProgram_Body {
12923    struct LDKu5 version;
12924    struct LDKCVec_u8Z program;
12925 } LDKFallback_LDKSegWitProgram_Body;
12926
12927 typedef struct MUST_USE_STRUCT LDKFallback {
12928    LDKFallback_Tag tag;
12929    union {
12930       LDKFallback_LDKSegWitProgram_Body seg_wit_program;
12931       struct {
12932          struct LDKTwentyBytes pub_key_hash;
12933       };
12934       struct {
12935          struct LDKTwentyBytes script_hash;
12936       };
12937    };
12938 } LDKFallback;
12939
12940 /**
12941  * A trait defining behavior of an [`Invoice`] payer.
12942  */
12943 typedef struct LDKPayer {
12944    /**
12945     * An opaque pointer which is passed to your function implementations as an argument.
12946     * This has no meaning in the LDK, and can be NULL or any other value.
12947     */
12948    void *this_arg;
12949    /**
12950     * Returns the payer's node id.
12951     */
12952    struct LDKPublicKey (*node_id)(const void *this_arg);
12953    /**
12954     * Returns the payer's channels.
12955     */
12956    struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
12957    /**
12958     * Sends a payment over the Lightning Network using the given [`Route`].
12959     *
12960     * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
12961     */
12962    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
12963    /**
12964     * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
12965     */
12966    struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
12967    /**
12968     * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
12969     */
12970    struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
12971    /**
12972     * Signals that no further retries for the given payment will occur.
12973     */
12974    void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
12975    /**
12976     * Frees any resources associated with this object given its this_arg pointer.
12977     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
12978     */
12979    void (*free)(void *this_arg);
12980 } LDKPayer;
12981
12982 /**
12983  * A trait defining behavior for routing an [`Invoice`] payment.
12984  */
12985 typedef struct LDKRouter {
12986    /**
12987     * An opaque pointer which is passed to your function implementations as an argument.
12988     * This has no meaning in the LDK, and can be NULL or any other value.
12989     */
12990    void *this_arg;
12991    /**
12992     * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
12993     *
12994     * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
12995     */
12996    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);
12997    /**
12998     * Frees any resources associated with this object given its this_arg pointer.
12999     * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
13000     */
13001    void (*free)(void *this_arg);
13002 } LDKRouter;
13003
13004
13005
13006 /**
13007  * A utility for paying [`Invoice`]s and sending spontaneous payments.
13008  *
13009  * See [module-level documentation] for details.
13010  *
13011  * [module-level documentation]: crate::payment
13012  */
13013 typedef struct MUST_USE_STRUCT LDKInvoicePayer {
13014    /**
13015     * A pointer to the opaque Rust object.
13016     * Nearly everywhere, inner must be non-null, however in places where
13017     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13018     */
13019    LDKnativeInvoicePayer *inner;
13020    /**
13021     * Indicates that this is the only struct which contains the same pointer.
13022     * Rust functions which take ownership of an object provided via an argument require
13023     * this to be true and invalidate the object pointed to by inner.
13024     */
13025    bool is_owned;
13026 } LDKInvoicePayer;
13027
13028 /**
13029  * Strategies available to retry payment path failures for an [`Invoice`].
13030  *
13031  */
13032 typedef enum LDKRetry_Tag {
13033    /**
13034     * Max number of attempts to retry payment.
13035     *
13036     * Note that this is the number of *path* failures, not full payment retries. For multi-path
13037     * payments, if this is less than the total number of paths, we will never even retry all of the
13038     * payment's paths.
13039     */
13040    LDKRetry_Attempts,
13041    /**
13042     * Time elapsed before abandoning retries for a payment.
13043     */
13044    LDKRetry_Timeout,
13045    /**
13046     * Must be last for serialization purposes
13047     */
13048    LDKRetry_Sentinel,
13049 } LDKRetry_Tag;
13050
13051 typedef struct MUST_USE_STRUCT LDKRetry {
13052    LDKRetry_Tag tag;
13053    union {
13054       struct {
13055          uintptr_t attempts;
13056       };
13057       struct {
13058          uint64_t timeout;
13059       };
13060    };
13061 } LDKRetry;
13062
13063
13064
13065 /**
13066  * A [`Router`] implemented using [`find_route`].
13067  */
13068 typedef struct MUST_USE_STRUCT LDKDefaultRouter {
13069    /**
13070     * A pointer to the opaque Rust object.
13071     * Nearly everywhere, inner must be non-null, however in places where
13072     * the Rust equivalent takes an Option, it may be set to null to indicate None.
13073     */
13074    LDKnativeDefaultRouter *inner;
13075    /**
13076     * Indicates that this is the only struct which contains the same pointer.
13077     * Rust functions which take ownership of an object provided via an argument require
13078     * this to be true and invalidate the object pointed to by inner.
13079     */
13080    bool is_owned;
13081 } LDKDefaultRouter;
13082
13083 extern const uintptr_t MAX_BUF_SIZE;
13084
13085 extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
13086
13087 extern const uint32_t FEERATE_FLOOR_SATS_PER_KW;
13088
13089 extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
13090
13091 extern const uint32_t ANTI_REORG_DELAY;
13092
13093 extern const uint16_t BREAKDOWN_TIMEOUT;
13094
13095 extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
13096
13097 extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
13098
13099 extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
13100
13101 extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
13102
13103 extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
13104
13105 extern const uint8_t DEFAULT_MAX_PATH_COUNT;
13106
13107 extern const uint64_t MAX_TIMESTAMP;
13108
13109 extern const uint64_t DEFAULT_EXPIRY_TIME;
13110
13111 extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
13112
13113 extern const uint8_t TAG_PAYMENT_HASH;
13114
13115 extern const uint8_t TAG_DESCRIPTION;
13116
13117 extern const uint8_t TAG_PAYEE_PUB_KEY;
13118
13119 extern const uint8_t TAG_DESCRIPTION_HASH;
13120
13121 extern const uint8_t TAG_EXPIRY_TIME;
13122
13123 extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
13124
13125 extern const uint8_t TAG_FALLBACK;
13126
13127 extern const uint8_t TAG_PRIVATE_ROUTE;
13128
13129 extern const uint8_t TAG_PAYMENT_SECRET;
13130
13131 extern const uint8_t TAG_FEATURES;
13132
13133 struct LDKStr _ldk_get_compiled_version(void);
13134
13135 struct LDKStr _ldk_c_bindings_get_compiled_version(void);
13136
13137 /**
13138  * Creates a new Bech32Error which has the same data as `orig`
13139  */
13140 struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
13141
13142 /**
13143  * Releases any memory held by the given `Bech32Error` (which is currently none)
13144  */
13145 void Bech32Error_free(struct LDKBech32Error o);
13146
13147 /**
13148  * Frees the data buffer, if data_is_owned is set and datalen > 0.
13149  */
13150 void Transaction_free(struct LDKTransaction _res);
13151
13152 /**
13153  * Convenience function for constructing a new TxOut
13154  */
13155 struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
13156
13157 /**
13158  * Frees the data pointed to by script_pubkey.
13159  */
13160 void TxOut_free(struct LDKTxOut _res);
13161
13162 /**
13163  * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
13164  */
13165 struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
13166
13167 /**
13168  * Frees the data buffer, if chars_is_owned is set and len > 0.
13169  */
13170 void Str_free(struct LDKStr _res);
13171
13172 #if defined(LDK_DEBUG_BUILD)
13173 /**
13174  * This function exists for memory safety testing purposes. It should never be used in production
13175  * code
13176  */
13177 const void *__unmangle_inner_ptr(const void *ptr);
13178 #endif
13179
13180 /**
13181  * Creates a new CResult_NoneNoneZ in the success state.
13182  */
13183 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
13184
13185 /**
13186  * Creates a new CResult_NoneNoneZ in the error state.
13187  */
13188 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
13189
13190 /**
13191  * Checks if the given object is currently in the success state
13192  */
13193 bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
13194
13195 /**
13196  * Frees any resources used by the CResult_NoneNoneZ.
13197  */
13198 void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
13199
13200 /**
13201  * Creates a new CResult_NoneNoneZ which has the same data as `orig`
13202  * but with all dynamically-allocated buffers duplicated in new buffers.
13203  */
13204 struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
13205
13206 /**
13207  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
13208  */
13209 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
13210
13211 /**
13212  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
13213  */
13214 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
13215
13216 /**
13217  * Checks if the given object is currently in the success state
13218  */
13219 bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
13220
13221 /**
13222  * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
13223  */
13224 void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
13225
13226 /**
13227  * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
13228  * but with all dynamically-allocated buffers duplicated in new buffers.
13229  */
13230 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
13231
13232 /**
13233  * Creates a new CResult_SecretKeyErrorZ in the success state.
13234  */
13235 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
13236
13237 /**
13238  * Creates a new CResult_SecretKeyErrorZ in the error state.
13239  */
13240 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
13241
13242 /**
13243  * Checks if the given object is currently in the success state
13244  */
13245 bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
13246
13247 /**
13248  * Frees any resources used by the CResult_SecretKeyErrorZ.
13249  */
13250 void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
13251
13252 /**
13253  * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
13254  * but with all dynamically-allocated buffers duplicated in new buffers.
13255  */
13256 struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
13257
13258 /**
13259  * Creates a new CResult_PublicKeyErrorZ in the success state.
13260  */
13261 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
13262
13263 /**
13264  * Creates a new CResult_PublicKeyErrorZ in the error state.
13265  */
13266 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
13267
13268 /**
13269  * Checks if the given object is currently in the success state
13270  */
13271 bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
13272
13273 /**
13274  * Frees any resources used by the CResult_PublicKeyErrorZ.
13275  */
13276 void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
13277
13278 /**
13279  * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
13280  * but with all dynamically-allocated buffers duplicated in new buffers.
13281  */
13282 struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
13283
13284 /**
13285  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
13286  */
13287 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
13288
13289 /**
13290  * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
13291  */
13292 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
13293
13294 /**
13295  * Checks if the given object is currently in the success state
13296  */
13297 bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
13298
13299 /**
13300  * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
13301  */
13302 void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
13303
13304 /**
13305  * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
13306  * but with all dynamically-allocated buffers duplicated in new buffers.
13307  */
13308 struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
13309
13310 /**
13311  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
13312  */
13313 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
13314
13315 /**
13316  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
13317  */
13318 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
13319
13320 /**
13321  * Checks if the given object is currently in the success state
13322  */
13323 bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
13324
13325 /**
13326  * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
13327  */
13328 void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
13329
13330 /**
13331  * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
13332  * but with all dynamically-allocated buffers duplicated in new buffers.
13333  */
13334 struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
13335
13336 /**
13337  * Creates a new CResult_TxCreationKeysErrorZ in the success state.
13338  */
13339 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
13340
13341 /**
13342  * Creates a new CResult_TxCreationKeysErrorZ in the error state.
13343  */
13344 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
13345
13346 /**
13347  * Checks if the given object is currently in the success state
13348  */
13349 bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
13350
13351 /**
13352  * Frees any resources used by the CResult_TxCreationKeysErrorZ.
13353  */
13354 void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
13355
13356 /**
13357  * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
13358  * but with all dynamically-allocated buffers duplicated in new buffers.
13359  */
13360 struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
13361
13362 /**
13363  * Constructs a new COption_u32Z containing a u32
13364  */
13365 struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
13366
13367 /**
13368  * Constructs a new COption_u32Z containing nothing
13369  */
13370 struct LDKCOption_u32Z COption_u32Z_none(void);
13371
13372 /**
13373  * Frees any resources associated with the u32, if we are in the Some state
13374  */
13375 void COption_u32Z_free(struct LDKCOption_u32Z _res);
13376
13377 /**
13378  * Creates a new COption_u32Z which has the same data as `orig`
13379  * but with all dynamically-allocated buffers duplicated in new buffers.
13380  */
13381 struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
13382
13383 /**
13384  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
13385  */
13386 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
13387
13388 /**
13389  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
13390  */
13391 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
13392
13393 /**
13394  * Checks if the given object is currently in the success state
13395  */
13396 bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
13397
13398 /**
13399  * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
13400  */
13401 void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
13402
13403 /**
13404  * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
13405  * but with all dynamically-allocated buffers duplicated in new buffers.
13406  */
13407 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
13408
13409 /**
13410  * Constructs a new COption_NoneZ containing a
13411  */
13412 enum LDKCOption_NoneZ COption_NoneZ_some(void);
13413
13414 /**
13415  * Constructs a new COption_NoneZ containing nothing
13416  */
13417 enum LDKCOption_NoneZ COption_NoneZ_none(void);
13418
13419 /**
13420  * Frees any resources associated with the , if we are in the Some state
13421  */
13422 void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
13423
13424 /**
13425  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
13426  */
13427 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
13428
13429 /**
13430  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
13431  */
13432 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
13433
13434 /**
13435  * Checks if the given object is currently in the success state
13436  */
13437 bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
13438
13439 /**
13440  * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
13441  */
13442 void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
13443
13444 /**
13445  * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
13446  * but with all dynamically-allocated buffers duplicated in new buffers.
13447  */
13448 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
13449
13450 /**
13451  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
13452  */
13453 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
13454
13455 /**
13456  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
13457  */
13458 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
13459
13460 /**
13461  * Checks if the given object is currently in the success state
13462  */
13463 bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
13464
13465 /**
13466  * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
13467  */
13468 void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
13469
13470 /**
13471  * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
13472  * but with all dynamically-allocated buffers duplicated in new buffers.
13473  */
13474 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
13475
13476 /**
13477  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13478  */
13479 void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
13480
13481 /**
13482  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
13483  */
13484 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
13485
13486 /**
13487  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
13488  */
13489 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13490
13491 /**
13492  * Checks if the given object is currently in the success state
13493  */
13494 bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13495
13496 /**
13497  * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
13498  */
13499 void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
13500
13501 /**
13502  * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
13503  * but with all dynamically-allocated buffers duplicated in new buffers.
13504  */
13505 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13506
13507 /**
13508  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
13509  */
13510 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
13511
13512 /**
13513  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
13514  */
13515 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13516
13517 /**
13518  * Checks if the given object is currently in the success state
13519  */
13520 bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13521
13522 /**
13523  * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
13524  */
13525 void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
13526
13527 /**
13528  * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
13529  * but with all dynamically-allocated buffers duplicated in new buffers.
13530  */
13531 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13532
13533 /**
13534  * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
13535  */
13536 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
13537
13538 /**
13539  * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
13540  */
13541 struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
13542
13543 /**
13544  * Checks if the given object is currently in the success state
13545  */
13546 bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
13547
13548 /**
13549  * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
13550  */
13551 void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
13552
13553 /**
13554  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
13555  */
13556 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
13557
13558 /**
13559  * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
13560  */
13561 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
13562
13563 /**
13564  * Checks if the given object is currently in the success state
13565  */
13566 bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
13567
13568 /**
13569  * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
13570  */
13571 void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
13572
13573 /**
13574  * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
13575  * but with all dynamically-allocated buffers duplicated in new buffers.
13576  */
13577 struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
13578
13579 /**
13580  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
13581  */
13582 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
13583
13584 /**
13585  * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
13586  */
13587 struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
13588
13589 /**
13590  * Checks if the given object is currently in the success state
13591  */
13592 bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
13593
13594 /**
13595  * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
13596  */
13597 void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
13598
13599 /**
13600  * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
13601  */
13602 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
13603
13604 /**
13605  * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
13606  */
13607 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
13608
13609 /**
13610  * Checks if the given object is currently in the success state
13611  */
13612 bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
13613
13614 /**
13615  * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
13616  */
13617 void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
13618
13619 /**
13620  * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
13621  * but with all dynamically-allocated buffers duplicated in new buffers.
13622  */
13623 struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
13624
13625 /**
13626  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
13627  */
13628 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
13629
13630 /**
13631  * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
13632  */
13633 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
13634
13635 /**
13636  * Checks if the given object is currently in the success state
13637  */
13638 bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
13639
13640 /**
13641  * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
13642  */
13643 void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
13644
13645 /**
13646  * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
13647  * but with all dynamically-allocated buffers duplicated in new buffers.
13648  */
13649 struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
13650
13651 /**
13652  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
13653  */
13654 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
13655
13656 /**
13657  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
13658  */
13659 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
13660
13661 /**
13662  * Checks if the given object is currently in the success state
13663  */
13664 bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
13665
13666 /**
13667  * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
13668  */
13669 void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
13670
13671 /**
13672  * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
13673  * but with all dynamically-allocated buffers duplicated in new buffers.
13674  */
13675 struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
13676
13677 /**
13678  * Creates a new CResult_NoneErrorZ in the success state.
13679  */
13680 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
13681
13682 /**
13683  * Creates a new CResult_NoneErrorZ in the error state.
13684  */
13685 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
13686
13687 /**
13688  * Checks if the given object is currently in the success state
13689  */
13690 bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
13691
13692 /**
13693  * Frees any resources used by the CResult_NoneErrorZ.
13694  */
13695 void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
13696
13697 /**
13698  * Creates a new CResult_NoneErrorZ which has the same data as `orig`
13699  * but with all dynamically-allocated buffers duplicated in new buffers.
13700  */
13701 struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
13702
13703 /**
13704  * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
13705  */
13706 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
13707
13708 /**
13709  * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
13710  */
13711 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
13712
13713 /**
13714  * Checks if the given object is currently in the success state
13715  */
13716 bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
13717
13718 /**
13719  * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
13720  */
13721 void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
13722
13723 /**
13724  * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
13725  * but with all dynamically-allocated buffers duplicated in new buffers.
13726  */
13727 struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
13728
13729 /**
13730  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13731  */
13732 void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
13733
13734 /**
13735  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13736  */
13737 void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
13738
13739 /**
13740  * Creates a new CResult_RouteDecodeErrorZ in the success state.
13741  */
13742 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
13743
13744 /**
13745  * Creates a new CResult_RouteDecodeErrorZ in the error state.
13746  */
13747 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
13748
13749 /**
13750  * Checks if the given object is currently in the success state
13751  */
13752 bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
13753
13754 /**
13755  * Frees any resources used by the CResult_RouteDecodeErrorZ.
13756  */
13757 void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
13758
13759 /**
13760  * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
13761  * but with all dynamically-allocated buffers duplicated in new buffers.
13762  */
13763 struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
13764
13765 /**
13766  * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
13767  */
13768 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
13769
13770 /**
13771  * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
13772  */
13773 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
13774
13775 /**
13776  * Checks if the given object is currently in the success state
13777  */
13778 bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
13779
13780 /**
13781  * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
13782  */
13783 void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
13784
13785 /**
13786  * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
13787  * but with all dynamically-allocated buffers duplicated in new buffers.
13788  */
13789 struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
13790
13791 /**
13792  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13793  */
13794 void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
13795
13796 /**
13797  * Constructs a new COption_u64Z containing a u64
13798  */
13799 struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
13800
13801 /**
13802  * Constructs a new COption_u64Z containing nothing
13803  */
13804 struct LDKCOption_u64Z COption_u64Z_none(void);
13805
13806 /**
13807  * Frees any resources associated with the u64, if we are in the Some state
13808  */
13809 void COption_u64Z_free(struct LDKCOption_u64Z _res);
13810
13811 /**
13812  * Creates a new COption_u64Z which has the same data as `orig`
13813  * but with all dynamically-allocated buffers duplicated in new buffers.
13814  */
13815 struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
13816
13817 /**
13818  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13819  */
13820 void CVec_u64Z_free(struct LDKCVec_u64Z _res);
13821
13822 /**
13823  * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
13824  */
13825 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
13826
13827 /**
13828  * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
13829  */
13830 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
13831
13832 /**
13833  * Checks if the given object is currently in the success state
13834  */
13835 bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
13836
13837 /**
13838  * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
13839  */
13840 void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
13841
13842 /**
13843  * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
13844  * but with all dynamically-allocated buffers duplicated in new buffers.
13845  */
13846 struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
13847
13848 /**
13849  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13850  */
13851 void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
13852
13853 /**
13854  * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
13855  */
13856 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
13857
13858 /**
13859  * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
13860  */
13861 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
13862
13863 /**
13864  * Checks if the given object is currently in the success state
13865  */
13866 bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
13867
13868 /**
13869  * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
13870  */
13871 void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
13872
13873 /**
13874  * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
13875  * but with all dynamically-allocated buffers duplicated in new buffers.
13876  */
13877 struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
13878
13879 /**
13880  * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
13881  */
13882 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
13883
13884 /**
13885  * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
13886  */
13887 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
13888
13889 /**
13890  * Checks if the given object is currently in the success state
13891  */
13892 bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
13893
13894 /**
13895  * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
13896  */
13897 void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
13898
13899 /**
13900  * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
13901  * but with all dynamically-allocated buffers duplicated in new buffers.
13902  */
13903 struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
13904
13905 /**
13906  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13907  */
13908 void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
13909
13910 /**
13911  * Creates a new CResult_RouteLightningErrorZ in the success state.
13912  */
13913 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
13914
13915 /**
13916  * Creates a new CResult_RouteLightningErrorZ in the error state.
13917  */
13918 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
13919
13920 /**
13921  * Checks if the given object is currently in the success state
13922  */
13923 bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
13924
13925 /**
13926  * Frees any resources used by the CResult_RouteLightningErrorZ.
13927  */
13928 void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
13929
13930 /**
13931  * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
13932  * but with all dynamically-allocated buffers duplicated in new buffers.
13933  */
13934 struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
13935
13936 /**
13937  * Frees the buffer pointed to by `data` if `datalen` is non-0.
13938  */
13939 void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
13940
13941 /**
13942  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
13943  */
13944 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
13945
13946 /**
13947  * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
13948  */
13949 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
13950
13951 /**
13952  * Checks if the given object is currently in the success state
13953  */
13954 bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
13955
13956 /**
13957  * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
13958  */
13959 void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
13960
13961 /**
13962  * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
13963  * but with all dynamically-allocated buffers duplicated in new buffers.
13964  */
13965 struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
13966
13967 /**
13968  * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
13969  */
13970 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
13971
13972 /**
13973  * Constructs a new COption_ClosureReasonZ containing nothing
13974  */
13975 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
13976
13977 /**
13978  * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
13979  */
13980 void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
13981
13982 /**
13983  * Creates a new COption_ClosureReasonZ which has the same data as `orig`
13984  * but with all dynamically-allocated buffers duplicated in new buffers.
13985  */
13986 struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
13987
13988 /**
13989  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
13990  */
13991 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
13992
13993 /**
13994  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
13995  */
13996 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
13997
13998 /**
13999  * Checks if the given object is currently in the success state
14000  */
14001 bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
14002
14003 /**
14004  * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
14005  */
14006 void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
14007
14008 /**
14009  * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
14010  * but with all dynamically-allocated buffers duplicated in new buffers.
14011  */
14012 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
14013
14014 /**
14015  * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
14016  */
14017 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o);
14018
14019 /**
14020  * Constructs a new COption_HTLCDestinationZ containing nothing
14021  */
14022 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void);
14023
14024 /**
14025  * Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
14026  */
14027 void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res);
14028
14029 /**
14030  * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
14031  * but with all dynamically-allocated buffers duplicated in new buffers.
14032  */
14033 struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig);
14034
14035 /**
14036  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
14037  */
14038 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o);
14039
14040 /**
14041  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
14042  */
14043 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e);
14044
14045 /**
14046  * Checks if the given object is currently in the success state
14047  */
14048 bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o);
14049
14050 /**
14051  * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
14052  */
14053 void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res);
14054
14055 /**
14056  * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
14057  * but with all dynamically-allocated buffers duplicated in new buffers.
14058  */
14059 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig);
14060
14061 /**
14062  * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate
14063  */
14064 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
14065
14066 /**
14067  * Constructs a new COption_NetworkUpdateZ containing nothing
14068  */
14069 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
14070
14071 /**
14072  * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state
14073  */
14074 void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
14075
14076 /**
14077  * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
14078  * but with all dynamically-allocated buffers duplicated in new buffers.
14079  */
14080 struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
14081
14082 /**
14083  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14084  */
14085 void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
14086
14087 /**
14088  * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
14089  */
14090 struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
14091
14092 /**
14093  * Constructs a new COption_EventZ containing nothing
14094  */
14095 struct LDKCOption_EventZ COption_EventZ_none(void);
14096
14097 /**
14098  * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
14099  */
14100 void COption_EventZ_free(struct LDKCOption_EventZ _res);
14101
14102 /**
14103  * Creates a new COption_EventZ which has the same data as `orig`
14104  * but with all dynamically-allocated buffers duplicated in new buffers.
14105  */
14106 struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
14107
14108 /**
14109  * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
14110  */
14111 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
14112
14113 /**
14114  * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
14115  */
14116 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
14117
14118 /**
14119  * Checks if the given object is currently in the success state
14120  */
14121 bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
14122
14123 /**
14124  * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
14125  */
14126 void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
14127
14128 /**
14129  * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
14130  * but with all dynamically-allocated buffers duplicated in new buffers.
14131  */
14132 struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
14133
14134 /**
14135  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14136  */
14137 void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
14138
14139 /**
14140  * Creates a new CResult_TxOutAccessErrorZ in the success state.
14141  */
14142 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
14143
14144 /**
14145  * Creates a new CResult_TxOutAccessErrorZ in the error state.
14146  */
14147 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
14148
14149 /**
14150  * Checks if the given object is currently in the success state
14151  */
14152 bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
14153
14154 /**
14155  * Frees any resources used by the CResult_TxOutAccessErrorZ.
14156  */
14157 void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
14158
14159 /**
14160  * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
14161  * but with all dynamically-allocated buffers duplicated in new buffers.
14162  */
14163 struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
14164
14165 /**
14166  * Creates a new tuple which has the same data as `orig`
14167  * but with all dynamically-allocated buffers duplicated in new buffers.
14168  */
14169 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
14170
14171 /**
14172  * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
14173  */
14174 struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
14175
14176 /**
14177  * Frees any resources used by the C2Tuple_usizeTransactionZ.
14178  */
14179 void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
14180
14181 /**
14182  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14183  */
14184 void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
14185
14186 /**
14187  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14188  */
14189 void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
14190
14191 /**
14192  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
14193  */
14194 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
14195
14196 /**
14197  * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
14198  */
14199 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
14200
14201 /**
14202  * Checks if the given object is currently in the success state
14203  */
14204 bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
14205
14206 /**
14207  * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
14208  */
14209 void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
14210
14211 /**
14212  * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
14213  * but with all dynamically-allocated buffers duplicated in new buffers.
14214  */
14215 struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
14216
14217 /**
14218  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14219  */
14220 void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
14221
14222 /**
14223  * Creates a new tuple which has the same data as `orig`
14224  * but with all dynamically-allocated buffers duplicated in new buffers.
14225  */
14226 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig);
14227
14228 /**
14229  * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements.
14230  */
14231 struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c);
14232
14233 /**
14234  * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ.
14235  */
14236 void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res);
14237
14238 /**
14239  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14240  */
14241 void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res);
14242
14243 /**
14244  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
14245  */
14246 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
14247
14248 /**
14249  * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
14250  */
14251 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
14252
14253 /**
14254  * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
14255  */
14256 void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
14257
14258 /**
14259  * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
14260  * but with all dynamically-allocated buffers duplicated in new buffers.
14261  */
14262 struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
14263
14264 /**
14265  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
14266  */
14267 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
14268
14269 /**
14270  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
14271  */
14272 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
14273
14274 /**
14275  * Checks if the given object is currently in the success state
14276  */
14277 bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
14278
14279 /**
14280  * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
14281  */
14282 void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
14283
14284 /**
14285  * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
14286  * but with all dynamically-allocated buffers duplicated in new buffers.
14287  */
14288 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
14289
14290 /**
14291  * Creates a new tuple which has the same data as `orig`
14292  * but with all dynamically-allocated buffers duplicated in new buffers.
14293  */
14294 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig);
14295
14296 /**
14297  * Creates a new C2Tuple_u64u64Z from the contained elements.
14298  */
14299 struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
14300
14301 /**
14302  * Frees any resources used by the C2Tuple_u64u64Z.
14303  */
14304 void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res);
14305
14306 /**
14307  * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z
14308  */
14309 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o);
14310
14311 /**
14312  * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing
14313  */
14314 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void);
14315
14316 /**
14317  * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state
14318  */
14319 void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res);
14320
14321 /**
14322  * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig`
14323  * but with all dynamically-allocated buffers duplicated in new buffers.
14324  */
14325 struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig);
14326
14327 /**
14328  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14329  */
14330 void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res);
14331
14332 /**
14333  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
14334  */
14335 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
14336
14337 /**
14338  * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
14339  */
14340 struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
14341
14342 /**
14343  * Checks if the given object is currently in the success state
14344  */
14345 bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
14346
14347 /**
14348  * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
14349  */
14350 void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
14351
14352 /**
14353  * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
14354  */
14355 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
14356
14357 /**
14358  * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
14359  */
14360 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14361
14362 /**
14363  * Checks if the given object is currently in the success state
14364  */
14365 bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
14366
14367 /**
14368  * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
14369  */
14370 void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
14371
14372 /**
14373  * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig`
14374  * but with all dynamically-allocated buffers duplicated in new buffers.
14375  */
14376 struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig);
14377
14378 /**
14379  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
14380  */
14381 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
14382
14383 /**
14384  * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
14385  */
14386 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14387
14388 /**
14389  * Checks if the given object is currently in the success state
14390  */
14391 bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
14392
14393 /**
14394  * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
14395  */
14396 void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
14397
14398 /**
14399  * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig`
14400  * but with all dynamically-allocated buffers duplicated in new buffers.
14401  */
14402 struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig);
14403
14404 /**
14405  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
14406  */
14407 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
14408
14409 /**
14410  * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
14411  */
14412 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14413
14414 /**
14415  * Checks if the given object is currently in the success state
14416  */
14417 bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
14418
14419 /**
14420  * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
14421  */
14422 void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
14423
14424 /**
14425  * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig`
14426  * but with all dynamically-allocated buffers duplicated in new buffers.
14427  */
14428 struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig);
14429
14430 /**
14431  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
14432  */
14433 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
14434
14435 /**
14436  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
14437  */
14438 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14439
14440 /**
14441  * Checks if the given object is currently in the success state
14442  */
14443 bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
14444
14445 /**
14446  * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
14447  */
14448 void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
14449
14450 /**
14451  * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig`
14452  * but with all dynamically-allocated buffers duplicated in new buffers.
14453  */
14454 struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig);
14455
14456 /**
14457  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
14458  */
14459 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
14460
14461 /**
14462  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
14463  */
14464 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
14465
14466 /**
14467  * Checks if the given object is currently in the success state
14468  */
14469 bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
14470
14471 /**
14472  * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
14473  */
14474 void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
14475
14476 /**
14477  * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig`
14478  * but with all dynamically-allocated buffers duplicated in new buffers.
14479  */
14480 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
14481
14482 /**
14483  * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
14484  */
14485 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
14486
14487 /**
14488  * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
14489  */
14490 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
14491
14492 /**
14493  * Checks if the given object is currently in the success state
14494  */
14495 bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
14496
14497 /**
14498  * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
14499  */
14500 void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
14501
14502 /**
14503  * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
14504  * but with all dynamically-allocated buffers duplicated in new buffers.
14505  */
14506 struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
14507
14508 /**
14509  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
14510  */
14511 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
14512
14513 /**
14514  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
14515  */
14516 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
14517
14518 /**
14519  * Checks if the given object is currently in the success state
14520  */
14521 bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
14522
14523 /**
14524  * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
14525  */
14526 void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
14527
14528 /**
14529  * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
14530  * but with all dynamically-allocated buffers duplicated in new buffers.
14531  */
14532 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
14533
14534 /**
14535  * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
14536  */
14537 struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
14538
14539 /**
14540  * Constructs a new COption_AccessZ containing nothing
14541  */
14542 struct LDKCOption_AccessZ COption_AccessZ_none(void);
14543
14544 /**
14545  * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
14546  */
14547 void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
14548
14549 /**
14550  * Creates a new CResult_boolLightningErrorZ in the success state.
14551  */
14552 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
14553
14554 /**
14555  * Creates a new CResult_boolLightningErrorZ in the error state.
14556  */
14557 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
14558
14559 /**
14560  * Checks if the given object is currently in the success state
14561  */
14562 bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
14563
14564 /**
14565  * Frees any resources used by the CResult_boolLightningErrorZ.
14566  */
14567 void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
14568
14569 /**
14570  * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
14571  * but with all dynamically-allocated buffers duplicated in new buffers.
14572  */
14573 struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
14574
14575 /**
14576  * Creates a new tuple which has the same data as `orig`
14577  * but with all dynamically-allocated buffers duplicated in new buffers.
14578  */
14579 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
14580
14581 /**
14582  * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
14583  */
14584 struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
14585
14586 /**
14587  * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
14588  */
14589 void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
14590
14591 /**
14592  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14593  */
14594 void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
14595
14596 /**
14597  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14598  */
14599 void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
14600
14601 /**
14602  * Creates a new CResult_NoneLightningErrorZ in the success state.
14603  */
14604 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
14605
14606 /**
14607  * Creates a new CResult_NoneLightningErrorZ in the error state.
14608  */
14609 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
14610
14611 /**
14612  * Checks if the given object is currently in the success state
14613  */
14614 bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
14615
14616 /**
14617  * Frees any resources used by the CResult_NoneLightningErrorZ.
14618  */
14619 void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
14620
14621 /**
14622  * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
14623  * but with all dynamically-allocated buffers duplicated in new buffers.
14624  */
14625 struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
14626
14627 /**
14628  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
14629  */
14630 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
14631
14632 /**
14633  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
14634  */
14635 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
14636
14637 /**
14638  * Checks if the given object is currently in the success state
14639  */
14640 bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
14641
14642 /**
14643  * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
14644  */
14645 void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
14646
14647 /**
14648  * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
14649  * but with all dynamically-allocated buffers duplicated in new buffers.
14650  */
14651 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
14652
14653 /**
14654  * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
14655  */
14656 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
14657
14658 /**
14659  * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
14660  */
14661 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
14662
14663 /**
14664  * Checks if the given object is currently in the success state
14665  */
14666 bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
14667
14668 /**
14669  * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
14670  */
14671 void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
14672
14673 /**
14674  * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
14675  * but with all dynamically-allocated buffers duplicated in new buffers.
14676  */
14677 struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
14678
14679 /**
14680  * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
14681  */
14682 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
14683
14684 /**
14685  * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
14686  */
14687 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
14688
14689 /**
14690  * Checks if the given object is currently in the success state
14691  */
14692 bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
14693
14694 /**
14695  * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
14696  */
14697 void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
14698
14699 /**
14700  * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
14701  * but with all dynamically-allocated buffers duplicated in new buffers.
14702  */
14703 struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
14704
14705 /**
14706  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14707  */
14708 void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
14709
14710 /**
14711  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
14712  */
14713 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
14714
14715 /**
14716  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
14717  */
14718 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
14719
14720 /**
14721  * Checks if the given object is currently in the success state
14722  */
14723 bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
14724
14725 /**
14726  * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
14727  */
14728 void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
14729
14730 /**
14731  * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
14732  * but with all dynamically-allocated buffers duplicated in new buffers.
14733  */
14734 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
14735
14736 /**
14737  * Creates a new CResult_NodeAliasDecodeErrorZ in the success state.
14738  */
14739 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o);
14740
14741 /**
14742  * Creates a new CResult_NodeAliasDecodeErrorZ in the error state.
14743  */
14744 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e);
14745
14746 /**
14747  * Checks if the given object is currently in the success state
14748  */
14749 bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o);
14750
14751 /**
14752  * Frees any resources used by the CResult_NodeAliasDecodeErrorZ.
14753  */
14754 void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res);
14755
14756 /**
14757  * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig`
14758  * but with all dynamically-allocated buffers duplicated in new buffers.
14759  */
14760 struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig);
14761
14762 /**
14763  * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
14764  */
14765 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
14766
14767 /**
14768  * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
14769  */
14770 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
14771
14772 /**
14773  * Checks if the given object is currently in the success state
14774  */
14775 bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
14776
14777 /**
14778  * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
14779  */
14780 void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
14781
14782 /**
14783  * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
14784  * but with all dynamically-allocated buffers duplicated in new buffers.
14785  */
14786 struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
14787
14788 /**
14789  * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
14790  */
14791 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
14792
14793 /**
14794  * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
14795  */
14796 struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
14797
14798 /**
14799  * Checks if the given object is currently in the success state
14800  */
14801 bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
14802
14803 /**
14804  * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
14805  */
14806 void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
14807
14808 /**
14809  * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
14810  */
14811 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
14812
14813 /**
14814  * Constructs a new COption_CVec_NetAddressZZ containing nothing
14815  */
14816 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
14817
14818 /**
14819  * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
14820  */
14821 void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
14822
14823 /**
14824  * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
14825  * but with all dynamically-allocated buffers duplicated in new buffers.
14826  */
14827 struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
14828
14829 /**
14830  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
14831  */
14832 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
14833
14834 /**
14835  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
14836  */
14837 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14838
14839 /**
14840  * Checks if the given object is currently in the success state
14841  */
14842 bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14843
14844 /**
14845  * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
14846  */
14847 void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
14848
14849 /**
14850  * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
14851  * but with all dynamically-allocated buffers duplicated in new buffers.
14852  */
14853 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14854
14855 /**
14856  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
14857  */
14858 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
14859
14860 /**
14861  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
14862  */
14863 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14864
14865 /**
14866  * Checks if the given object is currently in the success state
14867  */
14868 bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14869
14870 /**
14871  * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
14872  */
14873 void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
14874
14875 /**
14876  * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
14877  * but with all dynamically-allocated buffers duplicated in new buffers.
14878  */
14879 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14880
14881 /**
14882  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
14883  */
14884 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
14885
14886 /**
14887  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
14888  */
14889 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
14890
14891 /**
14892  * Checks if the given object is currently in the success state
14893  */
14894 bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
14895
14896 /**
14897  * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
14898  */
14899 void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
14900
14901 /**
14902  * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
14903  * but with all dynamically-allocated buffers duplicated in new buffers.
14904  */
14905 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
14906
14907 /**
14908  * Frees the buffer pointed to by `data` if `datalen` is non-0.
14909  */
14910 void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
14911
14912 /**
14913  * Creates a new tuple which has the same data as `orig`
14914  * but with all dynamically-allocated buffers duplicated in new buffers.
14915  */
14916 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
14917
14918 /**
14919  * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
14920  */
14921 struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
14922
14923 /**
14924  * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
14925  */
14926 void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
14927
14928 /**
14929  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
14930  */
14931 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
14932
14933 /**
14934  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
14935  */
14936 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
14937
14938 /**
14939  * Checks if the given object is currently in the success state
14940  */
14941 bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
14942
14943 /**
14944  * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
14945  */
14946 void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
14947
14948 /**
14949  * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
14950  * but with all dynamically-allocated buffers duplicated in new buffers.
14951  */
14952 struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
14953
14954 /**
14955  * Creates a new CResult_SignatureNoneZ in the success state.
14956  */
14957 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
14958
14959 /**
14960  * Creates a new CResult_SignatureNoneZ in the error state.
14961  */
14962 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
14963
14964 /**
14965  * Checks if the given object is currently in the success state
14966  */
14967 bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
14968
14969 /**
14970  * Frees any resources used by the CResult_SignatureNoneZ.
14971  */
14972 void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
14973
14974 /**
14975  * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
14976  * but with all dynamically-allocated buffers duplicated in new buffers.
14977  */
14978 struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
14979
14980 /**
14981  * Creates a new tuple which has the same data as `orig`
14982  * but with all dynamically-allocated buffers duplicated in new buffers.
14983  */
14984 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
14985
14986 /**
14987  * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
14988  */
14989 struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
14990
14991 /**
14992  * Frees any resources used by the C2Tuple_SignatureSignatureZ.
14993  */
14994 void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
14995
14996 /**
14997  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
14998  */
14999 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
15000
15001 /**
15002  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
15003  */
15004 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
15005
15006 /**
15007  * Checks if the given object is currently in the success state
15008  */
15009 bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
15010
15011 /**
15012  * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
15013  */
15014 void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
15015
15016 /**
15017  * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
15018  * but with all dynamically-allocated buffers duplicated in new buffers.
15019  */
15020 struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
15021
15022 /**
15023  * Creates a new CResult_SecretKeyNoneZ in the success state.
15024  */
15025 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
15026
15027 /**
15028  * Creates a new CResult_SecretKeyNoneZ in the error state.
15029  */
15030 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
15031
15032 /**
15033  * Checks if the given object is currently in the success state
15034  */
15035 bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
15036
15037 /**
15038  * Frees any resources used by the CResult_SecretKeyNoneZ.
15039  */
15040 void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
15041
15042 /**
15043  * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
15044  * but with all dynamically-allocated buffers duplicated in new buffers.
15045  */
15046 struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
15047
15048 /**
15049  * Creates a new CResult_SignDecodeErrorZ in the success state.
15050  */
15051 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
15052
15053 /**
15054  * Creates a new CResult_SignDecodeErrorZ in the error state.
15055  */
15056 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
15057
15058 /**
15059  * Checks if the given object is currently in the success state
15060  */
15061 bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
15062
15063 /**
15064  * Frees any resources used by the CResult_SignDecodeErrorZ.
15065  */
15066 void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
15067
15068 /**
15069  * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
15070  * but with all dynamically-allocated buffers duplicated in new buffers.
15071  */
15072 struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
15073
15074 /**
15075  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15076  */
15077 void CVec_u5Z_free(struct LDKCVec_u5Z _res);
15078
15079 /**
15080  * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
15081  */
15082 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
15083
15084 /**
15085  * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
15086  */
15087 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
15088
15089 /**
15090  * Checks if the given object is currently in the success state
15091  */
15092 bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
15093
15094 /**
15095  * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
15096  */
15097 void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
15098
15099 /**
15100  * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
15101  * but with all dynamically-allocated buffers duplicated in new buffers.
15102  */
15103 struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
15104
15105 /**
15106  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15107  */
15108 void CVec_u8Z_free(struct LDKCVec_u8Z _res);
15109
15110 /**
15111  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15112  */
15113 void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
15114
15115 /**
15116  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
15117  */
15118 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
15119
15120 /**
15121  * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
15122  */
15123 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
15124
15125 /**
15126  * Checks if the given object is currently in the success state
15127  */
15128 bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
15129
15130 /**
15131  * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
15132  */
15133 void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
15134
15135 /**
15136  * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
15137  * but with all dynamically-allocated buffers duplicated in new buffers.
15138  */
15139 struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
15140
15141 /**
15142  * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
15143  */
15144 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
15145
15146 /**
15147  * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
15148  */
15149 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
15150
15151 /**
15152  * Checks if the given object is currently in the success state
15153  */
15154 bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
15155
15156 /**
15157  * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
15158  */
15159 void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
15160
15161 /**
15162  * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
15163  * but with all dynamically-allocated buffers duplicated in new buffers.
15164  */
15165 struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
15166
15167 /**
15168  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15169  */
15170 void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
15171
15172 /**
15173  * Creates a new CResult_TransactionNoneZ in the success state.
15174  */
15175 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
15176
15177 /**
15178  * Creates a new CResult_TransactionNoneZ in the error state.
15179  */
15180 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
15181
15182 /**
15183  * Checks if the given object is currently in the success state
15184  */
15185 bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
15186
15187 /**
15188  * Frees any resources used by the CResult_TransactionNoneZ.
15189  */
15190 void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
15191
15192 /**
15193  * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
15194  * but with all dynamically-allocated buffers duplicated in new buffers.
15195  */
15196 struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
15197
15198 /**
15199  * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
15200  */
15201 struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
15202
15203 /**
15204  * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
15205  */
15206 void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
15207
15208 /**
15209  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15210  */
15211 void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
15212
15213 /**
15214  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
15215  */
15216 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
15217
15218 /**
15219  * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
15220  */
15221 struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
15222
15223 /**
15224  * Checks if the given object is currently in the success state
15225  */
15226 bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
15227
15228 /**
15229  * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
15230  */
15231 void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
15232
15233 /**
15234  * Constructs a new COption_u16Z containing a u16
15235  */
15236 struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
15237
15238 /**
15239  * Constructs a new COption_u16Z containing nothing
15240  */
15241 struct LDKCOption_u16Z COption_u16Z_none(void);
15242
15243 /**
15244  * Frees any resources associated with the u16, if we are in the Some state
15245  */
15246 void COption_u16Z_free(struct LDKCOption_u16Z _res);
15247
15248 /**
15249  * Creates a new COption_u16Z which has the same data as `orig`
15250  * but with all dynamically-allocated buffers duplicated in new buffers.
15251  */
15252 struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
15253
15254 /**
15255  * Creates a new CResult_NoneAPIErrorZ in the success state.
15256  */
15257 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
15258
15259 /**
15260  * Creates a new CResult_NoneAPIErrorZ in the error state.
15261  */
15262 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
15263
15264 /**
15265  * Checks if the given object is currently in the success state
15266  */
15267 bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
15268
15269 /**
15270  * Frees any resources used by the CResult_NoneAPIErrorZ.
15271  */
15272 void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
15273
15274 /**
15275  * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
15276  * but with all dynamically-allocated buffers duplicated in new buffers.
15277  */
15278 struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
15279
15280 /**
15281  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15282  */
15283 void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
15284
15285 /**
15286  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15287  */
15288 void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
15289
15290 /**
15291  * Creates a new CResult__u832APIErrorZ in the success state.
15292  */
15293 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
15294
15295 /**
15296  * Creates a new CResult__u832APIErrorZ in the error state.
15297  */
15298 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
15299
15300 /**
15301  * Checks if the given object is currently in the success state
15302  */
15303 bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
15304
15305 /**
15306  * Frees any resources used by the CResult__u832APIErrorZ.
15307  */
15308 void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
15309
15310 /**
15311  * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
15312  * but with all dynamically-allocated buffers duplicated in new buffers.
15313  */
15314 struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
15315
15316 /**
15317  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
15318  */
15319 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
15320
15321 /**
15322  * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
15323  */
15324 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
15325
15326 /**
15327  * Checks if the given object is currently in the success state
15328  */
15329 bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
15330
15331 /**
15332  * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
15333  */
15334 void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
15335
15336 /**
15337  * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
15338  * but with all dynamically-allocated buffers duplicated in new buffers.
15339  */
15340 struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
15341
15342 /**
15343  * Creates a new CResult_NonePaymentSendFailureZ in the success state.
15344  */
15345 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
15346
15347 /**
15348  * Creates a new CResult_NonePaymentSendFailureZ in the error state.
15349  */
15350 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
15351
15352 /**
15353  * Checks if the given object is currently in the success state
15354  */
15355 bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
15356
15357 /**
15358  * Frees any resources used by the CResult_NonePaymentSendFailureZ.
15359  */
15360 void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
15361
15362 /**
15363  * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
15364  * but with all dynamically-allocated buffers duplicated in new buffers.
15365  */
15366 struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
15367
15368 /**
15369  * Creates a new tuple which has the same data as `orig`
15370  * but with all dynamically-allocated buffers duplicated in new buffers.
15371  */
15372 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
15373
15374 /**
15375  * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
15376  */
15377 struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
15378
15379 /**
15380  * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
15381  */
15382 void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
15383
15384 /**
15385  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
15386  */
15387 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
15388
15389 /**
15390  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
15391  */
15392 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
15393
15394 /**
15395  * Checks if the given object is currently in the success state
15396  */
15397 bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
15398
15399 /**
15400  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
15401  */
15402 void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
15403
15404 /**
15405  * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
15406  * but with all dynamically-allocated buffers duplicated in new buffers.
15407  */
15408 struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
15409
15410 /**
15411  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15412  */
15413 void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res);
15414
15415 /**
15416  * Creates a new tuple which has the same data as `orig`
15417  * but with all dynamically-allocated buffers duplicated in new buffers.
15418  */
15419 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
15420
15421 /**
15422  * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
15423  */
15424 struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
15425
15426 /**
15427  * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
15428  */
15429 void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
15430
15431 /**
15432  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
15433  */
15434 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
15435
15436 /**
15437  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
15438  */
15439 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
15440
15441 /**
15442  * Checks if the given object is currently in the success state
15443  */
15444 bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
15445
15446 /**
15447  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
15448  */
15449 void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
15450
15451 /**
15452  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
15453  * but with all dynamically-allocated buffers duplicated in new buffers.
15454  */
15455 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
15456
15457 /**
15458  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
15459  */
15460 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
15461
15462 /**
15463  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
15464  */
15465 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
15466
15467 /**
15468  * Checks if the given object is currently in the success state
15469  */
15470 bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
15471
15472 /**
15473  * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
15474  */
15475 void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
15476
15477 /**
15478  * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
15479  * but with all dynamically-allocated buffers duplicated in new buffers.
15480  */
15481 struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
15482
15483 /**
15484  * Creates a new CResult_PaymentSecretNoneZ in the success state.
15485  */
15486 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
15487
15488 /**
15489  * Creates a new CResult_PaymentSecretNoneZ in the error state.
15490  */
15491 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
15492
15493 /**
15494  * Checks if the given object is currently in the success state
15495  */
15496 bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
15497
15498 /**
15499  * Frees any resources used by the CResult_PaymentSecretNoneZ.
15500  */
15501 void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
15502
15503 /**
15504  * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
15505  * but with all dynamically-allocated buffers duplicated in new buffers.
15506  */
15507 struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
15508
15509 /**
15510  * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
15511  */
15512 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
15513
15514 /**
15515  * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
15516  */
15517 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
15518
15519 /**
15520  * Checks if the given object is currently in the success state
15521  */
15522 bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
15523
15524 /**
15525  * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
15526  */
15527 void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
15528
15529 /**
15530  * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
15531  * but with all dynamically-allocated buffers duplicated in new buffers.
15532  */
15533 struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
15534
15535 /**
15536  * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
15537  */
15538 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
15539
15540 /**
15541  * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
15542  */
15543 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
15544
15545 /**
15546  * Checks if the given object is currently in the success state
15547  */
15548 bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
15549
15550 /**
15551  * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
15552  */
15553 void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
15554
15555 /**
15556  * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
15557  * but with all dynamically-allocated buffers duplicated in new buffers.
15558  */
15559 struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
15560
15561 /**
15562  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
15563  */
15564 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
15565
15566 /**
15567  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
15568  */
15569 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
15570
15571 /**
15572  * Checks if the given object is currently in the success state
15573  */
15574 bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
15575
15576 /**
15577  * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
15578  */
15579 void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
15580
15581 /**
15582  * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
15583  * but with all dynamically-allocated buffers duplicated in new buffers.
15584  */
15585 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
15586
15587 /**
15588  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
15589  */
15590 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
15591
15592 /**
15593  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
15594  */
15595 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
15596
15597 /**
15598  * Checks if the given object is currently in the success state
15599  */
15600 bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
15601
15602 /**
15603  * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
15604  */
15605 void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
15606
15607 /**
15608  * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
15609  * but with all dynamically-allocated buffers duplicated in new buffers.
15610  */
15611 struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
15612
15613 /**
15614  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
15615  */
15616 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
15617
15618 /**
15619  * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
15620  */
15621 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
15622
15623 /**
15624  * Checks if the given object is currently in the success state
15625  */
15626 bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
15627
15628 /**
15629  * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
15630  */
15631 void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
15632
15633 /**
15634  * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
15635  * but with all dynamically-allocated buffers duplicated in new buffers.
15636  */
15637 struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
15638
15639 /**
15640  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
15641  */
15642 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
15643
15644 /**
15645  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
15646  */
15647 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
15648
15649 /**
15650  * Checks if the given object is currently in the success state
15651  */
15652 bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
15653
15654 /**
15655  * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
15656  */
15657 void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
15658
15659 /**
15660  * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
15661  * but with all dynamically-allocated buffers duplicated in new buffers.
15662  */
15663 struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
15664
15665 /**
15666  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15667  */
15668 void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
15669
15670 /**
15671  * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
15672  */
15673 struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
15674
15675 /**
15676  * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
15677  */
15678 void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
15679
15680 /**
15681  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
15682  */
15683 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
15684
15685 /**
15686  * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
15687  */
15688 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
15689
15690 /**
15691  * Checks if the given object is currently in the success state
15692  */
15693 bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
15694
15695 /**
15696  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
15697  */
15698 void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
15699
15700 /**
15701  * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
15702  */
15703 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
15704
15705 /**
15706  * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
15707  */
15708 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
15709
15710 /**
15711  * Checks if the given object is currently in the success state
15712  */
15713 bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
15714
15715 /**
15716  * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
15717  */
15718 void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
15719
15720 /**
15721  * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
15722  * but with all dynamically-allocated buffers duplicated in new buffers.
15723  */
15724 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
15725
15726 /**
15727  * Creates a new CResult_OutPointDecodeErrorZ in the success state.
15728  */
15729 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
15730
15731 /**
15732  * Creates a new CResult_OutPointDecodeErrorZ in the error state.
15733  */
15734 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
15735
15736 /**
15737  * Checks if the given object is currently in the success state
15738  */
15739 bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
15740
15741 /**
15742  * Frees any resources used by the CResult_OutPointDecodeErrorZ.
15743  */
15744 void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
15745
15746 /**
15747  * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
15748  * but with all dynamically-allocated buffers duplicated in new buffers.
15749  */
15750 struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
15751
15752 /**
15753  * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
15754  */
15755 struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
15756
15757 /**
15758  * Constructs a new COption_TypeZ containing nothing
15759  */
15760 struct LDKCOption_TypeZ COption_TypeZ_none(void);
15761
15762 /**
15763  * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
15764  */
15765 void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
15766
15767 /**
15768  * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
15769  */
15770 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
15771
15772 /**
15773  * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
15774  */
15775 struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
15776
15777 /**
15778  * Checks if the given object is currently in the success state
15779  */
15780 bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
15781
15782 /**
15783  * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
15784  */
15785 void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
15786
15787 /**
15788  * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
15789  */
15790 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
15791
15792 /**
15793  * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
15794  */
15795 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
15796
15797 /**
15798  * Checks if the given object is currently in the success state
15799  */
15800 bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
15801
15802 /**
15803  * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
15804  */
15805 void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
15806
15807 /**
15808  * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
15809  * but with all dynamically-allocated buffers duplicated in new buffers.
15810  */
15811 struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
15812
15813 /**
15814  * Creates a new CResult_SiPrefixParseErrorZ in the success state.
15815  */
15816 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
15817
15818 /**
15819  * Creates a new CResult_SiPrefixParseErrorZ in the error state.
15820  */
15821 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
15822
15823 /**
15824  * Checks if the given object is currently in the success state
15825  */
15826 bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
15827
15828 /**
15829  * Frees any resources used by the CResult_SiPrefixParseErrorZ.
15830  */
15831 void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
15832
15833 /**
15834  * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
15835  * but with all dynamically-allocated buffers duplicated in new buffers.
15836  */
15837 struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
15838
15839 /**
15840  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
15841  */
15842 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
15843
15844 /**
15845  * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
15846  */
15847 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
15848
15849 /**
15850  * Checks if the given object is currently in the success state
15851  */
15852 bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
15853
15854 /**
15855  * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
15856  */
15857 void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
15858
15859 /**
15860  * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
15861  * but with all dynamically-allocated buffers duplicated in new buffers.
15862  */
15863 struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
15864
15865 /**
15866  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
15867  */
15868 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
15869
15870 /**
15871  * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
15872  */
15873 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
15874
15875 /**
15876  * Checks if the given object is currently in the success state
15877  */
15878 bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
15879
15880 /**
15881  * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
15882  */
15883 void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
15884
15885 /**
15886  * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
15887  * but with all dynamically-allocated buffers duplicated in new buffers.
15888  */
15889 struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
15890
15891 /**
15892  * Creates a new tuple which has the same data as `orig`
15893  * but with all dynamically-allocated buffers duplicated in new buffers.
15894  */
15895 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
15896
15897 /**
15898  * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
15899  */
15900 struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
15901
15902 /**
15903  * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
15904  */
15905 void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
15906
15907 /**
15908  * Creates a new CResult_PayeePubKeyErrorZ in the success state.
15909  */
15910 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
15911
15912 /**
15913  * Creates a new CResult_PayeePubKeyErrorZ in the error state.
15914  */
15915 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
15916
15917 /**
15918  * Checks if the given object is currently in the success state
15919  */
15920 bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
15921
15922 /**
15923  * Frees any resources used by the CResult_PayeePubKeyErrorZ.
15924  */
15925 void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
15926
15927 /**
15928  * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
15929  * but with all dynamically-allocated buffers duplicated in new buffers.
15930  */
15931 struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
15932
15933 /**
15934  * Frees the buffer pointed to by `data` if `datalen` is non-0.
15935  */
15936 void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
15937
15938 /**
15939  * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
15940  */
15941 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
15942
15943 /**
15944  * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
15945  */
15946 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
15947
15948 /**
15949  * Checks if the given object is currently in the success state
15950  */
15951 bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
15952
15953 /**
15954  * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
15955  */
15956 void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
15957
15958 /**
15959  * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
15960  * but with all dynamically-allocated buffers duplicated in new buffers.
15961  */
15962 struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
15963
15964 /**
15965  * Creates a new CResult_NoneSemanticErrorZ in the success state.
15966  */
15967 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
15968
15969 /**
15970  * Creates a new CResult_NoneSemanticErrorZ in the error state.
15971  */
15972 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
15973
15974 /**
15975  * Checks if the given object is currently in the success state
15976  */
15977 bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
15978
15979 /**
15980  * Frees any resources used by the CResult_NoneSemanticErrorZ.
15981  */
15982 void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
15983
15984 /**
15985  * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
15986  * but with all dynamically-allocated buffers duplicated in new buffers.
15987  */
15988 struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
15989
15990 /**
15991  * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
15992  */
15993 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
15994
15995 /**
15996  * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
15997  */
15998 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
15999
16000 /**
16001  * Checks if the given object is currently in the success state
16002  */
16003 bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
16004
16005 /**
16006  * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
16007  */
16008 void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
16009
16010 /**
16011  * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
16012  * but with all dynamically-allocated buffers duplicated in new buffers.
16013  */
16014 struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
16015
16016 /**
16017  * Creates a new CResult_DescriptionCreationErrorZ in the success state.
16018  */
16019 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
16020
16021 /**
16022  * Creates a new CResult_DescriptionCreationErrorZ in the error state.
16023  */
16024 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
16025
16026 /**
16027  * Checks if the given object is currently in the success state
16028  */
16029 bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
16030
16031 /**
16032  * Frees any resources used by the CResult_DescriptionCreationErrorZ.
16033  */
16034 void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
16035
16036 /**
16037  * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
16038  * but with all dynamically-allocated buffers duplicated in new buffers.
16039  */
16040 struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
16041
16042 /**
16043  * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
16044  */
16045 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
16046
16047 /**
16048  * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
16049  */
16050 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
16051
16052 /**
16053  * Checks if the given object is currently in the success state
16054  */
16055 bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
16056
16057 /**
16058  * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
16059  */
16060 void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
16061
16062 /**
16063  * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
16064  * but with all dynamically-allocated buffers duplicated in new buffers.
16065  */
16066 struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
16067
16068 /**
16069  * Creates a new CResult_StringErrorZ in the success state.
16070  */
16071 struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
16072
16073 /**
16074  * Creates a new CResult_StringErrorZ in the error state.
16075  */
16076 struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
16077
16078 /**
16079  * Checks if the given object is currently in the success state
16080  */
16081 bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
16082
16083 /**
16084  * Frees any resources used by the CResult_StringErrorZ.
16085  */
16086 void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
16087
16088 /**
16089  * Creates a new CResult_StringErrorZ which has the same data as `orig`
16090  * but with all dynamically-allocated buffers duplicated in new buffers.
16091  */
16092 struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig);
16093
16094 /**
16095  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
16096  */
16097 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
16098
16099 /**
16100  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
16101  */
16102 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16103
16104 /**
16105  * Checks if the given object is currently in the success state
16106  */
16107 bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
16108
16109 /**
16110  * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
16111  */
16112 void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
16113
16114 /**
16115  * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
16116  * but with all dynamically-allocated buffers duplicated in new buffers.
16117  */
16118 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
16119
16120 /**
16121  * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
16122  */
16123 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
16124
16125 /**
16126  * Constructs a new COption_MonitorEventZ containing nothing
16127  */
16128 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
16129
16130 /**
16131  * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
16132  */
16133 void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
16134
16135 /**
16136  * Creates a new COption_MonitorEventZ which has the same data as `orig`
16137  * but with all dynamically-allocated buffers duplicated in new buffers.
16138  */
16139 struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
16140
16141 /**
16142  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
16143  */
16144 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
16145
16146 /**
16147  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
16148  */
16149 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
16150
16151 /**
16152  * Checks if the given object is currently in the success state
16153  */
16154 bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
16155
16156 /**
16157  * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
16158  */
16159 void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
16160
16161 /**
16162  * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
16163  * but with all dynamically-allocated buffers duplicated in new buffers.
16164  */
16165 struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
16166
16167 /**
16168  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
16169  */
16170 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
16171
16172 /**
16173  * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
16174  */
16175 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
16176
16177 /**
16178  * Checks if the given object is currently in the success state
16179  */
16180 bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
16181
16182 /**
16183  * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
16184  */
16185 void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
16186
16187 /**
16188  * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
16189  * but with all dynamically-allocated buffers duplicated in new buffers.
16190  */
16191 struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
16192
16193 /**
16194  * Creates a new tuple which has the same data as `orig`
16195  * but with all dynamically-allocated buffers duplicated in new buffers.
16196  */
16197 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
16198
16199 /**
16200  * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
16201  */
16202 struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
16203
16204 /**
16205  * Frees any resources used by the C2Tuple_OutPointScriptZ.
16206  */
16207 void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
16208
16209 /**
16210  * Creates a new tuple which has the same data as `orig`
16211  * but with all dynamically-allocated buffers duplicated in new buffers.
16212  */
16213 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
16214
16215 /**
16216  * Creates a new C2Tuple_u32ScriptZ from the contained elements.
16217  */
16218 struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
16219
16220 /**
16221  * Frees any resources used by the C2Tuple_u32ScriptZ.
16222  */
16223 void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
16224
16225 /**
16226  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16227  */
16228 void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
16229
16230 /**
16231  * Creates a new tuple which has the same data as `orig`
16232  * but with all dynamically-allocated buffers duplicated in new buffers.
16233  */
16234 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
16235
16236 /**
16237  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
16238  */
16239 struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
16240
16241 /**
16242  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
16243  */
16244 void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
16245
16246 /**
16247  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16248  */
16249 void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
16250
16251 /**
16252  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16253  */
16254 void CVec_EventZ_free(struct LDKCVec_EventZ _res);
16255
16256 /**
16257  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16258  */
16259 void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
16260
16261 /**
16262  * Creates a new tuple which has the same data as `orig`
16263  * but with all dynamically-allocated buffers duplicated in new buffers.
16264  */
16265 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
16266
16267 /**
16268  * Creates a new C2Tuple_u32TxOutZ from the contained elements.
16269  */
16270 struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
16271
16272 /**
16273  * Frees any resources used by the C2Tuple_u32TxOutZ.
16274  */
16275 void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
16276
16277 /**
16278  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16279  */
16280 void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
16281
16282 /**
16283  * Creates a new tuple which has the same data as `orig`
16284  * but with all dynamically-allocated buffers duplicated in new buffers.
16285  */
16286 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
16287
16288 /**
16289  * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
16290  */
16291 struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
16292
16293 /**
16294  * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
16295  */
16296 void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
16297
16298 /**
16299  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16300  */
16301 void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
16302
16303 /**
16304  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16305  */
16306 void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
16307
16308 /**
16309  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
16310  */
16311 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
16312
16313 /**
16314  * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
16315  */
16316 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
16317
16318 /**
16319  * Checks if the given object is currently in the success state
16320  */
16321 bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
16322
16323 /**
16324  * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
16325  */
16326 void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
16327
16328 /**
16329  * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
16330  */
16331 struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
16332
16333 /**
16334  * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
16335  */
16336 void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
16337
16338 /**
16339  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16340  */
16341 void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
16342
16343 /**
16344  * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
16345  */
16346 struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
16347
16348 /**
16349  * Constructs a new COption_NetAddressZ containing nothing
16350  */
16351 struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
16352
16353 /**
16354  * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
16355  */
16356 void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
16357
16358 /**
16359  * Creates a new COption_NetAddressZ which has the same data as `orig`
16360  * but with all dynamically-allocated buffers duplicated in new buffers.
16361  */
16362 struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
16363
16364 /**
16365  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
16366  */
16367 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
16368
16369 /**
16370  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
16371  */
16372 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
16373
16374 /**
16375  * Checks if the given object is currently in the success state
16376  */
16377 bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
16378
16379 /**
16380  * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
16381  */
16382 void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
16383
16384 /**
16385  * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
16386  * but with all dynamically-allocated buffers duplicated in new buffers.
16387  */
16388 struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
16389
16390 /**
16391  * Creates a new CResult_NonePeerHandleErrorZ in the success state.
16392  */
16393 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
16394
16395 /**
16396  * Creates a new CResult_NonePeerHandleErrorZ in the error state.
16397  */
16398 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
16399
16400 /**
16401  * Checks if the given object is currently in the success state
16402  */
16403 bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
16404
16405 /**
16406  * Frees any resources used by the CResult_NonePeerHandleErrorZ.
16407  */
16408 void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
16409
16410 /**
16411  * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
16412  * but with all dynamically-allocated buffers duplicated in new buffers.
16413  */
16414 struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
16415
16416 /**
16417  * Creates a new CResult_boolPeerHandleErrorZ in the success state.
16418  */
16419 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
16420
16421 /**
16422  * Creates a new CResult_boolPeerHandleErrorZ in the error state.
16423  */
16424 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
16425
16426 /**
16427  * Checks if the given object is currently in the success state
16428  */
16429 bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
16430
16431 /**
16432  * Frees any resources used by the CResult_boolPeerHandleErrorZ.
16433  */
16434 void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
16435
16436 /**
16437  * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
16438  * but with all dynamically-allocated buffers duplicated in new buffers.
16439  */
16440 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
16441
16442 /**
16443  * Creates a new CResult_u32GraphSyncErrorZ in the success state.
16444  */
16445 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
16446
16447 /**
16448  * Creates a new CResult_u32GraphSyncErrorZ in the error state.
16449  */
16450 struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
16451
16452 /**
16453  * Checks if the given object is currently in the success state
16454  */
16455 bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
16456
16457 /**
16458  * Frees any resources used by the CResult_u32GraphSyncErrorZ.
16459  */
16460 void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
16461
16462 /**
16463  * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
16464  */
16465 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
16466
16467 /**
16468  * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
16469  */
16470 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
16471
16472 /**
16473  * Checks if the given object is currently in the success state
16474  */
16475 bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
16476
16477 /**
16478  * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
16479  */
16480 void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
16481
16482 /**
16483  * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
16484  * but with all dynamically-allocated buffers duplicated in new buffers.
16485  */
16486 struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
16487
16488 /**
16489  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16490  */
16491 void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
16492
16493 /**
16494  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16495  */
16496 void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
16497
16498 /**
16499  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16500  */
16501 void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
16502
16503 /**
16504  * Frees the buffer pointed to by `data` if `datalen` is non-0.
16505  */
16506 void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
16507
16508 /**
16509  * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
16510  */
16511 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
16512
16513 /**
16514  * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
16515  */
16516 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
16517
16518 /**
16519  * Checks if the given object is currently in the success state
16520  */
16521 bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
16522
16523 /**
16524  * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
16525  */
16526 void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
16527
16528 /**
16529  * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
16530  * but with all dynamically-allocated buffers duplicated in new buffers.
16531  */
16532 struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
16533
16534 /**
16535  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
16536  */
16537 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
16538
16539 /**
16540  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
16541  */
16542 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
16543
16544 /**
16545  * Checks if the given object is currently in the success state
16546  */
16547 bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
16548
16549 /**
16550  * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
16551  */
16552 void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
16553
16554 /**
16555  * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
16556  * but with all dynamically-allocated buffers duplicated in new buffers.
16557  */
16558 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
16559
16560 /**
16561  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
16562  */
16563 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
16564
16565 /**
16566  * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
16567  */
16568 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
16569
16570 /**
16571  * Checks if the given object is currently in the success state
16572  */
16573 bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
16574
16575 /**
16576  * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
16577  */
16578 void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
16579
16580 /**
16581  * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
16582  * but with all dynamically-allocated buffers duplicated in new buffers.
16583  */
16584 struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
16585
16586 /**
16587  * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
16588  */
16589 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
16590
16591 /**
16592  * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
16593  */
16594 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
16595
16596 /**
16597  * Checks if the given object is currently in the success state
16598  */
16599 bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
16600
16601 /**
16602  * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
16603  */
16604 void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
16605
16606 /**
16607  * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
16608  * but with all dynamically-allocated buffers duplicated in new buffers.
16609  */
16610 struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
16611
16612 /**
16613  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
16614  */
16615 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
16616
16617 /**
16618  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
16619  */
16620 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
16621
16622 /**
16623  * Checks if the given object is currently in the success state
16624  */
16625 bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
16626
16627 /**
16628  * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
16629  */
16630 void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
16631
16632 /**
16633  * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
16634  * but with all dynamically-allocated buffers duplicated in new buffers.
16635  */
16636 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
16637
16638 /**
16639  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
16640  */
16641 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
16642
16643 /**
16644  * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
16645  */
16646 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
16647
16648 /**
16649  * Checks if the given object is currently in the success state
16650  */
16651 bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
16652
16653 /**
16654  * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
16655  */
16656 void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
16657
16658 /**
16659  * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
16660  * but with all dynamically-allocated buffers duplicated in new buffers.
16661  */
16662 struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
16663
16664 /**
16665  * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
16666  */
16667 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
16668
16669 /**
16670  * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
16671  */
16672 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
16673
16674 /**
16675  * Checks if the given object is currently in the success state
16676  */
16677 bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
16678
16679 /**
16680  * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
16681  */
16682 void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
16683
16684 /**
16685  * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
16686  * but with all dynamically-allocated buffers duplicated in new buffers.
16687  */
16688 struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
16689
16690 /**
16691  * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
16692  */
16693 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
16694
16695 /**
16696  * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
16697  */
16698 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
16699
16700 /**
16701  * Checks if the given object is currently in the success state
16702  */
16703 bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
16704
16705 /**
16706  * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
16707  */
16708 void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
16709
16710 /**
16711  * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
16712  * but with all dynamically-allocated buffers duplicated in new buffers.
16713  */
16714 struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
16715
16716 /**
16717  * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state.
16718  */
16719 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o);
16720
16721 /**
16722  * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state.
16723  */
16724 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e);
16725
16726 /**
16727  * Checks if the given object is currently in the success state
16728  */
16729 bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o);
16730
16731 /**
16732  * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ.
16733  */
16734 void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res);
16735
16736 /**
16737  * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig`
16738  * but with all dynamically-allocated buffers duplicated in new buffers.
16739  */
16740 struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig);
16741
16742 /**
16743  * Creates a new CResult_InitDecodeErrorZ in the success state.
16744  */
16745 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
16746
16747 /**
16748  * Creates a new CResult_InitDecodeErrorZ in the error state.
16749  */
16750 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
16751
16752 /**
16753  * Checks if the given object is currently in the success state
16754  */
16755 bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
16756
16757 /**
16758  * Frees any resources used by the CResult_InitDecodeErrorZ.
16759  */
16760 void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
16761
16762 /**
16763  * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
16764  * but with all dynamically-allocated buffers duplicated in new buffers.
16765  */
16766 struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
16767
16768 /**
16769  * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
16770  */
16771 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
16772
16773 /**
16774  * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
16775  */
16776 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
16777
16778 /**
16779  * Checks if the given object is currently in the success state
16780  */
16781 bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
16782
16783 /**
16784  * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
16785  */
16786 void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
16787
16788 /**
16789  * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
16790  * but with all dynamically-allocated buffers duplicated in new buffers.
16791  */
16792 struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
16793
16794 /**
16795  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
16796  */
16797 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
16798
16799 /**
16800  * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
16801  */
16802 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
16803
16804 /**
16805  * Checks if the given object is currently in the success state
16806  */
16807 bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
16808
16809 /**
16810  * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
16811  */
16812 void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
16813
16814 /**
16815  * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
16816  * but with all dynamically-allocated buffers duplicated in new buffers.
16817  */
16818 struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
16819
16820 /**
16821  * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
16822  */
16823 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
16824
16825 /**
16826  * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
16827  */
16828 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
16829
16830 /**
16831  * Checks if the given object is currently in the success state
16832  */
16833 bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
16834
16835 /**
16836  * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
16837  */
16838 void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
16839
16840 /**
16841  * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
16842  * but with all dynamically-allocated buffers duplicated in new buffers.
16843  */
16844 struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
16845
16846 /**
16847  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
16848  */
16849 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
16850
16851 /**
16852  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
16853  */
16854 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16855
16856 /**
16857  * Checks if the given object is currently in the success state
16858  */
16859 bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
16860
16861 /**
16862  * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
16863  */
16864 void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
16865
16866 /**
16867  * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
16868  * but with all dynamically-allocated buffers duplicated in new buffers.
16869  */
16870 struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
16871
16872 /**
16873  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
16874  */
16875 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
16876
16877 /**
16878  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
16879  */
16880 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16881
16882 /**
16883  * Checks if the given object is currently in the success state
16884  */
16885 bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
16886
16887 /**
16888  * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
16889  */
16890 void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
16891
16892 /**
16893  * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
16894  * but with all dynamically-allocated buffers duplicated in new buffers.
16895  */
16896 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
16897
16898 /**
16899  * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
16900  */
16901 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
16902
16903 /**
16904  * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
16905  */
16906 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
16907
16908 /**
16909  * Checks if the given object is currently in the success state
16910  */
16911 bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
16912
16913 /**
16914  * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
16915  */
16916 void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
16917
16918 /**
16919  * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
16920  * but with all dynamically-allocated buffers duplicated in new buffers.
16921  */
16922 struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
16923
16924 /**
16925  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
16926  */
16927 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
16928
16929 /**
16930  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
16931  */
16932 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16933
16934 /**
16935  * Checks if the given object is currently in the success state
16936  */
16937 bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
16938
16939 /**
16940  * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
16941  */
16942 void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
16943
16944 /**
16945  * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
16946  * but with all dynamically-allocated buffers duplicated in new buffers.
16947  */
16948 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
16949
16950 /**
16951  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
16952  */
16953 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
16954
16955 /**
16956  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
16957  */
16958 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
16959
16960 /**
16961  * Checks if the given object is currently in the success state
16962  */
16963 bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
16964
16965 /**
16966  * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
16967  */
16968 void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
16969
16970 /**
16971  * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
16972  * but with all dynamically-allocated buffers duplicated in new buffers.
16973  */
16974 struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
16975
16976 /**
16977  * Creates a new CResult_PingDecodeErrorZ in the success state.
16978  */
16979 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
16980
16981 /**
16982  * Creates a new CResult_PingDecodeErrorZ in the error state.
16983  */
16984 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
16985
16986 /**
16987  * Checks if the given object is currently in the success state
16988  */
16989 bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
16990
16991 /**
16992  * Frees any resources used by the CResult_PingDecodeErrorZ.
16993  */
16994 void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
16995
16996 /**
16997  * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
16998  * but with all dynamically-allocated buffers duplicated in new buffers.
16999  */
17000 struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
17001
17002 /**
17003  * Creates a new CResult_PongDecodeErrorZ in the success state.
17004  */
17005 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
17006
17007 /**
17008  * Creates a new CResult_PongDecodeErrorZ in the error state.
17009  */
17010 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
17011
17012 /**
17013  * Checks if the given object is currently in the success state
17014  */
17015 bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
17016
17017 /**
17018  * Frees any resources used by the CResult_PongDecodeErrorZ.
17019  */
17020 void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
17021
17022 /**
17023  * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
17024  * but with all dynamically-allocated buffers duplicated in new buffers.
17025  */
17026 struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
17027
17028 /**
17029  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
17030  */
17031 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
17032
17033 /**
17034  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
17035  */
17036 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
17037
17038 /**
17039  * Checks if the given object is currently in the success state
17040  */
17041 bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
17042
17043 /**
17044  * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
17045  */
17046 void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
17047
17048 /**
17049  * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
17050  * but with all dynamically-allocated buffers duplicated in new buffers.
17051  */
17052 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
17053
17054 /**
17055  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
17056  */
17057 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
17058
17059 /**
17060  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
17061  */
17062 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
17063
17064 /**
17065  * Checks if the given object is currently in the success state
17066  */
17067 bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
17068
17069 /**
17070  * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
17071  */
17072 void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
17073
17074 /**
17075  * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
17076  * but with all dynamically-allocated buffers duplicated in new buffers.
17077  */
17078 struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
17079
17080 /**
17081  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
17082  */
17083 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
17084
17085 /**
17086  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
17087  */
17088 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
17089
17090 /**
17091  * Checks if the given object is currently in the success state
17092  */
17093 bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
17094
17095 /**
17096  * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
17097  */
17098 void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
17099
17100 /**
17101  * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
17102  * but with all dynamically-allocated buffers duplicated in new buffers.
17103  */
17104 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
17105
17106 /**
17107  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
17108  */
17109 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
17110
17111 /**
17112  * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
17113  */
17114 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
17115
17116 /**
17117  * Checks if the given object is currently in the success state
17118  */
17119 bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
17120
17121 /**
17122  * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
17123  */
17124 void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
17125
17126 /**
17127  * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
17128  * but with all dynamically-allocated buffers duplicated in new buffers.
17129  */
17130 struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
17131
17132 /**
17133  * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
17134  */
17135 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
17136
17137 /**
17138  * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
17139  */
17140 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
17141
17142 /**
17143  * Checks if the given object is currently in the success state
17144  */
17145 bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
17146
17147 /**
17148  * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
17149  */
17150 void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
17151
17152 /**
17153  * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
17154  * but with all dynamically-allocated buffers duplicated in new buffers.
17155  */
17156 struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
17157
17158 /**
17159  * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
17160  */
17161 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
17162
17163 /**
17164  * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
17165  */
17166 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
17167
17168 /**
17169  * Checks if the given object is currently in the success state
17170  */
17171 bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
17172
17173 /**
17174  * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
17175  */
17176 void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
17177
17178 /**
17179  * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
17180  * but with all dynamically-allocated buffers duplicated in new buffers.
17181  */
17182 struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
17183
17184 /**
17185  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
17186  */
17187 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
17188
17189 /**
17190  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
17191  */
17192 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
17193
17194 /**
17195  * Checks if the given object is currently in the success state
17196  */
17197 bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
17198
17199 /**
17200  * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
17201  */
17202 void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
17203
17204 /**
17205  * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
17206  * but with all dynamically-allocated buffers duplicated in new buffers.
17207  */
17208 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
17209
17210 /**
17211  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
17212  */
17213 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
17214
17215 /**
17216  * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
17217  */
17218 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
17219
17220 /**
17221  * Checks if the given object is currently in the success state
17222  */
17223 bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
17224
17225 /**
17226  * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
17227  */
17228 void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
17229
17230 /**
17231  * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
17232  * but with all dynamically-allocated buffers duplicated in new buffers.
17233  */
17234 struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
17235
17236 /**
17237  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
17238  */
17239 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
17240
17241 /**
17242  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
17243  */
17244 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
17245
17246 /**
17247  * Checks if the given object is currently in the success state
17248  */
17249 bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
17250
17251 /**
17252  * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
17253  */
17254 void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
17255
17256 /**
17257  * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
17258  * but with all dynamically-allocated buffers duplicated in new buffers.
17259  */
17260 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
17261
17262 /**
17263  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
17264  */
17265 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
17266
17267 /**
17268  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
17269  */
17270 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
17271
17272 /**
17273  * Checks if the given object is currently in the success state
17274  */
17275 bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
17276
17277 /**
17278  * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
17279  */
17280 void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
17281
17282 /**
17283  * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
17284  * but with all dynamically-allocated buffers duplicated in new buffers.
17285  */
17286 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
17287
17288 /**
17289  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
17290  */
17291 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
17292
17293 /**
17294  * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
17295  */
17296 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
17297
17298 /**
17299  * Checks if the given object is currently in the success state
17300  */
17301 bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
17302
17303 /**
17304  * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
17305  */
17306 void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
17307
17308 /**
17309  * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
17310  * but with all dynamically-allocated buffers duplicated in new buffers.
17311  */
17312 struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
17313
17314 /**
17315  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
17316  */
17317 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
17318
17319 /**
17320  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
17321  */
17322 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
17323
17324 /**
17325  * Checks if the given object is currently in the success state
17326  */
17327 bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
17328
17329 /**
17330  * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
17331  */
17332 void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
17333
17334 /**
17335  * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
17336  * but with all dynamically-allocated buffers duplicated in new buffers.
17337  */
17338 struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
17339
17340 /**
17341  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
17342  */
17343 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
17344
17345 /**
17346  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
17347  */
17348 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
17349
17350 /**
17351  * Checks if the given object is currently in the success state
17352  */
17353 bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
17354
17355 /**
17356  * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
17357  */
17358 void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
17359
17360 /**
17361  * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
17362  * but with all dynamically-allocated buffers duplicated in new buffers.
17363  */
17364 struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
17365
17366 /**
17367  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17368  */
17369 void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
17370
17371 /**
17372  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
17373  */
17374 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
17375
17376 /**
17377  * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
17378  */
17379 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
17380
17381 /**
17382  * Checks if the given object is currently in the success state
17383  */
17384 bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
17385
17386 /**
17387  * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
17388  */
17389 void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
17390
17391 /**
17392  * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
17393  * but with all dynamically-allocated buffers duplicated in new buffers.
17394  */
17395 struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
17396
17397 /**
17398  * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
17399  */
17400 struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
17401
17402 /**
17403  * Constructs a new COption_FilterZ containing nothing
17404  */
17405 struct LDKCOption_FilterZ COption_FilterZ_none(void);
17406
17407 /**
17408  * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
17409  */
17410 void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
17411
17412 /**
17413  * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
17414  */
17415 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
17416
17417 /**
17418  * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
17419  */
17420 struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
17421
17422 /**
17423  * Checks if the given object is currently in the success state
17424  */
17425 bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
17426
17427 /**
17428  * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
17429  */
17430 void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
17431
17432 /**
17433  * Frees the buffer pointed to by `data` if `datalen` is non-0.
17434  */
17435 void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
17436
17437 /**
17438  * Frees any resources used by the PaymentPurpose
17439  */
17440 void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
17441
17442 /**
17443  * Creates a copy of the PaymentPurpose
17444  */
17445 struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
17446
17447 /**
17448  * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
17449  */
17450 struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
17451
17452 /**
17453  * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
17454  */
17455 struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
17456
17457 /**
17458  * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
17459  */
17460 struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
17461
17462 /**
17463  * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
17464  */
17465 struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
17466
17467 /**
17468  * Frees any resources used by the ClosureReason
17469  */
17470 void ClosureReason_free(struct LDKClosureReason this_ptr);
17471
17472 /**
17473  * Creates a copy of the ClosureReason
17474  */
17475 struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
17476
17477 /**
17478  * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
17479  */
17480 struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
17481
17482 /**
17483  * Utility method to constructs a new HolderForceClosed-variant ClosureReason
17484  */
17485 struct LDKClosureReason ClosureReason_holder_force_closed(void);
17486
17487 /**
17488  * Utility method to constructs a new CooperativeClosure-variant ClosureReason
17489  */
17490 struct LDKClosureReason ClosureReason_cooperative_closure(void);
17491
17492 /**
17493  * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
17494  */
17495 struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
17496
17497 /**
17498  * Utility method to constructs a new FundingTimedOut-variant ClosureReason
17499  */
17500 struct LDKClosureReason ClosureReason_funding_timed_out(void);
17501
17502 /**
17503  * Utility method to constructs a new ProcessingError-variant ClosureReason
17504  */
17505 struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
17506
17507 /**
17508  * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
17509  */
17510 struct LDKClosureReason ClosureReason_disconnected_peer(void);
17511
17512 /**
17513  * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
17514  */
17515 struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
17516
17517 /**
17518  * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
17519  */
17520 struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
17521
17522 /**
17523  * Read a ClosureReason from a byte array, created by ClosureReason_write
17524  */
17525 struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
17526
17527 /**
17528  * Frees any resources used by the HTLCDestination
17529  */
17530 void HTLCDestination_free(struct LDKHTLCDestination this_ptr);
17531
17532 /**
17533  * Creates a copy of the HTLCDestination
17534  */
17535 struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig);
17536
17537 /**
17538  * Utility method to constructs a new NextHopChannel-variant HTLCDestination
17539  */
17540 struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id);
17541
17542 /**
17543  * Utility method to constructs a new UnknownNextHop-variant HTLCDestination
17544  */
17545 struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid);
17546
17547 /**
17548  * Utility method to constructs a new FailedPayment-variant HTLCDestination
17549  */
17550 struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
17551
17552 /**
17553  * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
17554  */
17555 struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj);
17556
17557 /**
17558  * Read a HTLCDestination from a byte array, created by HTLCDestination_write
17559  */
17560 struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser);
17561
17562 /**
17563  * Frees any resources used by the Event
17564  */
17565 void Event_free(struct LDKEvent this_ptr);
17566
17567 /**
17568  * Creates a copy of the Event
17569  */
17570 struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
17571
17572 /**
17573  * Utility method to constructs a new FundingGenerationReady-variant Event
17574  */
17575 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);
17576
17577 /**
17578  * Utility method to constructs a new PaymentReceived-variant Event
17579  */
17580 struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
17581
17582 /**
17583  * Utility method to constructs a new PaymentClaimed-variant Event
17584  */
17585 struct LDKEvent Event_payment_claimed(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
17586
17587 /**
17588  * Utility method to constructs a new PaymentSent-variant Event
17589  */
17590 struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
17591
17592 /**
17593  * Utility method to constructs a new PaymentFailed-variant Event
17594  */
17595 struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
17596
17597 /**
17598  * Utility method to constructs a new PaymentPathSuccessful-variant Event
17599  */
17600 struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
17601
17602 /**
17603  * Utility method to constructs a new PaymentPathFailed-variant Event
17604  */
17605 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);
17606
17607 /**
17608  * Utility method to constructs a new ProbeSuccessful-variant Event
17609  */
17610 struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
17611
17612 /**
17613  * Utility method to constructs a new ProbeFailed-variant Event
17614  */
17615 struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id);
17616
17617 /**
17618  * Utility method to constructs a new PendingHTLCsForwardable-variant Event
17619  */
17620 struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
17621
17622 /**
17623  * Utility method to constructs a new SpendableOutputs-variant Event
17624  */
17625 struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
17626
17627 /**
17628  * Utility method to constructs a new PaymentForwarded-variant Event
17629  */
17630 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);
17631
17632 /**
17633  * Utility method to constructs a new ChannelClosed-variant Event
17634  */
17635 struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
17636
17637 /**
17638  * Utility method to constructs a new DiscardFunding-variant Event
17639  */
17640 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
17641
17642 /**
17643  * Utility method to constructs a new OpenChannelRequest-variant Event
17644  */
17645 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);
17646
17647 /**
17648  * Utility method to constructs a new HTLCHandlingFailed-variant Event
17649  */
17650 struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination);
17651
17652 /**
17653  * Serialize the Event object into a byte array which can be read by Event_read
17654  */
17655 struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
17656
17657 /**
17658  * Read a Event from a byte array, created by Event_write
17659  */
17660 struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
17661
17662 /**
17663  * Frees any resources used by the MessageSendEvent
17664  */
17665 void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
17666
17667 /**
17668  * Creates a copy of the MessageSendEvent
17669  */
17670 struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
17671
17672 /**
17673  * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
17674  */
17675 struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
17676
17677 /**
17678  * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
17679  */
17680 struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
17681
17682 /**
17683  * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
17684  */
17685 struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
17686
17687 /**
17688  * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
17689  */
17690 struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
17691
17692 /**
17693  * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
17694  */
17695 struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
17696
17697 /**
17698  * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
17699  */
17700 struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
17701
17702 /**
17703  * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
17704  */
17705 struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
17706
17707 /**
17708  * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
17709  */
17710 struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
17711
17712 /**
17713  * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
17714  */
17715 struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
17716
17717 /**
17718  * Utility method to constructs a new SendShutdown-variant MessageSendEvent
17719  */
17720 struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
17721
17722 /**
17723  * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
17724  */
17725 struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
17726
17727 /**
17728  * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
17729  */
17730 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
17731
17732 /**
17733  * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
17734  */
17735 struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
17736
17737 /**
17738  * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
17739  */
17740 struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
17741
17742 /**
17743  * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
17744  */
17745 struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
17746
17747 /**
17748  * Utility method to constructs a new HandleError-variant MessageSendEvent
17749  */
17750 struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
17751
17752 /**
17753  * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
17754  */
17755 struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
17756
17757 /**
17758  * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
17759  */
17760 struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
17761
17762 /**
17763  * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
17764  */
17765 struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
17766
17767 /**
17768  * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
17769  */
17770 struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
17771
17772 /**
17773  * Calls the free function if one is set
17774  */
17775 void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
17776
17777 /**
17778  * Calls the free function if one is set
17779  */
17780 void EventsProvider_free(struct LDKEventsProvider this_ptr);
17781
17782 /**
17783  * Calls the free function if one is set
17784  */
17785 void EventHandler_free(struct LDKEventHandler this_ptr);
17786
17787 /**
17788  * Frees any resources used by the APIError
17789  */
17790 void APIError_free(struct LDKAPIError this_ptr);
17791
17792 /**
17793  * Creates a copy of the APIError
17794  */
17795 struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
17796
17797 /**
17798  * Utility method to constructs a new APIMisuseError-variant APIError
17799  */
17800 struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
17801
17802 /**
17803  * Utility method to constructs a new FeeRateTooHigh-variant APIError
17804  */
17805 struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
17806
17807 /**
17808  * Utility method to constructs a new RouteError-variant APIError
17809  */
17810 struct LDKAPIError APIError_route_error(struct LDKStr err);
17811
17812 /**
17813  * Utility method to constructs a new ChannelUnavailable-variant APIError
17814  */
17815 struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
17816
17817 /**
17818  * Utility method to constructs a new MonitorUpdateFailed-variant APIError
17819  */
17820 struct LDKAPIError APIError_monitor_update_failed(void);
17821
17822 /**
17823  * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
17824  */
17825 struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
17826
17827 /**
17828  * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL.
17829  */
17830 void BigSize_free(struct LDKBigSize this_obj);
17831
17832 uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr);
17833
17834 void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val);
17835
17836 /**
17837  * Constructs a new BigSize given each field
17838  */
17839 MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg);
17840
17841 /**
17842  * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL.
17843  */
17844 void Hostname_free(struct LDKHostname this_obj);
17845
17846 /**
17847  * Creates a copy of the Hostname
17848  */
17849 struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig);
17850
17851 /**
17852  * Returns the length of the hostname.
17853  */
17854 MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg);
17855
17856 /**
17857  * Creates a digital signature of a message given a SecretKey, like the node's secret.
17858  * 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.
17859  * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
17860  */
17861 struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
17862
17863 /**
17864  * Recovers the PublicKey of the signer of the message given the message and the signature.
17865  */
17866 struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
17867
17868 /**
17869  * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
17870  * and the PublicKey.
17871  */
17872 bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
17873
17874 /**
17875  * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
17876  */
17877 struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
17878
17879 /**
17880  * Calls the free function if one is set
17881  */
17882 void Persister_free(struct LDKPersister this_ptr);
17883
17884 /**
17885  * Creates a copy of the Level
17886  */
17887 enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
17888
17889 /**
17890  * Utility method to constructs a new Gossip-variant Level
17891  */
17892 enum LDKLevel Level_gossip(void);
17893
17894 /**
17895  * Utility method to constructs a new Trace-variant Level
17896  */
17897 enum LDKLevel Level_trace(void);
17898
17899 /**
17900  * Utility method to constructs a new Debug-variant Level
17901  */
17902 enum LDKLevel Level_debug(void);
17903
17904 /**
17905  * Utility method to constructs a new Info-variant Level
17906  */
17907 enum LDKLevel Level_info(void);
17908
17909 /**
17910  * Utility method to constructs a new Warn-variant Level
17911  */
17912 enum LDKLevel Level_warn(void);
17913
17914 /**
17915  * Utility method to constructs a new Error-variant Level
17916  */
17917 enum LDKLevel Level_error(void);
17918
17919 /**
17920  * Checks if two Levels contain equal inner contents.
17921  * This ignores pointers and is_owned flags and looks at the values in fields.
17922  */
17923 bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
17924
17925 /**
17926  * Checks if two Levels contain equal inner contents.
17927  */
17928 uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
17929
17930 /**
17931  * Returns the most verbose logging level.
17932  */
17933 MUST_USE_RES enum LDKLevel Level_max(void);
17934
17935 /**
17936  * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
17937  */
17938 void Record_free(struct LDKRecord this_obj);
17939
17940 /**
17941  * The verbosity level of the message.
17942  */
17943 enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
17944
17945 /**
17946  * The verbosity level of the message.
17947  */
17948 void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
17949
17950 /**
17951  * The message body.
17952  */
17953 struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
17954
17955 /**
17956  * The message body.
17957  */
17958 void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17959
17960 /**
17961  * The module path of the message.
17962  */
17963 struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
17964
17965 /**
17966  * The module path of the message.
17967  */
17968 void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17969
17970 /**
17971  * The source file containing the message.
17972  */
17973 struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
17974
17975 /**
17976  * The source file containing the message.
17977  */
17978 void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
17979
17980 /**
17981  * The line containing the message.
17982  */
17983 uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
17984
17985 /**
17986  * The line containing the message.
17987  */
17988 void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
17989
17990 /**
17991  * Creates a copy of the Record
17992  */
17993 struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
17994
17995 /**
17996  * Calls the free function if one is set
17997  */
17998 void Logger_free(struct LDKLogger this_ptr);
17999
18000 /**
18001  * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
18002  */
18003 void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
18004
18005 /**
18006  * Confirmations we will wait for before considering the channel locked in.
18007  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
18008  * equivalent limit applied to outbound channels).
18009  *
18010  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
18011  * transaction before operation. If you wish to accept channels with zero confirmations, see
18012  * [`UserConfig::manually_accept_inbound_channels`] and
18013  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
18014  *
18015  * Default value: 6.
18016  *
18017  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18018  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
18019  */
18020 uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
18021
18022 /**
18023  * Confirmations we will wait for before considering the channel locked in.
18024  * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
18025  * equivalent limit applied to outbound channels).
18026  *
18027  * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment
18028  * transaction before operation. If you wish to accept channels with zero confirmations, see
18029  * [`UserConfig::manually_accept_inbound_channels`] and
18030  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`].
18031  *
18032  * Default value: 6.
18033  *
18034  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
18035  * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf
18036  */
18037 void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
18038
18039 /**
18040  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
18041  * the number of blocks we have to punish our counterparty if they broadcast a revoked
18042  * transaction).
18043  *
18044  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
18045  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
18046  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
18047  * possibly with time in between to RBF the spending transaction).
18048  *
18049  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
18050  * case of an honest unilateral channel close, which implicitly decrease the economic value of
18051  * our channel.
18052  *
18053  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
18054  * can tweak config to ask for more security, not less.
18055  */
18056 uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
18057
18058 /**
18059  * Set to the number of blocks we require our counterparty to wait to claim their money (ie
18060  * the number of blocks we have to punish our counterparty if they broadcast a revoked
18061  * transaction).
18062  *
18063  * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
18064  * be online to check for revoked transactions on-chain at least once every our_to_self_delay
18065  * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
18066  * possibly with time in between to RBF the spending transaction).
18067  *
18068  * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
18069  * case of an honest unilateral channel close, which implicitly decrease the economic value of
18070  * our channel.
18071  *
18072  * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
18073  * can tweak config to ask for more security, not less.
18074  */
18075 void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
18076
18077 /**
18078  * Set to the smallest value HTLC we will accept to process.
18079  *
18080  * This value is sent to our counterparty on channel-open and we close the channel any time
18081  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
18082  *
18083  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
18084  * by the protocol.
18085  */
18086 uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
18087
18088 /**
18089  * Set to the smallest value HTLC we will accept to process.
18090  *
18091  * This value is sent to our counterparty on channel-open and we close the channel any time
18092  * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
18093  *
18094  * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
18095  * by the protocol.
18096  */
18097 void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
18098
18099 /**
18100  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
18101  * HTLCs to.
18102  *
18103  * This can be set to a value between 1-100, where the value corresponds to the percent of the
18104  * channel value in whole percentages.
18105  *
18106  * Note that:
18107  * * If configured to another value than the default value 10, any new channels created with
18108  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
18109  * `ChannelManager`.
18110  *
18111  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
18112  * no way to configure the cap for the total value of outbound HTLCs in-flight.
18113  *
18114  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
18115  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
18116  * restrict exposure to loss due to being offline for too long.
18117  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
18118  * for more information.
18119  *
18120  * Default value: 10.
18121  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
18122  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
18123  */
18124 uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
18125
18126 /**
18127  * Sets the percentage of the channel value we will cap the total value of outstanding inbound
18128  * HTLCs to.
18129  *
18130  * This can be set to a value between 1-100, where the value corresponds to the percent of the
18131  * channel value in whole percentages.
18132  *
18133  * Note that:
18134  * * If configured to another value than the default value 10, any new channels created with
18135  * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the
18136  * `ChannelManager`.
18137  *
18138  * * This caps the total value for inbound HTLCs in-flight only, and there's currently
18139  * no way to configure the cap for the total value of outbound HTLCs in-flight.
18140  *
18141  * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds
18142  * are different from the non-HTLC-encumbered funds. This makes this an important knob to
18143  * restrict exposure to loss due to being offline for too long.
18144  * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`]
18145  * for more information.
18146  *
18147  * Default value: 10.
18148  * Minimum value: 1, any values less than 1 will be treated as 1 instead.
18149  * Maximum value: 100, any values larger than 100 will be treated as 100 instead.
18150  */
18151 void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val);
18152
18153 /**
18154  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
18155  * BOLTs) option for outbound private channels. This provides better privacy by not including
18156  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
18157  * relay HTLCs to us using the channel's SCID alias.
18158  *
18159  * If this option is set, channels may be created that will not be readable by LDK versions
18160  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
18161  * [`DecodeError::InvalidValue`].
18162  *
18163  * Note that setting this to true does *not* prevent us from opening channels with
18164  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
18165  * private channel without that option.
18166  *
18167  * Ignored if the channel is negotiated to be announced, see
18168  * [`ChannelHandshakeConfig::announced_channel`] and
18169  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
18170  *
18171  * Default value: false. This value is likely to change to true in the future.
18172  *
18173  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
18174  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
18175  */
18176 bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
18177
18178 /**
18179  * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
18180  * BOLTs) option for outbound private channels. This provides better privacy by not including
18181  * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
18182  * relay HTLCs to us using the channel's SCID alias.
18183  *
18184  * If this option is set, channels may be created that will not be readable by LDK versions
18185  * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
18186  * [`DecodeError::InvalidValue`].
18187  *
18188  * Note that setting this to true does *not* prevent us from opening channels with
18189  * counterparties that do not support the `scid_alias` option; we will simply fall back to a
18190  * private channel without that option.
18191  *
18192  * Ignored if the channel is negotiated to be announced, see
18193  * [`ChannelHandshakeConfig::announced_channel`] and
18194  * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
18195  *
18196  * Default value: false. This value is likely to change to true in the future.
18197  *
18198  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
18199  * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
18200  */
18201 void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
18202
18203 /**
18204  * Set to announce the channel publicly and notify all nodes that they can route via this
18205  * channel.
18206  *
18207  * This should only be set to true for nodes which expect to be online reliably.
18208  *
18209  * As the node which funds a channel picks this value this will only apply for new outbound
18210  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
18211  *
18212  * Default value: false.
18213  */
18214 bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
18215
18216 /**
18217  * Set to announce the channel publicly and notify all nodes that they can route via this
18218  * channel.
18219  *
18220  * This should only be set to true for nodes which expect to be online reliably.
18221  *
18222  * As the node which funds a channel picks this value this will only apply for new outbound
18223  * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
18224  *
18225  * Default value: false.
18226  */
18227 void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
18228
18229 /**
18230  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
18231  * supports it, they will then enforce the mutual-close output to us matches what we provided
18232  * at intialization, preventing us from closing to an alternate pubkey.
18233  *
18234  * This is set to true by default to provide a slight increase in security, though ultimately
18235  * any attacker who is able to take control of a channel can just as easily send the funds via
18236  * lightning payments, so we never require that our counterparties support this option.
18237  *
18238  * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
18239  *
18240  * Default value: true.
18241  *
18242  * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
18243  */
18244 bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
18245
18246 /**
18247  * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
18248  * supports it, they will then enforce the mutual-close output to us matches what we provided
18249  * at intialization, preventing us from closing to an alternate pubkey.
18250  *
18251  * This is set to true by default to provide a slight increase in security, though ultimately
18252  * any attacker who is able to take control of a channel can just as easily send the funds via
18253  * lightning payments, so we never require that our counterparties support this option.
18254  *
18255  * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
18256  *
18257  * Default value: true.
18258  *
18259  * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
18260  */
18261 void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
18262
18263 /**
18264  * Constructs a new ChannelHandshakeConfig given each field
18265  */
18266 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
18267
18268 /**
18269  * Creates a copy of the ChannelHandshakeConfig
18270  */
18271 struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
18272
18273 /**
18274  * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
18275  */
18276 MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
18277
18278 /**
18279  * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
18280  */
18281 void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
18282
18283 /**
18284  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
18285  * only applies to inbound channels.
18286  *
18287  * Default value: 0.
18288  */
18289 uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18290
18291 /**
18292  * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so
18293  * only applies to inbound channels.
18294  *
18295  * Default value: 0.
18296  */
18297 void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
18298
18299 /**
18300  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
18301  * only applies to inbound channels.
18302  *
18303  * Default value: 2^24 - 1.
18304  */
18305 uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18306
18307 /**
18308  * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so
18309  * only applies to inbound channels.
18310  *
18311  * Default value: 2^24 - 1.
18312  */
18313 void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
18314
18315 /**
18316  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
18317  * you to limit the maximum minimum-size they can require.
18318  *
18319  * Default value: u64::max_value.
18320  */
18321 uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18322
18323 /**
18324  * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
18325  * you to limit the maximum minimum-size they can require.
18326  *
18327  * Default value: u64::max_value.
18328  */
18329 void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
18330
18331 /**
18332  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
18333  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
18334  *
18335  * Default value: 0.
18336  */
18337 uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18338
18339 /**
18340  * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
18341  * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
18342  *
18343  * Default value: 0.
18344  */
18345 void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
18346
18347 /**
18348  * The remote node will require we keep a certain amount in direct payment to ourselves at all
18349  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
18350  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
18351  *
18352  * Default value: u64::max_value.
18353  */
18354 uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18355
18356 /**
18357  * The remote node will require we keep a certain amount in direct payment to ourselves at all
18358  * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
18359  * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
18360  *
18361  * Default value: u64::max_value.
18362  */
18363 void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
18364
18365 /**
18366  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
18367  * time. This allows you to set a minimum such value.
18368  *
18369  * Default value: 0.
18370  */
18371 uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18372
18373 /**
18374  * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
18375  * time. This allows you to set a minimum such value.
18376  *
18377  * Default value: 0.
18378  */
18379 void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
18380
18381 /**
18382  * Before a channel is usable the funding transaction will need to be confirmed by at least a
18383  * certain number of blocks, specified by the node which is not the funder (as the funder can
18384  * assume they aren't going to double-spend themselves).
18385  * This config allows you to set a limit on the maximum amount of time to wait.
18386  *
18387  * Default value: 144, or roughly one day and only applies to outbound channels.
18388  */
18389 uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18390
18391 /**
18392  * Before a channel is usable the funding transaction will need to be confirmed by at least a
18393  * certain number of blocks, specified by the node which is not the funder (as the funder can
18394  * assume they aren't going to double-spend themselves).
18395  * This config allows you to set a limit on the maximum amount of time to wait.
18396  *
18397  * Default value: 144, or roughly one day and only applies to outbound channels.
18398  */
18399 void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
18400
18401 /**
18402  * Whether we implicitly trust funding transactions generated by us for our own outbound
18403  * channels to not be double-spent.
18404  *
18405  * If this is set, we assume that our own funding transactions are *never* double-spent, and
18406  * thus we can trust them without any confirmations. This is generally a reasonable
18407  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
18408  * control of the signing keys).
18409  *
18410  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
18411  * double-spend the funding transaction to RBF with an alternative channel open.
18412  *
18413  * This only applies if our counterparty set their confirmations-required value to 0, and we
18414  * always trust our own funding transaction at 1 confirmation irrespective of this value.
18415  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
18416  * `true` (0) and `false` (1).
18417  *
18418  * Default value: true
18419  */
18420 bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18421
18422 /**
18423  * Whether we implicitly trust funding transactions generated by us for our own outbound
18424  * channels to not be double-spent.
18425  *
18426  * If this is set, we assume that our own funding transactions are *never* double-spent, and
18427  * thus we can trust them without any confirmations. This is generally a reasonable
18428  * assumption, given we're the only ones who could ever double-spend it (assuming we have sole
18429  * control of the signing keys).
18430  *
18431  * You may wish to un-set this if you allow the user to (or do in an automated fashion)
18432  * double-spend the funding transaction to RBF with an alternative channel open.
18433  *
18434  * This only applies if our counterparty set their confirmations-required value to 0, and we
18435  * always trust our own funding transaction at 1 confirmation irrespective of this value.
18436  * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being
18437  * `true` (0) and `false` (1).
18438  *
18439  * Default value: true
18440  */
18441 void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
18442
18443 /**
18444  * Set to force an incoming channel to match our announced channel preference in
18445  * [`ChannelHandshakeConfig::announced_channel`].
18446  *
18447  * For a node which is not online reliably, this should be set to true and
18448  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
18449  * channels will ever be opened.
18450  *
18451  * Default value: true.
18452  */
18453 bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18454
18455 /**
18456  * Set to force an incoming channel to match our announced channel preference in
18457  * [`ChannelHandshakeConfig::announced_channel`].
18458  *
18459  * For a node which is not online reliably, this should be set to true and
18460  * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
18461  * channels will ever be opened.
18462  *
18463  * Default value: true.
18464  */
18465 void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
18466
18467 /**
18468  * Set to the amount of time we're willing to wait to claim money back to us.
18469  *
18470  * Not checking this value would be a security issue, as our peer would be able to set it to
18471  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
18472  *
18473  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
18474  * reduce the loss of having useless locked funds (if your peer accepts)
18475  */
18476 uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
18477
18478 /**
18479  * Set to the amount of time we're willing to wait to claim money back to us.
18480  *
18481  * Not checking this value would be a security issue, as our peer would be able to set it to
18482  * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
18483  *
18484  * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
18485  * reduce the loss of having useless locked funds (if your peer accepts)
18486  */
18487 void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
18488
18489 /**
18490  * Constructs a new ChannelHandshakeLimits given each field
18491  */
18492 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);
18493
18494 /**
18495  * Creates a copy of the ChannelHandshakeLimits
18496  */
18497 struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
18498
18499 /**
18500  * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
18501  */
18502 MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
18503
18504 /**
18505  * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
18506  */
18507 void ChannelConfig_free(struct LDKChannelConfig this_obj);
18508
18509 /**
18510  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
18511  * over the channel.
18512  * This may be allowed to change at runtime in a later update, however doing so must result in
18513  * update messages sent to notify all nodes of our updated relay fee.
18514  *
18515  * Default value: 0.
18516  */
18517 uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18518
18519 /**
18520  * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
18521  * over the channel.
18522  * This may be allowed to change at runtime in a later update, however doing so must result in
18523  * update messages sent to notify all nodes of our updated relay fee.
18524  *
18525  * Default value: 0.
18526  */
18527 void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
18528
18529 /**
18530  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
18531  * excess of [`forwarding_fee_proportional_millionths`].
18532  * This may be allowed to change at runtime in a later update, however doing so must result in
18533  * update messages sent to notify all nodes of our updated relay fee.
18534  *
18535  * The default value of a single satoshi roughly matches the market rate on many routing nodes
18536  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
18537  * this node.
18538  *
18539  * Default value: 1000.
18540  *
18541  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
18542  */
18543 uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18544
18545 /**
18546  * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
18547  * excess of [`forwarding_fee_proportional_millionths`].
18548  * This may be allowed to change at runtime in a later update, however doing so must result in
18549  * update messages sent to notify all nodes of our updated relay fee.
18550  *
18551  * The default value of a single satoshi roughly matches the market rate on many routing nodes
18552  * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
18553  * this node.
18554  *
18555  * Default value: 1000.
18556  *
18557  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
18558  */
18559 void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
18560
18561 /**
18562  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
18563  * the channel this config applies to.
18564  *
18565  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
18566  * HTLC balance when a channel appears on-chain whereas
18567  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
18568  * (non-HTLC-encumbered) balance.
18569  *
18570  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
18571  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
18572  * commitment transaction at least once per this many blocks (minus some margin to allow us
18573  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
18574  * the spending transaction).
18575  *
18576  * Default value: 72 (12 hours at an average of 6 blocks/hour).
18577  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
18578  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
18579  *
18580  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
18581  */
18582 uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18583
18584 /**
18585  * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
18586  * the channel this config applies to.
18587  *
18588  * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
18589  * HTLC balance when a channel appears on-chain whereas
18590  * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
18591  * (non-HTLC-encumbered) balance.
18592  *
18593  * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
18594  * we (or one of our watchtowers) MUST be online to check for broadcast of the current
18595  * commitment transaction at least once per this many blocks (minus some margin to allow us
18596  * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
18597  * the spending transaction).
18598  *
18599  * Default value: 72 (12 hours at an average of 6 blocks/hour).
18600  * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
18601  *                [`MIN_CLTV_EXPIRY_DELTA`] instead.
18602  *
18603  * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
18604  */
18605 void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
18606
18607 /**
18608  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
18609  * small to claim on-chain.
18610  *
18611  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
18612  * not be claimable on-chain, instead being turned into additional miner fees if either
18613  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
18614  * to such payments may be sustantial if there are many dust HTLCs present when the
18615  * channel is force-closed.
18616  *
18617  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
18618  * exposure across all three types per-channel. Setting this too low may prevent the
18619  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
18620  * important to prevent stealing of dust HTLCs by miners.
18621  *
18622  * Default value: 5_000_000 msat.
18623  */
18624 uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18625
18626 /**
18627  * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
18628  * small to claim on-chain.
18629  *
18630  * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
18631  * not be claimable on-chain, instead being turned into additional miner fees if either
18632  * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
18633  * to such payments may be sustantial if there are many dust HTLCs present when the
18634  * channel is force-closed.
18635  *
18636  * This limit is applied for sent, forwarded, and received HTLCs and limits the total
18637  * exposure across all three types per-channel. Setting this too low may prevent the
18638  * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
18639  * important to prevent stealing of dust HTLCs by miners.
18640  *
18641  * Default value: 5_000_000 msat.
18642  */
18643 void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
18644
18645 /**
18646  * The additional fee we're willing to pay to avoid waiting for the counterparty's
18647  * `to_self_delay` to reclaim funds.
18648  *
18649  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
18650  * closing transaction which both sides find acceptable, ultimately paid by the channel
18651  * funder/initiator.
18652  *
18653  * When we are the funder, because we have to pay the channel closing fee, we bound the
18654  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
18655  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
18656  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
18657  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
18658  * funds.
18659  *
18660  * When we are not the funder, we require the closing transaction fee pay at least our
18661  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
18662  * Thus, this value is ignored when we are not the funder.
18663  *
18664  * Default value: 1000 satoshis.
18665  *
18666  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
18667  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
18668  */
18669 uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
18670
18671 /**
18672  * The additional fee we're willing to pay to avoid waiting for the counterparty's
18673  * `to_self_delay` to reclaim funds.
18674  *
18675  * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
18676  * closing transaction which both sides find acceptable, ultimately paid by the channel
18677  * funder/initiator.
18678  *
18679  * When we are the funder, because we have to pay the channel closing fee, we bound the
18680  * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
18681  * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
18682  * [`Normal`] feerate during normal operation, this value represents the additional fee we're
18683  * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
18684  * funds.
18685  *
18686  * When we are not the funder, we require the closing transaction fee pay at least our
18687  * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
18688  * Thus, this value is ignored when we are not the funder.
18689  *
18690  * Default value: 1000 satoshis.
18691  *
18692  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
18693  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
18694  */
18695 void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
18696
18697 /**
18698  * Constructs a new ChannelConfig given each field
18699  */
18700 MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
18701
18702 /**
18703  * Creates a copy of the ChannelConfig
18704  */
18705 struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
18706
18707 /**
18708  * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
18709  */
18710 MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
18711
18712 /**
18713  * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
18714  */
18715 struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
18716
18717 /**
18718  * Read a ChannelConfig from a byte array, created by ChannelConfig_write
18719  */
18720 struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
18721
18722 /**
18723  * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
18724  */
18725 void UserConfig_free(struct LDKUserConfig this_obj);
18726
18727 /**
18728  * Channel handshake config that we propose to our counterparty.
18729  */
18730 struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18731
18732 /**
18733  * Channel handshake config that we propose to our counterparty.
18734  */
18735 void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
18736
18737 /**
18738  * Limits applied to our counterparty's proposed channel handshake config settings.
18739  */
18740 struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18741
18742 /**
18743  * Limits applied to our counterparty's proposed channel handshake config settings.
18744  */
18745 void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
18746
18747 /**
18748  * Channel config which affects behavior during channel lifetime.
18749  */
18750 struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18751
18752 /**
18753  * Channel config which affects behavior during channel lifetime.
18754  */
18755 void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
18756
18757 /**
18758  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
18759  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
18760  * node which is not online reliably.
18761  *
18762  * For nodes which are not online reliably, you should set all channels to *not* be announced
18763  * (using [`ChannelHandshakeConfig::announced_channel`] and
18764  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
18765  * ensure you are not exposed to any forwarding risk.
18766  *
18767  * Note that because you cannot change a channel's announced state after creation, there is no
18768  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
18769  * from a publicly-announced forwarding node to a private non-forwarding node you must close
18770  * all your channels and open new ones. For privacy, you should also change your node_id
18771  * (swapping all private and public key material for new ones) at that time.
18772  *
18773  * Default value: false.
18774  */
18775 bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18776
18777 /**
18778  * If this is set to false, we will reject any HTLCs which were to be forwarded over private
18779  * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
18780  * node which is not online reliably.
18781  *
18782  * For nodes which are not online reliably, you should set all channels to *not* be announced
18783  * (using [`ChannelHandshakeConfig::announced_channel`] and
18784  * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
18785  * ensure you are not exposed to any forwarding risk.
18786  *
18787  * Note that because you cannot change a channel's announced state after creation, there is no
18788  * way to disable forwarding on public channels retroactively. Thus, in order to change a node
18789  * from a publicly-announced forwarding node to a private non-forwarding node you must close
18790  * all your channels and open new ones. For privacy, you should also change your node_id
18791  * (swapping all private and public key material for new ones) at that time.
18792  *
18793  * Default value: false.
18794  */
18795 void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18796
18797 /**
18798  * If this is set to false, we do not accept inbound requests to open a new channel.
18799  * Default value: true.
18800  */
18801 bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18802
18803 /**
18804  * If this is set to false, we do not accept inbound requests to open a new channel.
18805  * Default value: true.
18806  */
18807 void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18808
18809 /**
18810  * If this is set to true, the user needs to manually accept inbound requests to open a new
18811  * channel.
18812  *
18813  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
18814  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
18815  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
18816  * user explicitly chooses to accept the request.
18817  *
18818  * Default value: false.
18819  *
18820  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
18821  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
18822  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
18823  */
18824 bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
18825
18826 /**
18827  * If this is set to true, the user needs to manually accept inbound requests to open a new
18828  * channel.
18829  *
18830  * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
18831  * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
18832  * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
18833  * user explicitly chooses to accept the request.
18834  *
18835  * Default value: false.
18836  *
18837  * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
18838  * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
18839  * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
18840  */
18841 void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
18842
18843 /**
18844  * Constructs a new UserConfig given each field
18845  */
18846 MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig channel_handshake_config_arg, struct LDKChannelHandshakeLimits channel_handshake_limits_arg, struct LDKChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg);
18847
18848 /**
18849  * Creates a copy of the UserConfig
18850  */
18851 struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
18852
18853 /**
18854  * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
18855  */
18856 MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
18857
18858 /**
18859  * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
18860  */
18861 void BestBlock_free(struct LDKBestBlock this_obj);
18862
18863 /**
18864  * Creates a copy of the BestBlock
18865  */
18866 struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
18867
18868 /**
18869  * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
18870  * network.
18871  */
18872 MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
18873
18874 /**
18875  * Returns a `BestBlock` as identified by the given block hash and height.
18876  */
18877 MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
18878
18879 /**
18880  * Returns the best block hash.
18881  */
18882 MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
18883
18884 /**
18885  * Returns the best block height.
18886  */
18887 MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
18888
18889 /**
18890  * Creates a copy of the AccessError
18891  */
18892 enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
18893
18894 /**
18895  * Utility method to constructs a new UnknownChain-variant AccessError
18896  */
18897 enum LDKAccessError AccessError_unknown_chain(void);
18898
18899 /**
18900  * Utility method to constructs a new UnknownTx-variant AccessError
18901  */
18902 enum LDKAccessError AccessError_unknown_tx(void);
18903
18904 /**
18905  * Calls the free function if one is set
18906  */
18907 void Access_free(struct LDKAccess this_ptr);
18908
18909 /**
18910  * Calls the free function if one is set
18911  */
18912 void Listen_free(struct LDKListen this_ptr);
18913
18914 /**
18915  * Calls the free function if one is set
18916  */
18917 void Confirm_free(struct LDKConfirm this_ptr);
18918
18919 /**
18920  * Creates a copy of the ChannelMonitorUpdateErr
18921  */
18922 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
18923
18924 /**
18925  * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
18926  */
18927 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
18928
18929 /**
18930  * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
18931  */
18932 enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
18933
18934 /**
18935  * Calls the free function if one is set
18936  */
18937 void Watch_free(struct LDKWatch this_ptr);
18938
18939 /**
18940  * Calls the free function if one is set
18941  */
18942 void Filter_free(struct LDKFilter this_ptr);
18943
18944 /**
18945  * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
18946  */
18947 void WatchedOutput_free(struct LDKWatchedOutput this_obj);
18948
18949 /**
18950  * First block where the transaction output may have been spent.
18951  *
18952  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
18953  */
18954 struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18955
18956 /**
18957  * First block where the transaction output may have been spent.
18958  *
18959  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
18960  */
18961 void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
18962
18963 /**
18964  * Outpoint identifying the transaction output.
18965  */
18966 struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18967
18968 /**
18969  * Outpoint identifying the transaction output.
18970  */
18971 void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
18972
18973 /**
18974  * Spending condition of the transaction output.
18975  */
18976 struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
18977
18978 /**
18979  * Spending condition of the transaction output.
18980  */
18981 void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
18982
18983 /**
18984  * Constructs a new WatchedOutput given each field
18985  */
18986 MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
18987
18988 /**
18989  * Creates a copy of the WatchedOutput
18990  */
18991 struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
18992
18993 /**
18994  * Checks if two WatchedOutputs contain equal inner contents.
18995  */
18996 uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
18997
18998 /**
18999  * Calls the free function if one is set
19000  */
19001 void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
19002
19003 /**
19004  * Creates a copy of the ConfirmationTarget
19005  */
19006 enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
19007
19008 /**
19009  * Utility method to constructs a new Background-variant ConfirmationTarget
19010  */
19011 enum LDKConfirmationTarget ConfirmationTarget_background(void);
19012
19013 /**
19014  * Utility method to constructs a new Normal-variant ConfirmationTarget
19015  */
19016 enum LDKConfirmationTarget ConfirmationTarget_normal(void);
19017
19018 /**
19019  * Utility method to constructs a new HighPriority-variant ConfirmationTarget
19020  */
19021 enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
19022
19023 /**
19024  * Checks if two ConfirmationTargets contain equal inner contents.
19025  * This ignores pointers and is_owned flags and looks at the values in fields.
19026  */
19027 bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
19028
19029 /**
19030  * Calls the free function if one is set
19031  */
19032 void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
19033
19034 /**
19035  * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
19036  */
19037 void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
19038
19039 /**
19040  * Creates a copy of the MonitorUpdateId
19041  */
19042 struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
19043
19044 /**
19045  * Checks if two MonitorUpdateIds contain equal inner contents.
19046  */
19047 uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
19048
19049 /**
19050  * Checks if two MonitorUpdateIds contain equal inner contents.
19051  * This ignores pointers and is_owned flags and looks at the values in fields.
19052  * Two objects with NULL inner values will be considered "equal" here.
19053  */
19054 bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
19055
19056 /**
19057  * Calls the free function if one is set
19058  */
19059 void Persist_free(struct LDKPersist this_ptr);
19060
19061 /**
19062  * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
19063  */
19064 void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
19065
19066 /**
19067  * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
19068  */
19069 void ChainMonitor_free(struct LDKChainMonitor this_obj);
19070
19071 /**
19072  * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
19073  *
19074  * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
19075  * will call back to it indicating transactions and outputs of interest. This allows clients to
19076  * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
19077  * always need to fetch full blocks absent another means for determining which blocks contain
19078  * transactions relevant to the watched channels.
19079  */
19080 MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
19081
19082 /**
19083  * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
19084  * claims which are awaiting confirmation.
19085  *
19086  * Includes the balances from each [`ChannelMonitor`] *except* those included in
19087  * `ignored_channels`, allowing you to filter out balances from channels which are still open
19088  * (and whose balance should likely be pulled from the [`ChannelDetails`]).
19089  *
19090  * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
19091  * inclusion in the return value.
19092  */
19093 MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
19094
19095 /**
19096  * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
19097  * such [`ChannelMonitor`] is currently being monitored for.
19098  *
19099  * Note that the result holds a mutex over our monitor set, and should not be held
19100  * indefinitely.
19101  */
19102 MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
19103
19104 /**
19105  * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
19106  *
19107  * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
19108  * monitoring for on-chain state resolutions.
19109  */
19110 MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
19111
19112 /**
19113  * Indicates the persistence of a [`ChannelMonitor`] has completed after
19114  * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
19115  *
19116  * Thus, the anticipated use is, at a high level:
19117  *  1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
19118  *     update to disk and begins updating any remote (e.g. watchtower/backup) copies,
19119  *     returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
19120  *  2) once all remote copies are updated, you call this function with the
19121  *     `completed_update_id` that completed, and once all pending updates have completed the
19122  *     channel will be re-enabled.
19123  *
19124  * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
19125  * registered [`ChannelMonitor`]s.
19126  */
19127 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);
19128
19129 /**
19130  * Constructs a new Listen which calls the relevant methods on this_arg.
19131  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
19132  */
19133 struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
19134
19135 /**
19136  * Constructs a new Confirm which calls the relevant methods on this_arg.
19137  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
19138  */
19139 struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
19140
19141 /**
19142  * Constructs a new Watch which calls the relevant methods on this_arg.
19143  * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
19144  */
19145 struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
19146
19147 /**
19148  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
19149  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
19150  */
19151 struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
19152
19153 /**
19154  * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
19155  */
19156 void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
19157
19158 /**
19159  * The sequence number of this update. Updates *must* be replayed in-order according to this
19160  * sequence number (and updates may panic if they are not). The update_id values are strictly
19161  * increasing and increase by one for each new update, with one exception specified below.
19162  *
19163  * This sequence number is also used to track up to which points updates which returned
19164  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
19165  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
19166  *
19167  * The only instance where update_id values are not strictly increasing is the case where we
19168  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
19169  * its docs for more details.
19170  */
19171 uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
19172
19173 /**
19174  * The sequence number of this update. Updates *must* be replayed in-order according to this
19175  * sequence number (and updates may panic if they are not). The update_id values are strictly
19176  * increasing and increase by one for each new update, with one exception specified below.
19177  *
19178  * This sequence number is also used to track up to which points updates which returned
19179  * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
19180  * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
19181  *
19182  * The only instance where update_id values are not strictly increasing is the case where we
19183  * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
19184  * its docs for more details.
19185  */
19186 void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
19187
19188 /**
19189  * Creates a copy of the ChannelMonitorUpdate
19190  */
19191 struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
19192
19193 /**
19194  * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
19195  */
19196 struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
19197
19198 /**
19199  * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
19200  */
19201 struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
19202
19203 /**
19204  * Frees any resources used by the MonitorEvent
19205  */
19206 void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
19207
19208 /**
19209  * Creates a copy of the MonitorEvent
19210  */
19211 struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
19212
19213 /**
19214  * Utility method to constructs a new HTLCEvent-variant MonitorEvent
19215  */
19216 struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
19217
19218 /**
19219  * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
19220  */
19221 struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
19222
19223 /**
19224  * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
19225  */
19226 struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
19227
19228 /**
19229  * Utility method to constructs a new UpdateFailed-variant MonitorEvent
19230  */
19231 struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
19232
19233 /**
19234  * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
19235  */
19236 struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
19237
19238 /**
19239  * Read a MonitorEvent from a byte array, created by MonitorEvent_write
19240  */
19241 struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
19242
19243 /**
19244  * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
19245  */
19246 void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
19247
19248 /**
19249  * Creates a copy of the HTLCUpdate
19250  */
19251 struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
19252
19253 /**
19254  * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
19255  */
19256 struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
19257
19258 /**
19259  * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
19260  */
19261 struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
19262
19263 /**
19264  * Frees any resources used by the Balance
19265  */
19266 void Balance_free(struct LDKBalance this_ptr);
19267
19268 /**
19269  * Creates a copy of the Balance
19270  */
19271 struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
19272
19273 /**
19274  * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
19275  */
19276 struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
19277
19278 /**
19279  * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
19280  */
19281 struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
19282
19283 /**
19284  * Utility method to constructs a new ContentiousClaimable-variant Balance
19285  */
19286 struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
19287
19288 /**
19289  * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
19290  */
19291 struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
19292
19293 /**
19294  * Checks if two Balances contain equal inner contents.
19295  * This ignores pointers and is_owned flags and looks at the values in fields.
19296  */
19297 bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
19298
19299 /**
19300  * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
19301  */
19302 void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
19303
19304 /**
19305  * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
19306  */
19307 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
19308
19309 /**
19310  * Updates a ChannelMonitor on the basis of some new information provided by the Channel
19311  * itself.
19312  *
19313  * panics if the given update is not the next update by update_id.
19314  */
19315 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, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
19316
19317 /**
19318  * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
19319  * ChannelMonitor.
19320  */
19321 MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19322
19323 /**
19324  * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
19325  */
19326 MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19327
19328 /**
19329  * Gets a list of txids, with their output scripts (in the order they appear in the
19330  * transaction), which we must learn about spends of via block_connected().
19331  */
19332 MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19333
19334 /**
19335  * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
19336  * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
19337  * have been registered.
19338  */
19339 void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
19340
19341 /**
19342  * Get the list of HTLCs who's status has been updated on chain. This should be called by
19343  * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
19344  */
19345 MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19346
19347 /**
19348  * Gets the list of pending events which were generated by previous actions, clearing the list
19349  * in the process.
19350  *
19351  * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
19352  * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
19353  * no internal locking in ChannelMonitors.
19354  */
19355 MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19356
19357 /**
19358  * Gets the `node_id` of the counterparty for this channel.
19359  *
19360  * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some`
19361  * otherwise.
19362  *
19363  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
19364  */
19365 MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19366
19367 /**
19368  * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
19369  * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
19370  * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
19371  * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
19372  * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
19373  * broadcast them if counterparty don't close channel with his higher commitment transaction after a
19374  * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
19375  * out-of-band the other node operator to coordinate with him if option is available to you.
19376  * In any-case, choice is up to the user.
19377  */
19378 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);
19379
19380 /**
19381  * Processes transactions in a newly connected block, which may result in any of the following:
19382  * - update the monitor's state against resolved HTLCs
19383  * - punish the counterparty in the case of seeing a revoked commitment transaction
19384  * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
19385  * - detect settled outputs for later spending
19386  * - schedule and bump any in-flight claims
19387  *
19388  * Returns any new outputs to watch from `txdata`; after called, these are also included in
19389  * [`get_outputs_to_watch`].
19390  *
19391  * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
19392  */
19393 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);
19394
19395 /**
19396  * Determines if the disconnected block contained any transactions of interest and updates
19397  * appropriately.
19398  */
19399 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);
19400
19401 /**
19402  * Processes transactions confirmed in a block with the given header and height, returning new
19403  * outputs to watch. See [`block_connected`] for details.
19404  *
19405  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
19406  * blocks. See [`chain::Confirm`] for calling expectations.
19407  *
19408  * [`block_connected`]: Self::block_connected
19409  */
19410 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);
19411
19412 /**
19413  * Processes a transaction that was reorganized out of the chain.
19414  *
19415  * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
19416  * than blocks. See [`chain::Confirm`] for calling expectations.
19417  *
19418  * [`block_disconnected`]: Self::block_disconnected
19419  */
19420 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);
19421
19422 /**
19423  * Updates the monitor with the current best chain tip, returning new outputs to watch. See
19424  * [`block_connected`] for details.
19425  *
19426  * Used instead of [`block_connected`] by clients that are notified of transactions rather than
19427  * blocks. See [`chain::Confirm`] for calling expectations.
19428  *
19429  * [`block_connected`]: Self::block_connected
19430  */
19431 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);
19432
19433 /**
19434  * Returns the set of txids that should be monitored for re-organization out of the chain.
19435  */
19436 MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19437
19438 /**
19439  * Gets the latest best block which was connected either via the [`chain::Listen`] or
19440  * [`chain::Confirm`] interfaces.
19441  */
19442 MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19443
19444 /**
19445  * Gets the balances in this channel which are either claimable by us if we were to
19446  * force-close the channel now or which are claimable on-chain (possibly awaiting
19447  * confirmation).
19448  *
19449  * Any balances in the channel which are available on-chain (excluding on-chain fees) are
19450  * included here until an [`Event::SpendableOutputs`] event has been generated for the
19451  * balance, or until our counterparty has claimed the balance and accrued several
19452  * confirmations on the claim transaction.
19453  *
19454  * Note that the balances available when you or your counterparty have broadcasted revoked
19455  * state(s) may not be fully captured here.
19456  *
19457  * See [`Balance`] for additional details on the types of claimable balances which
19458  * may be returned here and their meanings.
19459  */
19460 MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
19461
19462 /**
19463  * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
19464  */
19465 struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
19466
19467 /**
19468  * Frees any resources used by the OutPoint, if is_owned is set and inner is non-NULL.
19469  */
19470 void OutPoint_free(struct LDKOutPoint this_obj);
19471
19472 /**
19473  * The referenced transaction's txid.
19474  */
19475 const uint8_t (*OutPoint_get_txid(const struct LDKOutPoint *NONNULL_PTR this_ptr))[32];
19476
19477 /**
19478  * The referenced transaction's txid.
19479  */
19480 void OutPoint_set_txid(struct LDKOutPoint *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19481
19482 /**
19483  * The index of the referenced output in its transaction's vout.
19484  */
19485 uint16_t OutPoint_get_index(const struct LDKOutPoint *NONNULL_PTR this_ptr);
19486
19487 /**
19488  * The index of the referenced output in its transaction's vout.
19489  */
19490 void OutPoint_set_index(struct LDKOutPoint *NONNULL_PTR this_ptr, uint16_t val);
19491
19492 /**
19493  * Constructs a new OutPoint given each field
19494  */
19495 MUST_USE_RES struct LDKOutPoint OutPoint_new(struct LDKThirtyTwoBytes txid_arg, uint16_t index_arg);
19496
19497 /**
19498  * Creates a copy of the OutPoint
19499  */
19500 struct LDKOutPoint OutPoint_clone(const struct LDKOutPoint *NONNULL_PTR orig);
19501
19502 /**
19503  * Checks if two OutPoints contain equal inner contents.
19504  * This ignores pointers and is_owned flags and looks at the values in fields.
19505  * Two objects with NULL inner values will be considered "equal" here.
19506  */
19507 bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
19508
19509 /**
19510  * Checks if two OutPoints contain equal inner contents.
19511  */
19512 uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
19513
19514 /**
19515  * Convert an `OutPoint` to a lightning channel id.
19516  */
19517 MUST_USE_RES struct LDKThirtyTwoBytes OutPoint_to_channel_id(const struct LDKOutPoint *NONNULL_PTR this_arg);
19518
19519 /**
19520  * Serialize the OutPoint object into a byte array which can be read by OutPoint_read
19521  */
19522 struct LDKCVec_u8Z OutPoint_write(const struct LDKOutPoint *NONNULL_PTR obj);
19523
19524 /**
19525  * Read a OutPoint from a byte array, created by OutPoint_write
19526  */
19527 struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser);
19528
19529 /**
19530  * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
19531  */
19532 void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj);
19533
19534 /**
19535  * The outpoint which is spendable
19536  */
19537 struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19538
19539 /**
19540  * The outpoint which is spendable
19541  */
19542 void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19543
19544 /**
19545  * Per commitment point to derive delayed_payment_key by key holder
19546  */
19547 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19548
19549 /**
19550  * Per commitment point to derive delayed_payment_key by key holder
19551  */
19552 void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19553
19554 /**
19555  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
19556  * the witness_script.
19557  */
19558 uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19559
19560 /**
19561  * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
19562  * the witness_script.
19563  */
19564 void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val);
19565
19566 /**
19567  * The output which is referenced by the given outpoint
19568  */
19569 void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
19570
19571 /**
19572  * The revocation point specific to the commitment transaction which was broadcast. Used to
19573  * derive the witnessScript for this output.
19574  */
19575 struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19576
19577 /**
19578  * The revocation point specific to the commitment transaction which was broadcast. Used to
19579  * derive the witnessScript for this output.
19580  */
19581 void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val);
19582
19583 /**
19584  * Arbitrary identification information returned by a call to
19585  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19586  * the channel to spend the output.
19587  */
19588 const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
19589
19590 /**
19591  * Arbitrary identification information returned by a call to
19592  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19593  * the channel to spend the output.
19594  */
19595 void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19596
19597 /**
19598  * The value of the channel which this output originated from, possibly indirectly.
19599  */
19600 uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19601
19602 /**
19603  * The value of the channel which this output originated from, possibly indirectly.
19604  */
19605 void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
19606
19607 /**
19608  * Constructs a new DelayedPaymentOutputDescriptor given each field
19609  */
19610 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);
19611
19612 /**
19613  * Creates a copy of the DelayedPaymentOutputDescriptor
19614  */
19615 struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig);
19616
19617 /**
19618  * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
19619  */
19620 struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj);
19621
19622 /**
19623  * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
19624  */
19625 struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser);
19626
19627 /**
19628  * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL.
19629  */
19630 void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj);
19631
19632 /**
19633  * The outpoint which is spendable
19634  */
19635 struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19636
19637 /**
19638  * The outpoint which is spendable
19639  */
19640 void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val);
19641
19642 /**
19643  * The output which is referenced by the given outpoint
19644  */
19645 void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val);
19646
19647 /**
19648  * Arbitrary identification information returned by a call to
19649  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19650  * the channel to spend the output.
19651  */
19652 const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32];
19653
19654 /**
19655  * Arbitrary identification information returned by a call to
19656  * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
19657  * the channel to spend the output.
19658  */
19659 void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19660
19661 /**
19662  * The value of the channel which this transactions spends.
19663  */
19664 uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr);
19665
19666 /**
19667  * The value of the channel which this transactions spends.
19668  */
19669 void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val);
19670
19671 /**
19672  * Constructs a new StaticPaymentOutputDescriptor given each field
19673  */
19674 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);
19675
19676 /**
19677  * Creates a copy of the StaticPaymentOutputDescriptor
19678  */
19679 struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig);
19680
19681 /**
19682  * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
19683  */
19684 struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj);
19685
19686 /**
19687  * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
19688  */
19689 struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser);
19690
19691 /**
19692  * Frees any resources used by the SpendableOutputDescriptor
19693  */
19694 void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr);
19695
19696 /**
19697  * Creates a copy of the SpendableOutputDescriptor
19698  */
19699 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig);
19700
19701 /**
19702  * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
19703  */
19704 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output);
19705
19706 /**
19707  * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
19708  */
19709 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a);
19710
19711 /**
19712  * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
19713  */
19714 struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a);
19715
19716 /**
19717  * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
19718  */
19719 struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj);
19720
19721 /**
19722  * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
19723  */
19724 struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser);
19725
19726 /**
19727  * Calls the free function if one is set
19728  */
19729 void BaseSign_free(struct LDKBaseSign this_ptr);
19730
19731 /**
19732  * Creates a copy of a Sign
19733  */
19734 struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig);
19735
19736 /**
19737  * Calls the free function if one is set
19738  */
19739 void Sign_free(struct LDKSign this_ptr);
19740
19741 /**
19742  * Creates a copy of the Recipient
19743  */
19744 enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig);
19745
19746 /**
19747  * Utility method to constructs a new Node-variant Recipient
19748  */
19749 enum LDKRecipient Recipient_node(void);
19750
19751 /**
19752  * Utility method to constructs a new PhantomNode-variant Recipient
19753  */
19754 enum LDKRecipient Recipient_phantom_node(void);
19755
19756 /**
19757  * Calls the free function if one is set
19758  */
19759 void KeysInterface_free(struct LDKKeysInterface this_ptr);
19760
19761 /**
19762  * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL.
19763  */
19764 void InMemorySigner_free(struct LDKInMemorySigner this_obj);
19765
19766 /**
19767  * Private key of anchor tx
19768  */
19769 const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19770
19771 /**
19772  * Private key of anchor tx
19773  */
19774 void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19775
19776 /**
19777  * Holder secret key for blinded revocation pubkey
19778  */
19779 const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19780
19781 /**
19782  * Holder secret key for blinded revocation pubkey
19783  */
19784 void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19785
19786 /**
19787  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
19788  */
19789 const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19790
19791 /**
19792  * Holder secret key used for our balance in counterparty-broadcasted commitment transactions
19793  */
19794 void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19795
19796 /**
19797  * Holder secret key used in HTLC tx
19798  */
19799 const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19800
19801 /**
19802  * Holder secret key used in HTLC tx
19803  */
19804 void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19805
19806 /**
19807  * Holder htlc secret key used in commitment tx htlc outputs
19808  */
19809 const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19810
19811 /**
19812  * Holder htlc secret key used in commitment tx htlc outputs
19813  */
19814 void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val);
19815
19816 /**
19817  * Commitment seed
19818  */
19819 const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32];
19820
19821 /**
19822  * Commitment seed
19823  */
19824 void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
19825
19826 /**
19827  * Creates a copy of the InMemorySigner
19828  */
19829 struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig);
19830
19831 /**
19832  * Create a new InMemorySigner
19833  */
19834 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);
19835
19836 /**
19837  * Counterparty pubkeys.
19838  * Will panic if ready_channel wasn't called.
19839  */
19840 MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19841
19842 /**
19843  * The contest_delay value specified by our counterparty and applied on holder-broadcastable
19844  * transactions, ie the amount of time that we have to wait to recover our funds if we
19845  * broadcast a transaction.
19846  * Will panic if ready_channel wasn't called.
19847  */
19848 MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19849
19850 /**
19851  * The contest_delay value specified by us and applied on transactions broadcastable
19852  * by our counterparty, ie the amount of time that they have to wait to recover their funds
19853  * if they broadcast a transaction.
19854  * Will panic if ready_channel wasn't called.
19855  */
19856 MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19857
19858 /**
19859  * Whether the holder is the initiator
19860  * Will panic if ready_channel wasn't called.
19861  */
19862 MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19863
19864 /**
19865  * Funding outpoint
19866  * Will panic if ready_channel wasn't called.
19867  */
19868 MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19869
19870 /**
19871  * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or
19872  * building transactions.
19873  *
19874  * Will panic if ready_channel wasn't called.
19875  */
19876 MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19877
19878 /**
19879  * Whether anchors should be used.
19880  * Will panic if ready_channel wasn't called.
19881  */
19882 MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19883
19884 /**
19885  * Sign the single input of spend_tx at index `input_idx` which spends the output
19886  * described by descriptor, returning the witness stack for the input.
19887  *
19888  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
19889  * is not spending the outpoint described by `descriptor.outpoint`,
19890  * or if an output descriptor script_pubkey does not match the one we can spend.
19891  */
19892 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);
19893
19894 /**
19895  * Sign the single input of spend_tx at index `input_idx` which spends the output
19896  * described by descriptor, returning the witness stack for the input.
19897  *
19898  * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
19899  * is not spending the outpoint described by `descriptor.outpoint`, does not have a
19900  * sequence set to `descriptor.to_self_delay`, or if an output descriptor
19901  * script_pubkey does not match the one we can spend.
19902  */
19903 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);
19904
19905 /**
19906  * Constructs a new BaseSign which calls the relevant methods on this_arg.
19907  * This copies the `inner` pointer in this_arg and thus the returned BaseSign must be freed before this_arg is
19908  */
19909 struct LDKBaseSign InMemorySigner_as_BaseSign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19910
19911 /**
19912  * Constructs a new Sign which calls the relevant methods on this_arg.
19913  * This copies the `inner` pointer in this_arg and thus the returned Sign must be freed before this_arg is
19914  */
19915 struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
19916
19917 /**
19918  * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
19919  */
19920 struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj);
19921
19922 /**
19923  * Read a InMemorySigner from a byte array, created by InMemorySigner_write
19924  */
19925 struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKSecretKey arg);
19926
19927 /**
19928  * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
19929  */
19930 void KeysManager_free(struct LDKKeysManager this_obj);
19931
19932 /**
19933  * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your
19934  * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds).
19935  * starting_time isn't strictly required to actually be a time, but it must absolutely,
19936  * without a doubt, be unique to this instance. ie if you start multiple times with the same
19937  * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to
19938  * simply use the current time (with very high precision).
19939  *
19940  * The seed MUST be backed up safely prior to use so that the keys can be re-created, however,
19941  * obviously, starting_time should be unique every time you reload the library - it is only
19942  * used to generate new ephemeral key data (which will be stored by the individual channel if
19943  * necessary).
19944  *
19945  * Note that the seed is required to recover certain on-chain funds independent of
19946  * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any
19947  * channel, and some on-chain during-closing funds.
19948  *
19949  * Note that until the 0.1 release there is no guarantee of backward compatibility between
19950  * versions. Once the library is more fully supported, the docs will be updated to include a
19951  * detailed description of the guarantee.
19952  */
19953 MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos);
19954
19955 /**
19956  * Derive an old Sign containing per-channel secrets based on a key derivation parameters.
19957  *
19958  * Key derivation parameters are accessible through a per-channel secrets
19959  * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of
19960  * onchain output detection for which a corresponding delayed_payment_key must be derived.
19961  */
19962 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]);
19963
19964 /**
19965  * Creates a Transaction which spends the given descriptors to the given outputs, plus an
19966  * output to the given change destination (if sufficient change value remains). The
19967  * transaction will have a feerate, at least, of the given value.
19968  *
19969  * Returns `Err(())` if the output value is greater than the input value minus required fee,
19970  * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
19971  * does not match the one we can spend.
19972  *
19973  * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
19974  *
19975  * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used
19976  * this KeysManager or one of the `InMemorySigner` created by this KeysManager.
19977  */
19978 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);
19979
19980 /**
19981  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
19982  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
19983  */
19984 struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg);
19985
19986 /**
19987  * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL.
19988  */
19989 void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj);
19990
19991 /**
19992  * Constructs a new KeysInterface which calls the relevant methods on this_arg.
19993  * This copies the `inner` pointer in this_arg and thus the returned KeysInterface must be freed before this_arg is
19994  */
19995 struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg);
19996
19997 /**
19998  * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed`
19999  * that is shared across all nodes that intend to participate in [phantom node payments] together.
20000  *
20001  * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and
20002  * `starting_time_nanos`.
20003  *
20004  * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the
20005  * same across restarts, or else inbound payments may fail.
20006  *
20007  * [phantom node payments]: PhantomKeysManager
20008  */
20009 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]);
20010
20011 /**
20012  * See [`KeysManager::spend_spendable_outputs`] for documentation on this method.
20013  */
20014 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);
20015
20016 /**
20017  * See [`KeysManager::derive_channel_keys`] for documentation on this method.
20018  */
20019 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]);
20020
20021 /**
20022  * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL.
20023  */
20024 void ChannelManager_free(struct LDKChannelManager this_obj);
20025
20026 /**
20027  * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL.
20028  */
20029 void ChainParameters_free(struct LDKChainParameters this_obj);
20030
20031 /**
20032  * The network for determining the `chain_hash` in Lightning messages.
20033  */
20034 enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
20035
20036 /**
20037  * The network for determining the `chain_hash` in Lightning messages.
20038  */
20039 void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
20040
20041 /**
20042  * The hash and height of the latest block successfully connected.
20043  *
20044  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
20045  */
20046 struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
20047
20048 /**
20049  * The hash and height of the latest block successfully connected.
20050  *
20051  * Used to track on-chain channel funding outputs and send payments with reliable timelocks.
20052  */
20053 void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
20054
20055 /**
20056  * Constructs a new ChainParameters given each field
20057  */
20058 MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
20059
20060 /**
20061  * Creates a copy of the ChainParameters
20062  */
20063 struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
20064
20065 /**
20066  * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL.
20067  */
20068 void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
20069
20070 /**
20071  * Base routing fee in millisatoshis.
20072  */
20073 uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
20074
20075 /**
20076  * Base routing fee in millisatoshis.
20077  */
20078 void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
20079
20080 /**
20081  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
20082  */
20083 uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
20084
20085 /**
20086  * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
20087  */
20088 void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
20089
20090 /**
20091  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
20092  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
20093  * `cltv_expiry_delta` for more details.
20094  */
20095 uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
20096
20097 /**
20098  * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
20099  * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
20100  * `cltv_expiry_delta` for more details.
20101  */
20102 void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
20103
20104 /**
20105  * Constructs a new CounterpartyForwardingInfo given each field
20106  */
20107 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);
20108
20109 /**
20110  * Creates a copy of the CounterpartyForwardingInfo
20111  */
20112 struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
20113
20114 /**
20115  * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL.
20116  */
20117 void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
20118
20119 /**
20120  * The node_id of our counterparty
20121  */
20122 struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
20123
20124 /**
20125  * The node_id of our counterparty
20126  */
20127 void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20128
20129 /**
20130  * The Features the channel counterparty provided upon last connection.
20131  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
20132  * many routing-relevant features are present in the init context.
20133  */
20134 struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
20135
20136 /**
20137  * The Features the channel counterparty provided upon last connection.
20138  * Useful for routing as it is the most up-to-date copy of the counterparty's features and
20139  * many routing-relevant features are present in the init context.
20140  */
20141 void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
20142
20143 /**
20144  * The value, in satoshis, that must always be held in the channel for our counterparty. This
20145  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
20146  * claiming at least this value on chain.
20147  *
20148  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
20149  *
20150  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
20151  */
20152 uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
20153
20154 /**
20155  * The value, in satoshis, that must always be held in the channel for our counterparty. This
20156  * value ensures that if our counterparty broadcasts a revoked state, we can punish them by
20157  * claiming at least this value on chain.
20158  *
20159  * This value is not included in [`inbound_capacity_msat`] as it can never be spent.
20160  *
20161  * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
20162  */
20163 void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
20164
20165 /**
20166  * Information on the fees and requirements that the counterparty requires when forwarding
20167  * payments to us through this channel.
20168  *
20169  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20170  */
20171 struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
20172
20173 /**
20174  * Information on the fees and requirements that the counterparty requires when forwarding
20175  * payments to us through this channel.
20176  *
20177  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20178  */
20179 void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
20180
20181 /**
20182  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
20183  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
20184  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
20185  */
20186 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
20187
20188 /**
20189  * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field
20190  * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message
20191  * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107.
20192  */
20193 void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20194
20195 /**
20196  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
20197  */
20198 struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
20199
20200 /**
20201  * The largest value HTLC (in msat) the remote peer currently will accept, for this channel.
20202  */
20203 void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20204
20205 /**
20206  * Constructs a new ChannelCounterparty given each field
20207  */
20208 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);
20209
20210 /**
20211  * Creates a copy of the ChannelCounterparty
20212  */
20213 struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
20214
20215 /**
20216  * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL.
20217  */
20218 void ChannelDetails_free(struct LDKChannelDetails this_obj);
20219
20220 /**
20221  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
20222  * thereafter this is the txid of the funding transaction xor the funding transaction output).
20223  * Note that this means this value is *not* persistent - it can change once during the
20224  * lifetime of the channel.
20225  */
20226 const uint8_t (*ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr))[32];
20227
20228 /**
20229  * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
20230  * thereafter this is the txid of the funding transaction xor the funding transaction output).
20231  * Note that this means this value is *not* persistent - it can change once during the
20232  * lifetime of the channel.
20233  */
20234 void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
20235
20236 /**
20237  * Parameters which apply to our counterparty. See individual fields for more information.
20238  */
20239 struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20240
20241 /**
20242  * Parameters which apply to our counterparty. See individual fields for more information.
20243  */
20244 void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val);
20245
20246 /**
20247  * The Channel's funding transaction output, if we've negotiated the funding transaction with
20248  * our counterparty already.
20249  *
20250  * Note that, if this has been set, `channel_id` will be equivalent to
20251  * `funding_txo.unwrap().to_channel_id()`.
20252  *
20253  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20254  */
20255 struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20256
20257 /**
20258  * The Channel's funding transaction output, if we've negotiated the funding transaction with
20259  * our counterparty already.
20260  *
20261  * Note that, if this has been set, `channel_id` will be equivalent to
20262  * `funding_txo.unwrap().to_channel_id()`.
20263  *
20264  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20265  */
20266 void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val);
20267
20268 /**
20269  * The features which this channel operates with. See individual features for more info.
20270  *
20271  * `None` until negotiation completes and the channel type is finalized.
20272  *
20273  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20274  */
20275 struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20276
20277 /**
20278  * The features which this channel operates with. See individual features for more info.
20279  *
20280  * `None` until negotiation completes and the channel type is finalized.
20281  *
20282  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20283  */
20284 void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
20285
20286 /**
20287  * The position of the funding transaction in the chain. None if the funding transaction has
20288  * not yet been confirmed and the channel fully opened.
20289  *
20290  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
20291  * payments instead of this. See [`get_inbound_payment_scid`].
20292  *
20293  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
20294  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
20295  *
20296  * [`inbound_scid_alias`]: Self::inbound_scid_alias
20297  * [`outbound_scid_alias`]: Self::outbound_scid_alias
20298  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
20299  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
20300  * [`confirmations_required`]: Self::confirmations_required
20301  */
20302 struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20303
20304 /**
20305  * The position of the funding transaction in the chain. None if the funding transaction has
20306  * not yet been confirmed and the channel fully opened.
20307  *
20308  * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
20309  * payments instead of this. See [`get_inbound_payment_scid`].
20310  *
20311  * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
20312  * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
20313  *
20314  * [`inbound_scid_alias`]: Self::inbound_scid_alias
20315  * [`outbound_scid_alias`]: Self::outbound_scid_alias
20316  * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
20317  * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
20318  * [`confirmations_required`]: Self::confirmations_required
20319  */
20320 void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20321
20322 /**
20323  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
20324  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
20325  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
20326  * `Some(0)`).
20327  *
20328  * This will be `None` as long as the channel is not available for routing outbound payments.
20329  *
20330  * [`short_channel_id`]: Self::short_channel_id
20331  * [`confirmations_required`]: Self::confirmations_required
20332  */
20333 struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20334
20335 /**
20336  * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
20337  * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
20338  * the channel has not yet been confirmed (as long as [`confirmations_required`] is
20339  * `Some(0)`).
20340  *
20341  * This will be `None` as long as the channel is not available for routing outbound payments.
20342  *
20343  * [`short_channel_id`]: Self::short_channel_id
20344  * [`confirmations_required`]: Self::confirmations_required
20345  */
20346 void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20347
20348 /**
20349  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
20350  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
20351  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
20352  * when they see a payment to be routed to us.
20353  *
20354  * Our counterparty may choose to rotate this value at any time, though will always recognize
20355  * previous values for inbound payment forwarding.
20356  *
20357  * [`short_channel_id`]: Self::short_channel_id
20358  */
20359 struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20360
20361 /**
20362  * An optional [`short_channel_id`] alias for this channel, randomly generated by our
20363  * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
20364  * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
20365  * when they see a payment to be routed to us.
20366  *
20367  * Our counterparty may choose to rotate this value at any time, though will always recognize
20368  * previous values for inbound payment forwarding.
20369  *
20370  * [`short_channel_id`]: Self::short_channel_id
20371  */
20372 void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20373
20374 /**
20375  * The value, in satoshis, of this channel as appears in the funding output
20376  */
20377 uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20378
20379 /**
20380  * The value, in satoshis, of this channel as appears in the funding output
20381  */
20382 void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20383
20384 /**
20385  * The value, in satoshis, that must always be held in the channel for us. This value ensures
20386  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
20387  * this value on chain.
20388  *
20389  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
20390  *
20391  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20392  *
20393  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
20394  */
20395 struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20396
20397 /**
20398  * The value, in satoshis, that must always be held in the channel for us. This value ensures
20399  * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
20400  * this value on chain.
20401  *
20402  * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
20403  *
20404  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20405  *
20406  * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
20407  */
20408 void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20409
20410 /**
20411  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
20412  */
20413 uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20414
20415 /**
20416  * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
20417  */
20418 void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20419
20420 /**
20421  * Our total balance.  This is the amount we would get if we close the channel.
20422  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
20423  * amount is not likely to be recoverable on close.
20424  *
20425  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
20426  * balance is not available for inclusion in new outbound HTLCs). This further does not include
20427  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
20428  * This does not consider any on-chain fees.
20429  *
20430  * See also [`ChannelDetails::outbound_capacity_msat`]
20431  */
20432 uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20433
20434 /**
20435  * Our total balance.  This is the amount we would get if we close the channel.
20436  * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
20437  * amount is not likely to be recoverable on close.
20438  *
20439  * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
20440  * balance is not available for inclusion in new outbound HTLCs). This further does not include
20441  * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
20442  * This does not consider any on-chain fees.
20443  *
20444  * See also [`ChannelDetails::outbound_capacity_msat`]
20445  */
20446 void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20447
20448 /**
20449  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
20450  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
20451  * available for inclusion in new outbound HTLCs). This further does not include any pending
20452  * outgoing HTLCs which are awaiting some other resolution to be sent.
20453  *
20454  * See also [`ChannelDetails::balance_msat`]
20455  *
20456  * This value is not exact. Due to various in-flight changes, feerate changes, and our
20457  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
20458  * should be able to spend nearly this amount.
20459  */
20460 uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20461
20462 /**
20463  * The available outbound capacity for sending HTLCs to the remote peer. This does not include
20464  * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
20465  * available for inclusion in new outbound HTLCs). This further does not include any pending
20466  * outgoing HTLCs which are awaiting some other resolution to be sent.
20467  *
20468  * See also [`ChannelDetails::balance_msat`]
20469  *
20470  * This value is not exact. Due to various in-flight changes, feerate changes, and our
20471  * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
20472  * should be able to spend nearly this amount.
20473  */
20474 void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20475
20476 /**
20477  * The available outbound capacity for sending a single HTLC to the remote peer. This is
20478  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
20479  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
20480  * to use a limit as close as possible to the HTLC limit we can currently send.
20481  *
20482  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
20483  */
20484 uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20485
20486 /**
20487  * The available outbound capacity for sending a single HTLC to the remote peer. This is
20488  * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
20489  * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
20490  * to use a limit as close as possible to the HTLC limit we can currently send.
20491  *
20492  * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
20493  */
20494 void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20495
20496 /**
20497  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
20498  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
20499  * available for inclusion in new inbound HTLCs).
20500  * Note that there are some corner cases not fully handled here, so the actual available
20501  * inbound capacity may be slightly higher than this.
20502  *
20503  * This value is not exact. Due to various in-flight changes, feerate changes, and our
20504  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
20505  * However, our counterparty should be able to spend nearly this amount.
20506  */
20507 uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20508
20509 /**
20510  * The available inbound capacity for the remote peer to send HTLCs to us. This does not
20511  * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
20512  * available for inclusion in new inbound HTLCs).
20513  * Note that there are some corner cases not fully handled here, so the actual available
20514  * inbound capacity may be slightly higher than this.
20515  *
20516  * This value is not exact. Due to various in-flight changes, feerate changes, and our
20517  * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
20518  * However, our counterparty should be able to spend nearly this amount.
20519  */
20520 void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val);
20521
20522 /**
20523  * The number of required confirmations on the funding transaction before the funding will be
20524  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
20525  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
20526  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
20527  * [`ChannelHandshakeLimits::max_minimum_depth`].
20528  *
20529  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20530  *
20531  * [`is_outbound`]: ChannelDetails::is_outbound
20532  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
20533  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
20534  */
20535 struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20536
20537 /**
20538  * The number of required confirmations on the funding transaction before the funding will be
20539  * considered \"locked\". This number is selected by the channel fundee (i.e. us if
20540  * [`is_outbound`] is *not* set), and can be selected for inbound channels with
20541  * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
20542  * [`ChannelHandshakeLimits::max_minimum_depth`].
20543  *
20544  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20545  *
20546  * [`is_outbound`]: ChannelDetails::is_outbound
20547  * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
20548  * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
20549  */
20550 void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
20551
20552 /**
20553  * The number of blocks (after our commitment transaction confirms) that we will need to wait
20554  * until we can claim our funds after we force-close the channel. During this time our
20555  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
20556  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
20557  * time to claim our non-HTLC-encumbered funds.
20558  *
20559  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20560  */
20561 struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20562
20563 /**
20564  * The number of blocks (after our commitment transaction confirms) that we will need to wait
20565  * until we can claim our funds after we force-close the channel. During this time our
20566  * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
20567  * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
20568  * time to claim our non-HTLC-encumbered funds.
20569  *
20570  * This value will be `None` for outbound channels until the counterparty accepts the channel.
20571  */
20572 void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val);
20573
20574 /**
20575  * True if the channel was initiated (and thus funded) by us.
20576  */
20577 bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20578
20579 /**
20580  * True if the channel was initiated (and thus funded) by us.
20581  */
20582 void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20583
20584 /**
20585  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
20586  * channel is not currently being shut down. `channel_ready` message exchange implies the
20587  * required confirmation count has been reached (and we were connected to the peer at some
20588  * point after the funding transaction received enough confirmations). The required
20589  * confirmation count is provided in [`confirmations_required`].
20590  *
20591  * [`confirmations_required`]: ChannelDetails::confirmations_required
20592  */
20593 bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20594
20595 /**
20596  * True if the channel is confirmed, channel_ready messages have been exchanged, and the
20597  * channel is not currently being shut down. `channel_ready` message exchange implies the
20598  * required confirmation count has been reached (and we were connected to the peer at some
20599  * point after the funding transaction received enough confirmations). The required
20600  * confirmation count is provided in [`confirmations_required`].
20601  *
20602  * [`confirmations_required`]: ChannelDetails::confirmations_required
20603  */
20604 void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20605
20606 /**
20607  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
20608  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
20609  *
20610  * This is a strict superset of `is_channel_ready`.
20611  */
20612 bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20613
20614 /**
20615  * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
20616  * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
20617  *
20618  * This is a strict superset of `is_channel_ready`.
20619  */
20620 void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20621
20622 /**
20623  * True if this channel is (or will be) publicly-announced.
20624  */
20625 bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20626
20627 /**
20628  * True if this channel is (or will be) publicly-announced.
20629  */
20630 void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val);
20631
20632 /**
20633  * The smallest value HTLC (in msat) we will accept, for this channel. This field
20634  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
20635  */
20636 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20637
20638 /**
20639  * The smallest value HTLC (in msat) we will accept, for this channel. This field
20640  * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
20641  */
20642 void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20643
20644 /**
20645  * The largest value HTLC (in msat) we currently will accept, for this channel.
20646  */
20647 struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20648
20649 /**
20650  * The largest value HTLC (in msat) we currently will accept, for this channel.
20651  */
20652 void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
20653
20654 /**
20655  * Set of configurable parameters that affect channel operation.
20656  *
20657  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
20658  *
20659  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
20660  */
20661 struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
20662
20663 /**
20664  * Set of configurable parameters that affect channel operation.
20665  *
20666  * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
20667  *
20668  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
20669  */
20670 void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
20671
20672 /**
20673  * Constructs a new ChannelDetails given each field
20674  */
20675 MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg);
20676
20677 /**
20678  * Creates a copy of the ChannelDetails
20679  */
20680 struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig);
20681
20682 /**
20683  * Gets the current SCID which should be used to identify this channel for inbound payments.
20684  * This should be used for providing invoice hints or in any other context where our
20685  * counterparty will forward a payment to us.
20686  *
20687  * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
20688  * [`ChannelDetails::short_channel_id`]. See those for more information.
20689  */
20690 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
20691
20692 /**
20693  * Gets the current SCID which should be used to identify this channel for outbound payments.
20694  * This should be used in [`Route`]s to describe the first hop or in other contexts where
20695  * we're sending or forwarding a payment outbound over this channel.
20696  *
20697  * This is either the [`ChannelDetails::short_channel_id`], if set, or the
20698  * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
20699  */
20700 MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg);
20701
20702 /**
20703  * Frees any resources used by the PaymentSendFailure
20704  */
20705 void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr);
20706
20707 /**
20708  * Creates a copy of the PaymentSendFailure
20709  */
20710 struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig);
20711
20712 /**
20713  * Utility method to constructs a new ParameterError-variant PaymentSendFailure
20714  */
20715 struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a);
20716
20717 /**
20718  * Utility method to constructs a new PathParameterError-variant PaymentSendFailure
20719  */
20720 struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a);
20721
20722 /**
20723  * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure
20724  */
20725 struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a);
20726
20727 /**
20728  * Utility method to constructs a new PartialFailure-variant PaymentSendFailure
20729  */
20730 struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
20731
20732 /**
20733  * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL.
20734  */
20735 void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj);
20736
20737 /**
20738  * The list of channels to be included in the invoice route hints.
20739  */
20740 struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20741
20742 /**
20743  * The list of channels to be included in the invoice route hints.
20744  */
20745 void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val);
20746
20747 /**
20748  * A fake scid used for representing the phantom node's fake channel in generating the invoice
20749  * route hints.
20750  */
20751 uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20752
20753 /**
20754  * A fake scid used for representing the phantom node's fake channel in generating the invoice
20755  * route hints.
20756  */
20757 void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val);
20758
20759 /**
20760  * The pubkey of the real backing node that would ultimately receive the payment.
20761  */
20762 struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr);
20763
20764 /**
20765  * The pubkey of the real backing node that would ultimately receive the payment.
20766  */
20767 void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val);
20768
20769 /**
20770  * Constructs a new PhantomRouteHints given each field
20771  */
20772 MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg);
20773
20774 /**
20775  * Creates a copy of the PhantomRouteHints
20776  */
20777 struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
20778
20779 /**
20780  * Constructs a new ChannelManager to hold several channels and route between them.
20781  *
20782  * This is the main \"logic hub\" for all channel-related actions, and implements
20783  * ChannelMessageHandler.
20784  *
20785  * Non-proportional fees are fixed according to our risk using the provided fee estimator.
20786  *
20787  * Users need to notify the new ChannelManager when a new block is connected or
20788  * disconnected using its `block_connected` and `block_disconnected` methods, starting
20789  * from after `params.latest_hash`.
20790  */
20791 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);
20792
20793 /**
20794  * Gets the current configuration applied to all new channels,  as
20795  */
20796 MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg);
20797
20798 /**
20799  * Creates a new outbound channel to the given remote node and with the given value.
20800  *
20801  * `user_channel_id` will be provided back as in
20802  * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events
20803  * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0
20804  * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here.
20805  * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise
20806  * ignored.
20807  *
20808  * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is
20809  * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`.
20810  *
20811  * Note that we do not check if you are currently connected to the given peer. If no
20812  * connection is available, the outbound `open_channel` message may fail to send, resulting in
20813  * the channel eventually being silently forgotten (dropped on reload).
20814  *
20815  * Returns the new Channel's temporary `channel_id`. This ID will appear as
20816  * [`Event::FundingGenerationReady::temporary_channel_id`] and in
20817  * [`ChannelDetails::channel_id`] until after
20818  * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for
20819  * one derived from the funding transaction's TXID. If the counterparty rejects the channel
20820  * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`].
20821  *
20822  * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id
20823  * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id
20824  * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id
20825  *
20826  * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None
20827  */
20828 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);
20829
20830 /**
20831  * Gets the list of open channels, in random order. See ChannelDetail field documentation for
20832  * more information.
20833  */
20834 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
20835
20836 /**
20837  * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`]
20838  * to ensure non-announced channels are used.
20839  *
20840  * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the
20841  * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria
20842  * are.
20843  *
20844  * [`find_route`]: crate::routing::router::find_route
20845  */
20846 MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
20847
20848 /**
20849  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
20850  * will be accepted on the given channel, and after additional timeout/the closing of all
20851  * pending HTLCs, the channel will be closed on chain.
20852  *
20853  *  * If we are the channel initiator, we will pay between our [`Background`] and
20854  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
20855  *    estimate.
20856  *  * If our counterparty is the channel initiator, we will require a channel closing
20857  *    transaction feerate of at least our [`Background`] feerate or the feerate which
20858  *    would appear on a force-closure transaction, whichever is lower. We will allow our
20859  *    counterparty to pay as much fee as they'd like, however.
20860  *
20861  * May generate a SendShutdown message event on success, which should be relayed.
20862  *
20863  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
20864  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20865  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20866  */
20867 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);
20868
20869 /**
20870  * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
20871  * will be accepted on the given channel, and after additional timeout/the closing of all
20872  * pending HTLCs, the channel will be closed on chain.
20873  *
20874  * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
20875  * the channel being closed or not:
20876  *  * If we are the channel initiator, we will pay at least this feerate on the closing
20877  *    transaction. The upper-bound is set by
20878  *    [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
20879  *    estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
20880  *  * If our counterparty is the channel initiator, we will refuse to accept a channel closure
20881  *    transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
20882  *    will appear on a force-closure transaction, whichever is lower).
20883  *
20884  * May generate a SendShutdown message event on success, which should be relayed.
20885  *
20886  * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
20887  * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
20888  * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
20889  */
20890 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);
20891
20892 /**
20893  * Force closes a channel, immediately broadcasting the latest local transaction(s) and
20894  * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to
20895  * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding
20896  * channel.
20897  */
20898 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
20899
20900 /**
20901  * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting
20902  * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the
20903  * `counterparty_node_id` isn't the counterparty of the corresponding channel.
20904  *
20905  * You can always get the latest local transaction(s) to broadcast from
20906  * [`ChannelMonitor::get_latest_holder_commitment_txn`].
20907  */
20908 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
20909
20910 /**
20911  * Force close all channels, immediately broadcasting the latest local commitment transaction
20912  * for each to the chain and rejecting new HTLCs on each.
20913  */
20914 void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
20915
20916 /**
20917  * Force close all channels rejecting new HTLCs on each but without broadcasting the latest
20918  * local transaction(s).
20919  */
20920 void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg);
20921
20922 /**
20923  * Sends a payment along a given route.
20924  *
20925  * Value parameters are provided via the last hop in route, see documentation for RouteHop
20926  * fields for more info.
20927  *
20928  * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative
20929  * payment), we don't do anything to stop you! We always try to ensure that if the provided
20930  * next hop knows the preimage to payment_hash they can claim an additional amount as
20931  * specified in the last hop in the route! Thus, you should probably do your own
20932  * payment_preimage tracking (which you should already be doing as they represent \"proof of
20933  * payment\") and prevent double-sends yourself.
20934  *
20935  * May generate SendHTLCs message(s) event on success, which should be relayed.
20936  *
20937  * Each path may have a different return value, and PaymentSendValue may return a Vec with
20938  * each entry matching the corresponding-index entry in the route paths, see
20939  * PaymentSendFailure for more info.
20940  *
20941  * In general, a path may raise:
20942  *  * APIError::RouteError when an invalid route or forwarding parameter (cltv_delta, fee,
20943  *    node public key) is specified.
20944  *  * APIError::ChannelUnavailable if the next-hop channel is not available for updates
20945  *    (including due to previous monitor update failure or new permanent monitor update
20946  *    failure).
20947  *  * APIError::MonitorUpdateFailed if a new monitor update failure prevented sending the
20948  *    relevant updates.
20949  *
20950  * Note that depending on the type of the PaymentSendFailure the HTLC may have been
20951  * irrevocably committed to on our end. In such a case, do NOT retry the payment with a
20952  * different route unless you intend to pay twice!
20953  *
20954  * payment_secret is unrelated to payment_hash (or PaymentPreimage) and exists to authenticate
20955  * the sender to the recipient and prevent payment-probing (deanonymization) attacks. For
20956  * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route
20957  * must not contain multiple paths as multi-path payments require a recipient-provided
20958  * payment_secret.
20959  * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature
20960  * bit set (either as required or as available). If multiple paths are present in the Route,
20961  * we assume the invoice had the basic_mpp feature set.
20962  *
20963  * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
20964  */
20965 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);
20966
20967 /**
20968  * Retries a payment along the given [`Route`].
20969  *
20970  * Errors returned are a superset of those returned from [`send_payment`], so see
20971  * [`send_payment`] documentation for more details on errors. This method will also error if the
20972  * retry amount puts the payment more than 10% over the payment's total amount, if the payment
20973  * for the given `payment_id` cannot be found (likely due to timeout or success), or if
20974  * further retries have been disabled with [`abandon_payment`].
20975  *
20976  * [`send_payment`]: [`ChannelManager::send_payment`]
20977  * [`abandon_payment`]: [`ChannelManager::abandon_payment`]
20978  */
20979 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);
20980
20981 /**
20982  * Signals that no further retries for the given payment will occur.
20983  *
20984  * After this method returns, any future calls to [`retry_payment`] for the given `payment_id`
20985  * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated,
20986  * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining
20987  * pending HTLCs for this payment.
20988  *
20989  * Note that calling this method does *not* prevent a payment from succeeding. You must still
20990  * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to
20991  * determine the ultimate status of a payment.
20992  *
20993  * [`retry_payment`]: Self::retry_payment
20994  * [`Event::PaymentFailed`]: events::Event::PaymentFailed
20995  * [`Event::PaymentSent`]: events::Event::PaymentSent
20996  */
20997 void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id);
20998
20999 /**
21000  * Send a spontaneous payment, which is a payment that does not require the recipient to have
21001  * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
21002  * the preimage, it must be a cryptographically secure random value that no intermediate node
21003  * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
21004  * never reach the recipient.
21005  *
21006  * See [`send_payment`] documentation for more details on the return value of this function.
21007  *
21008  * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
21009  * [`send_payment`] for more information about the risks of duplicate preimage usage.
21010  *
21011  * Note that `route` must have exactly one path.
21012  *
21013  * [`send_payment`]: Self::send_payment
21014  *
21015  * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
21016  */
21017 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);
21018
21019 /**
21020  * Send a payment that is probing the given route for liquidity. We calculate the
21021  * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
21022  * us to easily discern them from real payments.
21023  */
21024 MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ hops);
21025
21026 /**
21027  * Call this upon creation of a funding transaction for the given channel.
21028  *
21029  * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs
21030  * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`].
21031  *
21032  * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation
21033  * across the p2p network.
21034  *
21035  * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided
21036  * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`].
21037  *
21038  * May panic if the output found in the funding transaction is duplicative with some other
21039  * channel (note that this should be trivially prevented by using unique funding transaction
21040  * keys per-channel).
21041  *
21042  * Do NOT broadcast the funding transaction yourself. When we have safely received our
21043  * counterparty's signature the funding transaction will automatically be broadcast via the
21044  * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed.
21045  *
21046  * Note that this includes RBF or similar transaction replacement strategies - lightning does
21047  * not currently support replacing a funding transaction on an existing channel. Instead,
21048  * create a new channel with a conflicting funding transaction.
21049  *
21050  * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend
21051  * the wallet software generating the funding transaction to apply anti-fee sniping as
21052  * implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
21053  * for more details.
21054  *
21055  * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
21056  * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
21057  */
21058 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);
21059
21060 /**
21061  * Regenerates channel_announcements and generates a signed node_announcement from the given
21062  * arguments, providing them in corresponding events via
21063  * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed
21064  * on-chain. This effectively re-broadcasts all channel announcements and sends our node
21065  * announcement to ensure that the lightning P2P network is aware of the channels we have and
21066  * our network addresses.
21067  *
21068  * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this
21069  * node to humans. They carry no in-protocol meaning.
21070  *
21071  * `addresses` represent the set (possibly empty) of socket addresses on which this node
21072  * accepts incoming connections. These will be included in the node_announcement, publicly
21073  * tying these addresses together and to this node. If you wish to preserve user privacy,
21074  * addresses should likely contain only Tor Onion addresses.
21075  *
21076  * Panics if `addresses` is absurdly large (more than 100).
21077  *
21078  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
21079  */
21080 void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
21081
21082 /**
21083  * Atomically updates the [`ChannelConfig`] for the given channels.
21084  *
21085  * Once the updates are applied, each eligible channel (advertised with a known short channel
21086  * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`],
21087  * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated
21088  * containing the new [`ChannelUpdate`] message which should be broadcast to the network.
21089  *
21090  * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect
21091  * `counterparty_node_id` is provided.
21092  *
21093  * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value
21094  * below [`MIN_CLTV_EXPIRY_DELTA`].
21095  *
21096  * If an error is returned, none of the updates should be considered applied.
21097  *
21098  * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
21099  * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat
21100  * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta
21101  * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate
21102  * [`ChannelUpdate`]: msgs::ChannelUpdate
21103  * [`ChannelUnavailable`]: APIError::ChannelUnavailable
21104  * [`APIMisuseError`]: APIError::APIMisuseError
21105  */
21106 MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ThirtyTwoBytesZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config);
21107
21108 /**
21109  * Processes HTLCs which are pending waiting on random forward delay.
21110  *
21111  * Should only really ever be called in response to a PendingHTLCsForwardable event.
21112  * Will likely generate further events.
21113  */
21114 void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg);
21115
21116 /**
21117  * Performs actions which should happen on startup and roughly once per minute thereafter.
21118  *
21119  * This currently includes:
21120  *  * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
21121  *  * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
21122  *    than a minute, informing the network that they should no longer attempt to route over
21123  *    the channel.
21124  *  * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs
21125  *    with the current `ChannelConfig`.
21126  *
21127  * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
21128  * estimate fetches.
21129  */
21130 void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
21131
21132 /**
21133  * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect
21134  * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources
21135  * along the path (including in our own channel on which we received it).
21136  *
21137  * Note that in some cases around unclean shutdown, it is possible the payment may have
21138  * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a
21139  * second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment
21140  * may have already been failed automatically by LDK if it was nearing its expiration time.
21141  *
21142  * While LDK will never claim a payment automatically on your behalf (i.e. without you calling
21143  * [`ChannelManager::claim_funds`]), you should still monitor for
21144  * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on
21145  * startup during which time claims that were in-progress at shutdown may be replayed.
21146  */
21147 void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
21148
21149 /**
21150  * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any
21151  * [`MessageSendEvent`]s needed to claim the payment.
21152  *
21153  * Note that calling this method does *not* guarantee that the payment has been claimed. You
21154  * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
21155  * provided to your [`EventHandler`] when [`process_pending_events`] is next called.
21156  *
21157  * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
21158  * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived`
21159  * event matches your expectation. If you fail to do so and call this method, you may provide
21160  * the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
21161  *
21162  * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived
21163  * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
21164  * [`process_pending_events`]: EventsProvider::process_pending_events
21165  * [`create_inbound_payment`]: Self::create_inbound_payment
21166  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
21167  * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events
21168  */
21169 void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage);
21170
21171 /**
21172  * Gets the node_id held by this ChannelManager
21173  */
21174 MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg);
21175
21176 /**
21177  * Accepts a request to open a channel after a [`Event::OpenChannelRequest`].
21178  *
21179  * The `temporary_channel_id` parameter indicates which inbound channel should be accepted,
21180  * and the `counterparty_node_id` parameter is the id of the peer which has requested to open
21181  * the channel.
21182  *
21183  * The `user_channel_id` parameter will be provided back in
21184  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
21185  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
21186  *
21187  * Note that this method will return an error and reject the channel, if it requires support
21188  * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be
21189  * used to accept such channels.
21190  *
21191  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
21192  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
21193  */
21194 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);
21195
21196 /**
21197  * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating
21198  * it as confirmed immediately.
21199  *
21200  * The `user_channel_id` parameter will be provided back in
21201  * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond
21202  * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call.
21203  *
21204  * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel
21205  * and (if the counterparty agrees), enables forwarding of payments immediately.
21206  *
21207  * This fully trusts that the counterparty has honestly and correctly constructed the funding
21208  * transaction and blindly assumes that it will eventually confirm.
21209  *
21210  * If it does not confirm before we decide to close the channel, or if the funding transaction
21211  * does not pay to the correct script the correct amount, *you will lose funds*.
21212  *
21213  * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
21214  * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
21215  */
21216 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);
21217
21218 /**
21219  * Gets a payment secret and payment hash for use in an invoice given to a third party wishing
21220  * to pay us.
21221  *
21222  * This differs from [`create_inbound_payment_for_hash`] only in that it generates the
21223  * [`PaymentHash`] and [`PaymentPreimage`] for you.
21224  *
21225  * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which
21226  * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be
21227  * passed directly to [`claim_funds`].
21228  *
21229  * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements.
21230  *
21231  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
21232  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
21233  *
21234  * # Note
21235  *
21236  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
21237  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
21238  *
21239  * Errors if `min_value_msat` is greater than total bitcoin supply.
21240  *
21241  * [`claim_funds`]: Self::claim_funds
21242  * [`PaymentReceived`]: events::Event::PaymentReceived
21243  * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage
21244  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
21245  */
21246 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);
21247
21248 /**
21249  * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share
21250  * serialized state with LDK node(s) running 0.0.103 and earlier.
21251  *
21252  * May panic if `invoice_expiry_delta_secs` is greater than one year.
21253  *
21254  * # Note
21255  * This method is deprecated and will be removed soon.
21256  *
21257  * [`create_inbound_payment`]: Self::create_inbound_payment
21258  */
21259 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);
21260
21261 /**
21262  * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is
21263  * stored external to LDK.
21264  *
21265  * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a
21266  * payment secret fetched via this method or [`create_inbound_payment`], and which is at least
21267  * the `min_value_msat` provided here, if one is provided.
21268  *
21269  * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though
21270  * note that LDK will not stop you from registering duplicate payment hashes for inbound
21271  * payments.
21272  *
21273  * `min_value_msat` should be set if the invoice being generated contains a value. Any payment
21274  * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat`
21275  * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the
21276  * sender \"proof-of-payment\" unless they have paid the required amount.
21277  *
21278  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
21279  * in excess of the current time. This should roughly match the expiry time set in the invoice.
21280  * After this many seconds, we will remove the inbound payment, resulting in any attempts to
21281  * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for
21282  * invoices when no timeout is set.
21283  *
21284  * Note that we use block header time to time-out pending inbound payments (with some margin
21285  * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will
21286  * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry.
21287  * If you need exact expiry semantics, you should enforce them upon receipt of
21288  * [`PaymentReceived`].
21289  *
21290  * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry`
21291  * set to at least [`MIN_FINAL_CLTV_EXPIRY`].
21292  *
21293  * Note that a malicious eavesdropper can intuit whether an inbound payment was created by
21294  * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime.
21295  *
21296  * # Note
21297  *
21298  * If you register an inbound payment with this method, then serialize the `ChannelManager`, then
21299  * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received.
21300  *
21301  * Errors if `min_value_msat` is greater than total bitcoin supply.
21302  *
21303  * [`create_inbound_payment`]: Self::create_inbound_payment
21304  * [`PaymentReceived`]: events::Event::PaymentReceived
21305  */
21306 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);
21307
21308 /**
21309  * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share
21310  * serialized state with LDK node(s) running 0.0.103 and earlier.
21311  *
21312  * May panic if `invoice_expiry_delta_secs` is greater than one year.
21313  *
21314  * # Note
21315  * This method is deprecated and will be removed soon.
21316  *
21317  * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
21318  */
21319 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);
21320
21321 /**
21322  * Gets an LDK-generated payment preimage from a payment hash and payment secret that were
21323  * previously returned from [`create_inbound_payment`].
21324  *
21325  * [`create_inbound_payment`]: Self::create_inbound_payment
21326  */
21327 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);
21328
21329 /**
21330  * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids
21331  * are used when constructing the phantom invoice's route hints.
21332  *
21333  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
21334  */
21335 MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg);
21336
21337 /**
21338  * Gets route hints for use in receiving [phantom node payments].
21339  *
21340  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
21341  */
21342 MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg);
21343
21344 /**
21345  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
21346  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
21347  */
21348 struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
21349
21350 /**
21351  * Constructs a new EventsProvider which calls the relevant methods on this_arg.
21352  * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
21353  */
21354 struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg);
21355
21356 /**
21357  * Constructs a new Listen which calls the relevant methods on this_arg.
21358  * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
21359  */
21360 struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg);
21361
21362 /**
21363  * Constructs a new Confirm which calls the relevant methods on this_arg.
21364  * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
21365  */
21366 struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
21367
21368 /**
21369  * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
21370  * indicating whether persistence is necessary. Only one listener on
21371  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
21372  * up.
21373  *
21374  * Note that this method is not available with the `no-std` feature.
21375  */
21376 MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
21377
21378 /**
21379  * Blocks until ChannelManager needs to be persisted. Only one listener on
21380  * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken
21381  * up.
21382  */
21383 void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
21384
21385 /**
21386  * Gets the latest best block which was connected either via the [`chain::Listen`] or
21387  * [`chain::Confirm`] interfaces.
21388  */
21389 MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg);
21390
21391 /**
21392  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
21393  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
21394  */
21395 struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg);
21396
21397 /**
21398  * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read
21399  */
21400 struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj);
21401
21402 /**
21403  * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write
21404  */
21405 struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser);
21406
21407 /**
21408  * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read
21409  */
21410 struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj);
21411
21412 /**
21413  * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write
21414  */
21415 struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser);
21416
21417 /**
21418  * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
21419  */
21420 struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj);
21421
21422 /**
21423  * Read a ChannelDetails from a byte array, created by ChannelDetails_write
21424  */
21425 struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser);
21426
21427 /**
21428  * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read
21429  */
21430 struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj);
21431
21432 /**
21433  * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write
21434  */
21435 struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser);
21436
21437 /**
21438  * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read
21439  */
21440 struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj);
21441
21442 /**
21443  * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL.
21444  */
21445 void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj);
21446
21447 /**
21448  * The keys provider which will give us relevant keys. Some keys will be loaded during
21449  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
21450  * signing data.
21451  */
21452 const struct LDKKeysInterface *ChannelManagerReadArgs_get_keys_manager(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21453
21454 /**
21455  * The keys provider which will give us relevant keys. Some keys will be loaded during
21456  * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel
21457  * signing data.
21458  */
21459 void ChannelManagerReadArgs_set_keys_manager(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKKeysInterface val);
21460
21461 /**
21462  * The fee_estimator for use in the ChannelManager in the future.
21463  *
21464  * No calls to the FeeEstimator will be made during deserialization.
21465  */
21466 const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21467
21468 /**
21469  * The fee_estimator for use in the ChannelManager in the future.
21470  *
21471  * No calls to the FeeEstimator will be made during deserialization.
21472  */
21473 void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val);
21474
21475 /**
21476  * The chain::Watch for use in the ChannelManager in the future.
21477  *
21478  * No calls to the chain::Watch will be made during deserialization. It is assumed that
21479  * you have deserialized ChannelMonitors separately and will add them to your
21480  * chain::Watch after deserializing this ChannelManager.
21481  */
21482 const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21483
21484 /**
21485  * The chain::Watch for use in the ChannelManager in the future.
21486  *
21487  * No calls to the chain::Watch will be made during deserialization. It is assumed that
21488  * you have deserialized ChannelMonitors separately and will add them to your
21489  * chain::Watch after deserializing this ChannelManager.
21490  */
21491 void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val);
21492
21493 /**
21494  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
21495  * used to broadcast the latest local commitment transactions of channels which must be
21496  * force-closed during deserialization.
21497  */
21498 const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21499
21500 /**
21501  * The BroadcasterInterface which will be used in the ChannelManager in the future and may be
21502  * used to broadcast the latest local commitment transactions of channels which must be
21503  * force-closed during deserialization.
21504  */
21505 void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val);
21506
21507 /**
21508  * The Logger for use in the ChannelManager and which may be used to log information during
21509  * deserialization.
21510  */
21511 const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21512
21513 /**
21514  * The Logger for use in the ChannelManager and which may be used to log information during
21515  * deserialization.
21516  */
21517 void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val);
21518
21519 /**
21520  * Default settings used for new channels. Any existing channels will continue to use the
21521  * runtime settings which were stored when the ChannelManager was serialized.
21522  */
21523 struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr);
21524
21525 /**
21526  * Default settings used for new channels. Any existing channels will continue to use the
21527  * runtime settings which were stored when the ChannelManager was serialized.
21528  */
21529 void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val);
21530
21531 /**
21532  * Simple utility function to create a ChannelManagerReadArgs which creates the monitor
21533  * HashMap for you. This is primarily useful for C bindings where it is not practical to
21534  * populate a HashMap directly from C.
21535  */
21536 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);
21537
21538 /**
21539  * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
21540  */
21541 struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg);
21542
21543 /**
21544  * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL.
21545  */
21546 void ExpandedKey_free(struct LDKExpandedKey this_obj);
21547
21548 /**
21549  * Create a  new [`ExpandedKey`] for generating an inbound payment hash and secret.
21550  *
21551  * It is recommended to cache this value and not regenerate it for each new inbound payment.
21552  */
21553 MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]);
21554
21555 /**
21556  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
21557  * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
21558  * a `ChannelManager`.
21559  *
21560  * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
21561  * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
21562  * regenerate it for each new inbound payment.
21563  *
21564  * `current_time` is a Unix timestamp representing the current time.
21565  *
21566  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
21567  */
21568 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);
21569
21570 /**
21571  * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
21572  * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
21573  * without a `ChannelManager`.
21574  *
21575  * See [`create`] for information on the `keys` and `current_time` parameters.
21576  *
21577  * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
21578  */
21579 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);
21580
21581 /**
21582  * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL.
21583  */
21584 void DecodeError_free(struct LDKDecodeError this_obj);
21585
21586 /**
21587  * Creates a copy of the DecodeError
21588  */
21589 struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig);
21590
21591 /**
21592  * Frees any resources used by the Init, if is_owned is set and inner is non-NULL.
21593  */
21594 void Init_free(struct LDKInit this_obj);
21595
21596 /**
21597  * The relevant features which the sender supports
21598  */
21599 struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr);
21600
21601 /**
21602  * The relevant features which the sender supports
21603  */
21604 void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val);
21605
21606 /**
21607  * The receipient's network address. This adds the option to report a remote IP address
21608  * back to a connecting peer using the init message. A node can decide to use that information
21609  * to discover a potential update to its public IPv4 address (NAT) and use
21610  * that for a node_announcement update message containing the new address.
21611  */
21612 struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr);
21613
21614 /**
21615  * The receipient's network address. This adds the option to report a remote IP address
21616  * back to a connecting peer using the init message. A node can decide to use that information
21617  * to discover a potential update to its public IPv4 address (NAT) and use
21618  * that for a node_announcement update message containing the new address.
21619  */
21620 void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val);
21621
21622 /**
21623  * Constructs a new Init given each field
21624  */
21625 MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg);
21626
21627 /**
21628  * Creates a copy of the Init
21629  */
21630 struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig);
21631
21632 /**
21633  * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL.
21634  */
21635 void ErrorMessage_free(struct LDKErrorMessage this_obj);
21636
21637 /**
21638  * The channel ID involved in the error.
21639  *
21640  * All-0s indicates a general error unrelated to a specific channel, after which all channels
21641  * with the sending peer should be closed.
21642  */
21643 const uint8_t (*ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr))[32];
21644
21645 /**
21646  * The channel ID involved in the error.
21647  *
21648  * All-0s indicates a general error unrelated to a specific channel, after which all channels
21649  * with the sending peer should be closed.
21650  */
21651 void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21652
21653 /**
21654  * A possibly human-readable error description.
21655  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21656  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21657  * the terminal emulator or the logging subsystem.
21658  */
21659 struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr);
21660
21661 /**
21662  * A possibly human-readable error description.
21663  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21664  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21665  * the terminal emulator or the logging subsystem.
21666  */
21667 void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val);
21668
21669 /**
21670  * Constructs a new ErrorMessage given each field
21671  */
21672 MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
21673
21674 /**
21675  * Creates a copy of the ErrorMessage
21676  */
21677 struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig);
21678
21679 /**
21680  * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL.
21681  */
21682 void WarningMessage_free(struct LDKWarningMessage this_obj);
21683
21684 /**
21685  * The channel ID involved in the warning.
21686  *
21687  * All-0s indicates a warning unrelated to a specific channel.
21688  */
21689 const uint8_t (*WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr))[32];
21690
21691 /**
21692  * The channel ID involved in the warning.
21693  *
21694  * All-0s indicates a warning unrelated to a specific channel.
21695  */
21696 void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21697
21698 /**
21699  * A possibly human-readable warning description.
21700  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21701  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21702  * the terminal emulator or the logging subsystem.
21703  */
21704 struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr);
21705
21706 /**
21707  * A possibly human-readable warning description.
21708  * The string should be sanitized before it is used (e.g. emitted to logs or printed to
21709  * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in
21710  * the terminal emulator or the logging subsystem.
21711  */
21712 void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val);
21713
21714 /**
21715  * Constructs a new WarningMessage given each field
21716  */
21717 MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKStr data_arg);
21718
21719 /**
21720  * Creates a copy of the WarningMessage
21721  */
21722 struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig);
21723
21724 /**
21725  * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL.
21726  */
21727 void Ping_free(struct LDKPing this_obj);
21728
21729 /**
21730  * The desired response length
21731  */
21732 uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr);
21733
21734 /**
21735  * The desired response length
21736  */
21737 void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
21738
21739 /**
21740  * The ping packet size.
21741  * This field is not sent on the wire. byteslen zeros are sent.
21742  */
21743 uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr);
21744
21745 /**
21746  * The ping packet size.
21747  * This field is not sent on the wire. byteslen zeros are sent.
21748  */
21749 void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val);
21750
21751 /**
21752  * Constructs a new Ping given each field
21753  */
21754 MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg);
21755
21756 /**
21757  * Creates a copy of the Ping
21758  */
21759 struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig);
21760
21761 /**
21762  * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL.
21763  */
21764 void Pong_free(struct LDKPong this_obj);
21765
21766 /**
21767  * The pong packet size.
21768  * This field is not sent on the wire. byteslen zeros are sent.
21769  */
21770 uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr);
21771
21772 /**
21773  * The pong packet size.
21774  * This field is not sent on the wire. byteslen zeros are sent.
21775  */
21776 void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val);
21777
21778 /**
21779  * Constructs a new Pong given each field
21780  */
21781 MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg);
21782
21783 /**
21784  * Creates a copy of the Pong
21785  */
21786 struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig);
21787
21788 /**
21789  * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL.
21790  */
21791 void OpenChannel_free(struct LDKOpenChannel this_obj);
21792
21793 /**
21794  * The genesis hash of the blockchain where the channel is to be opened
21795  */
21796 const uint8_t (*OpenChannel_get_chain_hash(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
21797
21798 /**
21799  * The genesis hash of the blockchain where the channel is to be opened
21800  */
21801 void OpenChannel_set_chain_hash(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21802
21803 /**
21804  * A temporary channel ID, until the funding outpoint is announced
21805  */
21806 const uint8_t (*OpenChannel_get_temporary_channel_id(const struct LDKOpenChannel *NONNULL_PTR this_ptr))[32];
21807
21808 /**
21809  * A temporary channel ID, until the funding outpoint is announced
21810  */
21811 void OpenChannel_set_temporary_channel_id(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
21812
21813 /**
21814  * The channel value
21815  */
21816 uint64_t OpenChannel_get_funding_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21817
21818 /**
21819  * The channel value
21820  */
21821 void OpenChannel_set_funding_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21822
21823 /**
21824  * The amount to push to the counterparty as part of the open, in milli-satoshi
21825  */
21826 uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21827
21828 /**
21829  * The amount to push to the counterparty as part of the open, in milli-satoshi
21830  */
21831 void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21832
21833 /**
21834  * The threshold below which outputs on transactions broadcast by sender will be omitted
21835  */
21836 uint64_t OpenChannel_get_dust_limit_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21837
21838 /**
21839  * The threshold below which outputs on transactions broadcast by sender will be omitted
21840  */
21841 void OpenChannel_set_dust_limit_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21842
21843 /**
21844  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21845  */
21846 uint64_t OpenChannel_get_max_htlc_value_in_flight_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21847
21848 /**
21849  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
21850  */
21851 void OpenChannel_set_max_htlc_value_in_flight_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21852
21853 /**
21854  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21855  */
21856 uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21857
21858 /**
21859  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
21860  */
21861 void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21862
21863 /**
21864  * The minimum HTLC size incoming to sender, in milli-satoshi
21865  */
21866 uint64_t OpenChannel_get_htlc_minimum_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21867
21868 /**
21869  * The minimum HTLC size incoming to sender, in milli-satoshi
21870  */
21871 void OpenChannel_set_htlc_minimum_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val);
21872
21873 /**
21874  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
21875  */
21876 uint32_t OpenChannel_get_feerate_per_kw(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21877
21878 /**
21879  * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
21880  */
21881 void OpenChannel_set_feerate_per_kw(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint32_t val);
21882
21883 /**
21884  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21885  */
21886 uint16_t OpenChannel_get_to_self_delay(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21887
21888 /**
21889  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
21890  */
21891 void OpenChannel_set_to_self_delay(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
21892
21893 /**
21894  * The maximum number of inbound HTLCs towards sender
21895  */
21896 uint16_t OpenChannel_get_max_accepted_htlcs(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21897
21898 /**
21899  * The maximum number of inbound HTLCs towards sender
21900  */
21901 void OpenChannel_set_max_accepted_htlcs(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint16_t val);
21902
21903 /**
21904  * The sender's key controlling the funding transaction
21905  */
21906 struct LDKPublicKey OpenChannel_get_funding_pubkey(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21907
21908 /**
21909  * The sender's key controlling the funding transaction
21910  */
21911 void OpenChannel_set_funding_pubkey(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21912
21913 /**
21914  * Used to derive a revocation key for transactions broadcast by counterparty
21915  */
21916 struct LDKPublicKey OpenChannel_get_revocation_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21917
21918 /**
21919  * Used to derive a revocation key for transactions broadcast by counterparty
21920  */
21921 void OpenChannel_set_revocation_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21922
21923 /**
21924  * A payment key to sender for transactions broadcast by counterparty
21925  */
21926 struct LDKPublicKey OpenChannel_get_payment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21927
21928 /**
21929  * A payment key to sender for transactions broadcast by counterparty
21930  */
21931 void OpenChannel_set_payment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21932
21933 /**
21934  * Used to derive a payment key to sender for transactions broadcast by sender
21935  */
21936 struct LDKPublicKey OpenChannel_get_delayed_payment_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21937
21938 /**
21939  * Used to derive a payment key to sender for transactions broadcast by sender
21940  */
21941 void OpenChannel_set_delayed_payment_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21942
21943 /**
21944  * Used to derive an HTLC payment key to sender
21945  */
21946 struct LDKPublicKey OpenChannel_get_htlc_basepoint(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21947
21948 /**
21949  * Used to derive an HTLC payment key to sender
21950  */
21951 void OpenChannel_set_htlc_basepoint(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21952
21953 /**
21954  * The first to-be-broadcast-by-sender transaction's per commitment point
21955  */
21956 struct LDKPublicKey OpenChannel_get_first_per_commitment_point(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21957
21958 /**
21959  * The first to-be-broadcast-by-sender transaction's per commitment point
21960  */
21961 void OpenChannel_set_first_per_commitment_point(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
21962
21963 /**
21964  * Channel flags
21965  */
21966 uint8_t OpenChannel_get_channel_flags(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21967
21968 /**
21969  * Channel flags
21970  */
21971 void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val);
21972
21973 /**
21974  * The channel type that this channel will represent. If none is set, we derive the channel
21975  * type from the intersection of our feature bits with our counterparty's feature bits from
21976  * the Init message.
21977  *
21978  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
21979  */
21980 struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr);
21981
21982 /**
21983  * The channel type that this channel will represent. If none is set, we derive the channel
21984  * type from the intersection of our feature bits with our counterparty's feature bits from
21985  * the Init message.
21986  *
21987  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
21988  */
21989 void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
21990
21991 /**
21992  * Creates a copy of the OpenChannel
21993  */
21994 struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig);
21995
21996 /**
21997  * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL.
21998  */
21999 void AcceptChannel_free(struct LDKAcceptChannel this_obj);
22000
22001 /**
22002  * A temporary channel ID, until the funding outpoint is announced
22003  */
22004 const uint8_t (*AcceptChannel_get_temporary_channel_id(const struct LDKAcceptChannel *NONNULL_PTR this_ptr))[32];
22005
22006 /**
22007  * A temporary channel ID, until the funding outpoint is announced
22008  */
22009 void AcceptChannel_set_temporary_channel_id(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22010
22011 /**
22012  * The threshold below which outputs on transactions broadcast by sender will be omitted
22013  */
22014 uint64_t AcceptChannel_get_dust_limit_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22015
22016 /**
22017  * The threshold below which outputs on transactions broadcast by sender will be omitted
22018  */
22019 void AcceptChannel_set_dust_limit_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
22020
22021 /**
22022  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
22023  */
22024 uint64_t AcceptChannel_get_max_htlc_value_in_flight_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22025
22026 /**
22027  * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
22028  */
22029 void AcceptChannel_set_max_htlc_value_in_flight_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
22030
22031 /**
22032  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
22033  */
22034 uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22035
22036 /**
22037  * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
22038  */
22039 void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
22040
22041 /**
22042  * The minimum HTLC size incoming to sender, in milli-satoshi
22043  */
22044 uint64_t AcceptChannel_get_htlc_minimum_msat(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22045
22046 /**
22047  * The minimum HTLC size incoming to sender, in milli-satoshi
22048  */
22049 void AcceptChannel_set_htlc_minimum_msat(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val);
22050
22051 /**
22052  * Minimum depth of the funding transaction before the channel is considered open
22053  */
22054 uint32_t AcceptChannel_get_minimum_depth(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22055
22056 /**
22057  * Minimum depth of the funding transaction before the channel is considered open
22058  */
22059 void AcceptChannel_set_minimum_depth(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint32_t val);
22060
22061 /**
22062  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
22063  */
22064 uint16_t AcceptChannel_get_to_self_delay(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22065
22066 /**
22067  * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
22068  */
22069 void AcceptChannel_set_to_self_delay(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
22070
22071 /**
22072  * The maximum number of inbound HTLCs towards sender
22073  */
22074 uint16_t AcceptChannel_get_max_accepted_htlcs(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22075
22076 /**
22077  * The maximum number of inbound HTLCs towards sender
22078  */
22079 void AcceptChannel_set_max_accepted_htlcs(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint16_t val);
22080
22081 /**
22082  * The sender's key controlling the funding transaction
22083  */
22084 struct LDKPublicKey AcceptChannel_get_funding_pubkey(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22085
22086 /**
22087  * The sender's key controlling the funding transaction
22088  */
22089 void AcceptChannel_set_funding_pubkey(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22090
22091 /**
22092  * Used to derive a revocation key for transactions broadcast by counterparty
22093  */
22094 struct LDKPublicKey AcceptChannel_get_revocation_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22095
22096 /**
22097  * Used to derive a revocation key for transactions broadcast by counterparty
22098  */
22099 void AcceptChannel_set_revocation_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22100
22101 /**
22102  * A payment key to sender for transactions broadcast by counterparty
22103  */
22104 struct LDKPublicKey AcceptChannel_get_payment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22105
22106 /**
22107  * A payment key to sender for transactions broadcast by counterparty
22108  */
22109 void AcceptChannel_set_payment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22110
22111 /**
22112  * Used to derive a payment key to sender for transactions broadcast by sender
22113  */
22114 struct LDKPublicKey AcceptChannel_get_delayed_payment_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22115
22116 /**
22117  * Used to derive a payment key to sender for transactions broadcast by sender
22118  */
22119 void AcceptChannel_set_delayed_payment_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22120
22121 /**
22122  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
22123  */
22124 struct LDKPublicKey AcceptChannel_get_htlc_basepoint(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22125
22126 /**
22127  * Used to derive an HTLC payment key to sender for transactions broadcast by counterparty
22128  */
22129 void AcceptChannel_set_htlc_basepoint(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22130
22131 /**
22132  * The first to-be-broadcast-by-sender transaction's per commitment point
22133  */
22134 struct LDKPublicKey AcceptChannel_get_first_per_commitment_point(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22135
22136 /**
22137  * The first to-be-broadcast-by-sender transaction's per commitment point
22138  */
22139 void AcceptChannel_set_first_per_commitment_point(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22140
22141 /**
22142  * The channel type that this channel will represent. If none is set, we derive the channel
22143  * type from the intersection of our feature bits with our counterparty's feature bits from
22144  * the Init message.
22145  *
22146  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
22147  *
22148  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22149  */
22150 struct LDKChannelTypeFeatures AcceptChannel_get_channel_type(const struct LDKAcceptChannel *NONNULL_PTR this_ptr);
22151
22152 /**
22153  * The channel type that this channel will represent. If none is set, we derive the channel
22154  * type from the intersection of our feature bits with our counterparty's feature bits from
22155  * the Init message.
22156  *
22157  * This is required to match the equivalent field in [`OpenChannel::channel_type`].
22158  *
22159  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22160  */
22161 void AcceptChannel_set_channel_type(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val);
22162
22163 /**
22164  * Creates a copy of the AcceptChannel
22165  */
22166 struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig);
22167
22168 /**
22169  * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL.
22170  */
22171 void FundingCreated_free(struct LDKFundingCreated this_obj);
22172
22173 /**
22174  * A temporary channel ID, until the funding is established
22175  */
22176 const uint8_t (*FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
22177
22178 /**
22179  * A temporary channel ID, until the funding is established
22180  */
22181 void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22182
22183 /**
22184  * The funding transaction ID
22185  */
22186 const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32];
22187
22188 /**
22189  * The funding transaction ID
22190  */
22191 void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22192
22193 /**
22194  * The specific output index funding this channel
22195  */
22196 uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
22197
22198 /**
22199  * The specific output index funding this channel
22200  */
22201 void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val);
22202
22203 /**
22204  * The signature of the channel initiator (funder) on the initial commitment transaction
22205  */
22206 struct LDKSignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr);
22207
22208 /**
22209  * The signature of the channel initiator (funder) on the initial commitment transaction
22210  */
22211 void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKSignature val);
22212
22213 /**
22214  * Constructs a new FundingCreated given each field
22215  */
22216 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);
22217
22218 /**
22219  * Creates a copy of the FundingCreated
22220  */
22221 struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig);
22222
22223 /**
22224  * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL.
22225  */
22226 void FundingSigned_free(struct LDKFundingSigned this_obj);
22227
22228 /**
22229  * The channel ID
22230  */
22231 const uint8_t (*FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr))[32];
22232
22233 /**
22234  * The channel ID
22235  */
22236 void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22237
22238 /**
22239  * The signature of the channel acceptor (fundee) on the initial commitment transaction
22240  */
22241 struct LDKSignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr);
22242
22243 /**
22244  * The signature of the channel acceptor (fundee) on the initial commitment transaction
22245  */
22246 void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
22247
22248 /**
22249  * Constructs a new FundingSigned given each field
22250  */
22251 MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg);
22252
22253 /**
22254  * Creates a copy of the FundingSigned
22255  */
22256 struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig);
22257
22258 /**
22259  * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
22260  */
22261 void ChannelReady_free(struct LDKChannelReady this_obj);
22262
22263 /**
22264  * The channel ID
22265  */
22266 const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32];
22267
22268 /**
22269  * The channel ID
22270  */
22271 void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22272
22273 /**
22274  * The per-commitment point of the second commitment transaction
22275  */
22276 struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr);
22277
22278 /**
22279  * The per-commitment point of the second commitment transaction
22280  */
22281 void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22282
22283 /**
22284  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
22285  * to be forwarded over this SCID and forward them to this messages' recipient.
22286  */
22287 struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr);
22288
22289 /**
22290  * If set, provides a short_channel_id alias for this channel. The sender will accept payments
22291  * to be forwarded over this SCID and forward them to this messages' recipient.
22292  */
22293 void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
22294
22295 /**
22296  * Constructs a new ChannelReady given each field
22297  */
22298 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);
22299
22300 /**
22301  * Creates a copy of the ChannelReady
22302  */
22303 struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig);
22304
22305 /**
22306  * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL.
22307  */
22308 void Shutdown_free(struct LDKShutdown this_obj);
22309
22310 /**
22311  * The channel ID
22312  */
22313 const uint8_t (*Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr))[32];
22314
22315 /**
22316  * The channel ID
22317  */
22318 void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22319
22320 /**
22321  * The destination of this peer's funds on closing.
22322  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
22323  */
22324 struct LDKu8slice Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr);
22325
22326 /**
22327  * The destination of this peer's funds on closing.
22328  * Must be in one of these forms: p2pkh, p2sh, p2wpkh, p2wsh.
22329  */
22330 void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
22331
22332 /**
22333  * Constructs a new Shutdown given each field
22334  */
22335 MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg);
22336
22337 /**
22338  * Creates a copy of the Shutdown
22339  */
22340 struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
22341
22342 /**
22343  * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL.
22344  */
22345 void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
22346
22347 /**
22348  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
22349  * transaction.
22350  */
22351 uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
22352
22353 /**
22354  * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
22355  * transaction.
22356  */
22357 void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
22358
22359 /**
22360  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
22361  * transaction.
22362  */
22363 uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
22364
22365 /**
22366  * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
22367  * transaction.
22368  */
22369 void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
22370
22371 /**
22372  * Constructs a new ClosingSignedFeeRange given each field
22373  */
22374 MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
22375
22376 /**
22377  * Creates a copy of the ClosingSignedFeeRange
22378  */
22379 struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
22380
22381 /**
22382  * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL.
22383  */
22384 void ClosingSigned_free(struct LDKClosingSigned this_obj);
22385
22386 /**
22387  * The channel ID
22388  */
22389 const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
22390
22391 /**
22392  * The channel ID
22393  */
22394 void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22395
22396 /**
22397  * The proposed total fee for the closing transaction
22398  */
22399 uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
22400
22401 /**
22402  * The proposed total fee for the closing transaction
22403  */
22404 void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val);
22405
22406 /**
22407  * A signature on the closing transaction
22408  */
22409 struct LDKSignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
22410
22411 /**
22412  * A signature on the closing transaction
22413  */
22414 void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
22415
22416 /**
22417  * The minimum and maximum fees which the sender is willing to accept, provided only by new
22418  * nodes.
22419  *
22420  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
22421  */
22422 struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
22423
22424 /**
22425  * The minimum and maximum fees which the sender is willing to accept, provided only by new
22426  * nodes.
22427  *
22428  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
22429  */
22430 void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
22431
22432 /**
22433  * Constructs a new ClosingSigned given each field
22434  */
22435 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);
22436
22437 /**
22438  * Creates a copy of the ClosingSigned
22439  */
22440 struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
22441
22442 /**
22443  * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL.
22444  */
22445 void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
22446
22447 /**
22448  * The channel ID
22449  */
22450 const uint8_t (*UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
22451
22452 /**
22453  * The channel ID
22454  */
22455 void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22456
22457 /**
22458  * The HTLC ID
22459  */
22460 uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
22461
22462 /**
22463  * The HTLC ID
22464  */
22465 void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
22466
22467 /**
22468  * The HTLC value in milli-satoshi
22469  */
22470 uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
22471
22472 /**
22473  * The HTLC value in milli-satoshi
22474  */
22475 void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val);
22476
22477 /**
22478  * The payment hash, the pre-image of which controls HTLC redemption
22479  */
22480 const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32];
22481
22482 /**
22483  * The payment hash, the pre-image of which controls HTLC redemption
22484  */
22485 void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22486
22487 /**
22488  * The expiry height of the HTLC
22489  */
22490 uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr);
22491
22492 /**
22493  * The expiry height of the HTLC
22494  */
22495 void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val);
22496
22497 /**
22498  * Creates a copy of the UpdateAddHTLC
22499  */
22500 struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig);
22501
22502 /**
22503  * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL.
22504  */
22505 void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj);
22506
22507 /**
22508  * The channel ID
22509  */
22510 const uint8_t (*UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
22511
22512 /**
22513  * The channel ID
22514  */
22515 void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22516
22517 /**
22518  * The HTLC ID
22519  */
22520 uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr);
22521
22522 /**
22523  * The HTLC ID
22524  */
22525 void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val);
22526
22527 /**
22528  * The pre-image of the payment hash, allowing HTLC redemption
22529  */
22530 const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32];
22531
22532 /**
22533  * The pre-image of the payment hash, allowing HTLC redemption
22534  */
22535 void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22536
22537 /**
22538  * Constructs a new UpdateFulfillHTLC given each field
22539  */
22540 MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg);
22541
22542 /**
22543  * Creates a copy of the UpdateFulfillHTLC
22544  */
22545 struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig);
22546
22547 /**
22548  * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL.
22549  */
22550 void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj);
22551
22552 /**
22553  * The channel ID
22554  */
22555 const uint8_t (*UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr))[32];
22556
22557 /**
22558  * The channel ID
22559  */
22560 void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22561
22562 /**
22563  * The HTLC ID
22564  */
22565 uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr);
22566
22567 /**
22568  * The HTLC ID
22569  */
22570 void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val);
22571
22572 /**
22573  * Creates a copy of the UpdateFailHTLC
22574  */
22575 struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig);
22576
22577 /**
22578  * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL.
22579  */
22580 void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj);
22581
22582 /**
22583  * The channel ID
22584  */
22585 const uint8_t (*UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr))[32];
22586
22587 /**
22588  * The channel ID
22589  */
22590 void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22591
22592 /**
22593  * The HTLC ID
22594  */
22595 uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
22596
22597 /**
22598  * The HTLC ID
22599  */
22600 void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val);
22601
22602 /**
22603  * The failure code
22604  */
22605 uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr);
22606
22607 /**
22608  * The failure code
22609  */
22610 void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val);
22611
22612 /**
22613  * Creates a copy of the UpdateFailMalformedHTLC
22614  */
22615 struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig);
22616
22617 /**
22618  * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL.
22619  */
22620 void CommitmentSigned_free(struct LDKCommitmentSigned this_obj);
22621
22622 /**
22623  * The channel ID
22624  */
22625 const uint8_t (*CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr))[32];
22626
22627 /**
22628  * The channel ID
22629  */
22630 void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22631
22632 /**
22633  * A signature on the commitment transaction
22634  */
22635 struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr);
22636
22637 /**
22638  * A signature on the commitment transaction
22639  */
22640 void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
22641
22642 /**
22643  * Signatures on the HTLC transactions
22644  */
22645 void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
22646
22647 /**
22648  * Constructs a new CommitmentSigned given each field
22649  */
22650 MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKSignature signature_arg, struct LDKCVec_SignatureZ htlc_signatures_arg);
22651
22652 /**
22653  * Creates a copy of the CommitmentSigned
22654  */
22655 struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig);
22656
22657 /**
22658  * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL.
22659  */
22660 void RevokeAndACK_free(struct LDKRevokeAndACK this_obj);
22661
22662 /**
22663  * The channel ID
22664  */
22665 const uint8_t (*RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
22666
22667 /**
22668  * The channel ID
22669  */
22670 void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22671
22672 /**
22673  * The secret corresponding to the per-commitment point
22674  */
22675 const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32];
22676
22677 /**
22678  * The secret corresponding to the per-commitment point
22679  */
22680 void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22681
22682 /**
22683  * The next sender-broadcast commitment transaction's per-commitment point
22684  */
22685 struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr);
22686
22687 /**
22688  * The next sender-broadcast commitment transaction's per-commitment point
22689  */
22690 void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22691
22692 /**
22693  * Constructs a new RevokeAndACK given each field
22694  */
22695 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);
22696
22697 /**
22698  * Creates a copy of the RevokeAndACK
22699  */
22700 struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig);
22701
22702 /**
22703  * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL.
22704  */
22705 void UpdateFee_free(struct LDKUpdateFee this_obj);
22706
22707 /**
22708  * The channel ID
22709  */
22710 const uint8_t (*UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr))[32];
22711
22712 /**
22713  * The channel ID
22714  */
22715 void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22716
22717 /**
22718  * Fee rate per 1000-weight of the transaction
22719  */
22720 uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr);
22721
22722 /**
22723  * Fee rate per 1000-weight of the transaction
22724  */
22725 void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val);
22726
22727 /**
22728  * Constructs a new UpdateFee given each field
22729  */
22730 MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKThirtyTwoBytes channel_id_arg, uint32_t feerate_per_kw_arg);
22731
22732 /**
22733  * Creates a copy of the UpdateFee
22734  */
22735 struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig);
22736
22737 /**
22738  * Frees any resources used by the DataLossProtect, if is_owned is set and inner is non-NULL.
22739  */
22740 void DataLossProtect_free(struct LDKDataLossProtect this_obj);
22741
22742 /**
22743  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
22744  * belonging to the recipient
22745  */
22746 const uint8_t (*DataLossProtect_get_your_last_per_commitment_secret(const struct LDKDataLossProtect *NONNULL_PTR this_ptr))[32];
22747
22748 /**
22749  * Proof that the sender knows the per-commitment secret of a specific commitment transaction
22750  * belonging to the recipient
22751  */
22752 void DataLossProtect_set_your_last_per_commitment_secret(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22753
22754 /**
22755  * The sender's per-commitment point for their current commitment transaction
22756  */
22757 struct LDKPublicKey DataLossProtect_get_my_current_per_commitment_point(const struct LDKDataLossProtect *NONNULL_PTR this_ptr);
22758
22759 /**
22760  * The sender's per-commitment point for their current commitment transaction
22761  */
22762 void DataLossProtect_set_my_current_per_commitment_point(struct LDKDataLossProtect *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22763
22764 /**
22765  * Constructs a new DataLossProtect given each field
22766  */
22767 MUST_USE_RES struct LDKDataLossProtect DataLossProtect_new(struct LDKThirtyTwoBytes your_last_per_commitment_secret_arg, struct LDKPublicKey my_current_per_commitment_point_arg);
22768
22769 /**
22770  * Creates a copy of the DataLossProtect
22771  */
22772 struct LDKDataLossProtect DataLossProtect_clone(const struct LDKDataLossProtect *NONNULL_PTR orig);
22773
22774 /**
22775  * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL.
22776  */
22777 void ChannelReestablish_free(struct LDKChannelReestablish this_obj);
22778
22779 /**
22780  * The channel ID
22781  */
22782 const uint8_t (*ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32];
22783
22784 /**
22785  * The channel ID
22786  */
22787 void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22788
22789 /**
22790  * The next commitment number for the sender
22791  */
22792 uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
22793
22794 /**
22795  * The next commitment number for the sender
22796  */
22797 void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
22798
22799 /**
22800  * The next commitment number for the recipient
22801  */
22802 uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr);
22803
22804 /**
22805  * The next commitment number for the recipient
22806  */
22807 void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val);
22808
22809 /**
22810  * Creates a copy of the ChannelReestablish
22811  */
22812 struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig);
22813
22814 /**
22815  * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL.
22816  */
22817 void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj);
22818
22819 /**
22820  * The channel ID
22821  */
22822 const uint8_t (*AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr))[32];
22823
22824 /**
22825  * The channel ID
22826  */
22827 void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22828
22829 /**
22830  * The short channel ID
22831  */
22832 uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22833
22834 /**
22835  * The short channel ID
22836  */
22837 void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val);
22838
22839 /**
22840  * A signature by the node key
22841  */
22842 struct LDKSignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22843
22844 /**
22845  * A signature by the node key
22846  */
22847 void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
22848
22849 /**
22850  * A signature by the funding key
22851  */
22852 struct LDKSignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr);
22853
22854 /**
22855  * A signature by the funding key
22856  */
22857 void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKSignature val);
22858
22859 /**
22860  * Constructs a new AnnouncementSignatures given each field
22861  */
22862 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);
22863
22864 /**
22865  * Creates a copy of the AnnouncementSignatures
22866  */
22867 struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig);
22868
22869 /**
22870  * Frees any resources used by the NetAddress
22871  */
22872 void NetAddress_free(struct LDKNetAddress this_ptr);
22873
22874 /**
22875  * Creates a copy of the NetAddress
22876  */
22877 struct LDKNetAddress NetAddress_clone(const struct LDKNetAddress *NONNULL_PTR orig);
22878
22879 /**
22880  * Utility method to constructs a new IPv4-variant NetAddress
22881  */
22882 struct LDKNetAddress NetAddress_ipv4(struct LDKFourBytes addr, uint16_t port);
22883
22884 /**
22885  * Utility method to constructs a new IPv6-variant NetAddress
22886  */
22887 struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port);
22888
22889 /**
22890  * Utility method to constructs a new OnionV2-variant NetAddress
22891  */
22892 struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a);
22893
22894 /**
22895  * Utility method to constructs a new OnionV3-variant NetAddress
22896  */
22897 struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port);
22898
22899 /**
22900  * Utility method to constructs a new Hostname-variant NetAddress
22901  */
22902 struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port);
22903
22904 /**
22905  * Serialize the NetAddress object into a byte array which can be read by NetAddress_read
22906  */
22907 struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj);
22908
22909 /**
22910  * Read a NetAddress from a byte array, created by NetAddress_write
22911  */
22912 struct LDKCResult_NetAddressDecodeErrorZ NetAddress_read(struct LDKu8slice ser);
22913
22914 /**
22915  * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL.
22916  */
22917 void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj);
22918
22919 /**
22920  * The advertised features
22921  */
22922 struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22923
22924 /**
22925  * The advertised features
22926  */
22927 void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
22928
22929 /**
22930  * A strictly monotonic announcement counter, with gaps allowed
22931  */
22932 uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22933
22934 /**
22935  * A strictly monotonic announcement counter, with gaps allowed
22936  */
22937 void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val);
22938
22939 /**
22940  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
22941  * to this node).
22942  */
22943 struct LDKPublicKey UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
22944
22945 /**
22946  * The node_id this announcement originated from (don't rebroadcast the node_announcement back
22947  * to this node).
22948  */
22949 void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
22950
22951 /**
22952  * An RGB color for UI purposes
22953  */
22954 const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3];
22955
22956 /**
22957  * An RGB color for UI purposes
22958  */
22959 void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
22960
22961 /**
22962  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
22963  * of uniqueness.
22964  */
22965 const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
22966
22967 /**
22968  * An alias, for UI purposes.  This should be sanitized before use.  There is no guarantee
22969  * of uniqueness.
22970  */
22971 void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
22972
22973 /**
22974  * List of addresses on which this node is reachable
22975  */
22976 void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
22977
22978 /**
22979  * Creates a copy of the UnsignedNodeAnnouncement
22980  */
22981 struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig);
22982
22983 /**
22984  * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL.
22985  */
22986 void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj);
22987
22988 /**
22989  * The signature by the node key
22990  */
22991 struct LDKSignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
22992
22993 /**
22994  * The signature by the node key
22995  */
22996 void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
22997
22998 /**
22999  * The actual content of the announcement
23000  */
23001 struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr);
23002
23003 /**
23004  * The actual content of the announcement
23005  */
23006 void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val);
23007
23008 /**
23009  * Constructs a new NodeAnnouncement given each field
23010  */
23011 MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKSignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg);
23012
23013 /**
23014  * Creates a copy of the NodeAnnouncement
23015  */
23016 struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig);
23017
23018 /**
23019  * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL.
23020  */
23021 void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj);
23022
23023 /**
23024  * The advertised channel features
23025  */
23026 struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
23027
23028 /**
23029  * The advertised channel features
23030  */
23031 void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
23032
23033 /**
23034  * The genesis hash of the blockchain where the channel is to be opened
23035  */
23036 const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32];
23037
23038 /**
23039  * The genesis hash of the blockchain where the channel is to be opened
23040  */
23041 void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23042
23043 /**
23044  * The short channel ID
23045  */
23046 uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
23047
23048 /**
23049  * The short channel ID
23050  */
23051 void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val);
23052
23053 /**
23054  * One of the two node_ids which are endpoints of this channel
23055  */
23056 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
23057
23058 /**
23059  * One of the two node_ids which are endpoints of this channel
23060  */
23061 void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23062
23063 /**
23064  * The other of the two node_ids which are endpoints of this channel
23065  */
23066 struct LDKPublicKey UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
23067
23068 /**
23069  * The other of the two node_ids which are endpoints of this channel
23070  */
23071 void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23072
23073 /**
23074  * The funding key for the first node
23075  */
23076 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
23077
23078 /**
23079  * The funding key for the first node
23080  */
23081 void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23082
23083 /**
23084  * The funding key for the second node
23085  */
23086 struct LDKPublicKey UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr);
23087
23088 /**
23089  * The funding key for the second node
23090  */
23091 void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKPublicKey val);
23092
23093 /**
23094  * Creates a copy of the UnsignedChannelAnnouncement
23095  */
23096 struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig);
23097
23098 /**
23099  * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL.
23100  */
23101 void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj);
23102
23103 /**
23104  * Authentication of the announcement by the first public node
23105  */
23106 struct LDKSignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
23107
23108 /**
23109  * Authentication of the announcement by the first public node
23110  */
23111 void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
23112
23113 /**
23114  * Authentication of the announcement by the second public node
23115  */
23116 struct LDKSignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
23117
23118 /**
23119  * Authentication of the announcement by the second public node
23120  */
23121 void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
23122
23123 /**
23124  * Proof of funding UTXO ownership by the first public node
23125  */
23126 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
23127
23128 /**
23129  * Proof of funding UTXO ownership by the first public node
23130  */
23131 void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
23132
23133 /**
23134  * Proof of funding UTXO ownership by the second public node
23135  */
23136 struct LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
23137
23138 /**
23139  * Proof of funding UTXO ownership by the second public node
23140  */
23141 void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKSignature val);
23142
23143 /**
23144  * The actual announcement
23145  */
23146 struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr);
23147
23148 /**
23149  * The actual announcement
23150  */
23151 void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val);
23152
23153 /**
23154  * Constructs a new ChannelAnnouncement given each field
23155  */
23156 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);
23157
23158 /**
23159  * Creates a copy of the ChannelAnnouncement
23160  */
23161 struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig);
23162
23163 /**
23164  * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL.
23165  */
23166 void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj);
23167
23168 /**
23169  * The genesis hash of the blockchain where the channel is to be opened
23170  */
23171 const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32];
23172
23173 /**
23174  * The genesis hash of the blockchain where the channel is to be opened
23175  */
23176 void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23177
23178 /**
23179  * The short channel ID
23180  */
23181 uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
23182
23183 /**
23184  * The short channel ID
23185  */
23186 void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
23187
23188 /**
23189  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
23190  */
23191 uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
23192
23193 /**
23194  * A strictly monotonic announcement counter, with gaps allowed, specific to this channel
23195  */
23196 void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
23197
23198 /**
23199  * Channel flags
23200  */
23201 uint8_t UnsignedChannelUpdate_get_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
23202
23203 /**
23204  * Channel flags
23205  */
23206 void UnsignedChannelUpdate_set_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val);
23207
23208 /**
23209  * The number of blocks such that if:
23210  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
23211  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
23212  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
23213  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
23214  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
23215  * forwarding. Note that the HTLC sender is the one who originally sets this value when
23216  * constructing the route.
23217  */
23218 uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
23219
23220 /**
23221  * The number of blocks such that if:
23222  * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta`
23223  * then we need to fail the HTLC backwards. When forwarding an HTLC, cltv_expiry_delta determines
23224  * the outgoing HTLC's minimum cltv_expiry value -- so, if an incoming HTLC comes in with a
23225  * cltv_expiry of 100000, and the node we're forwarding to has a cltv_expiry_delta value of 10,
23226  * then we'll check that the outgoing HTLC's cltv_expiry value is at least 100010 before
23227  * forwarding. Note that the HTLC sender is the one who originally sets this value when
23228  * constructing the route.
23229  */
23230 void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val);
23231
23232 /**
23233  * The minimum HTLC size incoming to sender, in milli-satoshi
23234  */
23235 uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
23236
23237 /**
23238  * The minimum HTLC size incoming to sender, in milli-satoshi
23239  */
23240 void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
23241
23242 /**
23243  * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional.
23244  */
23245 uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
23246
23247 /**
23248  * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional.
23249  */
23250 void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val);
23251
23252 /**
23253  * The base HTLC fee charged by sender, in milli-satoshi
23254  */
23255 uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
23256
23257 /**
23258  * The base HTLC fee charged by sender, in milli-satoshi
23259  */
23260 void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
23261
23262 /**
23263  * The amount to fee multiplier, in micro-satoshi
23264  */
23265 uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr);
23266
23267 /**
23268  * The amount to fee multiplier, in micro-satoshi
23269  */
23270 void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val);
23271
23272 /**
23273  * Excess data which was signed as a part of the message which we do not (yet) understand how
23274  * to decode. This is stored to ensure forward-compatibility as new fields are added to the
23275  * lightning gossip
23276  */
23277 void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
23278
23279 /**
23280  * Constructs a new UnsignedChannelUpdate given each field
23281  */
23282 MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, uint32_t timestamp_arg, uint8_t flags_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, struct LDKCVec_u8Z excess_data_arg);
23283
23284 /**
23285  * Creates a copy of the UnsignedChannelUpdate
23286  */
23287 struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig);
23288
23289 /**
23290  * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL.
23291  */
23292 void ChannelUpdate_free(struct LDKChannelUpdate this_obj);
23293
23294 /**
23295  * A signature of the channel update
23296  */
23297 struct LDKSignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
23298
23299 /**
23300  * A signature of the channel update
23301  */
23302 void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKSignature val);
23303
23304 /**
23305  * The actual channel update
23306  */
23307 struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr);
23308
23309 /**
23310  * The actual channel update
23311  */
23312 void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val);
23313
23314 /**
23315  * Constructs a new ChannelUpdate given each field
23316  */
23317 MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKSignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg);
23318
23319 /**
23320  * Creates a copy of the ChannelUpdate
23321  */
23322 struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig);
23323
23324 /**
23325  * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL.
23326  */
23327 void QueryChannelRange_free(struct LDKQueryChannelRange this_obj);
23328
23329 /**
23330  * The genesis hash of the blockchain being queried
23331  */
23332 const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32];
23333
23334 /**
23335  * The genesis hash of the blockchain being queried
23336  */
23337 void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23338
23339 /**
23340  * The height of the first block for the channel UTXOs being queried
23341  */
23342 uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
23343
23344 /**
23345  * The height of the first block for the channel UTXOs being queried
23346  */
23347 void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
23348
23349 /**
23350  * The number of blocks to include in the query results
23351  */
23352 uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr);
23353
23354 /**
23355  * The number of blocks to include in the query results
23356  */
23357 void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val);
23358
23359 /**
23360  * Constructs a new QueryChannelRange given each field
23361  */
23362 MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg);
23363
23364 /**
23365  * Creates a copy of the QueryChannelRange
23366  */
23367 struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig);
23368
23369 /**
23370  * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL.
23371  */
23372 void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj);
23373
23374 /**
23375  * The genesis hash of the blockchain being queried
23376  */
23377 const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32];
23378
23379 /**
23380  * The genesis hash of the blockchain being queried
23381  */
23382 void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23383
23384 /**
23385  * The height of the first block in the range of the reply
23386  */
23387 uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
23388
23389 /**
23390  * The height of the first block in the range of the reply
23391  */
23392 void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
23393
23394 /**
23395  * The number of blocks included in the range of the reply
23396  */
23397 uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
23398
23399 /**
23400  * The number of blocks included in the range of the reply
23401  */
23402 void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val);
23403
23404 /**
23405  * True when this is the final reply for a query
23406  */
23407 bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr);
23408
23409 /**
23410  * True when this is the final reply for a query
23411  */
23412 void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val);
23413
23414 /**
23415  * The short_channel_ids in the channel range
23416  */
23417 void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
23418
23419 /**
23420  * Constructs a new ReplyChannelRange given each field
23421  */
23422 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);
23423
23424 /**
23425  * Creates a copy of the ReplyChannelRange
23426  */
23427 struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig);
23428
23429 /**
23430  * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL.
23431  */
23432 void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj);
23433
23434 /**
23435  * The genesis hash of the blockchain being queried
23436  */
23437 const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32];
23438
23439 /**
23440  * The genesis hash of the blockchain being queried
23441  */
23442 void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23443
23444 /**
23445  * The short_channel_ids that are being queried
23446  */
23447 void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
23448
23449 /**
23450  * Constructs a new QueryShortChannelIds given each field
23451  */
23452 MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg);
23453
23454 /**
23455  * Creates a copy of the QueryShortChannelIds
23456  */
23457 struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig);
23458
23459 /**
23460  * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL.
23461  */
23462 void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj);
23463
23464 /**
23465  * The genesis hash of the blockchain that was queried
23466  */
23467 const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32];
23468
23469 /**
23470  * The genesis hash of the blockchain that was queried
23471  */
23472 void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23473
23474 /**
23475  * Indicates if the query recipient maintains up-to-date channel
23476  * information for the chain_hash
23477  */
23478 bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr);
23479
23480 /**
23481  * Indicates if the query recipient maintains up-to-date channel
23482  * information for the chain_hash
23483  */
23484 void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val);
23485
23486 /**
23487  * Constructs a new ReplyShortChannelIdsEnd given each field
23488  */
23489 MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg);
23490
23491 /**
23492  * Creates a copy of the ReplyShortChannelIdsEnd
23493  */
23494 struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig);
23495
23496 /**
23497  * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL.
23498  */
23499 void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj);
23500
23501 /**
23502  * The genesis hash of the blockchain for channel and node information
23503  */
23504 const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32];
23505
23506 /**
23507  * The genesis hash of the blockchain for channel and node information
23508  */
23509 void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
23510
23511 /**
23512  * The starting unix timestamp
23513  */
23514 uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
23515
23516 /**
23517  * The starting unix timestamp
23518  */
23519 void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
23520
23521 /**
23522  * The range of information in seconds
23523  */
23524 uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr);
23525
23526 /**
23527  * The range of information in seconds
23528  */
23529 void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val);
23530
23531 /**
23532  * Constructs a new GossipTimestampFilter given each field
23533  */
23534 MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg);
23535
23536 /**
23537  * Creates a copy of the GossipTimestampFilter
23538  */
23539 struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig);
23540
23541 /**
23542  * Frees any resources used by the ErrorAction
23543  */
23544 void ErrorAction_free(struct LDKErrorAction this_ptr);
23545
23546 /**
23547  * Creates a copy of the ErrorAction
23548  */
23549 struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig);
23550
23551 /**
23552  * Utility method to constructs a new DisconnectPeer-variant ErrorAction
23553  */
23554 struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg);
23555
23556 /**
23557  * Utility method to constructs a new IgnoreError-variant ErrorAction
23558  */
23559 struct LDKErrorAction ErrorAction_ignore_error(void);
23560
23561 /**
23562  * Utility method to constructs a new IgnoreAndLog-variant ErrorAction
23563  */
23564 struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a);
23565
23566 /**
23567  * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction
23568  */
23569 struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void);
23570
23571 /**
23572  * Utility method to constructs a new SendErrorMessage-variant ErrorAction
23573  */
23574 struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg);
23575
23576 /**
23577  * Utility method to constructs a new SendWarningMessage-variant ErrorAction
23578  */
23579 struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level);
23580
23581 /**
23582  * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL.
23583  */
23584 void LightningError_free(struct LDKLightningError this_obj);
23585
23586 /**
23587  * A human-readable message describing the error
23588  */
23589 struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr);
23590
23591 /**
23592  * A human-readable message describing the error
23593  */
23594 void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val);
23595
23596 /**
23597  * The action which should be taken against the offending peer.
23598  */
23599 struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr);
23600
23601 /**
23602  * The action which should be taken against the offending peer.
23603  */
23604 void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val);
23605
23606 /**
23607  * Constructs a new LightningError given each field
23608  */
23609 MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg);
23610
23611 /**
23612  * Creates a copy of the LightningError
23613  */
23614 struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig);
23615
23616 /**
23617  * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL.
23618  */
23619 void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
23620
23621 /**
23622  * update_add_htlc messages which should be sent
23623  */
23624 struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23625
23626 /**
23627  * update_add_htlc messages which should be sent
23628  */
23629 void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
23630
23631 /**
23632  * update_fulfill_htlc messages which should be sent
23633  */
23634 struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23635
23636 /**
23637  * update_fulfill_htlc messages which should be sent
23638  */
23639 void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
23640
23641 /**
23642  * update_fail_htlc messages which should be sent
23643  */
23644 struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23645
23646 /**
23647  * update_fail_htlc messages which should be sent
23648  */
23649 void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
23650
23651 /**
23652  * update_fail_malformed_htlc messages which should be sent
23653  */
23654 struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23655
23656 /**
23657  * update_fail_malformed_htlc messages which should be sent
23658  */
23659 void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
23660
23661 /**
23662  * An update_fee message which should be sent
23663  *
23664  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
23665  */
23666 struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23667
23668 /**
23669  * An update_fee message which should be sent
23670  *
23671  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
23672  */
23673 void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val);
23674
23675 /**
23676  * Finally, the commitment_signed message which should be sent
23677  */
23678 struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
23679
23680 /**
23681  * Finally, the commitment_signed message which should be sent
23682  */
23683 void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val);
23684
23685 /**
23686  * Constructs a new CommitmentUpdate given each field
23687  */
23688 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);
23689
23690 /**
23691  * Creates a copy of the CommitmentUpdate
23692  */
23693 struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
23694
23695 /**
23696  * Calls the free function if one is set
23697  */
23698 void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
23699
23700 /**
23701  * Calls the free function if one is set
23702  */
23703 void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
23704
23705 /**
23706  * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read
23707  */
23708 struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj);
23709
23710 /**
23711  * Read a AcceptChannel from a byte array, created by AcceptChannel_write
23712  */
23713 struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser);
23714
23715 /**
23716  * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
23717  */
23718 struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj);
23719
23720 /**
23721  * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
23722  */
23723 struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser);
23724
23725 /**
23726  * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
23727  */
23728 struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj);
23729
23730 /**
23731  * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
23732  */
23733 struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser);
23734
23735 /**
23736  * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
23737  */
23738 struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj);
23739
23740 /**
23741  * Read a ClosingSigned from a byte array, created by ClosingSigned_write
23742  */
23743 struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
23744
23745 /**
23746  * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
23747  */
23748 struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
23749
23750 /**
23751  * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
23752  */
23753 struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
23754
23755 /**
23756  * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
23757  */
23758 struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
23759
23760 /**
23761  * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
23762  */
23763 struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
23764
23765 /**
23766  * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
23767  */
23768 struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj);
23769
23770 /**
23771  * Read a FundingCreated from a byte array, created by FundingCreated_write
23772  */
23773 struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser);
23774
23775 /**
23776  * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
23777  */
23778 struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj);
23779
23780 /**
23781  * Read a FundingSigned from a byte array, created by FundingSigned_write
23782  */
23783 struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser);
23784
23785 /**
23786  * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
23787  */
23788 struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj);
23789
23790 /**
23791  * Read a ChannelReady from a byte array, created by ChannelReady_write
23792  */
23793 struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser);
23794
23795 /**
23796  * Serialize the Init object into a byte array which can be read by Init_read
23797  */
23798 struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj);
23799
23800 /**
23801  * Read a Init from a byte array, created by Init_write
23802  */
23803 struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser);
23804
23805 /**
23806  * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
23807  */
23808 struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj);
23809
23810 /**
23811  * Read a OpenChannel from a byte array, created by OpenChannel_write
23812  */
23813 struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser);
23814
23815 /**
23816  * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
23817  */
23818 struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj);
23819
23820 /**
23821  * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
23822  */
23823 struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser);
23824
23825 /**
23826  * Serialize the Shutdown object into a byte array which can be read by Shutdown_read
23827  */
23828 struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj);
23829
23830 /**
23831  * Read a Shutdown from a byte array, created by Shutdown_write
23832  */
23833 struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser);
23834
23835 /**
23836  * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read
23837  */
23838 struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj);
23839
23840 /**
23841  * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write
23842  */
23843 struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser);
23844
23845 /**
23846  * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read
23847  */
23848 struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj);
23849
23850 /**
23851  * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write
23852  */
23853 struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser);
23854
23855 /**
23856  * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
23857  */
23858 struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj);
23859
23860 /**
23861  * Read a UpdateFee from a byte array, created by UpdateFee_write
23862  */
23863 struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser);
23864
23865 /**
23866  * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read
23867  */
23868 struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj);
23869
23870 /**
23871  * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write
23872  */
23873 struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser);
23874
23875 /**
23876  * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
23877  */
23878 struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj);
23879
23880 /**
23881  * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
23882  */
23883 struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser);
23884
23885 /**
23886  * Serialize the Ping object into a byte array which can be read by Ping_read
23887  */
23888 struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj);
23889
23890 /**
23891  * Read a Ping from a byte array, created by Ping_write
23892  */
23893 struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser);
23894
23895 /**
23896  * Serialize the Pong object into a byte array which can be read by Pong_read
23897  */
23898 struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj);
23899
23900 /**
23901  * Read a Pong from a byte array, created by Pong_write
23902  */
23903 struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser);
23904
23905 /**
23906  * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read
23907  */
23908 struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj);
23909
23910 /**
23911  * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write
23912  */
23913 struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser);
23914
23915 /**
23916  * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read
23917  */
23918 struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj);
23919
23920 /**
23921  * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write
23922  */
23923 struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser);
23924
23925 /**
23926  * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read
23927  */
23928 struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj);
23929
23930 /**
23931  * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write
23932  */
23933 struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser);
23934
23935 /**
23936  * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read
23937  */
23938 struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj);
23939
23940 /**
23941  * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write
23942  */
23943 struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser);
23944
23945 /**
23946  * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read
23947  */
23948 struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj);
23949
23950 /**
23951  * Read a ErrorMessage from a byte array, created by ErrorMessage_write
23952  */
23953 struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser);
23954
23955 /**
23956  * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read
23957  */
23958 struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj);
23959
23960 /**
23961  * Read a WarningMessage from a byte array, created by WarningMessage_write
23962  */
23963 struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser);
23964
23965 /**
23966  * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read
23967  */
23968 struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj);
23969
23970 /**
23971  * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write
23972  */
23973 struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser);
23974
23975 /**
23976  * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read
23977  */
23978 struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj);
23979
23980 /**
23981  * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write
23982  */
23983 struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser);
23984
23985 /**
23986  * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write
23987  */
23988 struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser);
23989
23990 /**
23991  * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read
23992  */
23993 struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
23994
23995 /**
23996  * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
23997  */
23998 struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
23999
24000 /**
24001  * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
24002  */
24003 struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
24004
24005 /**
24006  *\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
24007  */
24008 MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
24009
24010 /**
24011  * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
24012  */
24013 struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
24014
24015 /**
24016  * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
24017  */
24018 struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
24019
24020 /**
24021  * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
24022  */
24023 struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
24024
24025 /**
24026  * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
24027  */
24028 struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
24029
24030 /**
24031  * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
24032  */
24033 struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
24034
24035 /**
24036  * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
24037  */
24038 struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
24039
24040 /**
24041  * Calls the free function if one is set
24042  */
24043 void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
24044
24045 /**
24046  * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL.
24047  */
24048 void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
24049
24050 /**
24051  * Constructs a new IgnoringMessageHandler given each field
24052  */
24053 MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
24054
24055 /**
24056  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
24057  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
24058  */
24059 struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
24060
24061 /**
24062  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
24063  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
24064  */
24065 struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
24066
24067 /**
24068  * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
24069  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
24070  */
24071 struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
24072
24073 /**
24074  * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
24075  * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
24076  */
24077 struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
24078
24079 /**
24080  * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL.
24081  */
24082 void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
24083
24084 /**
24085  * Constructs a new ErroringMessageHandler
24086  */
24087 MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
24088
24089 /**
24090  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
24091  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
24092  */
24093 struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
24094
24095 /**
24096  * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg.
24097  * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is
24098  */
24099 struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg);
24100
24101 /**
24102  * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL.
24103  */
24104 void MessageHandler_free(struct LDKMessageHandler this_obj);
24105
24106 /**
24107  * A message handler which handles messages specific to channels. Usually this is just a
24108  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
24109  *
24110  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
24111  */
24112 const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
24113
24114 /**
24115  * A message handler which handles messages specific to channels. Usually this is just a
24116  * [`ChannelManager`] object or an [`ErroringMessageHandler`].
24117  *
24118  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
24119  */
24120 void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val);
24121
24122 /**
24123  * A message handler which handles messages updating our knowledge of the network channel
24124  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
24125  *
24126  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
24127  */
24128 const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr);
24129
24130 /**
24131  * A message handler which handles messages updating our knowledge of the network channel
24132  * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`].
24133  *
24134  * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync
24135  */
24136 void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val);
24137
24138 /**
24139  * Constructs a new MessageHandler given each field
24140  */
24141 MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg);
24142
24143 /**
24144  * Creates a copy of a SocketDescriptor
24145  */
24146 struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig);
24147
24148 /**
24149  * Calls the free function if one is set
24150  */
24151 void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr);
24152
24153 /**
24154  * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL.
24155  */
24156 void PeerHandleError_free(struct LDKPeerHandleError this_obj);
24157
24158 /**
24159  * Used to indicate that we probably can't make any future connections to this peer (e.g.
24160  * because we required features that our peer was missing, or vice versa).
24161  *
24162  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
24163  * any channels with this peer or check for new versions of LDK.
24164  *
24165  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
24166  */
24167 bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr);
24168
24169 /**
24170  * Used to indicate that we probably can't make any future connections to this peer (e.g.
24171  * because we required features that our peer was missing, or vice versa).
24172  *
24173  * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close
24174  * any channels with this peer or check for new versions of LDK.
24175  *
24176  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
24177  */
24178 void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val);
24179
24180 /**
24181  * Constructs a new PeerHandleError given each field
24182  */
24183 MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(bool no_connection_possible_arg);
24184
24185 /**
24186  * Creates a copy of the PeerHandleError
24187  */
24188 struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig);
24189
24190 /**
24191  * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL.
24192  */
24193 void PeerManager_free(struct LDKPeerManager this_obj);
24194
24195 /**
24196  * Constructs a new PeerManager with the given message handlers and node_id secret key
24197  * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
24198  * cryptographically secure random bytes.
24199  */
24200 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);
24201
24202 /**
24203  * Get the list of node ids for peers which have completed the initial handshake.
24204  *
24205  * For outbound connections, this will be the same as the their_node_id parameter passed in to
24206  * new_outbound_connection, however entries will only appear once the initial handshake has
24207  * completed and we are sure the remote peer has the private key for the given node_id.
24208  */
24209 MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
24210
24211 /**
24212  * Indicates a new outbound connection has been established to a node with the given node_id
24213  * and an optional remote network address.
24214  *
24215  * The remote network address adds the option to report a remote IP address back to a connecting
24216  * peer using the init message.
24217  * The user should pass the remote network address of the host they are connected to.
24218  *
24219  * If an `Err` is returned here you must disconnect the connection immediately.
24220  *
24221  * Returns a small number of bytes to send to the remote node (currently always 50).
24222  *
24223  * Panics if descriptor is duplicative with some other descriptor which has not yet been
24224  * [`socket_disconnected()`].
24225  *
24226  * [`socket_disconnected()`]: PeerManager::socket_disconnected
24227  */
24228 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);
24229
24230 /**
24231  * Indicates a new inbound connection has been established to a node with an optional remote
24232  * network address.
24233  *
24234  * The remote network address adds the option to report a remote IP address back to a connecting
24235  * peer using the init message.
24236  * The user should pass the remote network address of the host they are connected to.
24237  *
24238  * May refuse the connection by returning an Err, but will never write bytes to the remote end
24239  * (outbound connector always speaks first). If an `Err` is returned here you must disconnect
24240  * the connection immediately.
24241  *
24242  * Panics if descriptor is duplicative with some other descriptor which has not yet been
24243  * [`socket_disconnected()`].
24244  *
24245  * [`socket_disconnected()`]: PeerManager::socket_disconnected
24246  */
24247 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);
24248
24249 /**
24250  * Indicates that there is room to write data to the given socket descriptor.
24251  *
24252  * May return an Err to indicate that the connection should be closed.
24253  *
24254  * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
24255  * returning. Thus, be very careful with reentrancy issues! The invariants around calling
24256  * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
24257  * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
24258  * sufficient!
24259  *
24260  * [`send_data`]: SocketDescriptor::send_data
24261  * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail
24262  */
24263 MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor);
24264
24265 /**
24266  * Indicates that data was read from the given socket descriptor.
24267  *
24268  * May return an Err to indicate that the connection should be closed.
24269  *
24270  * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity.
24271  * Thus, however, you should call [`process_events`] after any `read_event` to generate
24272  * [`send_data`] calls to handle responses.
24273  *
24274  * If `Ok(true)` is returned, further read_events should not be triggered until a
24275  * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the
24276  * send buffer).
24277  *
24278  * [`send_data`]: SocketDescriptor::send_data
24279  * [`process_events`]: PeerManager::process_events
24280  */
24281 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);
24282
24283 /**
24284  * Checks for any events generated by our handlers and processes them. Includes sending most
24285  * response messages as well as messages generated by calls to handler functions directly (eg
24286  * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]).
24287  *
24288  * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
24289  * issues!
24290  *
24291  * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
24292  * or one of the other clients provided in our language bindings.
24293  *
24294  * Note that if there are any other calls to this function waiting on lock(s) this may return
24295  * without doing any work. All available events that need handling will be handled before the
24296  * other calls return.
24297  *
24298  * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
24299  * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
24300  * [`send_data`]: SocketDescriptor::send_data
24301  */
24302 void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg);
24303
24304 /**
24305  * Indicates that the given socket descriptor's connection is now closed.
24306  */
24307 void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor);
24308
24309 /**
24310  * Disconnect a peer given its node id.
24311  *
24312  * Set `no_connection_possible` to true to prevent any further connection with this peer,
24313  * force-closing any channels we have with it.
24314  *
24315  * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
24316  * peer. Thus, be very careful about reentrancy issues.
24317  *
24318  * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
24319  */
24320 void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id, bool no_connection_possible);
24321
24322 /**
24323  * Disconnects all currently-connected peers. This is useful on platforms where there may be
24324  * an indication that TCP sockets have stalled even if we weren't around to time them out
24325  * using regular ping/pongs.
24326  */
24327 void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg);
24328
24329 /**
24330  * Send pings to each peer and disconnect those which did not respond to the last round of
24331  * pings.
24332  *
24333  * This may be called on any timescale you want, however, roughly once every ten seconds is
24334  * preferred. The call rate determines both how often we send a ping to our peers and how much
24335  * time they have to respond before we disconnect them.
24336  *
24337  * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
24338  * issues!
24339  *
24340  * [`send_data`]: SocketDescriptor::send_data
24341  */
24342 void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg);
24343
24344 /**
24345  * Gets the weight for an HTLC-Success transaction.
24346  */
24347 uint64_t htlc_success_tx_weight(bool opt_anchors);
24348
24349 /**
24350  * Gets the weight for an HTLC-Timeout transaction.
24351  */
24352 uint64_t htlc_timeout_tx_weight(bool opt_anchors);
24353
24354 /**
24355  * Build the commitment secret from the seed and the commitment number
24356  */
24357 struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
24358
24359 /**
24360  * Build a closing transaction
24361  */
24362 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);
24363
24364 /**
24365  * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL.
24366  */
24367 void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj);
24368
24369 /**
24370  * Creates a copy of the CounterpartyCommitmentSecrets
24371  */
24372 struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig);
24373
24374 /**
24375  * Creates a new empty `CounterpartyCommitmentSecrets` structure.
24376  */
24377 MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void);
24378
24379 /**
24380  * Returns the minimum index of all stored secrets. Note that indexes start
24381  * at 1 << 48 and get decremented by one for each new secret.
24382  */
24383 MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg);
24384
24385 /**
24386  * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret
24387  * was generated in accordance with BOLT 3 and is consistent with previous secrets.
24388  */
24389 MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret);
24390
24391 /**
24392  * Returns the secret at `idx`.
24393  * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`].
24394  *
24395  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24396  */
24397 MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx);
24398
24399 /**
24400  * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read
24401  */
24402 struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj);
24403
24404 /**
24405  * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write
24406  */
24407 struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser);
24408
24409 /**
24410  * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
24411  * from the base secret and the per_commitment_point.
24412  *
24413  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
24414  * generated (ie our own).
24415  */
24416 struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
24417
24418 /**
24419  * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
24420  * from the base point and the per_commitment_key. This is the public equivalent of
24421  * derive_private_key - using only public keys to derive a public key instead of private keys.
24422  *
24423  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
24424  * generated (ie our own).
24425  */
24426 struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
24427
24428 /**
24429  * Derives a per-commitment-transaction revocation key from its constituent parts.
24430  *
24431  * Only the cheating participant owns a valid witness to propagate a revoked
24432  * commitment transaction, thus per_commitment_secret always come from cheater
24433  * and revocation_base_secret always come from punisher, which is the broadcaster
24434  * of the transaction spending with this key knowledge.
24435  *
24436  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
24437  * generated (ie our own).
24438  */
24439 struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]);
24440
24441 /**
24442  * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
24443  * the public equivalend of derive_private_revocation_key - using only public keys to derive a
24444  * public key instead of private keys.
24445  *
24446  * Only the cheating participant owns a valid witness to propagate a revoked
24447  * commitment transaction, thus per_commitment_point always come from cheater
24448  * and revocation_base_point always come from punisher, which is the broadcaster
24449  * of the transaction spending with this key knowledge.
24450  *
24451  * Note that this is infallible iff we trust that at least one of the two input keys are randomly
24452  * generated (ie our own).
24453  */
24454 struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point);
24455
24456 /**
24457  * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL.
24458  */
24459 void TxCreationKeys_free(struct LDKTxCreationKeys this_obj);
24460
24461 /**
24462  * The broadcaster's per-commitment public key which was used to derive the other keys.
24463  */
24464 struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
24465
24466 /**
24467  * The broadcaster's per-commitment public key which was used to derive the other keys.
24468  */
24469 void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24470
24471 /**
24472  * The revocation key which is used to allow the broadcaster of the commitment
24473  * transaction to provide their counterparty the ability to punish them if they broadcast
24474  * an old state.
24475  */
24476 struct LDKPublicKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
24477
24478 /**
24479  * The revocation key which is used to allow the broadcaster of the commitment
24480  * transaction to provide their counterparty the ability to punish them if they broadcast
24481  * an old state.
24482  */
24483 void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24484
24485 /**
24486  * Broadcaster's HTLC Key
24487  */
24488 struct LDKPublicKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
24489
24490 /**
24491  * Broadcaster's HTLC Key
24492  */
24493 void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24494
24495 /**
24496  * Countersignatory's HTLC Key
24497  */
24498 struct LDKPublicKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
24499
24500 /**
24501  * Countersignatory's HTLC Key
24502  */
24503 void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24504
24505 /**
24506  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
24507  */
24508 struct LDKPublicKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr);
24509
24510 /**
24511  * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay)
24512  */
24513 void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24514
24515 /**
24516  * Constructs a new TxCreationKeys given each field
24517  */
24518 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);
24519
24520 /**
24521  * Creates a copy of the TxCreationKeys
24522  */
24523 struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig);
24524
24525 /**
24526  * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read
24527  */
24528 struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj);
24529
24530 /**
24531  * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write
24532  */
24533 struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser);
24534
24535 /**
24536  * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL.
24537  */
24538 void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj);
24539
24540 /**
24541  * The public key which is used to sign all commitment transactions, as it appears in the
24542  * on-chain channel lock-in 2-of-2 multisig output.
24543  */
24544 struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
24545
24546 /**
24547  * The public key which is used to sign all commitment transactions, as it appears in the
24548  * on-chain channel lock-in 2-of-2 multisig output.
24549  */
24550 void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24551
24552 /**
24553  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
24554  * revocation keys. This is combined with the per-commitment-secret generated by the
24555  * counterparty to create a secret which the counterparty can reveal to revoke previous
24556  * states.
24557  */
24558 struct LDKPublicKey ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
24559
24560 /**
24561  * The base point which is used (with derive_public_revocation_key) to derive per-commitment
24562  * revocation keys. This is combined with the per-commitment-secret generated by the
24563  * counterparty to create a secret which the counterparty can reveal to revoke previous
24564  * states.
24565  */
24566 void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24567
24568 /**
24569  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
24570  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
24571  * static across every commitment transaction.
24572  */
24573 struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
24574
24575 /**
24576  * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
24577  * spendable primary channel balance on the broadcaster's commitment transaction. This key is
24578  * static across every commitment transaction.
24579  */
24580 void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24581
24582 /**
24583  * The base point which is used (with derive_public_key) to derive a per-commitment payment
24584  * public key which receives non-HTLC-encumbered funds which are only available for spending
24585  * after some delay (or can be claimed via the revocation path).
24586  */
24587 struct LDKPublicKey ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
24588
24589 /**
24590  * The base point which is used (with derive_public_key) to derive a per-commitment payment
24591  * public key which receives non-HTLC-encumbered funds which are only available for spending
24592  * after some delay (or can be claimed via the revocation path).
24593  */
24594 void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24595
24596 /**
24597  * The base point which is used (with derive_public_key) to derive a per-commitment public key
24598  * which is used to encumber HTLC-in-flight outputs.
24599  */
24600 struct LDKPublicKey ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr);
24601
24602 /**
24603  * The base point which is used (with derive_public_key) to derive a per-commitment public key
24604  * which is used to encumber HTLC-in-flight outputs.
24605  */
24606 void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val);
24607
24608 /**
24609  * Constructs a new ChannelPublicKeys given each field
24610  */
24611 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);
24612
24613 /**
24614  * Creates a copy of the ChannelPublicKeys
24615  */
24616 struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig);
24617
24618 /**
24619  * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
24620  */
24621 struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj);
24622
24623 /**
24624  * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
24625  */
24626 struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser);
24627
24628 /**
24629  * Create per-state keys from channel base points and the per-commitment point.
24630  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
24631  */
24632 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);
24633
24634 /**
24635  * Generate per-state keys from channel static keys.
24636  * Key set is asymmetric and can't be used as part of counter-signatory set of transactions.
24637  */
24638 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);
24639
24640 /**
24641  * A script either spendable by the revocation
24642  * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
24643  * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
24644  */
24645 struct LDKCVec_u8Z get_revokeable_redeemscript(struct LDKPublicKey revocation_key, uint16_t contest_delay, struct LDKPublicKey broadcaster_delayed_payment_key);
24646
24647 /**
24648  * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL.
24649  */
24650 void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj);
24651
24652 /**
24653  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
24654  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
24655  * need to compare this value to whether the commitment transaction in question is that of
24656  * the counterparty or our own.
24657  */
24658 bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24659
24660 /**
24661  * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
24662  * Note that this is not the same as whether it is ountbound *from us*. To determine that you
24663  * need to compare this value to whether the commitment transaction in question is that of
24664  * the counterparty or our own.
24665  */
24666 void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val);
24667
24668 /**
24669  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
24670  * this divided by 1000.
24671  */
24672 uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24673
24674 /**
24675  * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
24676  * this divided by 1000.
24677  */
24678 void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val);
24679
24680 /**
24681  * The CLTV lock-time at which this HTLC expires.
24682  */
24683 uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24684
24685 /**
24686  * The CLTV lock-time at which this HTLC expires.
24687  */
24688 void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val);
24689
24690 /**
24691  * The hash of the preimage which unlocks this HTLC.
24692  */
24693 const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32];
24694
24695 /**
24696  * The hash of the preimage which unlocks this HTLC.
24697  */
24698 void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
24699
24700 /**
24701  * The position within the commitment transactions' outputs. This may be None if the value is
24702  * below the dust limit (in which case no output appears in the commitment transaction and the
24703  * value is spent to additional transaction fees).
24704  */
24705 struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr);
24706
24707 /**
24708  * The position within the commitment transactions' outputs. This may be None if the value is
24709  * below the dust limit (in which case no output appears in the commitment transaction and the
24710  * value is spent to additional transaction fees).
24711  */
24712 void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
24713
24714 /**
24715  * Constructs a new HTLCOutputInCommitment given each field
24716  */
24717 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);
24718
24719 /**
24720  * Creates a copy of the HTLCOutputInCommitment
24721  */
24722 struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig);
24723
24724 /**
24725  * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
24726  */
24727 struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj);
24728
24729 /**
24730  * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
24731  */
24732 struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser);
24733
24734 /**
24735  * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
24736  * does not need to have its previous_output_index filled.
24737  */
24738 struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys);
24739
24740 /**
24741  * Gets the redeemscript for a funding output from the two funding public keys.
24742  * Note that the order of funding public keys does not matter.
24743  */
24744 struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory);
24745
24746 /**
24747  * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
24748  * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
24749  * transaction which needs signing, and can be used to construct an HTLC transaction which is
24750  * broadcastable given a counterparty HTLC signature.
24751  *
24752  * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
24753  * commitment transaction).
24754  */
24755 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);
24756
24757 /**
24758  * Gets the witnessScript for an anchor output from the funding public key.
24759  * The witness in the spending input must be:
24760  * <BIP 143 funding_signature>
24761  * After 16 blocks of confirmation, an alternative satisfying witness could be:
24762  * <>
24763  * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
24764  */
24765 struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey);
24766
24767 /**
24768  * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24769  */
24770 void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj);
24771
24772 /**
24773  * Holder public keys
24774  */
24775 struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24776
24777 /**
24778  * Holder public keys
24779  */
24780 void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
24781
24782 /**
24783  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
24784  */
24785 uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24786
24787 /**
24788  * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
24789  */
24790 void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
24791
24792 /**
24793  * Whether the holder is the initiator of this channel.
24794  * This is an input to the commitment number obscure factor computation.
24795  */
24796 bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24797
24798 /**
24799  * Whether the holder is the initiator of this channel.
24800  * This is an input to the commitment number obscure factor computation.
24801  */
24802 void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val);
24803
24804 /**
24805  * The late-bound counterparty channel transaction parameters.
24806  * These parameters are populated at the point in the protocol where the counterparty provides them.
24807  *
24808  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24809  */
24810 struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24811
24812 /**
24813  * The late-bound counterparty channel transaction parameters.
24814  * These parameters are populated at the point in the protocol where the counterparty provides them.
24815  *
24816  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24817  */
24818 void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val);
24819
24820 /**
24821  * The late-bound funding outpoint
24822  *
24823  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
24824  */
24825 struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24826
24827 /**
24828  * The late-bound funding outpoint
24829  *
24830  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
24831  */
24832 void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val);
24833
24834 /**
24835  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
24836  */
24837 enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr);
24838
24839 /**
24840  * Are anchors used for this channel.  Boolean is serialization backwards-compatible
24841  */
24842 void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val);
24843
24844 /**
24845  * Constructs a new ChannelTransactionParameters given each field
24846  */
24847 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);
24848
24849 /**
24850  * Creates a copy of the ChannelTransactionParameters
24851  */
24852 struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
24853
24854 /**
24855  * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24856  */
24857 void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj);
24858
24859 /**
24860  * Counter-party public keys
24861  */
24862 struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
24863
24864 /**
24865  * Counter-party public keys
24866  */
24867 void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val);
24868
24869 /**
24870  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
24871  */
24872 uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr);
24873
24874 /**
24875  * The contest delay selected by the counterparty, which applies to holder-broadcast transactions
24876  */
24877 void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val);
24878
24879 /**
24880  * Constructs a new CounterpartyChannelTransactionParameters given each field
24881  */
24882 MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg);
24883
24884 /**
24885  * Creates a copy of the CounterpartyChannelTransactionParameters
24886  */
24887 struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
24888
24889 /**
24890  * Whether the late bound parameters are populated.
24891  */
24892 MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24893
24894 /**
24895  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
24896  * given that the holder is the broadcaster.
24897  *
24898  * self.is_populated() must be true before calling this function.
24899  */
24900 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24901
24902 /**
24903  * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
24904  * given that the counterparty is the broadcaster.
24905  *
24906  * self.is_populated() must be true before calling this function.
24907  */
24908 MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg);
24909
24910 /**
24911  * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read
24912  */
24913 struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj);
24914
24915 /**
24916  * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write
24917  */
24918 struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser);
24919
24920 /**
24921  * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
24922  */
24923 struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj);
24924
24925 /**
24926  * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
24927  */
24928 struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser);
24929
24930 /**
24931  * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL.
24932  */
24933 void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj);
24934
24935 /**
24936  * Get the channel pubkeys for the broadcaster
24937  */
24938 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24939
24940 /**
24941  * Get the channel pubkeys for the countersignatory
24942  */
24943 MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24944
24945 /**
24946  * Get the contest delay applicable to the transactions.
24947  * Note that the contest delay was selected by the countersignatory.
24948  */
24949 MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24950
24951 /**
24952  * Whether the channel is outbound from the broadcaster.
24953  *
24954  * The boolean representing the side that initiated the channel is
24955  * an input to the commitment number obscure factor computation.
24956  */
24957 MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24958
24959 /**
24960  * The funding outpoint
24961  */
24962 MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24963
24964 /**
24965  * Whether to use anchors for this channel
24966  */
24967 MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg);
24968
24969 /**
24970  * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL.
24971  */
24972 void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj);
24973
24974 /**
24975  * Our counterparty's signature for the transaction
24976  */
24977 struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr);
24978
24979 /**
24980  * Our counterparty's signature for the transaction
24981  */
24982 void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val);
24983
24984 /**
24985  * All non-dust counterparty HTLC signatures, in the order they appear in the transaction
24986  */
24987 void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_SignatureZ val);
24988
24989 /**
24990  * Creates a copy of the HolderCommitmentTransaction
24991  */
24992 struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig);
24993
24994 /**
24995  * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read
24996  */
24997 struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj);
24998
24999 /**
25000  * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write
25001  */
25002 struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser);
25003
25004 /**
25005  * Create a new holder transaction with the given counterparty signatures.
25006  * The funding keys are used to figure out which signature should go first when building the transaction for broadcast.
25007  */
25008 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);
25009
25010 /**
25011  * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL.
25012  */
25013 void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj);
25014
25015 /**
25016  * The commitment transaction
25017  */
25018 struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr);
25019
25020 /**
25021  * The commitment transaction
25022  */
25023 void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val);
25024
25025 /**
25026  * The txid for the commitment transaction.
25027  *
25028  * This is provided as a performance optimization, instead of calling transaction.txid()
25029  * multiple times.
25030  */
25031 const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32];
25032
25033 /**
25034  * The txid for the commitment transaction.
25035  *
25036  * This is provided as a performance optimization, instead of calling transaction.txid()
25037  * multiple times.
25038  */
25039 void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
25040
25041 /**
25042  * Constructs a new BuiltCommitmentTransaction given each field
25043  */
25044 MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg);
25045
25046 /**
25047  * Creates a copy of the BuiltCommitmentTransaction
25048  */
25049 struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig);
25050
25051 /**
25052  * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
25053  */
25054 struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj);
25055
25056 /**
25057  * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
25058  */
25059 struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser);
25060
25061 /**
25062  * Get the SIGHASH_ALL sighash value of the transaction.
25063  *
25064  * This can be used to verify a signature.
25065  */
25066 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);
25067
25068 /**
25069  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
25070  * because we are about to broadcast a holder transaction.
25071  */
25072 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);
25073
25074 /**
25075  * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
25076  */
25077 void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
25078
25079 /**
25080  * Creates a copy of the ClosingTransaction
25081  */
25082 struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
25083
25084 /**
25085  * Checks if two ClosingTransactions contain equal inner contents.
25086  */
25087 uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
25088
25089 /**
25090  * Construct an object of the class
25091  */
25092 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);
25093
25094 /**
25095  * Trust our pre-built transaction.
25096  *
25097  * Applies a wrapper which allows access to the transaction.
25098  *
25099  * This should only be used if you fully trust the builder of this object. It should not
25100  * be used by an external signer - instead use the verify function.
25101  */
25102 MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
25103
25104 /**
25105  * Verify our pre-built transaction.
25106  *
25107  * Applies a wrapper which allows access to the transaction.
25108  *
25109  * An external validating signer must call this method before signing
25110  * or using the built transaction.
25111  */
25112 MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
25113
25114 /**
25115  * The value to be sent to the holder, or zero if the output will be omitted
25116  */
25117 MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
25118
25119 /**
25120  * The value to be sent to the counterparty, or zero if the output will be omitted
25121  */
25122 MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
25123
25124 /**
25125  * The destination of the holder's output
25126  */
25127 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
25128
25129 /**
25130  * The destination of the counterparty's output
25131  */
25132 MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
25133
25134 /**
25135  * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL.
25136  */
25137 void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
25138
25139 /**
25140  * The pre-built Bitcoin commitment transaction
25141  */
25142 MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
25143
25144 /**
25145  * Get the SIGHASH_ALL sighash value of the transaction.
25146  *
25147  * This can be used to verify a signature.
25148  */
25149 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);
25150
25151 /**
25152  * Sign a transaction, either because we are counter-signing the counterparty's transaction or
25153  * because we are about to broadcast a holder transaction.
25154  */
25155 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);
25156
25157 /**
25158  * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL.
25159  */
25160 void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
25161
25162 /**
25163  * Creates a copy of the CommitmentTransaction
25164  */
25165 struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
25166
25167 /**
25168  * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read
25169  */
25170 struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj);
25171
25172 /**
25173  * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write
25174  */
25175 struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser);
25176
25177 /**
25178  * The backwards-counting commitment number
25179  */
25180 MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
25181
25182 /**
25183  * The value to be sent to the broadcaster
25184  */
25185 MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
25186
25187 /**
25188  * The value to be sent to the counterparty
25189  */
25190 MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
25191
25192 /**
25193  * The feerate paid per 1000-weight-unit in this commitment transaction.
25194  */
25195 MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
25196
25197 /**
25198  * Trust our pre-built transaction and derived transaction creation public keys.
25199  *
25200  * Applies a wrapper which allows access to these fields.
25201  *
25202  * This should only be used if you fully trust the builder of this object.  It should not
25203  * be used by an external signer - instead use the verify function.
25204  */
25205 MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg);
25206
25207 /**
25208  * Verify our pre-built transaction and derived transaction creation public keys.
25209  *
25210  * Applies a wrapper which allows access to these fields.
25211  *
25212  * An external validating signer must call this method before signing
25213  * or using the built transaction.
25214  */
25215 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);
25216
25217 /**
25218  * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL.
25219  */
25220 void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj);
25221
25222 /**
25223  * The transaction ID of the built Bitcoin transaction
25224  */
25225 MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
25226
25227 /**
25228  * The pre-built Bitcoin commitment transaction
25229  */
25230 MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
25231
25232 /**
25233  * The pre-calculated transaction creation public keys.
25234  */
25235 MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
25236
25237 /**
25238  * Should anchors be used.
25239  */
25240 MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg);
25241
25242 /**
25243  * Get a signature for each HTLC which was included in the commitment transaction (ie for
25244  * which HTLCOutputInCommitment::transaction_output_index.is_some()).
25245  *
25246  * The returned Vec has one entry for each HTLC, and in the same order.
25247  *
25248  * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
25249  */
25250 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);
25251
25252 /**
25253  * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
25254  * shared secret first. This prevents on-chain observers from discovering how many commitment
25255  * transactions occurred in a channel before it was closed.
25256  *
25257  * This function gets the shared secret from relevant channel public keys and can be used to
25258  * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
25259  */
25260 uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster);
25261
25262 /**
25263  * Checks if two InitFeaturess contain equal inner contents.
25264  * This ignores pointers and is_owned flags and looks at the values in fields.
25265  * Two objects with NULL inner values will be considered "equal" here.
25266  */
25267 bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b);
25268
25269 /**
25270  * Checks if two NodeFeaturess contain equal inner contents.
25271  * This ignores pointers and is_owned flags and looks at the values in fields.
25272  * Two objects with NULL inner values will be considered "equal" here.
25273  */
25274 bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b);
25275
25276 /**
25277  * Checks if two ChannelFeaturess contain equal inner contents.
25278  * This ignores pointers and is_owned flags and looks at the values in fields.
25279  * Two objects with NULL inner values will be considered "equal" here.
25280  */
25281 bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b);
25282
25283 /**
25284  * Checks if two InvoiceFeaturess contain equal inner contents.
25285  * This ignores pointers and is_owned flags and looks at the values in fields.
25286  * Two objects with NULL inner values will be considered "equal" here.
25287  */
25288 bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b);
25289
25290 /**
25291  * Checks if two ChannelTypeFeaturess contain equal inner contents.
25292  * This ignores pointers and is_owned flags and looks at the values in fields.
25293  * Two objects with NULL inner values will be considered "equal" here.
25294  */
25295 bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b);
25296
25297 /**
25298  * Creates a copy of the InitFeatures
25299  */
25300 struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig);
25301
25302 /**
25303  * Creates a copy of the NodeFeatures
25304  */
25305 struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig);
25306
25307 /**
25308  * Creates a copy of the ChannelFeatures
25309  */
25310 struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig);
25311
25312 /**
25313  * Creates a copy of the InvoiceFeatures
25314  */
25315 struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig);
25316
25317 /**
25318  * Creates a copy of the ChannelTypeFeatures
25319  */
25320 struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig);
25321
25322 /**
25323  * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL.
25324  */
25325 void InitFeatures_free(struct LDKInitFeatures this_obj);
25326
25327 /**
25328  * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL.
25329  */
25330 void NodeFeatures_free(struct LDKNodeFeatures this_obj);
25331
25332 /**
25333  * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL.
25334  */
25335 void ChannelFeatures_free(struct LDKChannelFeatures this_obj);
25336
25337 /**
25338  * Frees any resources used by the InvoiceFeatures, if is_owned is set and inner is non-NULL.
25339  */
25340 void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj);
25341
25342 /**
25343  * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL.
25344  */
25345 void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj);
25346
25347 /**
25348  * Create a blank Features with no features set
25349  */
25350 MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
25351
25352 /**
25353  * Creates a Features with the bits set which are known by the implementation
25354  */
25355 MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
25356
25357 /**
25358  * Returns true if this `Features` object contains unknown feature flags which are set as
25359  * \"required\".
25360  */
25361 MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25362
25363 /**
25364  * Create a blank Features with no features set
25365  */
25366 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
25367
25368 /**
25369  * Creates a Features with the bits set which are known by the implementation
25370  */
25371 MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
25372
25373 /**
25374  * Returns true if this `Features` object contains unknown feature flags which are set as
25375  * \"required\".
25376  */
25377 MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25378
25379 /**
25380  * Create a blank Features with no features set
25381  */
25382 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
25383
25384 /**
25385  * Creates a Features with the bits set which are known by the implementation
25386  */
25387 MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
25388
25389 /**
25390  * Returns true if this `Features` object contains unknown feature flags which are set as
25391  * \"required\".
25392  */
25393 MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
25394
25395 /**
25396  * Create a blank Features with no features set
25397  */
25398 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
25399
25400 /**
25401  * Creates a Features with the bits set which are known by the implementation
25402  */
25403 MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
25404
25405 /**
25406  * Returns true if this `Features` object contains unknown feature flags which are set as
25407  * \"required\".
25408  */
25409 MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25410
25411 /**
25412  * Create a blank Features with no features set
25413  */
25414 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void);
25415
25416 /**
25417  * Creates a Features with the bits set which are known by the implementation
25418  */
25419 MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void);
25420
25421 /**
25422  * Returns true if this `Features` object contains unknown feature flags which are set as
25423  * \"required\".
25424  */
25425 MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25426
25427 /**
25428  * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read
25429  */
25430 struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
25431
25432 /**
25433  * Read a InitFeatures from a byte array, created by InitFeatures_write
25434  */
25435 struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
25436
25437 /**
25438  * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
25439  */
25440 struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
25441
25442 /**
25443  * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write
25444  */
25445 struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
25446
25447 /**
25448  * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
25449  */
25450 struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
25451
25452 /**
25453  * Read a NodeFeatures from a byte array, created by NodeFeatures_write
25454  */
25455 struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
25456
25457 /**
25458  * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
25459  */
25460 struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj);
25461
25462 /**
25463  * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
25464  */
25465 struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
25466
25467 /**
25468  * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
25469  */
25470 struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj);
25471
25472 /**
25473  * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
25474  */
25475 struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser);
25476
25477 /**
25478  * Set this feature as optional.
25479  */
25480 void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25481
25482 /**
25483  * Set this feature as required.
25484  */
25485 void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25486
25487 /**
25488  * Checks if this feature is supported.
25489  */
25490 MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25491
25492 /**
25493  * Set this feature as optional.
25494  */
25495 void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25496
25497 /**
25498  * Set this feature as required.
25499  */
25500 void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25501
25502 /**
25503  * Checks if this feature is supported.
25504  */
25505 MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25506
25507 /**
25508  * Checks if this feature is required.
25509  */
25510 MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25511
25512 /**
25513  * Checks if this feature is required.
25514  */
25515 MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25516
25517 /**
25518  * Set this feature as optional.
25519  */
25520 void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25521
25522 /**
25523  * Set this feature as required.
25524  */
25525 void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25526
25527 /**
25528  * Checks if this feature is supported.
25529  */
25530 MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25531
25532 /**
25533  * Set this feature as optional.
25534  */
25535 void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25536
25537 /**
25538  * Set this feature as required.
25539  */
25540 void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25541
25542 /**
25543  * Checks if this feature is supported.
25544  */
25545 MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25546
25547 /**
25548  * Set this feature as optional.
25549  */
25550 void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25551
25552 /**
25553  * Set this feature as required.
25554  */
25555 void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25556
25557 /**
25558  * Checks if this feature is supported.
25559  */
25560 MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25561
25562 /**
25563  * Checks if this feature is required.
25564  */
25565 MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25566
25567 /**
25568  * Checks if this feature is required.
25569  */
25570 MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25571
25572 /**
25573  * Set this feature as optional.
25574  */
25575 void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25576
25577 /**
25578  * Set this feature as required.
25579  */
25580 void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25581
25582 /**
25583  * Checks if this feature is supported.
25584  */
25585 MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25586
25587 /**
25588  * Set this feature as optional.
25589  */
25590 void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25591
25592 /**
25593  * Set this feature as required.
25594  */
25595 void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25596
25597 /**
25598  * Checks if this feature is supported.
25599  */
25600 MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25601
25602 /**
25603  * Checks if this feature is required.
25604  */
25605 MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25606
25607 /**
25608  * Checks if this feature is required.
25609  */
25610 MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25611
25612 /**
25613  * Set this feature as optional.
25614  */
25615 void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25616
25617 /**
25618  * Set this feature as required.
25619  */
25620 void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25621
25622 /**
25623  * Checks if this feature is supported.
25624  */
25625 MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25626
25627 /**
25628  * Set this feature as optional.
25629  */
25630 void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25631
25632 /**
25633  * Set this feature as required.
25634  */
25635 void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25636
25637 /**
25638  * Checks if this feature is supported.
25639  */
25640 MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25641
25642 /**
25643  * Set this feature as optional.
25644  */
25645 void InvoiceFeatures_set_variable_length_onion_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25646
25647 /**
25648  * Set this feature as required.
25649  */
25650 void InvoiceFeatures_set_variable_length_onion_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25651
25652 /**
25653  * Checks if this feature is supported.
25654  */
25655 MUST_USE_RES bool InvoiceFeatures_supports_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25656
25657 /**
25658  * Checks if this feature is required.
25659  */
25660 MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25661
25662 /**
25663  * Checks if this feature is required.
25664  */
25665 MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25666
25667 /**
25668  * Checks if this feature is required.
25669  */
25670 MUST_USE_RES bool InvoiceFeatures_requires_variable_length_onion(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25671
25672 /**
25673  * Set this feature as optional.
25674  */
25675 void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25676
25677 /**
25678  * Set this feature as required.
25679  */
25680 void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25681
25682 /**
25683  * Checks if this feature is supported.
25684  */
25685 MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25686
25687 /**
25688  * Set this feature as optional.
25689  */
25690 void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25691
25692 /**
25693  * Set this feature as required.
25694  */
25695 void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25696
25697 /**
25698  * Checks if this feature is supported.
25699  */
25700 MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25701
25702 /**
25703  * Set this feature as optional.
25704  */
25705 void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25706
25707 /**
25708  * Set this feature as required.
25709  */
25710 void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25711
25712 /**
25713  * Checks if this feature is supported.
25714  */
25715 MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25716
25717 /**
25718  * Checks if this feature is required.
25719  */
25720 MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25721
25722 /**
25723  * Checks if this feature is required.
25724  */
25725 MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25726
25727 /**
25728  * Checks if this feature is required.
25729  */
25730 MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
25731
25732 /**
25733  * Set this feature as optional.
25734  */
25735 void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25736
25737 /**
25738  * Set this feature as required.
25739  */
25740 void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25741
25742 /**
25743  * Checks if this feature is supported.
25744  */
25745 MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25746
25747 /**
25748  * Set this feature as optional.
25749  */
25750 void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25751
25752 /**
25753  * Set this feature as required.
25754  */
25755 void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25756
25757 /**
25758  * Checks if this feature is supported.
25759  */
25760 MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25761
25762 /**
25763  * Set this feature as optional.
25764  */
25765 void InvoiceFeatures_set_payment_secret_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25766
25767 /**
25768  * Set this feature as required.
25769  */
25770 void InvoiceFeatures_set_payment_secret_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25771
25772 /**
25773  * Checks if this feature is supported.
25774  */
25775 MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25776
25777 /**
25778  * Checks if this feature is required.
25779  */
25780 MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25781
25782 /**
25783  * Checks if this feature is required.
25784  */
25785 MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25786
25787 /**
25788  * Checks if this feature is required.
25789  */
25790 MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25791
25792 /**
25793  * Set this feature as optional.
25794  */
25795 void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25796
25797 /**
25798  * Set this feature as required.
25799  */
25800 void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25801
25802 /**
25803  * Checks if this feature is supported.
25804  */
25805 MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25806
25807 /**
25808  * Set this feature as optional.
25809  */
25810 void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25811
25812 /**
25813  * Set this feature as required.
25814  */
25815 void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25816
25817 /**
25818  * Checks if this feature is supported.
25819  */
25820 MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25821
25822 /**
25823  * Set this feature as optional.
25824  */
25825 void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25826
25827 /**
25828  * Set this feature as required.
25829  */
25830 void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25831
25832 /**
25833  * Checks if this feature is supported.
25834  */
25835 MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25836
25837 /**
25838  * Checks if this feature is required.
25839  */
25840 MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25841
25842 /**
25843  * Checks if this feature is required.
25844  */
25845 MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25846
25847 /**
25848  * Checks if this feature is required.
25849  */
25850 MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
25851
25852 /**
25853  * Set this feature as optional.
25854  */
25855 void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25856
25857 /**
25858  * Set this feature as required.
25859  */
25860 void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25861
25862 /**
25863  * Checks if this feature is supported.
25864  */
25865 MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25866
25867 /**
25868  * Set this feature as optional.
25869  */
25870 void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25871
25872 /**
25873  * Set this feature as required.
25874  */
25875 void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25876
25877 /**
25878  * Checks if this feature is supported.
25879  */
25880 MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25881
25882 /**
25883  * Checks if this feature is required.
25884  */
25885 MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25886
25887 /**
25888  * Checks if this feature is required.
25889  */
25890 MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25891
25892 /**
25893  * Set this feature as optional.
25894  */
25895 void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25896
25897 /**
25898  * Set this feature as required.
25899  */
25900 void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25901
25902 /**
25903  * Checks if this feature is supported.
25904  */
25905 MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25906
25907 /**
25908  * Set this feature as optional.
25909  */
25910 void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25911
25912 /**
25913  * Set this feature as required.
25914  */
25915 void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25916
25917 /**
25918  * Checks if this feature is supported.
25919  */
25920 MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25921
25922 /**
25923  * Checks if this feature is required.
25924  */
25925 MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25926
25927 /**
25928  * Checks if this feature is required.
25929  */
25930 MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25931
25932 /**
25933  * Set this feature as optional.
25934  */
25935 void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25936
25937 /**
25938  * Set this feature as required.
25939  */
25940 void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25941
25942 /**
25943  * Checks if this feature is supported.
25944  */
25945 MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25946
25947 /**
25948  * Set this feature as optional.
25949  */
25950 void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25951
25952 /**
25953  * Set this feature as required.
25954  */
25955 void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25956
25957 /**
25958  * Checks if this feature is supported.
25959  */
25960 MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25961
25962 /**
25963  * Checks if this feature is required.
25964  */
25965 MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25966
25967 /**
25968  * Checks if this feature is required.
25969  */
25970 MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
25971
25972 /**
25973  * Set this feature as optional.
25974  */
25975 void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
25976
25977 /**
25978  * Set this feature as required.
25979  */
25980 void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
25981
25982 /**
25983  * Checks if this feature is supported.
25984  */
25985 MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
25986
25987 /**
25988  * Set this feature as optional.
25989  */
25990 void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25991
25992 /**
25993  * Set this feature as required.
25994  */
25995 void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
25996
25997 /**
25998  * Checks if this feature is supported.
25999  */
26000 MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26001
26002 /**
26003  * Set this feature as optional.
26004  */
26005 void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26006
26007 /**
26008  * Set this feature as required.
26009  */
26010 void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26011
26012 /**
26013  * Checks if this feature is supported.
26014  */
26015 MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26016
26017 /**
26018  * Checks if this feature is required.
26019  */
26020 MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26021
26022 /**
26023  * Checks if this feature is required.
26024  */
26025 MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26026
26027 /**
26028  * Checks if this feature is required.
26029  */
26030 MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26031
26032 /**
26033  * Set this feature as optional.
26034  */
26035 void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg);
26036
26037 /**
26038  * Set this feature as required.
26039  */
26040 void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg);
26041
26042 /**
26043  * Checks if this feature is supported.
26044  */
26045 MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26046
26047 /**
26048  * Set this feature as optional.
26049  */
26050 void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26051
26052 /**
26053  * Set this feature as required.
26054  */
26055 void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26056
26057 /**
26058  * Checks if this feature is supported.
26059  */
26060 MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26061
26062 /**
26063  * Set this feature as optional.
26064  */
26065 void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26066
26067 /**
26068  * Set this feature as required.
26069  */
26070 void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26071
26072 /**
26073  * Checks if this feature is supported.
26074  */
26075 MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26076
26077 /**
26078  * Checks if this feature is required.
26079  */
26080 MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg);
26081
26082 /**
26083  * Checks if this feature is required.
26084  */
26085 MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26086
26087 /**
26088  * Checks if this feature is required.
26089  */
26090 MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
26091
26092 /**
26093  * Set this feature as optional.
26094  */
26095 void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26096
26097 /**
26098  * Set this feature as required.
26099  */
26100 void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg);
26101
26102 /**
26103  * Checks if this feature is supported.
26104  */
26105 MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26106
26107 /**
26108  * Checks if this feature is required.
26109  */
26110 MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
26111
26112 /**
26113  * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL.
26114  */
26115 void ShutdownScript_free(struct LDKShutdownScript this_obj);
26116
26117 /**
26118  * Creates a copy of the ShutdownScript
26119  */
26120 struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
26121
26122 /**
26123  * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL.
26124  */
26125 void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
26126
26127 /**
26128  * The script that did not meet the requirements from [BOLT #2].
26129  *
26130  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
26131  */
26132 struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
26133
26134 /**
26135  * The script that did not meet the requirements from [BOLT #2].
26136  *
26137  * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
26138  */
26139 void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
26140
26141 /**
26142  * Constructs a new InvalidShutdownScript given each field
26143  */
26144 MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
26145
26146 /**
26147  * Creates a copy of the InvalidShutdownScript
26148  */
26149 struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig);
26150
26151 /**
26152  * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
26153  */
26154 struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
26155
26156 /**
26157  * Read a ShutdownScript from a byte array, created by ShutdownScript_write
26158  */
26159 struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
26160
26161 /**
26162  * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
26163  */
26164 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
26165
26166 /**
26167  * Generates a P2WSH script pubkey from the given [`WScriptHash`].
26168  */
26169 MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
26170
26171 /**
26172  * Generates a witness script pubkey from the given segwit version and program.
26173  *
26174  * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
26175  * [`ShutdownScript::new_p2wsh`] instead.
26176  *
26177  * # Errors
26178  *
26179  * This function may return an error if `program` is invalid for the segwit `version`.
26180  */
26181 MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program);
26182
26183 /**
26184  * Converts the shutdown script into the underlying [`Script`].
26185  */
26186 MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
26187
26188 /**
26189  * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
26190  *
26191  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26192  */
26193 MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
26194
26195 /**
26196  * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
26197  *
26198  * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
26199  */
26200 MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
26201
26202 /**
26203  * Calls the free function if one is set
26204  */
26205 void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
26206
26207 /**
26208  * Calls the free function if one is set
26209  */
26210 void Type_free(struct LDKType this_ptr);
26211
26212 /**
26213  * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL.
26214  */
26215 void NodeId_free(struct LDKNodeId this_obj);
26216
26217 /**
26218  * Creates a copy of the NodeId
26219  */
26220 struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig);
26221
26222 /**
26223  * Create a new NodeId from a public key
26224  */
26225 MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey);
26226
26227 /**
26228  * Get the public key slice from this NodeId
26229  */
26230 MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
26231
26232 /**
26233  * Checks if two NodeIds contain equal inner contents.
26234  */
26235 uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
26236
26237 /**
26238  * Serialize the NodeId object into a byte array which can be read by NodeId_read
26239  */
26240 struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj);
26241
26242 /**
26243  * Read a NodeId from a byte array, created by NodeId_write
26244  */
26245 struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser);
26246
26247 /**
26248  * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
26249  */
26250 void NetworkGraph_free(struct LDKNetworkGraph this_obj);
26251
26252 /**
26253  * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL.
26254  */
26255 void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
26256
26257 /**
26258  * Frees any resources used by the NetworkUpdate
26259  */
26260 void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
26261
26262 /**
26263  * Creates a copy of the NetworkUpdate
26264  */
26265 struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
26266
26267 /**
26268  * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
26269  */
26270 struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
26271
26272 /**
26273  * Utility method to constructs a new ChannelFailure-variant NetworkUpdate
26274  */
26275 struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent);
26276
26277 /**
26278  * Utility method to constructs a new NodeFailure-variant NetworkUpdate
26279  */
26280 struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
26281
26282 /**
26283  * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
26284  */
26285 struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
26286
26287 /**
26288  * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
26289  */
26290 struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser);
26291
26292 /**
26293  * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL.
26294  */
26295 void P2PGossipSync_free(struct LDKP2PGossipSync this_obj);
26296
26297 /**
26298  * Creates a new tracker of the actual state of the network of channels and nodes,
26299  * assuming an existing Network Graph.
26300  * Chain monitor is used to make sure announced channels exist on-chain,
26301  * channel data is correct, and that the announcement is signed with
26302  * channel owners' keys.
26303  */
26304 MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
26305
26306 /**
26307  * Adds a provider used to check new announcements. Does not affect
26308  * existing announcements unless they are updated.
26309  * Add, update or remove the provider would replace the current one.
26310  */
26311 void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
26312
26313 /**
26314  * Constructs a new EventHandler which calls the relevant methods on this_arg.
26315  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
26316  */
26317 struct LDKEventHandler NetworkGraph_as_EventHandler(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26318
26319 /**
26320  * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
26321  * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
26322  */
26323 struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
26324
26325 /**
26326  * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
26327  * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
26328  */
26329 struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg);
26330
26331 /**
26332  * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL.
26333  */
26334 void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj);
26335
26336 /**
26337  * When the last update to the channel direction was issued.
26338  * Value is opaque, as set in the announcement.
26339  */
26340 uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
26341
26342 /**
26343  * When the last update to the channel direction was issued.
26344  * Value is opaque, as set in the announcement.
26345  */
26346 void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val);
26347
26348 /**
26349  * Whether the channel can be currently used for payments (in this one direction).
26350  */
26351 bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
26352
26353 /**
26354  * Whether the channel can be currently used for payments (in this one direction).
26355  */
26356 void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val);
26357
26358 /**
26359  * The difference in CLTV values that you must have when routing through this channel.
26360  */
26361 uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
26362
26363 /**
26364  * The difference in CLTV values that you must have when routing through this channel.
26365  */
26366 void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val);
26367
26368 /**
26369  * The minimum value, which must be relayed to the next hop via the channel
26370  */
26371 uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
26372
26373 /**
26374  * The minimum value, which must be relayed to the next hop via the channel
26375  */
26376 void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
26377
26378 /**
26379  * The maximum value which may be relayed to the next hop via the channel.
26380  */
26381 uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
26382
26383 /**
26384  * The maximum value which may be relayed to the next hop via the channel.
26385  */
26386 void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val);
26387
26388 /**
26389  * Fees charged when the channel is used for routing
26390  */
26391 struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
26392
26393 /**
26394  * Fees charged when the channel is used for routing
26395  */
26396 void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
26397
26398 /**
26399  * Most recent update for the channel received from the network
26400  * Mostly redundant with the data we store in fields explicitly.
26401  * Everything else is useful only for sending out for initial routing sync.
26402  * Not stored if contains excess data to prevent DoS.
26403  *
26404  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26405  */
26406 struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr);
26407
26408 /**
26409  * Most recent update for the channel received from the network
26410  * Mostly redundant with the data we store in fields explicitly.
26411  * Everything else is useful only for sending out for initial routing sync.
26412  * Not stored if contains excess data to prevent DoS.
26413  *
26414  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26415  */
26416 void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val);
26417
26418 /**
26419  * Constructs a new ChannelUpdateInfo given each field
26420  */
26421 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, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg);
26422
26423 /**
26424  * Creates a copy of the ChannelUpdateInfo
26425  */
26426 struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig);
26427
26428 /**
26429  * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
26430  */
26431 struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj);
26432
26433 /**
26434  * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
26435  */
26436 struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser);
26437
26438 /**
26439  * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL.
26440  */
26441 void ChannelInfo_free(struct LDKChannelInfo this_obj);
26442
26443 /**
26444  * Protocol features of a channel communicated during its announcement
26445  */
26446 struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26447
26448 /**
26449  * Protocol features of a channel communicated during its announcement
26450  */
26451 void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
26452
26453 /**
26454  * Source node of the first direction of a channel
26455  */
26456 struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26457
26458 /**
26459  * Source node of the first direction of a channel
26460  */
26461 void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
26462
26463 /**
26464  * Details about the first direction of a channel
26465  *
26466  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26467  */
26468 struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26469
26470 /**
26471  * Details about the first direction of a channel
26472  *
26473  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26474  */
26475 void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
26476
26477 /**
26478  * Source node of the second direction of a channel
26479  */
26480 struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26481
26482 /**
26483  * Source node of the second direction of a channel
26484  */
26485 void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val);
26486
26487 /**
26488  * Details about the second direction of a channel
26489  *
26490  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26491  */
26492 struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26493
26494 /**
26495  * Details about the second direction of a channel
26496  *
26497  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26498  */
26499 void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val);
26500
26501 /**
26502  * The channel capacity as seen on-chain, if chain lookup is available.
26503  */
26504 struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26505
26506 /**
26507  * The channel capacity as seen on-chain, if chain lookup is available.
26508  */
26509 void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
26510
26511 /**
26512  * An initial announcement of the channel
26513  * Mostly redundant with the data we store in fields explicitly.
26514  * Everything else is useful only for sending out for initial routing sync.
26515  * Not stored if contains excess data to prevent DoS.
26516  *
26517  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26518  */
26519 struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr);
26520
26521 /**
26522  * An initial announcement of the channel
26523  * Mostly redundant with the data we store in fields explicitly.
26524  * Everything else is useful only for sending out for initial routing sync.
26525  * Not stored if contains excess data to prevent DoS.
26526  *
26527  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26528  */
26529 void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val);
26530
26531 /**
26532  * Creates a copy of the ChannelInfo
26533  */
26534 struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig);
26535
26536 /**
26537  * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag.
26538  *
26539  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26540  */
26541 MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags);
26542
26543 /**
26544  * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
26545  */
26546 struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj);
26547
26548 /**
26549  * Read a ChannelInfo from a byte array, created by ChannelInfo_write
26550  */
26551 struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser);
26552
26553 /**
26554  * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL.
26555  */
26556 void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj);
26557
26558 /**
26559  * Creates a copy of the DirectedChannelInfo
26560  */
26561 struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig);
26562
26563 /**
26564  * Returns information for the channel.
26565  */
26566 MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
26567
26568 /**
26569  * Returns information for the direction.
26570  *
26571  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26572  */
26573 MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
26574
26575 /**
26576  * Returns the maximum HTLC amount allowed over the channel in the direction.
26577  */
26578 MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
26579
26580 /**
26581  * Returns the [`EffectiveCapacity`] of the channel in the direction.
26582  *
26583  * This is either the total capacity from the funding transaction, if known, or the
26584  * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
26585  * otherwise.
26586  */
26587 MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg);
26588
26589 /**
26590  * Frees any resources used by the EffectiveCapacity
26591  */
26592 void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr);
26593
26594 /**
26595  * Creates a copy of the EffectiveCapacity
26596  */
26597 struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig);
26598
26599 /**
26600  * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
26601  */
26602 struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat);
26603
26604 /**
26605  * Utility method to constructs a new MaximumHTLC-variant EffectiveCapacity
26606  */
26607 struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat);
26608
26609 /**
26610  * Utility method to constructs a new Total-variant EffectiveCapacity
26611  */
26612 struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, struct LDKCOption_u64Z htlc_maximum_msat);
26613
26614 /**
26615  * Utility method to constructs a new Infinite-variant EffectiveCapacity
26616  */
26617 struct LDKEffectiveCapacity EffectiveCapacity_infinite(void);
26618
26619 /**
26620  * Utility method to constructs a new Unknown-variant EffectiveCapacity
26621  */
26622 struct LDKEffectiveCapacity EffectiveCapacity_unknown(void);
26623
26624 /**
26625  * Returns the effective capacity denominated in millisatoshi.
26626  */
26627 MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg);
26628
26629 /**
26630  * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL.
26631  */
26632 void RoutingFees_free(struct LDKRoutingFees this_obj);
26633
26634 /**
26635  * Flat routing fee in satoshis
26636  */
26637 uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
26638
26639 /**
26640  * Flat routing fee in satoshis
26641  */
26642 void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
26643
26644 /**
26645  * Liquidity-based routing fee in millionths of a routed amount.
26646  * In other words, 10000 is 1%.
26647  */
26648 uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr);
26649
26650 /**
26651  * Liquidity-based routing fee in millionths of a routed amount.
26652  * In other words, 10000 is 1%.
26653  */
26654 void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val);
26655
26656 /**
26657  * Constructs a new RoutingFees given each field
26658  */
26659 MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg);
26660
26661 /**
26662  * Checks if two RoutingFeess contain equal inner contents.
26663  * This ignores pointers and is_owned flags and looks at the values in fields.
26664  * Two objects with NULL inner values will be considered "equal" here.
26665  */
26666 bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b);
26667
26668 /**
26669  * Creates a copy of the RoutingFees
26670  */
26671 struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
26672
26673 /**
26674  * Checks if two RoutingFeess contain equal inner contents.
26675  */
26676 uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
26677
26678 /**
26679  * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
26680  */
26681 struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
26682
26683 /**
26684  * Read a RoutingFees from a byte array, created by RoutingFees_write
26685  */
26686 struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
26687
26688 /**
26689  * Frees any resources used by the NodeAnnouncementInfo, if is_owned is set and inner is non-NULL.
26690  */
26691 void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj);
26692
26693 /**
26694  * Protocol features the node announced support for
26695  */
26696 struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26697
26698 /**
26699  * Protocol features the node announced support for
26700  */
26701 void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
26702
26703 /**
26704  * When the last known update to the node state was issued.
26705  * Value is opaque, as set in the announcement.
26706  */
26707 uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26708
26709 /**
26710  * When the last known update to the node state was issued.
26711  * Value is opaque, as set in the announcement.
26712  */
26713 void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val);
26714
26715 /**
26716  * Color assigned to the node
26717  */
26718 const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3];
26719
26720 /**
26721  * Color assigned to the node
26722  */
26723 void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val);
26724
26725 /**
26726  * Moniker assigned to the node.
26727  * May be invalid or malicious (eg control chars),
26728  * should not be exposed to the user.
26729  */
26730 struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26731
26732 /**
26733  * Moniker assigned to the node.
26734  * May be invalid or malicious (eg control chars),
26735  * should not be exposed to the user.
26736  */
26737 void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
26738
26739 /**
26740  * Internet-level addresses via which one can connect to the node
26741  */
26742 void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
26743
26744 /**
26745  * An initial announcement of the node
26746  * Mostly redundant with the data we store in fields explicitly.
26747  * Everything else is useful only for sending out for initial routing sync.
26748  * Not stored if contains excess data to prevent DoS.
26749  *
26750  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26751  */
26752 struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
26753
26754 /**
26755  * An initial announcement of the node
26756  * Mostly redundant with the data we store in fields explicitly.
26757  * Everything else is useful only for sending out for initial routing sync.
26758  * Not stored if contains excess data to prevent DoS.
26759  *
26760  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26761  */
26762 void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val);
26763
26764 /**
26765  * Constructs a new NodeAnnouncementInfo given each field
26766  */
26767 MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
26768
26769 /**
26770  * Creates a copy of the NodeAnnouncementInfo
26771  */
26772 struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig);
26773
26774 /**
26775  * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
26776  */
26777 struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj);
26778
26779 /**
26780  * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write
26781  */
26782 struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser);
26783
26784 /**
26785  * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL.
26786  */
26787 void NodeAlias_free(struct LDKNodeAlias this_obj);
26788
26789 const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32];
26790
26791 void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
26792
26793 /**
26794  * Constructs a new NodeAlias given each field
26795  */
26796 MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg);
26797
26798 /**
26799  * Creates a copy of the NodeAlias
26800  */
26801 struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig);
26802
26803 /**
26804  * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read
26805  */
26806 struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj);
26807
26808 /**
26809  * Read a NodeAlias from a byte array, created by NodeAlias_write
26810  */
26811 struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser);
26812
26813 /**
26814  * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL.
26815  */
26816 void NodeInfo_free(struct LDKNodeInfo this_obj);
26817
26818 /**
26819  * All valid channels a node has announced
26820  */
26821 void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
26822
26823 /**
26824  * Lowest fees enabling routing via any of the enabled, known channels to a node.
26825  * The two fields (flat and proportional fee) are independent,
26826  * meaning they don't have to refer to the same channel.
26827  *
26828  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26829  */
26830 struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
26831
26832 /**
26833  * Lowest fees enabling routing via any of the enabled, known channels to a node.
26834  * The two fields (flat and proportional fee) are independent,
26835  * meaning they don't have to refer to the same channel.
26836  *
26837  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26838  */
26839 void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
26840
26841 /**
26842  * More information about a node from node_announcement.
26843  * Optional because we store a Node entry after learning about it from
26844  * a channel announcement, but before receiving a node announcement.
26845  *
26846  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
26847  */
26848 struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr);
26849
26850 /**
26851  * More information about a node from node_announcement.
26852  * Optional because we store a Node entry after learning about it from
26853  * a channel announcement, but before receiving a node announcement.
26854  *
26855  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
26856  */
26857 void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val);
26858
26859 /**
26860  * Constructs a new NodeInfo given each field
26861  */
26862 MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg);
26863
26864 /**
26865  * Creates a copy of the NodeInfo
26866  */
26867 struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig);
26868
26869 /**
26870  * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read
26871  */
26872 struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj);
26873
26874 /**
26875  * Read a NodeInfo from a byte array, created by NodeInfo_write
26876  */
26877 struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser);
26878
26879 /**
26880  * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
26881  */
26882 struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj);
26883
26884 /**
26885  * Read a NetworkGraph from a byte array, created by NetworkGraph_write
26886  */
26887 struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg);
26888
26889 /**
26890  * Creates a new, empty, network graph.
26891  */
26892 MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger);
26893
26894 /**
26895  * Returns a read-only view of the network graph.
26896  */
26897 MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26898
26899 /**
26900  * The unix timestamp provided by the most recent rapid gossip sync.
26901  * It will be set by the rapid sync process after every sync completion.
26902  */
26903 MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26904
26905 /**
26906  * Update the unix timestamp provided by the most recent rapid gossip sync.
26907  * This should be done automatically by the rapid sync process after every sync completion.
26908  */
26909 void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp);
26910
26911 /**
26912  * For an already known node (from channel announcements), update its stored properties from a
26913  * given node announcement.
26914  *
26915  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26916  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26917  * routing messages from a source using a protocol other than the lightning P2P protocol.
26918  */
26919 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
26920
26921 /**
26922  * For an already known node (from channel announcements), update its stored properties from a
26923  * given node announcement without verifying the associated signatures. Because we aren't
26924  * given the associated signatures here we cannot relay the node announcement to any of our
26925  * peers.
26926  */
26927 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);
26928
26929 /**
26930  * Store or update channel info from a channel announcement.
26931  *
26932  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
26933  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
26934  * routing messages from a source using a protocol other than the lightning P2P protocol.
26935  *
26936  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
26937  * the corresponding UTXO exists on chain and is correctly-formatted.
26938  */
26939 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);
26940
26941 /**
26942  * Store or update channel info from a channel announcement without verifying the associated
26943  * signatures. Because we aren't given the associated signatures here we cannot relay the
26944  * channel announcement to any of our peers.
26945  *
26946  * If a `chain::Access` object is provided via `chain_access`, it will be called to verify
26947  * the corresponding UTXO exists on chain and is correctly-formatted.
26948  */
26949 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);
26950
26951 /**
26952  * Update channel from partial announcement data received via rapid gossip sync
26953  *
26954  * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the
26955  * rapid gossip sync server)
26956  *
26957  * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields.
26958  */
26959 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);
26960
26961 /**
26962  * Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
26963  * If permanent, removes a channel from the local storage.
26964  * May cause the removal of nodes too, if this was their last channel.
26965  * If not permanent, makes channels unavailable for routing.
26966  */
26967 void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
26968
26969 /**
26970  * Marks a node in the graph as failed.
26971  */
26972 void NetworkGraph_node_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
26973
26974 /**
26975  * Removes information about channels that we haven't heard any updates about in some time.
26976  * This can be used regularly to prune the network graph of channels that likely no longer
26977  * exist.
26978  *
26979  * While there is no formal requirement that nodes regularly re-broadcast their channel
26980  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
26981  * pruning occur for updates which are at least two weeks old, which we implement here.
26982  *
26983  * Note that for users of the `lightning-background-processor` crate this method may be
26984  * automatically called regularly for you.
26985  *
26986  * This method is only available with the `std` feature. See
26987  * [`NetworkGraph::remove_stale_channels_with_time`] for `no-std` use.
26988  */
26989 void NetworkGraph_remove_stale_channels(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
26990
26991 /**
26992  * Removes information about channels that we haven't heard any updates about in some time.
26993  * This can be used regularly to prune the network graph of channels that likely no longer
26994  * exist.
26995  *
26996  * While there is no formal requirement that nodes regularly re-broadcast their channel
26997  * updates every two weeks, the non-normative section of BOLT 7 currently suggests that
26998  * pruning occur for updates which are at least two weeks old, which we implement here.
26999  *
27000  * This function takes the current unix time as an argument. For users with the `std` feature
27001  * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable.
27002  */
27003 void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix);
27004
27005 /**
27006  * For an already known (from announcement) channel, update info about one of the directions
27007  * of the channel.
27008  *
27009  * You probably don't want to call this directly, instead relying on a P2PGossipSync's
27010  * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept
27011  * routing messages from a source using a protocol other than the lightning P2P protocol.
27012  *
27013  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
27014  * materially in the future will be rejected.
27015  */
27016 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
27017
27018 /**
27019  * For an already known (from announcement) channel, update info about one of the directions
27020  * of the channel without verifying the associated signatures. Because we aren't given the
27021  * associated signatures here we cannot relay the channel update to any of our peers.
27022  *
27023  * If built with `no-std`, any updates with a timestamp more than two weeks in the past or
27024  * materially in the future will be rejected.
27025  */
27026 MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
27027
27028 /**
27029  * Returns information on a channel with the given id.
27030  *
27031  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27032  */
27033 MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
27034
27035 /**
27036  * Returns information on a node with the given id.
27037  *
27038  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27039  */
27040 MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
27041
27042 /**
27043  * Get network addresses by node id.
27044  * Returns None if the requested node is completely unknown,
27045  * or if node announcement for the node was never received.
27046  */
27047 MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey);
27048
27049 /**
27050  * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL.
27051  */
27052 void RouteHop_free(struct LDKRouteHop this_obj);
27053
27054 /**
27055  * The node_id of the node at this hop.
27056  */
27057 struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
27058
27059 /**
27060  * The node_id of the node at this hop.
27061  */
27062 void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27063
27064 /**
27065  * The node_announcement features of the node at this hop. For the last hop, these may be
27066  * amended to match the features present in the invoice this node generated.
27067  */
27068 struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
27069
27070 /**
27071  * The node_announcement features of the node at this hop. For the last hop, these may be
27072  * amended to match the features present in the invoice this node generated.
27073  */
27074 void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val);
27075
27076 /**
27077  * The channel that should be used from the previous hop to reach this node.
27078  */
27079 uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr);
27080
27081 /**
27082  * The channel that should be used from the previous hop to reach this node.
27083  */
27084 void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
27085
27086 /**
27087  * The channel_announcement features of the channel that should be used from the previous hop
27088  * to reach this node.
27089  */
27090 struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr);
27091
27092 /**
27093  * The channel_announcement features of the channel that should be used from the previous hop
27094  * to reach this node.
27095  */
27096 void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val);
27097
27098 /**
27099  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
27100  * For the last hop, this should be the full value of the payment (might be more than
27101  * requested if we had to match htlc_minimum_msat).
27102  */
27103 uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
27104
27105 /**
27106  * The fee taken on this hop (for paying for the use of the *next* channel in the path).
27107  * For the last hop, this should be the full value of the payment (might be more than
27108  * requested if we had to match htlc_minimum_msat).
27109  */
27110 void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
27111
27112 /**
27113  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
27114  * expected at the destination, in excess of the current block height.
27115  */
27116 uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
27117
27118 /**
27119  * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
27120  * expected at the destination, in excess of the current block height.
27121  */
27122 void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
27123
27124 /**
27125  * Constructs a new RouteHop given each field
27126  */
27127 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);
27128
27129 /**
27130  * Creates a copy of the RouteHop
27131  */
27132 struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
27133
27134 /**
27135  * Checks if two RouteHops contain equal inner contents.
27136  */
27137 uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
27138
27139 /**
27140  * Checks if two RouteHops contain equal inner contents.
27141  * This ignores pointers and is_owned flags and looks at the values in fields.
27142  * Two objects with NULL inner values will be considered "equal" here.
27143  */
27144 bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
27145
27146 /**
27147  * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
27148  */
27149 struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
27150
27151 /**
27152  * Read a RouteHop from a byte array, created by RouteHop_write
27153  */
27154 struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
27155
27156 /**
27157  * Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
27158  */
27159 void Route_free(struct LDKRoute this_obj);
27160
27161 /**
27162  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
27163  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
27164  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
27165  * least length one. While the maximum length of any given path is variable, keeping the length
27166  * of any path less or equal to 19 should currently ensure it is viable.
27167  */
27168 struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
27169
27170 /**
27171  * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
27172  * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
27173  * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
27174  * least length one. While the maximum length of any given path is variable, keeping the length
27175  * of any path less or equal to 19 should currently ensure it is viable.
27176  */
27177 void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
27178
27179 /**
27180  * The `payment_params` parameter passed to [`find_route`].
27181  * This is used by `ChannelManager` to track information which may be required for retries,
27182  * provided back to you via [`Event::PaymentPathFailed`].
27183  *
27184  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
27185  *
27186  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27187  */
27188 struct LDKPaymentParameters Route_get_payment_params(const struct LDKRoute *NONNULL_PTR this_ptr);
27189
27190 /**
27191  * The `payment_params` parameter passed to [`find_route`].
27192  * This is used by `ChannelManager` to track information which may be required for retries,
27193  * provided back to you via [`Event::PaymentPathFailed`].
27194  *
27195  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
27196  *
27197  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27198  */
27199 void Route_set_payment_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
27200
27201 /**
27202  * Constructs a new Route given each field
27203  */
27204 MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
27205
27206 /**
27207  * Creates a copy of the Route
27208  */
27209 struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
27210
27211 /**
27212  * Checks if two Routes contain equal inner contents.
27213  */
27214 uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
27215
27216 /**
27217  * Checks if two Routes contain equal inner contents.
27218  * This ignores pointers and is_owned flags and looks at the values in fields.
27219  * Two objects with NULL inner values will be considered "equal" here.
27220  */
27221 bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
27222
27223 /**
27224  * Returns the total amount of fees paid on this [`Route`].
27225  *
27226  * This doesn't include any extra payment made to the recipient, which can happen in excess of
27227  * the amount passed to [`find_route`]'s `params.final_value_msat`.
27228  */
27229 MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
27230
27231 /**
27232  * Returns the total amount paid on this [`Route`], excluding the fees.
27233  */
27234 MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
27235
27236 /**
27237  * Serialize the Route object into a byte array which can be read by Route_read
27238  */
27239 struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
27240
27241 /**
27242  * Read a Route from a byte array, created by Route_write
27243  */
27244 struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
27245
27246 /**
27247  * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL.
27248  */
27249 void RouteParameters_free(struct LDKRouteParameters this_obj);
27250
27251 /**
27252  * The parameters of the failed payment path.
27253  */
27254 struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
27255
27256 /**
27257  * The parameters of the failed payment path.
27258  */
27259 void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val);
27260
27261 /**
27262  * The amount in msats sent on the failed payment path.
27263  */
27264 uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
27265
27266 /**
27267  * The amount in msats sent on the failed payment path.
27268  */
27269 void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val);
27270
27271 /**
27272  * The CLTV on the final hop of the failed payment path.
27273  */
27274 uint32_t RouteParameters_get_final_cltv_expiry_delta(const struct LDKRouteParameters *NONNULL_PTR this_ptr);
27275
27276 /**
27277  * The CLTV on the final hop of the failed payment path.
27278  */
27279 void RouteParameters_set_final_cltv_expiry_delta(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint32_t val);
27280
27281 /**
27282  * Constructs a new RouteParameters given each field
27283  */
27284 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);
27285
27286 /**
27287  * Creates a copy of the RouteParameters
27288  */
27289 struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig);
27290
27291 /**
27292  * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
27293  */
27294 struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj);
27295
27296 /**
27297  * Read a RouteParameters from a byte array, created by RouteParameters_write
27298  */
27299 struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser);
27300
27301 /**
27302  * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL.
27303  */
27304 void PaymentParameters_free(struct LDKPaymentParameters this_obj);
27305
27306 /**
27307  * The node id of the payee.
27308  */
27309 struct LDKPublicKey PaymentParameters_get_payee_pubkey(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
27310
27311 /**
27312  * The node id of the payee.
27313  */
27314 void PaymentParameters_set_payee_pubkey(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27315
27316 /**
27317  * Features supported by the payee.
27318  *
27319  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
27320  * does not contain any features.
27321  *
27322  * [`for_keysend`]: Self::for_keysend
27323  *
27324  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
27325  */
27326 struct LDKInvoiceFeatures PaymentParameters_get_features(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
27327
27328 /**
27329  * Features supported by the payee.
27330  *
27331  * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice
27332  * does not contain any features.
27333  *
27334  * [`for_keysend`]: Self::for_keysend
27335  *
27336  * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
27337  */
27338 void PaymentParameters_set_features(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKInvoiceFeatures val);
27339
27340 /**
27341  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
27342  */
27343 struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
27344
27345 /**
27346  * Hints for routing to the payee, containing channels connecting the payee to public nodes.
27347  */
27348 void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
27349
27350 /**
27351  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
27352  */
27353 struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
27354
27355 /**
27356  * Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
27357  */
27358 void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27359
27360 /**
27361  * The maximum total CLTV delta we accept for the route.
27362  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
27363  */
27364 uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
27365
27366 /**
27367  * The maximum total CLTV delta we accept for the route.
27368  * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`].
27369  */
27370 void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val);
27371
27372 /**
27373  * The maximum number of paths that may be used by (MPP) payments.
27374  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
27375  */
27376 uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
27377
27378 /**
27379  * The maximum number of paths that may be used by (MPP) payments.
27380  * Defaults to [`DEFAULT_MAX_PATH_COUNT`].
27381  */
27382 void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
27383
27384 /**
27385  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
27386  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
27387  * a lower value prefers to send larger MPP parts, potentially saturating channels and
27388  * increasing failure probability for those paths.
27389  *
27390  * Note that this restriction will be relaxed during pathfinding after paths which meet this
27391  * restriction have been found. While paths which meet this criteria will be searched for, it
27392  * is ultimately up to the scorer to select them over other paths.
27393  *
27394  * A value of 0 will allow payments up to and including a channel's total announced usable
27395  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
27396  *
27397  * Default value: 2
27398  */
27399 uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
27400
27401 /**
27402  * Selects the maximum share of a channel's total capacity which will be sent over a channel,
27403  * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas
27404  * a lower value prefers to send larger MPP parts, potentially saturating channels and
27405  * increasing failure probability for those paths.
27406  *
27407  * Note that this restriction will be relaxed during pathfinding after paths which meet this
27408  * restriction have been found. While paths which meet this criteria will be searched for, it
27409  * is ultimately up to the scorer to select them over other paths.
27410  *
27411  * A value of 0 will allow payments up to and including a channel's total announced usable
27412  * capacity, a value of one will only use up to half its capacity, two 1/4, etc.
27413  *
27414  * Default value: 2
27415  */
27416 void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val);
27417
27418 /**
27419  * A list of SCIDs which this payment was previously attempted over and which caused the
27420  * payment to fail. Future attempts for the same payment shouldn't be relayed through any of
27421  * these SCIDs.
27422  */
27423 void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val);
27424
27425 /**
27426  * Constructs a new PaymentParameters given each field
27427  */
27428 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg);
27429
27430 /**
27431  * Creates a copy of the PaymentParameters
27432  */
27433 struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
27434
27435 /**
27436  * Checks if two PaymentParameterss contain equal inner contents.
27437  */
27438 uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
27439
27440 /**
27441  * Checks if two PaymentParameterss contain equal inner contents.
27442  * This ignores pointers and is_owned flags and looks at the values in fields.
27443  * Two objects with NULL inner values will be considered "equal" here.
27444  */
27445 bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b);
27446
27447 /**
27448  * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read
27449  */
27450 struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj);
27451
27452 /**
27453  * Read a PaymentParameters from a byte array, created by PaymentParameters_write
27454  */
27455 struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser);
27456
27457 /**
27458  * Creates a payee with the node id of the given `pubkey`.
27459  */
27460 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey);
27461
27462 /**
27463  * Creates a payee with the node id of the given `pubkey` to use for keysend payments.
27464  */
27465 MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey);
27466
27467 /**
27468  * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
27469  */
27470 void RouteHint_free(struct LDKRouteHint this_obj);
27471
27472 struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr);
27473
27474 void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val);
27475
27476 /**
27477  * Constructs a new RouteHint given each field
27478  */
27479 MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg);
27480
27481 /**
27482  * Creates a copy of the RouteHint
27483  */
27484 struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
27485
27486 /**
27487  * Checks if two RouteHints contain equal inner contents.
27488  */
27489 uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
27490
27491 /**
27492  * Checks if two RouteHints contain equal inner contents.
27493  * This ignores pointers and is_owned flags and looks at the values in fields.
27494  * Two objects with NULL inner values will be considered "equal" here.
27495  */
27496 bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
27497
27498 /**
27499  * Serialize the RouteHint object into a byte array which can be read by RouteHint_read
27500  */
27501 struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj);
27502
27503 /**
27504  * Read a RouteHint from a byte array, created by RouteHint_write
27505  */
27506 struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser);
27507
27508 /**
27509  * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
27510  */
27511 void RouteHintHop_free(struct LDKRouteHintHop this_obj);
27512
27513 /**
27514  * The node_id of the non-target end of the route
27515  */
27516 struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27517
27518 /**
27519  * The node_id of the non-target end of the route
27520  */
27521 void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
27522
27523 /**
27524  * The short_channel_id of this channel
27525  */
27526 uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27527
27528 /**
27529  * The short_channel_id of this channel
27530  */
27531 void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
27532
27533 /**
27534  * The fees which must be paid to use this channel
27535  */
27536 struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27537
27538 /**
27539  * The fees which must be paid to use this channel
27540  */
27541 void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
27542
27543 /**
27544  * The difference in CLTV values between this node and the next node.
27545  */
27546 uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27547
27548 /**
27549  * The difference in CLTV values between this node and the next node.
27550  */
27551 void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
27552
27553 /**
27554  * The minimum value, in msat, which must be relayed to the next hop.
27555  */
27556 struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27557
27558 /**
27559  * The minimum value, in msat, which must be relayed to the next hop.
27560  */
27561 void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27562
27563 /**
27564  * The maximum value in msat available for routing with a single HTLC.
27565  */
27566 struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
27567
27568 /**
27569  * The maximum value in msat available for routing with a single HTLC.
27570  */
27571 void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
27572
27573 /**
27574  * Constructs a new RouteHintHop given each field
27575  */
27576 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);
27577
27578 /**
27579  * Creates a copy of the RouteHintHop
27580  */
27581 struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
27582
27583 /**
27584  * Checks if two RouteHintHops contain equal inner contents.
27585  */
27586 uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
27587
27588 /**
27589  * Checks if two RouteHintHops contain equal inner contents.
27590  * This ignores pointers and is_owned flags and looks at the values in fields.
27591  * Two objects with NULL inner values will be considered "equal" here.
27592  */
27593 bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
27594
27595 /**
27596  * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
27597  */
27598 struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj);
27599
27600 /**
27601  * Read a RouteHintHop from a byte array, created by RouteHintHop_write
27602  */
27603 struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser);
27604
27605 /**
27606  * Finds a route from us (payer) to the given target node (payee).
27607  *
27608  * If the payee provided features in their invoice, they should be provided via `params.payee`.
27609  * Without this, MPP will only be used if the payee's features are available in the network graph.
27610  *
27611  * Private routing paths between a public node and the target may be included in `params.payee`.
27612  *
27613  * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
27614  * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
27615  * from `network_graph` will be ignored, and only those in `first_hops` will be used.
27616  *
27617  * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
27618  * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
27619  * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
27620  *
27621  * # Note
27622  *
27623  * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
27624  * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
27625  * function.
27626  *
27627  * # Panics
27628  *
27629  * Panics if first_hops contains channels without short_channel_ids;
27630  * [`ChannelManager::list_usable_channels`] will never include such channels.
27631  *
27632  * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
27633  * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
27634  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
27635  *
27636  * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
27637  */
27638 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]);
27639
27640 /**
27641  * Construct a route from us (payer) to the target node (payee) via the given hops (which should
27642  * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
27643  *
27644  * Re-uses logic from `find_route`, so the restrictions described there also apply here.
27645  */
27646 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]);
27647
27648 /**
27649  * Calls the free function if one is set
27650  */
27651 void Score_free(struct LDKScore this_ptr);
27652
27653 /**
27654  * Calls the free function if one is set
27655  */
27656 void LockableScore_free(struct LDKLockableScore this_ptr);
27657
27658 /**
27659  * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL.
27660  */
27661 void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj);
27662
27663 /**
27664  * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read
27665  */
27666 struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj);
27667
27668 /**
27669  * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`].
27670  */
27671 MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score);
27672
27673 /**
27674  * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL.
27675  */
27676 void ChannelUsage_free(struct LDKChannelUsage this_obj);
27677
27678 /**
27679  * The amount to send through the channel, denominated in millisatoshis.
27680  */
27681 uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
27682
27683 /**
27684  * The amount to send through the channel, denominated in millisatoshis.
27685  */
27686 void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
27687
27688 /**
27689  * Total amount, denominated in millisatoshis, already allocated to send through the channel
27690  * as part of a multi-path payment.
27691  */
27692 uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
27693
27694 /**
27695  * Total amount, denominated in millisatoshis, already allocated to send through the channel
27696  * as part of a multi-path payment.
27697  */
27698 void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val);
27699
27700 /**
27701  * The effective capacity of the channel.
27702  */
27703 struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr);
27704
27705 /**
27706  * The effective capacity of the channel.
27707  */
27708 void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val);
27709
27710 /**
27711  * Constructs a new ChannelUsage given each field
27712  */
27713 MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg);
27714
27715 /**
27716  * Creates a copy of the ChannelUsage
27717  */
27718 struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig);
27719
27720 /**
27721  * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL.
27722  */
27723 void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj);
27724
27725 /**
27726  * Creates a copy of the FixedPenaltyScorer
27727  */
27728 struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig);
27729
27730 /**
27731  * Creates a new scorer using `penalty_msat`.
27732  */
27733 MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat);
27734
27735 /**
27736  * Constructs a new Score which calls the relevant methods on this_arg.
27737  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
27738  */
27739 struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg);
27740
27741 /**
27742  * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
27743  */
27744 struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj);
27745
27746 /**
27747  * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
27748  */
27749 struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg);
27750
27751 /**
27752  * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL.
27753  */
27754 void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj);
27755
27756 /**
27757  * Frees any resources used by the ProbabilisticScoringParameters, if is_owned is set and inner is non-NULL.
27758  */
27759 void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj);
27760
27761 /**
27762  * A fixed penalty in msats to apply to each channel.
27763  *
27764  * Default value: 500 msat
27765  */
27766 uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27767
27768 /**
27769  * A fixed penalty in msats to apply to each channel.
27770  *
27771  * Default value: 500 msat
27772  */
27773 void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27774
27775 /**
27776  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
27777  * channel, in excess of the [`base_penalty_msat`].
27778  *
27779  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
27780  * fees plus penalty) for large payments. The penalty is computed as the product of this
27781  * multiplier and `2^30`ths of the payment amount.
27782  *
27783  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
27784  *
27785  * Default value: 8,192 msat
27786  *
27787  * [`base_penalty_msat`]: Self::base_penalty_msat
27788  */
27789 uint64_t ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27790
27791 /**
27792  * A multiplier used with the payment amount to calculate a fixed penalty applied to each
27793  * channel, in excess of the [`base_penalty_msat`].
27794  *
27795  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
27796  * fees plus penalty) for large payments. The penalty is computed as the product of this
27797  * multiplier and `2^30`ths of the payment amount.
27798  *
27799  * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30`
27800  *
27801  * Default value: 8,192 msat
27802  *
27803  * [`base_penalty_msat`]: Self::base_penalty_msat
27804  */
27805 void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27806
27807 /**
27808  * A multiplier used in conjunction with the negative `log10` of the channel's success
27809  * probability for a payment to determine the liquidity penalty.
27810  *
27811  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
27812  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
27813  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
27814  * lower bounding the success probability to `0.01`) when the amount falls within the
27815  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
27816  * result in a `u64::max_value` penalty, however.
27817  *
27818  * Default value: 40,000 msat
27819  *
27820  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
27821  */
27822 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27823
27824 /**
27825  * A multiplier used in conjunction with the negative `log10` of the channel's success
27826  * probability for a payment to determine the liquidity penalty.
27827  *
27828  * The penalty is based in part on the knowledge learned from prior successful and unsuccessful
27829  * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The
27830  * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to
27831  * lower bounding the success probability to `0.01`) when the amount falls within the
27832  * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will
27833  * result in a `u64::max_value` penalty, however.
27834  *
27835  * Default value: 40,000 msat
27836  *
27837  * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life
27838  */
27839 void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27840
27841 /**
27842  * The time required to elapse before any knowledge learned about channel liquidity balances is
27843  * cut in half.
27844  *
27845  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
27846  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
27847  * the certainty of the channel liquidity balance.
27848  *
27849  * Default value: 1 hour
27850  *
27851  * # Note
27852  *
27853  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
27854  * liquidity knowledge will never decay except when the bounds cross.
27855  */
27856 uint64_t ProbabilisticScoringParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27857
27858 /**
27859  * The time required to elapse before any knowledge learned about channel liquidity balances is
27860  * cut in half.
27861  *
27862  * The bounds are defined in terms of offsets and are initially zero. Increasing the offsets
27863  * gives tighter bounds on the channel liquidity balance. Thus, halving the offsets decreases
27864  * the certainty of the channel liquidity balance.
27865  *
27866  * Default value: 1 hour
27867  *
27868  * # Note
27869  *
27870  * When built with the `no-std` feature, time will never elapse. Therefore, the channel
27871  * liquidity knowledge will never decay except when the bounds cross.
27872  */
27873 void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27874
27875 /**
27876  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
27877  * channel's success probability for the payment to determine the amount penalty.
27878  *
27879  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
27880  * fees plus penalty) for large payments. The penalty is computed as the product of this
27881  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
27882  * success probability.
27883  *
27884  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
27885  *
27886  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
27887  * the amount will result in a penalty of the multiplier. And, as the success probability
27888  * decreases, the negative `log10` weighting will increase dramatically. For higher success
27889  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
27890  * fall below `1`.
27891  *
27892  * Default value: 256 msat
27893  */
27894 uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27895
27896 /**
27897  * A multiplier used in conjunction with a payment amount and the negative `log10` of the
27898  * channel's success probability for the payment to determine the amount penalty.
27899  *
27900  * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e.,
27901  * fees plus penalty) for large payments. The penalty is computed as the product of this
27902  * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the
27903  * success probability.
27904  *
27905  * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20`
27906  *
27907  * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of
27908  * the amount will result in a penalty of the multiplier. And, as the success probability
27909  * decreases, the negative `log10` weighting will increase dramatically. For higher success
27910  * probabilities, the multiplier will have a decreasing effect as the negative `log10` will
27911  * fall below `1`.
27912  *
27913  * Default value: 256 msat
27914  */
27915 void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27916
27917 /**
27918  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
27919  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
27920  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
27921  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
27922  *
27923  * Default value: 250 msat
27924  */
27925 uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27926
27927 /**
27928  * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the
27929  * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We
27930  * treat such nodes preferentially as this makes balance discovery attacks harder to execute,
27931  * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy.
27932  *
27933  * Default value: 250 msat
27934  */
27935 void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27936
27937 /**
27938  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
27939  * current estimate of the channel's available liquidity.
27940  *
27941  * Note that in this case all other penalties, including the
27942  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
27943  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
27944  * applicable, are still included in the overall penalty.
27945  *
27946  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
27947  * `u64::max_value()` will guarantee that.
27948  *
27949  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
27950  *
27951  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
27952  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
27953  * [`base_penalty_msat`]: Self::base_penalty_msat
27954  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
27955  */
27956 uint64_t ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr);
27957
27958 /**
27959  * This penalty is applied when the amount we're attempting to send over a channel exceeds our
27960  * current estimate of the channel's available liquidity.
27961  *
27962  * Note that in this case all other penalties, including the
27963  * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based
27964  * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if
27965  * applicable, are still included in the overall penalty.
27966  *
27967  * If you wish to avoid creating paths with such channels entirely, setting this to a value of
27968  * `u64::max_value()` will guarantee that.
27969  *
27970  * Default value: 1_0000_0000_000 msat (1 Bitcoin)
27971  *
27972  * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat
27973  * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat
27974  * [`base_penalty_msat`]: Self::base_penalty_msat
27975  * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat
27976  */
27977 void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val);
27978
27979 /**
27980  * Creates a copy of the ProbabilisticScoringParameters
27981  */
27982 struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig);
27983
27984 /**
27985  * Creates a new scorer using the given scoring parameters for sending payments from a node
27986  * through a network graph.
27987  */
27988 MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
27989
27990 /**
27991  * Dump the contents of this scorer into the configured logger.
27992  *
27993  * Note that this writes roughly one line per channel for which we have a liquidity estimate,
27994  * which may be a substantial amount of log output.
27995  */
27996 void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
27997
27998 /**
27999  * Query the estimated minimum and maximum liquidity available for sending a payment over the
28000  * channel with `scid` towards the given `target` node.
28001  */
28002 MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_channel_liquidity_range(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target);
28003
28004 /**
28005  * Marks the node with the given `node_id` as banned, i.e.,
28006  * it will be avoided during path finding.
28007  */
28008 void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
28009
28010 /**
28011  * Removes the node with the given `node_id` from the list of nodes to avoid.
28012  */
28013 void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
28014
28015 /**
28016  * Sets a manual penalty for the given node.
28017  */
28018 void ProbabilisticScorer_set_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty);
28019
28020 /**
28021  * Removes the node with the given `node_id` from the list of manual penalties.
28022  */
28023 void ProbabilisticScorer_remove_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id);
28024
28025 /**
28026  * Clears the list of manual penalties that are applied during path finding.
28027  */
28028 void ProbabilisticScorer_clear_manual_penalties(struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
28029
28030 /**
28031  * Marks all nodes in the given list as banned, i.e.,
28032  * they will be avoided during path finding.
28033  */
28034 void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids);
28035
28036 /**
28037  * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used.
28038  */
28039 MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void);
28040
28041 /**
28042  * Constructs a new Score which calls the relevant methods on this_arg.
28043  * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
28044  */
28045 struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg);
28046
28047 /**
28048  * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read
28049  */
28050 struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj);
28051
28052 /**
28053  * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write
28054  */
28055 struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
28056
28057 /**
28058  * Frees any resources used by the FilesystemPersister, if is_owned is set and inner is non-NULL.
28059  */
28060 void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
28061
28062 /**
28063  * Initialize a new FilesystemPersister and set the path to the individual channels'
28064  * files.
28065  */
28066 MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data);
28067
28068 /**
28069  * Get the directory which was provided when this persister was initialized.
28070  */
28071 MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
28072
28073 /**
28074  * Read `ChannelMonitor`s from disk.
28075  */
28076 MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager);
28077
28078 /**
28079  * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL.
28080  */
28081 void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj);
28082
28083 /**
28084  * Frees any resources used by the GossipSync
28085  */
28086 void GossipSync_free(struct LDKGossipSync this_ptr);
28087
28088 /**
28089  * Utility method to constructs a new P2P-variant GossipSync
28090  */
28091 struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a);
28092
28093 /**
28094  * Utility method to constructs a new Rapid-variant GossipSync
28095  */
28096 struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a);
28097
28098 /**
28099  * Utility method to constructs a new None-variant GossipSync
28100  */
28101 struct LDKGossipSync GossipSync_none(void);
28102
28103 /**
28104  * Start a background thread that takes care of responsibilities enumerated in the [top-level
28105  * documentation].
28106  *
28107  * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
28108  * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
28109  * either [`join`] or [`stop`].
28110  *
28111  * # Data Persistence
28112  *
28113  * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
28114  * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
28115  * [`ChannelManager`]. See the `lightning-persister` crate for LDK's
28116  * provided implementation.
28117  *
28118  * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
28119  * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
28120  * See the `lightning-persister` crate for LDK's provided implementation.
28121  *
28122  * Typically, users should either implement [`Persister::persist_manager`] to never return an
28123  * error or call [`join`] and handle any error that may arise. For the latter case,
28124  * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
28125  *
28126  * # Event Handling
28127  *
28128  * `event_handler` is responsible for handling events that users should be notified of (e.g.,
28129  * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
28130  * functionality implemented by other handlers.
28131  * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
28132  *
28133  * # Rapid Gossip Sync
28134  *
28135  * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
28136  * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
28137  * until the [`RapidGossipSync`] instance completes its first sync.
28138  *
28139  * [top-level documentation]: BackgroundProcessor
28140  * [`join`]: Self::join
28141  * [`stop`]: Self::stop
28142  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
28143  * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
28144  * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
28145  * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
28146  * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
28147  * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
28148  *
28149  * Note that scorer (or a relevant inner pointer) may be NULL or all-0s to represent None
28150  */
28151 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);
28152
28153 /**
28154  * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
28155  * [`ChannelManager`].
28156  *
28157  * # Panics
28158  *
28159  * This function panics if the background thread has panicked such as while persisting or
28160  * handling events.
28161  *
28162  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
28163  */
28164 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
28165
28166 /**
28167  * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
28168  * [`ChannelManager`].
28169  *
28170  * # Panics
28171  *
28172  * This function panics if the background thread has panicked such as while persisting or
28173  * handling events.
28174  *
28175  * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
28176  */
28177 MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
28178
28179 /**
28180  * Frees any resources used by the ParseError
28181  */
28182 void ParseError_free(struct LDKParseError this_ptr);
28183
28184 /**
28185  * Creates a copy of the ParseError
28186  */
28187 struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig);
28188
28189 /**
28190  * Utility method to constructs a new Bech32Error-variant ParseError
28191  */
28192 struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a);
28193
28194 /**
28195  * Utility method to constructs a new ParseAmountError-variant ParseError
28196  */
28197 struct LDKParseError ParseError_parse_amount_error(struct LDKError a);
28198
28199 /**
28200  * Utility method to constructs a new MalformedSignature-variant ParseError
28201  */
28202 struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a);
28203
28204 /**
28205  * Utility method to constructs a new BadPrefix-variant ParseError
28206  */
28207 struct LDKParseError ParseError_bad_prefix(void);
28208
28209 /**
28210  * Utility method to constructs a new UnknownCurrency-variant ParseError
28211  */
28212 struct LDKParseError ParseError_unknown_currency(void);
28213
28214 /**
28215  * Utility method to constructs a new UnknownSiPrefix-variant ParseError
28216  */
28217 struct LDKParseError ParseError_unknown_si_prefix(void);
28218
28219 /**
28220  * Utility method to constructs a new MalformedHRP-variant ParseError
28221  */
28222 struct LDKParseError ParseError_malformed_hrp(void);
28223
28224 /**
28225  * Utility method to constructs a new TooShortDataPart-variant ParseError
28226  */
28227 struct LDKParseError ParseError_too_short_data_part(void);
28228
28229 /**
28230  * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError
28231  */
28232 struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void);
28233
28234 /**
28235  * Utility method to constructs a new DescriptionDecodeError-variant ParseError
28236  */
28237 struct LDKParseError ParseError_description_decode_error(struct LDKError a);
28238
28239 /**
28240  * Utility method to constructs a new PaddingError-variant ParseError
28241  */
28242 struct LDKParseError ParseError_padding_error(void);
28243
28244 /**
28245  * Utility method to constructs a new IntegerOverflowError-variant ParseError
28246  */
28247 struct LDKParseError ParseError_integer_overflow_error(void);
28248
28249 /**
28250  * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError
28251  */
28252 struct LDKParseError ParseError_invalid_seg_wit_program_length(void);
28253
28254 /**
28255  * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError
28256  */
28257 struct LDKParseError ParseError_invalid_pub_key_hash_length(void);
28258
28259 /**
28260  * Utility method to constructs a new InvalidScriptHashLength-variant ParseError
28261  */
28262 struct LDKParseError ParseError_invalid_script_hash_length(void);
28263
28264 /**
28265  * Utility method to constructs a new InvalidRecoveryId-variant ParseError
28266  */
28267 struct LDKParseError ParseError_invalid_recovery_id(void);
28268
28269 /**
28270  * Utility method to constructs a new InvalidSliceLength-variant ParseError
28271  */
28272 struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a);
28273
28274 /**
28275  * Utility method to constructs a new Skip-variant ParseError
28276  */
28277 struct LDKParseError ParseError_skip(void);
28278
28279 /**
28280  * Frees any resources used by the ParseOrSemanticError
28281  */
28282 void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr);
28283
28284 /**
28285  * Creates a copy of the ParseOrSemanticError
28286  */
28287 struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig);
28288
28289 /**
28290  * Utility method to constructs a new ParseError-variant ParseOrSemanticError
28291  */
28292 struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a);
28293
28294 /**
28295  * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
28296  */
28297 struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a);
28298
28299 /**
28300  * Frees any resources used by the Invoice, if is_owned is set and inner is non-NULL.
28301  */
28302 void Invoice_free(struct LDKInvoice this_obj);
28303
28304 /**
28305  * Checks if two Invoices contain equal inner contents.
28306  * This ignores pointers and is_owned flags and looks at the values in fields.
28307  * Two objects with NULL inner values will be considered "equal" here.
28308  */
28309 bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b);
28310
28311 /**
28312  * Creates a copy of the Invoice
28313  */
28314 struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
28315
28316 /**
28317  * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL.
28318  */
28319 void SignedRawInvoice_free(struct LDKSignedRawInvoice this_obj);
28320
28321 /**
28322  * Checks if two SignedRawInvoices contain equal inner contents.
28323  * This ignores pointers and is_owned flags and looks at the values in fields.
28324  * Two objects with NULL inner values will be considered "equal" here.
28325  */
28326 bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const struct LDKSignedRawInvoice *NONNULL_PTR b);
28327
28328 /**
28329  * Creates a copy of the SignedRawInvoice
28330  */
28331 struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
28332
28333 /**
28334  * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL.
28335  */
28336 void RawInvoice_free(struct LDKRawInvoice this_obj);
28337
28338 /**
28339  * data part
28340  */
28341 struct LDKRawDataPart RawInvoice_get_data(const struct LDKRawInvoice *NONNULL_PTR this_ptr);
28342
28343 /**
28344  * data part
28345  */
28346 void RawInvoice_set_data(struct LDKRawInvoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val);
28347
28348 /**
28349  * Checks if two RawInvoices contain equal inner contents.
28350  * This ignores pointers and is_owned flags and looks at the values in fields.
28351  * Two objects with NULL inner values will be considered "equal" here.
28352  */
28353 bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRawInvoice *NONNULL_PTR b);
28354
28355 /**
28356  * Creates a copy of the RawInvoice
28357  */
28358 struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
28359
28360 /**
28361  * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL.
28362  */
28363 void RawDataPart_free(struct LDKRawDataPart this_obj);
28364
28365 /**
28366  * generation time of the invoice
28367  */
28368 struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr);
28369
28370 /**
28371  * generation time of the invoice
28372  */
28373 void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val);
28374
28375 /**
28376  * Checks if two RawDataParts contain equal inner contents.
28377  * This ignores pointers and is_owned flags and looks at the values in fields.
28378  * Two objects with NULL inner values will be considered "equal" here.
28379  */
28380 bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b);
28381
28382 /**
28383  * Creates a copy of the RawDataPart
28384  */
28385 struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
28386
28387 /**
28388  * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL.
28389  */
28390 void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj);
28391
28392 /**
28393  * Checks if two PositiveTimestamps contain equal inner contents.
28394  * This ignores pointers and is_owned flags and looks at the values in fields.
28395  * Two objects with NULL inner values will be considered "equal" here.
28396  */
28397 bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b);
28398
28399 /**
28400  * Creates a copy of the PositiveTimestamp
28401  */
28402 struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
28403
28404 /**
28405  * Creates a copy of the SiPrefix
28406  */
28407 enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig);
28408
28409 /**
28410  * Utility method to constructs a new Milli-variant SiPrefix
28411  */
28412 enum LDKSiPrefix SiPrefix_milli(void);
28413
28414 /**
28415  * Utility method to constructs a new Micro-variant SiPrefix
28416  */
28417 enum LDKSiPrefix SiPrefix_micro(void);
28418
28419 /**
28420  * Utility method to constructs a new Nano-variant SiPrefix
28421  */
28422 enum LDKSiPrefix SiPrefix_nano(void);
28423
28424 /**
28425  * Utility method to constructs a new Pico-variant SiPrefix
28426  */
28427 enum LDKSiPrefix SiPrefix_pico(void);
28428
28429 /**
28430  * Checks if two SiPrefixs contain equal inner contents.
28431  * This ignores pointers and is_owned flags and looks at the values in fields.
28432  */
28433 bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
28434
28435 /**
28436  * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix.
28437  * This is effectively 10^12 * the prefix multiplier
28438  */
28439 MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg);
28440
28441 /**
28442  * Creates a copy of the Currency
28443  */
28444 enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig);
28445
28446 /**
28447  * Utility method to constructs a new Bitcoin-variant Currency
28448  */
28449 enum LDKCurrency Currency_bitcoin(void);
28450
28451 /**
28452  * Utility method to constructs a new BitcoinTestnet-variant Currency
28453  */
28454 enum LDKCurrency Currency_bitcoin_testnet(void);
28455
28456 /**
28457  * Utility method to constructs a new Regtest-variant Currency
28458  */
28459 enum LDKCurrency Currency_regtest(void);
28460
28461 /**
28462  * Utility method to constructs a new Simnet-variant Currency
28463  */
28464 enum LDKCurrency Currency_simnet(void);
28465
28466 /**
28467  * Utility method to constructs a new Signet-variant Currency
28468  */
28469 enum LDKCurrency Currency_signet(void);
28470
28471 /**
28472  * Checks if two Currencys contain equal inner contents.
28473  */
28474 uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
28475
28476 /**
28477  * Checks if two Currencys contain equal inner contents.
28478  * This ignores pointers and is_owned flags and looks at the values in fields.
28479  */
28480 bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
28481
28482 /**
28483  * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL.
28484  */
28485 void Sha256_free(struct LDKSha256 this_obj);
28486
28487 /**
28488  * Creates a copy of the Sha256
28489  */
28490 struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
28491
28492 /**
28493  * Checks if two Sha256s contain equal inner contents.
28494  */
28495 uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
28496
28497 /**
28498  * Checks if two Sha256s contain equal inner contents.
28499  * This ignores pointers and is_owned flags and looks at the values in fields.
28500  * Two objects with NULL inner values will be considered "equal" here.
28501  */
28502 bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
28503
28504 /**
28505  * Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
28506  */
28507 void Description_free(struct LDKDescription this_obj);
28508
28509 /**
28510  * Creates a copy of the Description
28511  */
28512 struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
28513
28514 /**
28515  * Checks if two Descriptions contain equal inner contents.
28516  */
28517 uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
28518
28519 /**
28520  * Checks if two Descriptions contain equal inner contents.
28521  * This ignores pointers and is_owned flags and looks at the values in fields.
28522  * Two objects with NULL inner values will be considered "equal" here.
28523  */
28524 bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
28525
28526 /**
28527  * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL.
28528  */
28529 void PayeePubKey_free(struct LDKPayeePubKey this_obj);
28530
28531 struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr);
28532
28533 void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val);
28534
28535 /**
28536  * Constructs a new PayeePubKey given each field
28537  */
28538 MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg);
28539
28540 /**
28541  * Creates a copy of the PayeePubKey
28542  */
28543 struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
28544
28545 /**
28546  * Checks if two PayeePubKeys contain equal inner contents.
28547  */
28548 uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
28549
28550 /**
28551  * Checks if two PayeePubKeys contain equal inner contents.
28552  * This ignores pointers and is_owned flags and looks at the values in fields.
28553  * Two objects with NULL inner values will be considered "equal" here.
28554  */
28555 bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
28556
28557 /**
28558  * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL.
28559  */
28560 void ExpiryTime_free(struct LDKExpiryTime this_obj);
28561
28562 /**
28563  * Creates a copy of the ExpiryTime
28564  */
28565 struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
28566
28567 /**
28568  * Checks if two ExpiryTimes contain equal inner contents.
28569  */
28570 uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
28571
28572 /**
28573  * Checks if two ExpiryTimes contain equal inner contents.
28574  * This ignores pointers and is_owned flags and looks at the values in fields.
28575  * Two objects with NULL inner values will be considered "equal" here.
28576  */
28577 bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
28578
28579 /**
28580  * Frees any resources used by the MinFinalCltvExpiry, if is_owned is set and inner is non-NULL.
28581  */
28582 void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
28583
28584 uint64_t MinFinalCltvExpiry_get_a(const struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr);
28585
28586 void MinFinalCltvExpiry_set_a(struct LDKMinFinalCltvExpiry *NONNULL_PTR this_ptr, uint64_t val);
28587
28588 /**
28589  * Constructs a new MinFinalCltvExpiry given each field
28590  */
28591 MUST_USE_RES struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_new(uint64_t a_arg);
28592
28593 /**
28594  * Creates a copy of the MinFinalCltvExpiry
28595  */
28596 struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
28597
28598 /**
28599  * Checks if two MinFinalCltvExpirys contain equal inner contents.
28600  */
28601 uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
28602
28603 /**
28604  * Checks if two MinFinalCltvExpirys contain equal inner contents.
28605  * This ignores pointers and is_owned flags and looks at the values in fields.
28606  * Two objects with NULL inner values will be considered "equal" here.
28607  */
28608 bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
28609
28610 /**
28611  * Frees any resources used by the Fallback
28612  */
28613 void Fallback_free(struct LDKFallback this_ptr);
28614
28615 /**
28616  * Creates a copy of the Fallback
28617  */
28618 struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
28619
28620 /**
28621  * Utility method to constructs a new SegWitProgram-variant Fallback
28622  */
28623 struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program);
28624
28625 /**
28626  * Utility method to constructs a new PubKeyHash-variant Fallback
28627  */
28628 struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a);
28629
28630 /**
28631  * Utility method to constructs a new ScriptHash-variant Fallback
28632  */
28633 struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
28634
28635 /**
28636  * Checks if two Fallbacks contain equal inner contents.
28637  */
28638 uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
28639
28640 /**
28641  * Checks if two Fallbacks contain equal inner contents.
28642  * This ignores pointers and is_owned flags and looks at the values in fields.
28643  */
28644 bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
28645
28646 /**
28647  * Frees any resources used by the InvoiceSignature, if is_owned is set and inner is non-NULL.
28648  */
28649 void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
28650
28651 /**
28652  * Creates a copy of the InvoiceSignature
28653  */
28654 struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
28655
28656 /**
28657  * Checks if two InvoiceSignatures contain equal inner contents.
28658  * This ignores pointers and is_owned flags and looks at the values in fields.
28659  * Two objects with NULL inner values will be considered "equal" here.
28660  */
28661 bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
28662
28663 /**
28664  * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL.
28665  */
28666 void PrivateRoute_free(struct LDKPrivateRoute this_obj);
28667
28668 /**
28669  * Creates a copy of the PrivateRoute
28670  */
28671 struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
28672
28673 /**
28674  * Checks if two PrivateRoutes contain equal inner contents.
28675  */
28676 uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
28677
28678 /**
28679  * Checks if two PrivateRoutes contain equal inner contents.
28680  * This ignores pointers and is_owned flags and looks at the values in fields.
28681  * Two objects with NULL inner values will be considered "equal" here.
28682  */
28683 bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
28684
28685 /**
28686  * Disassembles the `SignedRawInvoice` into its three parts:
28687  *  1. raw invoice
28688  *  2. hash of the raw invoice
28689  *  3. signature
28690  */
28691 MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
28692
28693 /**
28694  * The `RawInvoice` which was signed.
28695  */
28696 MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
28697
28698 /**
28699  * The hash of the `RawInvoice` that was signed.
28700  */
28701 MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
28702
28703 /**
28704  * InvoiceSignature for the invoice.
28705  */
28706 MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
28707
28708 /**
28709  * Recovers the public key used for signing the invoice from the recoverable signature.
28710  */
28711 MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_pub_key(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
28712
28713 /**
28714  * Checks if the signature is valid for the included payee public key or if none exists if it's
28715  * valid for the recovered signature (which should always be true?).
28716  */
28717 MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
28718
28719 /**
28720  * Calculate the hash of the encoded `RawInvoice`
28721  */
28722 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28723
28724 /**
28725  *
28726  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28727  */
28728 MUST_USE_RES struct LDKSha256 RawInvoice_payment_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28729
28730 /**
28731  *
28732  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28733  */
28734 MUST_USE_RES struct LDKDescription RawInvoice_description(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28735
28736 /**
28737  *
28738  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28739  */
28740 MUST_USE_RES struct LDKPayeePubKey RawInvoice_payee_pub_key(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28741
28742 /**
28743  *
28744  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28745  */
28746 MUST_USE_RES struct LDKSha256 RawInvoice_description_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28747
28748 /**
28749  *
28750  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28751  */
28752 MUST_USE_RES struct LDKExpiryTime RawInvoice_expiry_time(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28753
28754 /**
28755  *
28756  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28757  */
28758 MUST_USE_RES struct LDKMinFinalCltvExpiry RawInvoice_min_final_cltv_expiry(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28759
28760 /**
28761  *
28762  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28763  */
28764 MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28765
28766 /**
28767  *
28768  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28769  */
28770 MUST_USE_RES struct LDKInvoiceFeatures RawInvoice_features(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28771
28772 MUST_USE_RES struct LDKCVec_PrivateRouteZ RawInvoice_private_routes(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28773
28774 MUST_USE_RES struct LDKCOption_u64Z RawInvoice_amount_pico_btc(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28775
28776 MUST_USE_RES enum LDKCurrency RawInvoice_currency(const struct LDKRawInvoice *NONNULL_PTR this_arg);
28777
28778 /**
28779  * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`.
28780  *
28781  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
28782  */
28783 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds);
28784
28785 /**
28786  * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in
28787  * the range `0..=MAX_TIMESTAMP`.
28788  *
28789  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
28790  */
28791 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time);
28792
28793 /**
28794  * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range
28795  * `0..=MAX_TIMESTAMP`.
28796  *
28797  * Otherwise, returns a [`CreationError::TimestampOutOfBounds`].
28798  */
28799 MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration);
28800
28801 /**
28802  * Returns the Unix timestamp representing the stored time
28803  */
28804 MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
28805
28806 /**
28807  * Returns the duration of the stored time since the Unix epoch
28808  */
28809 MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
28810
28811 /**
28812  * Returns the [`SystemTime`] representing the stored time
28813  */
28814 MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
28815
28816 /**
28817  * Transform the `Invoice` into it's unchecked version
28818  */
28819 MUST_USE_RES struct LDKSignedRawInvoice Invoice_into_signed_raw(struct LDKInvoice this_arg);
28820
28821 /**
28822  * Check that the invoice is signed correctly and that key recovery works
28823  */
28824 MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
28825
28826 /**
28827  * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
28828  * ```
28829  * use lightning_invoice::*;
28830  *
28831  * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
28832  * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
28833  * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
28834  * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
28835  * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
28836  * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
28837  * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
28838  * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
28839  * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
28840  * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
28841  * j5r6drg6k6zcqj0fcwg\";
28842  *
28843  * let signed = invoice.parse::<SignedRawInvoice>().unwrap();
28844  *
28845  * assert!(Invoice::from_signed(signed).is_ok());
28846  * ```
28847  */
28848 MUST_USE_RES struct LDKCResult_InvoiceSemanticErrorZ Invoice_from_signed(struct LDKSignedRawInvoice signed_invoice);
28849
28850 /**
28851  * Returns the `Invoice`'s timestamp (should equal its creation time)
28852  */
28853 MUST_USE_RES uint64_t Invoice_timestamp(const struct LDKInvoice *NONNULL_PTR this_arg);
28854
28855 /**
28856  * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
28857  */
28858 MUST_USE_RES uint64_t Invoice_duration_since_epoch(const struct LDKInvoice *NONNULL_PTR this_arg);
28859
28860 /**
28861  * Returns the hash to which we will receive the preimage on completion of the payment
28862  */
28863 MUST_USE_RES const uint8_t (*Invoice_payment_hash(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
28864
28865 /**
28866  * Get the payee's public key if one was included in the invoice
28867  *
28868  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28869  */
28870 MUST_USE_RES struct LDKPublicKey Invoice_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
28871
28872 /**
28873  * Get the payment secret if one was included in the invoice
28874  */
28875 MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
28876
28877 /**
28878  * Get the invoice features if they were included in the invoice
28879  *
28880  * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
28881  */
28882 MUST_USE_RES struct LDKInvoiceFeatures Invoice_features(const struct LDKInvoice *NONNULL_PTR this_arg);
28883
28884 /**
28885  * Recover the payee's public key (only to be used if none was included in the invoice)
28886  */
28887 MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
28888
28889 /**
28890  * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
28891  */
28892 MUST_USE_RES uint64_t Invoice_expiry_time(const struct LDKInvoice *NONNULL_PTR this_arg);
28893
28894 /**
28895  * Returns whether the invoice has expired.
28896  */
28897 MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
28898
28899 /**
28900  * Returns whether the expiry time would pass at the given point in time.
28901  * `at_time` is the timestamp as a duration since the Unix epoch.
28902  */
28903 MUST_USE_RES bool Invoice_would_expire(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t at_time);
28904
28905 /**
28906  * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
28907  * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
28908  */
28909 MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
28910
28911 /**
28912  * Returns a list of all routes included in the invoice
28913  */
28914 MUST_USE_RES struct LDKCVec_PrivateRouteZ Invoice_private_routes(const struct LDKInvoice *NONNULL_PTR this_arg);
28915
28916 /**
28917  * Returns a list of all routes included in the invoice as the underlying hints
28918  */
28919 MUST_USE_RES struct LDKCVec_RouteHintZ Invoice_route_hints(const struct LDKInvoice *NONNULL_PTR this_arg);
28920
28921 /**
28922  * Returns the currency for which the invoice was issued
28923  */
28924 MUST_USE_RES enum LDKCurrency Invoice_currency(const struct LDKInvoice *NONNULL_PTR this_arg);
28925
28926 /**
28927  * Returns the amount if specified in the invoice as millisatoshis.
28928  */
28929 MUST_USE_RES struct LDKCOption_u64Z Invoice_amount_milli_satoshis(const struct LDKInvoice *NONNULL_PTR this_arg);
28930
28931 /**
28932  * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
28933  * returns `CreationError::DescriptionTooLong` otherwise
28934  *
28935  * Please note that single characters may use more than one byte due to UTF8 encoding.
28936  */
28937 MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
28938
28939 /**
28940  * Returns the underlying description `String`
28941  */
28942 MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
28943
28944 /**
28945  * Construct an `ExpiryTime` from seconds.
28946  */
28947 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
28948
28949 /**
28950  * Construct an `ExpiryTime` from a `Duration`.
28951  */
28952 MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
28953
28954 /**
28955  * Returns the expiry time in seconds
28956  */
28957 MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
28958
28959 /**
28960  * Returns a reference to the underlying `Duration` (=expiry time)
28961  */
28962 MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
28963
28964 /**
28965  * Creates a new (partial) route from a list of hops
28966  */
28967 MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops);
28968
28969 /**
28970  * Returns the underlying list of hops
28971  */
28972 MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg);
28973
28974 /**
28975  * Creates a copy of the CreationError
28976  */
28977 enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig);
28978
28979 /**
28980  * Utility method to constructs a new DescriptionTooLong-variant CreationError
28981  */
28982 enum LDKCreationError CreationError_description_too_long(void);
28983
28984 /**
28985  * Utility method to constructs a new RouteTooLong-variant CreationError
28986  */
28987 enum LDKCreationError CreationError_route_too_long(void);
28988
28989 /**
28990  * Utility method to constructs a new TimestampOutOfBounds-variant CreationError
28991  */
28992 enum LDKCreationError CreationError_timestamp_out_of_bounds(void);
28993
28994 /**
28995  * Utility method to constructs a new InvalidAmount-variant CreationError
28996  */
28997 enum LDKCreationError CreationError_invalid_amount(void);
28998
28999 /**
29000  * Utility method to constructs a new MissingRouteHints-variant CreationError
29001  */
29002 enum LDKCreationError CreationError_missing_route_hints(void);
29003
29004 /**
29005  * Checks if two CreationErrors contain equal inner contents.
29006  * This ignores pointers and is_owned flags and looks at the values in fields.
29007  */
29008 bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b);
29009
29010 /**
29011  * Get the string representation of a CreationError object
29012  */
29013 struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o);
29014
29015 /**
29016  * Creates a copy of the SemanticError
29017  */
29018 enum LDKSemanticError SemanticError_clone(const enum LDKSemanticError *NONNULL_PTR orig);
29019
29020 /**
29021  * Utility method to constructs a new NoPaymentHash-variant SemanticError
29022  */
29023 enum LDKSemanticError SemanticError_no_payment_hash(void);
29024
29025 /**
29026  * Utility method to constructs a new MultiplePaymentHashes-variant SemanticError
29027  */
29028 enum LDKSemanticError SemanticError_multiple_payment_hashes(void);
29029
29030 /**
29031  * Utility method to constructs a new NoDescription-variant SemanticError
29032  */
29033 enum LDKSemanticError SemanticError_no_description(void);
29034
29035 /**
29036  * Utility method to constructs a new MultipleDescriptions-variant SemanticError
29037  */
29038 enum LDKSemanticError SemanticError_multiple_descriptions(void);
29039
29040 /**
29041  * Utility method to constructs a new NoPaymentSecret-variant SemanticError
29042  */
29043 enum LDKSemanticError SemanticError_no_payment_secret(void);
29044
29045 /**
29046  * Utility method to constructs a new MultiplePaymentSecrets-variant SemanticError
29047  */
29048 enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
29049
29050 /**
29051  * Utility method to constructs a new InvalidFeatures-variant SemanticError
29052  */
29053 enum LDKSemanticError SemanticError_invalid_features(void);
29054
29055 /**
29056  * Utility method to constructs a new InvalidRecoveryId-variant SemanticError
29057  */
29058 enum LDKSemanticError SemanticError_invalid_recovery_id(void);
29059
29060 /**
29061  * Utility method to constructs a new InvalidSignature-variant SemanticError
29062  */
29063 enum LDKSemanticError SemanticError_invalid_signature(void);
29064
29065 /**
29066  * Utility method to constructs a new ImpreciseAmount-variant SemanticError
29067  */
29068 enum LDKSemanticError SemanticError_imprecise_amount(void);
29069
29070 /**
29071  * Checks if two SemanticErrors contain equal inner contents.
29072  * This ignores pointers and is_owned flags and looks at the values in fields.
29073  */
29074 bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
29075
29076 /**
29077  * Get the string representation of a SemanticError object
29078  */
29079 struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
29080
29081 /**
29082  * Frees any resources used by the SignOrCreationError
29083  */
29084 void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr);
29085
29086 /**
29087  * Creates a copy of the SignOrCreationError
29088  */
29089 struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig);
29090
29091 /**
29092  * Utility method to constructs a new SignError-variant SignOrCreationError
29093  */
29094 struct LDKSignOrCreationError SignOrCreationError_sign_error(void);
29095
29096 /**
29097  * Utility method to constructs a new CreationError-variant SignOrCreationError
29098  */
29099 struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a);
29100
29101 /**
29102  * Checks if two SignOrCreationErrors contain equal inner contents.
29103  * This ignores pointers and is_owned flags and looks at the values in fields.
29104  */
29105 bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b);
29106
29107 /**
29108  * Get the string representation of a SignOrCreationError object
29109  */
29110 struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o);
29111
29112 /**
29113  * Frees any resources used by the InvoicePayer, if is_owned is set and inner is non-NULL.
29114  */
29115 void InvoicePayer_free(struct LDKInvoicePayer this_obj);
29116
29117 /**
29118  * Calls the free function if one is set
29119  */
29120 void Payer_free(struct LDKPayer this_ptr);
29121
29122 /**
29123  * Calls the free function if one is set
29124  */
29125 void Router_free(struct LDKRouter this_ptr);
29126
29127 /**
29128  * Frees any resources used by the Retry
29129  */
29130 void Retry_free(struct LDKRetry this_ptr);
29131
29132 /**
29133  * Creates a copy of the Retry
29134  */
29135 struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig);
29136
29137 /**
29138  * Utility method to constructs a new Attempts-variant Retry
29139  */
29140 struct LDKRetry Retry_attempts(uintptr_t a);
29141
29142 /**
29143  * Utility method to constructs a new Timeout-variant Retry
29144  */
29145 struct LDKRetry Retry_timeout(uint64_t a);
29146
29147 /**
29148  * Checks if two Retrys contain equal inner contents.
29149  * This ignores pointers and is_owned flags and looks at the values in fields.
29150  */
29151 bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
29152
29153 /**
29154  * Checks if two Retrys contain equal inner contents.
29155  */
29156 uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
29157
29158 /**
29159  * Frees any resources used by the PaymentError
29160  */
29161 void PaymentError_free(struct LDKPaymentError this_ptr);
29162
29163 /**
29164  * Creates a copy of the PaymentError
29165  */
29166 struct LDKPaymentError PaymentError_clone(const struct LDKPaymentError *NONNULL_PTR orig);
29167
29168 /**
29169  * Utility method to constructs a new Invoice-variant PaymentError
29170  */
29171 struct LDKPaymentError PaymentError_invoice(struct LDKStr a);
29172
29173 /**
29174  * Utility method to constructs a new Routing-variant PaymentError
29175  */
29176 struct LDKPaymentError PaymentError_routing(struct LDKLightningError a);
29177
29178 /**
29179  * Utility method to constructs a new Sending-variant PaymentError
29180  */
29181 struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a);
29182
29183 /**
29184  * Creates an invoice payer that retries failed payment paths.
29185  *
29186  * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once
29187  * `retry` has been exceeded for a given [`Invoice`].
29188  */
29189 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);
29190
29191 /**
29192  * Pays the given [`Invoice`], caching it for later use in case a retry is needed.
29193  *
29194  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
29195  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
29196  * for you.
29197  */
29198 MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice);
29199
29200 /**
29201  * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in
29202  * case a retry is needed.
29203  *
29204  * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has
29205  * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so
29206  * for you.
29207  */
29208 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);
29209
29210 /**
29211  * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in
29212  * case a retry is needed.
29213  *
29214  * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never
29215  * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you.
29216  */
29217 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);
29218
29219 /**
29220  * Removes the payment cached by the given payment hash.
29221  *
29222  * Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an
29223  * [`EventHandler`]. Otherwise, calling this method is unnecessary.
29224  */
29225 void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]);
29226
29227 /**
29228  * Constructs a new EventHandler which calls the relevant methods on this_arg.
29229  * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
29230  */
29231 struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg);
29232
29233 /**
29234  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
29235  * See [`PhantomKeysManager`] for more information on phantom node payments.
29236  *
29237  * `phantom_route_hints` parameter:
29238  * * Contains channel info for all nodes participating in the phantom invoice
29239  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
29240  *   participating node
29241  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
29242  *   updated when a channel becomes disabled or closes
29243  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
29244  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
29245  *   down
29246  *
29247  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
29248  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
29249  * If `None` is provided for `payment_hash`, then one will be created.
29250  *
29251  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
29252  * in excess of the current time.
29253  *
29254  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
29255  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
29256  * requirement).
29257  *
29258  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
29259  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
29260  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
29261  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
29262  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
29263  *
29264  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
29265  */
29266 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);
29267
29268 /**
29269  * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
29270  * See [`PhantomKeysManager`] for more information on phantom node payments.
29271  *
29272  * `phantom_route_hints` parameter:
29273  * * Contains channel info for all nodes participating in the phantom invoice
29274  * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
29275  *   participating node
29276  * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
29277  *   updated when a channel becomes disabled or closes
29278  * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
29279  *   may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
29280  *   down
29281  *
29282  * `description_hash` is a SHA-256 hash of the description text
29283  *
29284  * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
29285  * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
29286  * If `None` is provided for `payment_hash`, then one will be created.
29287  *
29288  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
29289  * in excess of the current time.
29290  *
29291  * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
29292  * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
29293  * requirement).
29294  *
29295  * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
29296  * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
29297  * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
29298  * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
29299  * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
29300  *
29301  * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
29302  */
29303 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);
29304
29305 /**
29306  * Utility to construct an invoice. Generally, unless you want to do something like a custom
29307  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
29308  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
29309  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
29310  * that the payment secret is valid when the invoice is paid.
29311  *
29312  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
29313  * in excess of the current time.
29314  */
29315 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);
29316
29317 /**
29318  * Utility to construct an invoice. Generally, unless you want to do something like a custom
29319  * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
29320  * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
29321  * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
29322  * that the payment secret is valid when the invoice is paid.
29323  * Use this variant if you want to pass the `description_hash` to the invoice.
29324  *
29325  * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
29326  * in excess of the current time.
29327  */
29328 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);
29329
29330 /**
29331  * See [`create_invoice_from_channelmanager_with_description_hash`]
29332  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
29333  * available and the current time is supplied by the caller.
29334  */
29335 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);
29336
29337 /**
29338  * See [`create_invoice_from_channelmanager`]
29339  * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
29340  * available and the current time is supplied by the caller.
29341  */
29342 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);
29343
29344 /**
29345  * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL.
29346  */
29347 void DefaultRouter_free(struct LDKDefaultRouter this_obj);
29348
29349 /**
29350  * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source
29351  * `random_seed_bytes`.
29352  */
29353 MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes);
29354
29355 /**
29356  * Constructs a new Router which calls the relevant methods on this_arg.
29357  * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
29358  */
29359 struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg);
29360
29361 /**
29362  * Constructs a new Payer which calls the relevant methods on this_arg.
29363  * This copies the `inner` pointer in this_arg and thus the returned Payer must be freed before this_arg is
29364  */
29365 struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg);
29366
29367 /**
29368  * Read a SiPrefix object from a string
29369  */
29370 struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s);
29371
29372 /**
29373  * Read a Invoice object from a string
29374  */
29375 struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s);
29376
29377 /**
29378  * Read a SignedRawInvoice object from a string
29379  */
29380 struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s);
29381
29382 /**
29383  * Get the string representation of a ParseError object
29384  */
29385 struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o);
29386
29387 /**
29388  * Get the string representation of a ParseOrSemanticError object
29389  */
29390 struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o);
29391
29392 /**
29393  * Get the string representation of a Invoice object
29394  */
29395 struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o);
29396
29397 /**
29398  * Get the string representation of a SignedRawInvoice object
29399  */
29400 struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o);
29401
29402 /**
29403  * Get the string representation of a Currency object
29404  */
29405 struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o);
29406
29407 /**
29408  * Get the string representation of a SiPrefix object
29409  */
29410 struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o);
29411
29412 /**
29413  * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL.
29414  */
29415 void RapidGossipSync_free(struct LDKRapidGossipSync this_obj);
29416
29417 /**
29418  * Instantiate a new [`RapidGossipSync`] instance
29419  */
29420 MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph);
29421
29422 /**
29423  * Sync gossip data from a file
29424  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
29425  *
29426  * `network_graph`: The network graph to apply the updates to
29427  *
29428  * `sync_path`: Path to the file where the gossip update data is located
29429  *
29430  */
29431 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path);
29432
29433 /**
29434  * Returns whether a rapid gossip sync has completed at least once
29435  */
29436 MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg);
29437
29438 /**
29439  * Frees any resources used by the GraphSyncError
29440  */
29441 void GraphSyncError_free(struct LDKGraphSyncError this_ptr);
29442
29443 /**
29444  * Creates a copy of the GraphSyncError
29445  */
29446 struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig);
29447
29448 /**
29449  * Utility method to constructs a new DecodeError-variant GraphSyncError
29450  */
29451 struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a);
29452
29453 /**
29454  * Utility method to constructs a new LightningError-variant GraphSyncError
29455  */
29456 struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a);
29457
29458 /**
29459  * Update network graph from binary data.
29460  * Returns the last sync timestamp to be used the next time rapid sync data is queried.
29461  *
29462  * `network_graph`: network graph to be updated
29463  *
29464  * `update_data`: `&[u8]` binary stream that comprises the update data
29465  */
29466 MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
29467
29468 #endif /* LDK_C_BINDINGS_H */
29469
29470 #include "ldk_ver.h"